Rotate an image by 90-degree increments
#include <img/img.h> int img_rotate_ortho( const img_t *src, img_t *dst, img_fixed_t angle );
- The image to rotate
- 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.
- 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)
Use the -l img option to qcc to link against this library.
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.
- Some fields of src are missing (that is, not marked as valid in flags)
- Unsupported format conversion or angle
- Insufficient memory (the function requires a small amount of working memory)