KXL_CopyImageRect
Author: kacchan

Prev Top Next

Name
KXL_CopyImageRect
Synopsis

    KXL_CopyImageRect -- The arbitrary rectangles of an image are copied to a new image.

Description

    KXL_Image *KXL_CopyImageRect(KXL_Image *img, KXL_Rect rect);

Arguments

img | Pointer of KXL_Image structure.
rect | KXL_Rect structure.

Return Value
Pointer of new KXL_Image structure.
Exsample

    sample.bmp

    #include <KXL.h>

    int main(void)
    {
      KXL_Image *img, *copy_img;
      KXL_Rect rect = {8, 8, 16, 16};

      KXL_CreateWindow(100, 100, "sample", 0);
      img = KXL_LoadBitmap("sample.bmp", 0);
      copy_img = KXL_CopyImageRect(img, rect);

      KXL_SetDrawColor(0x00, 0x00, 0xff);
      KXL_ClearFrameImm(0, 0, 100, 100);
      KXL_PutImage(img, 10, 10);
      KXL_PutImage(copy_img, 50, 50);
      KXL_UpDateImm(0, 0, 100, 100);
      getchar();
      KXL_DeleteImage(img);
      KXL_DeleteImage(copy_img);
      KXL_DeleteWindow();
      return 0;
    }