Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
![]() |
PiCropImage()
Crop an image to the specified boundary
Synopsis:
PhImage_t *PiCropImage( PhImage_t *image,
PhRect_t const *bounds,
int flags );
Library:
ph
Description:
This function crops a Photon image. It allocates space for the resulting image, leaving the original image untouched.
The image argument is a pointer to a PhImage_t structure that defines the image to be cropped, while the bounds argument points to a PhRect_t structure specifying the rectangle within the image to keep.
The flags argument dictates special behavior of the cropping process and can take on the following values:
- Pi_FREE
- Free the original image if the cropping succeeds.
- Pi_SHMEM
- Store the newly created image data in shared memory. This is useful if fast rendering of the image is required.
![]() |
If you set the Pi_FREE flag, the function will free the old image by setting all its release flags and calling PhReleaseImage() on it. |
Returns:
A pointer to the new image on success, or NULL if an error occurred.
Classification:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
See also:
PhCreateImage(), PhImage_t, PhRect_t, PiConvertImage(), PiDuplicateImage(), PiFlipImage(), PiResizeImage
"Images" in the Raw Drawing and Animation chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
