2.10.1 Function Coordinates

Ellipse and polygon functions require coordinates in logical units, which GDI uses to determine the location and size of an object in logical space. The use of logical units ensures device independence in Windows. GDI uses a mapping function to map logical units to pixels on the device. The number of logical units that Windows maps to a pixel depends on the current mapping mode. The default mapping mode, MM_TEXT, maps one logical unit to one pixel.

When GDI draws a rectangle, it uses four arguments. The first two arguments specify the rectangle's upper-left corner. The last two arguments do not actually specify part of the rectangle; they specify the point adjacent to the lower-right corner. For example, if the first point is specified by (X1, Y1) and the second point is specified by (X2, Y2), the rectangle's upper-left corner will be (X1, Y1) and the lower-right corner will be (X2 – 1, Y2 – 1).