Graphics Primitives

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 :

Thus there are three versions of those functions :

int ggiDrawPixel(ggi_visual_t vis,int x,int y);
int ggiPutPixel(ggi_visual_t vis,int x,int y,ggi_uint col);
int ggiGetPixel(ggi_visual_t vis,int x,int y,ggi_uint *col);
Draw/Get/Put single pixels at x/y.

int ggiDrawHLine(ggi_visual_t vis,int x,int y,int w);
int ggiPutHLine(ggi_visual_t vis,int x,int y,int w,void *buf);
int ggiGetHLine(ggi_visual_t vis,int x,int y,int w,void *buf);
Draw/Get/Put horizontal lines starting at x/y and extending w pixels in the positive x direction (normally left).

int ggiDrawVLine(ggi_visual_t vis,int x,int y,int h);
int ggiPutVLine(ggi_visual_t vis,int x,int y,int h,void *buf);
int ggiGetVLine(ggi_visual_t vis,int x,int y,int h,void *buf);
Draw/Get/Put vertical lines starting at x/y and extending h pixels in the positive y direction (normally down).

int ggiDrawBox(ggi_visual_t vis,int x,int y,int w,int h);
int ggiPutBox(ggi_visual_t vis,int x,int y,int w,int h,void *buf);
int ggiGetBox(ggi_visual_t vis,int x,int y,int w,int h,void *buf);
Draw/Get/Put a filled rectangle at x/y and extending w pixels in the positive x direction and h in the positive y direction.

The buffers are filled with the x coordinate walking first.

int ggiFillscreen(ggi_visual_t vis);
Fill the entire virtual screen. Might be more efficient than the corresponding call to ggiDrawBox.

int ggiCopyBox(ggi_visual_t vis,int x,int y,int w,int h,int nx,int ny);
This is a screen-to-screen-blit. Copy the box described by x,y,w,h to the new location nx,ny. This automatically takes care of overlaps and optimizes for the given target (i.e. uses HW-accel or intermediate buffers as appropriate).

int ggiDrawLine(ggi_visual_t vis,int x,int y,int xe,int ye);
Draw a line form x/y to xe/ye. The line is exact i.e. the pixel set is no more than 0.5 pixels off the place it should be.

int ggiDrawCircle(ggi_visual_t vis,int x,int y,int r);
Draw a circle of given radius r around x/y.

int ggiCrossBlit(ggi_visual *src,int sx,int sy,int sw,int sh,
                 ggi_visual *dst,int dx,int dy,int dw,int dh)
Blit a rectangular memory area from one visual to another. This is a very complex function as it handles: We try hard to optimize this, but don't use it, if you don't need it. And try to keep its work easy. Do not copy between different colorspaces, if not necessary. The same applies for stretching.