Files
libimg/include/image/transformations.h
T
DarthMooMancer 39911cd662 REFACTOR: I forgot to actually change the function logic after rename;
The functions take in {width,height} to use instead of PPM image
containers. The function only pulled len, width and height so I just
imported them instead for all image types to be used.
2026-09-09 17:26:02 -04:00

44 lines
1.6 KiB
C

#ifndef TRANSFORMATIONS_H
#define TRANSFORMATIONS_H
#include "utils.h"
/**
* @brief Flips image on X-Axis
* @details Creates a new buffer to move pixels to and flips pixels on X-Axis,
* freeing the old buffer at the end.
* @param[in] buf Pointer to original pixel buffer, later freed.
* @param[in] img Loaded PPM image for calculations
* @return unsigned int Pointer to new pixel buffer
* @retval NULL If original buffer is invalid or if new buffer fails to create
* */
unsigned int*
u32_flop(const unsigned int* buf, const int width, const int height);
/**
* @brief Flips image on Y-Axis
* @details Creates a new buffer to move pixels to and flips pixels on Y-Axis,
* freeing the old buffer at the end.
* @param[in] buf Pointer to original pixel buffer, later freed.
* @param[in] img Loaded PPM image for calculations
* @return unsigned int Pointer to new pixel buffer
* @retval NULL If original buffer is invalid or if new buffer fails to create
* */
unsigned int*
u32_flip(const unsigned int* buf, const int width, const int height);
/**
* @brief Rotates image on 90 Clockwise
* @details Creates a new buffer to move pixels to and rotates pixels 90 degrees
* clockwise around center of origin, freeing the old buffer at the end.
* @param[in] buf Pointer to original pixel buffer, later freed.
* @param[in] img Pointer to loaded PPM image for calculations
* @return unsigned int Pointer to new pixel buffer
* @retval NULL If original buffer is invalid, if image pointer is invalid or if
* new buffer fails to create and is invalid
* */
unsigned int*
u32_rotate(const unsigned int* buf, PPM* m_img);
#endif