ggiGetOrigin(3) Set and get origin of virtual screen

Other Alias

ggiSetOrigin

SYNOPSIS


#include <ggi/ggi.h>
int ggiSetOrigin(ggi_visual_t vis, int x, int y);
int ggiGetOrigin(ggi_visual_t vis, int *x, int *y);

DESCRIPTION

ggiSetOrigin sets the top-left corner of the displayed area to (x, y).

When using a larger virtual area, you can pan the visible area over the virtual one to do scrolling. Some targets have extremely efficient means to do this (i.e. they do it in hardware).

Large virtual areas are also commonly used for buffering the display contents, but that is usually more easily accomplished by requesting a specific number of frames when setting a mode.

This call takes dot coordinates (see ggi_mode(3)), not pixel coordinates as all other drawing primitives do. There is no difference in graphic modes because by definition dpp is 1x1, but in text modes the application can do smooth scrolling.

When ggiSetOrigin returns, the screen reflects the new origin. It is not necessary to call ggiFlush.

ggiGetOrigin gets the current top-left corner of the displayed area into (x, y).

Due to rounding to the hardware's capabilities, the values retrieved by a subsequent ggiGetOrigin may not necessarily match those passed to ggiSetOrigin previously.

RETURN VALUE

0 for OK, otherwise a ggi-error(3) code.

EXAMPLES

Pan from the top to the bottom of the virtual screen:

for(i = 0; i < virt_y-visible_y; i++) {
      ggiSetOrigin(vis, 0, i);
}