LibGGI has three basic types of primitives when it comes to filling rectangular areas (including the degenerate cases of horizontal and vertical lines and single pixels).
We have found three operations commonly performed on such areas:
Draw: This means you set all contained pixels to the current foreground color (maybe modified by the update operations as set in the current graphics context).
Put: Fill the area with pixels of different value from a buffer.
Get: Read pixels from the screen into such a buffer.
Get/Put buffers are buffers used by the functions ggiGet*, ggiPut*, ggiPackColors and ggiUnpackPixels.
The format of the individual pixels in get/put buffers are defined by ggi_pixelformat (see the ggi_pixelformat section above).
Pixels are stored linearly, e.g. a rectangle with a width of three and a height of two will be stored with pixels (0,0) (1,0) (2,0) (0,1) (1,1), (2,1) in that order.
Get/put buffers use chunky pixels, unpacked, even if their representation in the framebuffer is packed (i.e. pixel size not multiple of 8 bits) or non-linear. Thus, the application does not need to know how to use planar or packed pixels for non-direct acccess.
Note: (You may specify use of packed buffers using the GT_SUB_PACKED_GETPUT ggi_graphtype flag, but as of this writing, no targets implement that yet.)
The get/put buffer passed to the LibGGI functions should be allocated for at least width * height * ((ggiGetPixelFormat()->size+7)/8) bytes.
(That is, the pixel size is obtained from ggi_pixelformat.size, rounded to a multiple of 8 bits (one byte), and is multiplied by the width and the height of the buffer.)