Navigation C API Pages Python bindings Applications

Coordinate System


GFXprim uses Cartesian coordinate system. The pixel (0, 0) lies at the upper left corner of the bitmap and coordinates grows to the right and to the bottom. The last valid pixel, that still lies in the bitmap of size w and h, occupies coordinate (w-1,h-1). The precise position of the point with integer coordinates is in the middle of the pixel (and borders between the pixels lies are integers + 0.5).

Coordinate system
Figure 1. GFXprim coordinate system and GP_LineXYXY(5, 3, 9, 3)

Width and Height

The width and height, when passed as an argument, are interpreted as number of pixels to draw (rather than lengt from one pixel center to another pixel center). Which means that for rectangle of size (w,h) starting at (x,y) first pixel to draw would be (x,y) and last one would be (x+w-1,y+h-1). Especially when w or h is less than or equal to zero no action is taken.

Coordinates Rectangle
Figure 2. GP_RectangleXYWH(2, 1, 8, 4)