Path always 2 antialiased pixels wide


#1

Hi,

 

I'm porting a Qt application to JUCE and there are paths in there, that won't render correct. They are drawing a rounded rectangle with small indicaters. But the rounded rectangle looks pretty awefull, see attached screenshot. The horrizontal and vertical lines are always antialiased and 2 pixels wide. If you zoom in, you see that that the rounded corners are drawn correctly with 1px thickness.

 

The whole path is based on integers, so there is no way I'm drawing between 2 pixels.

 


#2

Offset the position by 0.5f


#3

We've had many threads about this misunderstanding in the past.

Think about it: The coordinates are for the centre of the line, so that must be in the centre of a pixel if you want it to exactly fill that pixel.

BTW if you're drawing horizontal or vertical lines, never use drawLine, always use fillRect.


#4

Or you could use drawHorizontalLine or drawVerticalLine that calls fillrect...


#5

Just out of curiousity, why are you porting from Qt ? I.e. why not continue using Qt ?