ggiOvlSetVals

Name

ggiOvlSetPos, ggiOvlMove, ggiOvlGetPos, ggiOvlSetSize, ggiOvlGetSize, ggiOvlSetZoom, ggiOvlGetZoom, ggiOvlSetVals -- Position, resize and zoom a graphics overlay.

Synopsis

#include <ggi/ovl.h>

int ggiOvlSetPos(ggiOvl_t ovl int x int y);

int ggiOvlMove(ggiOvl_t ovl int x int y);

int ggiOvlGetPos(ggiOvl_t ovl int *x int *y);

int ggiOvlSetSize(ggiOvl_t ovl int w int h);

int ggiOvlGetSize(ggiOvl_t ovl int *w int *h);

int ggiOvlSetZoom(ggiOvl_t ovl int x int y int w int h);

int ggiOvlGetZoom(ggiOvl_t ovl int *x int *y int *w int *h);

int ggiOvlSetVals(ggiOvl_t ovl int x int y int w int h int zx int zy int zw int zh);

Description

Important Note: all the coordinates and sizes are given in the units which were last set with the function ggiOvlSetCoordBase. In addition, where noted below, coordinates are offset by the values last passed to ggiOvlSetCoordBase. New resources, opon which ggiOvlSetCoorbase has never been used, start with their point of origin at the top left corner of the visual, and use the same units that were used to negotiate them via the ggiOvlAdd* or ggiOvlCreate* functions. If you didn't specifically ask for certain units, then you should call ggiOvlSetCoordBase to set the desired units before attempting to use these functions.

ggiOvlSetPos positions the graphics overlay with the top left corner at the given coordinates x and y. The actual coordinates used may be altered by the target subsystem if their are restrictions on the placement of the resource. ggiOvlGetPos will read the actual position of the resource into the offered parameters x and y. ggiOvlMove is just another name for ggiOvlSetPos.

ggiOvlSetSize alters the visible size of a graphics overlay. The actual sizes used may be altered by the target subsystem if their are restrictions on the pplacement of the resource. ggiOvlGetSize will read the actual position of the resource into the offered parameters x and y. The zoom parameters (see below) are interpolated to the new size of the resource.

ggiOvlSetZoom alters the contents displayed inside the overlay on resources which support zooming and panning. The parameters are given in the same units as those of the above five functions, and if the contents are not panned or zoomed, x, y will have the same values as last supplied to ggiOvlSetPos and w, h will have the same values as last supplied to ggiOvlSetZoom. Their usage is best described by example, see below.

ggiOvlSetVals is used to set all the positioning and zooming parameters at the same time. It is recommended to use this function, rather than the above, when you need to perform a combination of positioning, sizing, or zooming, operations on the overlay, for two reasons: Firstly, if you are setting these parameters on an overlay which is not hidden, this will likely induce less user-visible artifacts; Secondly, some resources may not support the intermediate states you traverse by using combinations of the other functions above, and you may find they fail to actually implement the requested changes.

Return value

All functions return 0 on success, or a negative value if an error occurred.

Examples

Example 1. Move, zoom, and pan a video overlay.


ggi_mode mode;

/* Set the units to pixels */
ggiGASetCoordBase(GA_COORBASE_PIXELS,0,0,0,0);

/* Get the current size of the overlay */
ggiOvlGetSize(ovl, &sizex, &sizey);

err = ggiOvlMove(video,(mode.visible.x - sizex/2),(mode.visible.y - sizey/2));
if (err) {
	fprintf(stderr, "Could not center the video display\n");
}

/* Get the current position of the overlay, 
   which may be slightly off from the above. */
ggiOvlGetPos(ovl, &posx, &posy);

/* Zoom the contents of the overlay to twice their normal size. */
ggiOvlZoom(ovl, sizex * 2, sizey * 2, posx, posy);

/* Slowly pan over from the top left quadrant of the video image, 
   where we are now, to the lower right quadrant */
for (i = 100; i > 0; i++) {
	ggiOvlZoom(ovl, sizex * 2, sizey * 2, 
	           posx + sizex / i, posy + sizey / i);
	usleep(10000);
}

See Also