After working with the .NET GDI+ Rectangle object, I’ve noticed that if I create a rectangle that is X:0 * Y:0 * Width:100 * Height:100, the Right and Bottom properties are set to 100, 100. Shouldn’t this be 99, 99? 0 – 99 is 100 pixels. 0 – 100 is 101 pixels.
FWIW, the documentation does say the right is computed by x + width and the bottom is y + height, but is that correct? Perhaps “correct” doesn’t matter here as long it’s consistent?
All I know is that it is somewhat (read… very) annoying!
It depends on whether you regard the coordinates as labelling whole pixels, or labelling points between pixels. If you regard them as infinitely small points, then the number of pixels between (0, 0) and (100, 0) is 100 pixels. If, however, you regard them as labelling the pixels – such that both pixels (0, 0) and (100, 0) are included in the rectangle, then that’s clearly 101 pixels wide as you say.
It would be nice to have this spelled out somewhere, of course. I suspect it is, but I haven’t run across the relevant documentation. Hopefully someone can provide a link 🙂