How to draw a thin line?

In paint(Graphics &g), if I draw 4 lines, it looks like JUCE automatically does some interesting things and adds a drop shadow on the bottom and right. I’m not sure if that is the correct description. See screenshot:

[attachment=0]screenshot.png[/attachment]

See how the right and bottom lines are thicker? While I like this effect, in this particular case I’m trying to get a single pixel line. What should I be calling instead?

A line along an integer coordinate will be anti-aliased and thus two pixels wide. You could probably call g.drawLine(0.5f, 0.5f, w+0.5f, 0.5f) (not sure whether it has to be +0.5 or -0.5). Also there is Graphics::drawHorizontalLine/Graphics::drawVerticalLine.
The top and left lines aren’t two pixels because they are clipped by the grapics context.

There is also a Graphics::drawRectangle available.

Chris

1 Like

Thanks! Exactly what I needed to understand.