[Interest] [ Missing pixels when using drawLine ]

Christoph Feck christoph at maxiom.de
Tue Mar 13 10:16:29 CET 2012

On Tuesday 13 March 2012 08:28:04 ashish raste wrote:
> *Dear all,
> Recently I worked on a paint application, where I implemented a
> function to draw whatever a user is scribbling on an image. In the
> mouseMove event, I called a function to draw with the previous
> point and the current point as its arguments, using the drawLine
> function of QPainter.
> Now, I noticed that the pixels sent to this function are not
> continuous but some in-between pixels were being left. I assume
> that this is due to the delay for a user->kernel and kernel->user
> mode switch when calling the underlying paint-engine's functions
> to draw the line.

If this only appears since Qt 4.8 with raster engine, this could be

As a workaround, use drawPixel() for single-pixel "lines".

> I have looked-up in the documentation of Qt-painting to find how it
> internally calls drawLines(), which instead creates a qpainterPath
> to draw a curve, line or whatever we scribble. But I couldn't find
> how the missing pixels were added in between just knowing the
> start and end point of a line (though we know that a curve will
> contain a large set of small lines, each having a start and end
> point)
> Is there anyway to track these "missed" pixels i.e to track all the
> pixels which are being drawn?
> Thanks you!*

Christoph Feck
KDE Quality Team

More information about the Interest mailing list