First of all I am aware of this post here: Pixel behaviour of FillRectangle and DrawRectangle. But it does not fully address my issue.
Let's start with a square of length 3 created as follows:
RectF rc(0, 0, 3, 3);
If I fill this rectangle using Graphics::FillRectangle()
then I get a square of 3 x 3 pixels as seen in the image below with the 2 little white squares:
If I then try to draw a border around these squares using Graphics::DrawRectangle()
, and supplying exactly the same rect I used when I filled them, I get a border which covers 4 x 4 pixels thereby visually extending the squares by a pixel on the right and bottom:
I am led to understand this is because FillRectangle() doesn't draw the right or bottom edge. I can't find any documentation on why it behaves this way.
If I then bring Graphics::SetClip()
into the equation, and set the clipping region to the same rect I have used in the previous 2 tests I get the following:
So, now the clipping region seems to ignore the right and bottom edges the same way that FillRectangle()
does which seems silly given how DrawRectangle()
works.
Can someone help me understand how all of this inconsistency should be interpreted?