Caution: This version of this document is no longer maintained. For the latest documentation, see


A function exported by PhAB to allocate memory for an image


PhImage_t* alloc_image  (
  PhImage_t *src );


The PhImage_t image for which you want to allocate memory.


This function is exported from PhAB in the PhABResExportCommon_t structure.

This function allocates a new Photon image, based on the src image. The src image is duplicated: the function allocates a new palette, a new alpha map, etc.

After an image is allocated with alloc_image(), you are free to modify it. If you need to allocate memory for the image palette, image data, or alpha map, use the alloc_mem() function.

Note: The newly allocated image will have the flags member set to Ph_RELEASE_IMAGE_ALL, meaning that all the fields of the new image that required allocating memory will be released when the image is released.

You should free the image with the PhAB exported free_image() function.


A pointer to the image, or NULL when an error occurs.



Interrupt handler No
Signal handler No
Thread No

See also:

alloc_mem(), free_image(), PhABResExportCommon_t, PhImage_t