vg4->misc->rect2position()
Set a centered position from a rectangle.
SYNTAX
struct VG_Position *
vg4->misc->rect2position(struct VG_Position *posdst, const struct VG_Rect *rect)
FUNCTION PARAMETERS
posdst | Position to be set |
rect | Rectangle |
RETURN VALUE
Returns posdst
DESCRIPTION
Set a centered position from a rectangle.
This function is mainly used for copying an image to another image or the window.
EXAMPLE
struct VG_Position posdst; struct VG_Rect rect; struct VG_Image *imgp; /* load image and get size */ imgp = vg4->image->load("myimg.bmp"); vg4->image->getsize(imgp, NULL, &rect.w, &rect.h); /* image shall be copied onto the window, centered at position 80,50 */ rect.x = 80; rect.y = 50; vg4->window->copy(imgp, vg4->misc->rect2position(&posdst, &rect), NULL);