DOCS: Added documentation to transformations

TRANSFORMATIONS: Added Checks for null buffers and null image. Also now free old buffer to prevent leaks
This commit is contained in:
Andrew Haynes
2026-08-31 22:41:16 -04:00
parent 854f5c2ba6
commit 3d00cfd2a7
3 changed files with 54 additions and 5 deletions
+28
View File
@@ -3,12 +3,40 @@
#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*
ppm_flip_h(const unsigned int* buf, const PPM img);
/**
* @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*
ppm_flip_v(const unsigned int* buf, const PPM img);
/**
* @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);