VgaGames4

VgaGames4 - image man-pages

[.. upper level ..]

# vg4->image->clone()

Clone image creating a new one.

SYNTAX
struct VG_Image * vg4->image->clone(const struct VG_Image *imgsrc, const struct VG_Rect *rect, const struct VG_ImagecopyAttr *iattr)
FUNCTION PARAMETERS

imgsrc | Source image
rect | Rectangle to clone out of source image, or NULL = whole image
iattr | Image-copy attributes for modifying the cloned image, or NULL

RETURN VALUE
Returns cloned image, or NULL = rectangle out of bounds of source image
DESCRIPTION
Clone image creating a new one.
EXAMPLE

    /* clone left upper rectangle of half size of source image and rotate contents */

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

    /* load source image, assuming no error */
    imgp = vg4->image->load("myimg.bmp");

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

    /* rotate contents */
    VG_IMAGECOPY_ATTR_DEFAULT(&iattr);
    iattr.image.rotate = 45;

    /* clone source image */
    imgclon = vg4->image->clone(imgp, &rect, &iattr);

SEE ALSO
vg4->image->create() vg4->image->load()