Rotate an image by 90-degree increments
#include <img.h>
int img_rotate_ortho( const img_t *src,
img_t *dst,
img_fixed_t angle );
- src
- The image to rotate
- dst
- The address of an img_t describing the destination. If you don't specify width or height (or both) in the dst then this function will calculate the missing dimension(s) based on the src image, taking into account the rotation. If you do specify either width or height (or both), the image is clipped as necessary; unused data remains untouched.
- angle
- A 16.16 fixed point representation of the angle (in radians). There are 3 defines provided for convenience:
- IMG_ANGLE_90CW — 90 degrees clockwise (to the right)
- IMG_ANGLE_180 — 180 degrees
- IMG_ANGLE_90CCW — 90 degrees counter-clockwise (to the left)
img
This function rotates the src image by 90-degree increments. The rotation is not a true “rotation” in that the image is not rotated about a fixed point. Rather, the image itself is rotated and the new origin of the image becomes the upper-left corner of the rotated image.
The formats of src and dst don't have to be the same; if they are different, the data is converted. A palette-based dst format is only supported if the src data also is palette-based.
|
Rotation cannot be done in place. |
- IMG_ERR_OK
- Success
- IMG_ERR_PARM
- Some fields of src are missing (that is, not marked as valid in flags)
- IMG_ERR_NOSUPPORT
- Unsupported format conversion or angle
- IMG_ERR_MEM
- Insufficient memory (the function requires a small amount of working memory)
Image library
Safety: | |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
img_resize_fs()