VgaGames4 - window man-pages

[.. upper level ..]

vg4->window->clone()

Clone window contents into image.

SYNTAX
struct VG_Image * vg4->window->clone(const struct VG_Rect *rect, const struct VG_ImagecopyAttr *iattr)

FUNCTION PARAMETERS
rect Rectangle to clone out of window, or NULL = whole window
iattr Image-copy attributes for modifying the cloned image, or NULL

RETURN VALUE
Returns created image with window contents, or NULL = rectangle out of bounds of window

DESCRIPTION
Clone window contents into image.

EXAMPLE
/* clone centered rectangle of half of window-size into image and flip contents */

struct VG_Image *imgp;
struct VG_Rect rect;
struct VG_ImagecopyAttr iattr;

/* set rectangle */
vg4->window->getsize(&rect.w, &rect.h);
rect.w /= 2;
rect.h /= 2;
rect.x = rect.w / 2;
rect.y = rect.h / 2;

/* flip contents at the vertical axe */
VG_IMAGECOPY_ATTR_DEFAULT(&iattr);
iattr.image.flip = VG_AXE_VERTICAL;

imgp = vg4->window->clone(&rect, &iattr);

vg4->window->clear();
vg4->window->copy(imgp, NULL, NULL);
vg4->window->flush();