Logo Search packages:      
Sourcecode: adesklets version File versions

Imlib_Image imlib_create_image_using_copied_data ( int  width,
int  height,
DATA32 *  data 
)

Parameters:
width The width of the image.
height The height of the image.
data The data.
Returns:
A valid image, otherwise NULL.
Works the same way as imlib_create_image_using_data() but Imlib2 copies the image data to the image structure. You may now do whatever you wish with the original data as it will not be needed anymore. Imlib2 returns a valid image handle on success or NULL on failure.

Definition at line 2558 of file imlib2.c.

{
   ImlibImage         *im;

   if (!ctx)
      ctx = imlib_context_new();
   CHECK_PARAM_POINTER_RETURN("imlib_create_image_using_copied_data", "data",
                              data, NULL);
   if ((width <= 0) || (height <= 0))
      return NULL;
   im = __imlib_CreateImage(width, height, NULL);
   if (!im)
      return NULL;
   im->data = malloc(width * height * sizeof(DATA32));
   if (data)
     {
        memcpy(im->data, data, width * height * sizeof(DATA32));
        return (Imlib_Image) im;
     }
   else
      __imlib_FreeImage(im);
   return NULL;
}


Generated by  Doxygen 1.6.0   Back to index