Week 8 recap - Dealing with micro-pixels

·

2 min read

Since our main problem up to this point is to deal with the constant micro-pixel calls, we decided to discard all these < 1 pixel movements by filtering out distances of less than 1 pixel before they go down the pipeline in KisToolFreehandHelper::paint. Using m_d->history.last(), we can get the last called point and get the distance by comparing it to info.pos(). We are also going to check if the last used paint information is the same as the one outputted last so we don't get instances where paintBezierSegment gets called on the same pixels multiple times keeping the process simple and cleaner.

Because of how Krita sets up line drawings, by having fewer of these small super rapid calls from within the pixels, we call drawLine less frequently, allowing drawLine to naturally draw pixel-perfect lines when given a diagonal start and end point.

Of course, we will still run into a few corner pixels regardless because if Krita reads a horizontal line movement directly into a vertical line movement (and vise versa) there's still nothing in place to stop that.

The current approach to this is the 3-point system where we wait to draw the intermediary point ( as explained before ) and it seems to be promising, I just need to work out a few errors where the pixel tracking is a little off/ things not resetting like these should.