REFACTOR: Expanded many parameter names for functions.

DOCS: Corrected comments to match new parameters.
CHORE: Moved some variable definition to top of function call.
This commit is contained in:
2026-09-12 05:15:16 -04:00
parent 81c228beb8
commit 54a2d44a53
9 changed files with 181 additions and 184 deletions
+5 -5
View File
@@ -107,11 +107,11 @@ u32_mask(const unsigned int clr, const char keep);
* it is just rotated back to original position. Cannot be greater than 8
* because the calculations would result in a negative.
* @param[in] clr Packed Pixel
* @param[in] n Amount of times to move bits to left.
* @param[in] dist Distance from original position to move each bit to the left.
* @return unsigned int Packed Pixel with newly moved bits
*/
unsigned int
u32_rotl(const unsigned int clr, const int n);
u32_rotl(const unsigned int clr, const int dist);
/**
* @brief Raises Color Vibrance
@@ -139,13 +139,13 @@ u32_avg_gb(const unsigned int clr);
* them. Then it moves to the next pixel doing the same. Then it does the second
* loop from top to bottom doing the same principle. This can take some time
* depending on hardware, image size, radius, etc.
* @param[in] src_buf The image buffer to be blurred
* @param[in] img the PPM image container
* @param[in] buf The image buffer to be blurred
* @param[in] metadata the PPM image container
* @param[in] radius The amount of pixels around the left and right, then top
* and bottom to mix with the currently selected pixel
* @return unsigned int Pointer to new created image buffer.
*/
unsigned int*
u32_box_blur(const unsigned int* src_buf, const PPM* img, const int radius);
u32_box_blur(const unsigned int* buf, const PPM* metadata, const int radius);
#endif
+20 -21
View File
@@ -5,67 +5,66 @@
/**
* @brief Open and Fill buffer from .ppm file
* @param [in] file Char pointer use to locate the image to be modified lays.
* @param [in,out] m_attr PPM pointer to store image information
* @param [in] filename Location of the image to be modified
* @param [in,out] metadata PPM pointer to store image information
*/
unsigned int*
read_ppm(const char* file, PPM* m_attr);
read_ppm(const char* filename, PPM* metadata);
/**
* @brief Open and write buffer to file
* @param [in] buf Information of pixels
* @param [in] img PPM pointer to store image information
* @param [in] char Name/Location for file
* @param [in] buffer Information of pixels
* @param [in] metadata PPM pointer to store image information
* @param [in] filename Name/Location for file
*/
int
write_ppm(const unsigned int* buf, const PPM img, const char* name);
write_ppm(const unsigned int* buffer, const PPM metadata, const char* filename);
/**
* @brief Open and Fill buffer from .jpg file
* @details Opens a .jpg file, creates a new buffer and extracts the pixels into
* said buffer as integers.
* @param [in] file Char pointer use to locate the image to be modified lays.
* @param [in,out] m_attr JPEG pointer to store image information
* @param [in,out] metadata JPEG pointer to store image information
*/
unsigned int*
read_jpeg(JPEG* m_attr);
read_jpeg(JPEG* metadata);
/**
* @brief Open and write buffer to file
* @param [in] buf Information of pixels
* @param [in] attr JPEG pointer to store image information
* @param [in] char Name/Location for file
* @param [in] metadata JPEG pointer to store image information
* @param [in] filename Name/Location for file
*/
int
write_jpeg(const unsigned int* src_buf, const JPEG* attr, const char* name);
write_jpeg(const unsigned int* buf, const JPEG* metadata, const char* filename);
/**
* @brief Converts PPM to JPEG
* @param [in] in Pointer to PPM container
* @param [in] location points to file to use
*/
void
transcode_to_jpeg(PPM* in);
transcode_to_jpeg(const char* location);
/**
* @brief Converts JPEG to PPM
* @param [in] in Pointer to JPEG container
* @param [in] location Pointer to JPEG container
*/
void
transcode_to_ppm(JPEG* in);
transcode_to_ppm(const char* location);
/**
* @brief Inherits the attributes from JPEG container
* @param [in] in Pointer to JPEG container
* @param [in] metadata Pointer to JPEG container
* @param [in] fmt Character for type of PPM image, binary or raw
*/
PPM
inherit_from_jpeg(const JPEG* in, const char fmt);
inherit_from_jpeg(const JPEG* metadata, const char fmt);
/**
* @brief Inherits the attributes from PPM container
* @param [in] in Pointer to PPM container
* @param [in] metadata Pointer to PPM container
*/
JPEG
inherit_from_ppm(const PPM* in);
inherit_from_ppm(const PPM* metadata);
#endif
+1 -1
View File
@@ -38,6 +38,6 @@ u32_flip(const unsigned int* buf, const int width, const int height);
* new buffer fails to create and is invalid
* */
unsigned int*
u32_rotate(const unsigned int* buf, PPM* m_img);
u32_rotate(const unsigned int* buf, PPM* metadata);
#endif
+6 -6
View File
@@ -158,27 +158,27 @@ u64to_u32(const unsigned long clr, const unsigned long u64_div);
* @brief Prints quick debug info of container
* @details Prints metadata like Name, Format, Width, Height and Length
* important for debugging errors
* @param[in] src Pointer to src metadata of a PPM image
* @param[in] metadata Pointer to information of a PPM image
*/
void __attribute__((overloadable))
print_attr(const PPM* src);
print_attr(const PPM* metadata);
/**
* @brief Prints quick debug info of container
* @details Prints metadata like Name, Width, Height and Length
* important for debugging errors
* @param[in] src Pointer to src metadata of a JPEG image
* @param[in] metadata Pointer to information of a JPEG image
*/
void __attribute__((overloadable))
print_attr(const JPEG* src);
print_attr(const JPEG* metadata);
/**
* @brief Finds start of extension in image name
* @details Loops through the character array starting from the end to find the
* start of the extension.
* @param[in] n Char array (str)
* @param[in] str Char array to loop through
*/
size_t
find_extension(const char* n);
find_extension(const char* str);
#endif