DOCS: added documentation to find_extension and removed redundant

asterisks from comments
This commit is contained in:
2026-09-09 17:32:22 -04:00
parent 39911cd662
commit 33bc2f29e6
+17 -11
View File
@@ -47,7 +47,7 @@ extern const char* error_messages[];
* @brief Max value for any channel * @brief Max value for any channel
* @details For alpha channel this is the max opacity setting and 0 is fully * @details For alpha channel this is the max opacity setting and 0 is fully
* transparent, 255 is white for any color and 0 is black. * transparent, 255 is white for any color and 0 is black.
* */ */
#define MAX 255 #define MAX 255
#define HALF_MAX \ #define HALF_MAX \
((int)(MAX / 2) + 1) /**< Half Max Color Value for any channel */ ((int)(MAX / 2) + 1) /**< Half Max Color Value for any channel */
@@ -70,7 +70,7 @@ extern const char* error_messages[];
* @param[in] g The green channel stored as char and packed into int * @param[in] g The green channel stored as char and packed into int
* @param[in] b The blue channel stored as char and packed into int * @param[in] b The blue channel stored as char and packed into int
* *
* */ */
#define ENCODE_RGB(r, g, b) \ #define ENCODE_RGB(r, g, b) \
(((unsigned int)(MAX) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \ (((unsigned int)(MAX) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \
((unsigned int)(g) << SHIFT_8) | (unsigned int)(b)) ((unsigned int)(g) << SHIFT_8) | (unsigned int)(b))
@@ -85,7 +85,7 @@ extern const char* error_messages[];
* @param[in] g The green channel stored as char and packed into int * @param[in] g The green channel stored as char and packed into int
* @param[in] b The blue channel stored as char and packed into int * @param[in] b The blue channel stored as char and packed into int
* *
* */ */
#define ENCODE_ARGB(a, r, g, b) \ #define ENCODE_ARGB(a, r, g, b) \
(((unsigned int)(a) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \ (((unsigned int)(a) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \
((unsigned int)(g) << SHIFT_8) | (unsigned int)(b)) ((unsigned int)(g) << SHIFT_8) | (unsigned int)(b))
@@ -95,7 +95,7 @@ extern const char* error_messages[];
* @details Takes in a value of X and checks if it is Above the Max of 255. If * @details Takes in a value of X and checks if it is Above the Max of 255. If
* so, then set to Max. If not, then simply set back to whatever X was before. * so, then set to Max. If not, then simply set back to whatever X was before.
* @param[in] x Color channel: char * @param[in] x Color channel: char
* */ */
#define CLAMP_MAX(x) (((x) > MAX) ? MAX : (x)) #define CLAMP_MAX(x) (((x) > MAX) ? MAX : (x))
/** /**
@@ -103,14 +103,14 @@ extern const char* error_messages[];
* @details Takes in a value of X and checks if it is Below 0. If so, then set * @details Takes in a value of X and checks if it is Below 0. If so, then set
* to 0. If not, then simply set back to whatever X was before. * to 0. If not, then simply set back to whatever X was before.
* @param[in] x Color channel: char * @param[in] x Color channel: char
* */ */
#define CLAMP_MIN(x) (((x) < 0) ? 0 : (x)) #define CLAMP_MIN(x) (((x) < 0) ? 0 : (x))
/** /**
* @brief Contains values for PPM Image * @brief Contains values for PPM Image
* @details Can be defined with just a name and filled later with ppm_load * @details Can be defined with just a name and filled later with ppm_load
* as it stores information for header of file not the pixels of the image * as it stores information for header of file not the pixels of the image
* */ */
typedef struct typedef struct
{ {
int width; /**< Image width in pixels */ int width; /**< Image width in pixels */
@@ -124,7 +124,7 @@ typedef struct
* @brief Contains values for JPEG Image * @brief Contains values for JPEG Image
* @details Can be defined with just a name and filled later with jpeg_load as * @details Can be defined with just a name and filled later with jpeg_load as
* it stores information for header of file not the pixels of the image * it stores information for header of file not the pixels of the image
* */ */
typedef struct typedef struct
{ {
int width; /**< Image width in pixels */ int width; /**< Image width in pixels */
@@ -140,7 +140,7 @@ typedef struct
* then dividing later. * then dividing later.
* @param[in] clr Takes a packed color, unsigned int * @param[in] clr Takes a packed color, unsigned int
* @return unsigned long Packed color in 4 ints instead of one * @return unsigned long Packed color in 4 ints instead of one
* */ */
unsigned long unsigned long
u32to_u64(const unsigned int clr); u32to_u64(const unsigned int clr);
@@ -150,7 +150,7 @@ u32to_u64(const unsigned int clr);
* @param[in] clr Takes a packed color, unsigned long * @param[in] clr Takes a packed color, unsigned long
* @param[in] u64_div Takes a divisor to break down to raw color * @param[in] u64_div Takes a divisor to break down to raw color
* @return unsigned int Packed color in 1 int instead of 4 * @return unsigned int Packed color in 1 int instead of 4
* */ */
unsigned int unsigned int
u64to_u32(const unsigned long clr, const unsigned long u64_div); u64to_u32(const unsigned long clr, const unsigned long u64_div);
@@ -159,7 +159,7 @@ u64to_u32(const unsigned long clr, const unsigned long u64_div);
* @details Prints metadata like Name, Format, Width, Height and Length * @details Prints metadata like Name, Format, Width, Height and Length
* important for debugging errors * important for debugging errors
* @param[in] src Pointer to src metadata of a PPM image * @param[in] src Pointer to src metadata of a PPM image
* */ */
void __attribute__((overloadable)) void __attribute__((overloadable))
print_attr(const PPM* src); print_attr(const PPM* src);
@@ -168,10 +168,16 @@ print_attr(const PPM* src);
* @details Prints metadata like Name, Width, Height and Length * @details Prints metadata like Name, Width, Height and Length
* important for debugging errors * important for debugging errors
* @param[in] src Pointer to src metadata of a JPEG image * @param[in] src Pointer to src metadata of a JPEG image
* */ */
void __attribute__((overloadable)) void __attribute__((overloadable))
print_attr(const JPEG* src); print_attr(const JPEG* src);
/**
* @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)
*/
size_t size_t
find_extension(const char* n); find_extension(const char* n);