API: updated CMAKELISTS for static linking

This commit is contained in:
Andrew Haynes
2026-03-22 17:41:31 -04:00
parent 64cf77bbe3
commit 50d17af073
5 changed files with 16 additions and 8 deletions
+44
View File
@@ -0,0 +1,44 @@
#ifndef FILTERS_H
#define FILTERS_H
#include "utils.h"
unsigned int
u32_put_alpha(const unsigned int clr, const unsigned char alpha);
unsigned int
u32_invert(const unsigned int clr);
unsigned int
u32_swap_rb(const unsigned int clr);
unsigned int
u32_grayscale(const unsigned int clr);
unsigned int
u32_step(const unsigned int clr, const unsigned char max);
unsigned int
u32_brighten(const unsigned int clr, const float factor);
unsigned int
u32_mix(const unsigned int clr_a, const unsigned int clr_b);
unsigned int
u32_lerp(const unsigned clr_a, const unsigned int clr_b, const float ratio);
unsigned int
u32_mask(const unsigned int clr, const char keep);
unsigned int
u32_rotl(const unsigned int clr, const int n);
unsigned int
u32_contrast(const unsigned int clr, const float factor);
unsigned int
u32_avg_gb(const unsigned int clr);
unsigned int*
box_blur(const unsigned int* src_buf, const PPM* img, const int radius);
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef IMGIO_H
#define IMGIO_H
#include "utils.h"
unsigned int*
ppm_load(const char* file, PPM* m_attr);
int
ppm_save(const unsigned int* buf, const PPM img);
unsigned int*
jpeg_load(JPEG* m_attr);
int
jpeg_save(const unsigned int* src_buf, const JPEG* attr, const char* name);
void
ppm_to_jpeg(PPM* in, JPEG* out);
void
jpeg_to_ppm(JPEG* input, PPM* out);
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef TRANSFORMATIONS_H
#define TRANSFORMATIONS_H
#include "utils.h"
unsigned int*
ppm_flip_h(const unsigned int* buf, const PPM img);
unsigned int*
ppm_flip_v(const unsigned int* buf, const PPM img);
unsigned int*
u32_rotate(const unsigned int* buf, PPM* m_img, const int len);
#endif
+60
View File
@@ -0,0 +1,60 @@
#ifndef UTILS_H
#define UTILS_H
#define BYTE_A 0xFF000000
#define BYTE_R 0x00FF0000
#define BYTE_G 0x0000FF00
#define BYTE_B 0x000000FF
#define BYTE_RGB 0x00FFFFFF
#define BYTE 0xFF
#define LONG_BYTE 0xFFFF
#define SHIFT_8 8
#define SHIFT_16 16
#define SHIFT_24 24
#define MAX 255
#define HALF_MAX ((int)(MAX / 2) + 1)
#define DECODE_A(clr) (((clr) >> SHIFT_24) & BYTE)
#define DECODE_R(clr) (((clr) >> SHIFT_16) & BYTE)
#define DECODE_G(clr) (((clr) >> SHIFT_8) & BYTE)
#define DECODE_B(clr) ((clr) & BYTE)
#define ENCODE_RGB(r, g, b) \
(((unsigned int)(MAX) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \
((unsigned int)(g) << SHIFT_8) | (unsigned int)(b))
#define ENCODE_ARGB(a, r, g, b) \
(((unsigned int)(a) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \
((unsigned int)(g) << SHIFT_8) | (unsigned int)(b))
#define ENCODE_BGRA(b, g, r, a) \
(((unsigned int)(b) << SHIFT_24) | ((unsigned int)(g) << SHIFT_16) | \
((unsigned int)(r) << SHIFT_8) | (unsigned int)(a))
#define CLAMP_MAX(x) (((x) > MAX) ? MAX : (x))
#define CLAMP_MIN(x) (((x) < 0) ? 0 : (x))
typedef struct
{
int width, height;
int len;
char* name;
char fmt;
} PPM;
typedef struct
{
int width, height;
int len;
char* name;
} JPEG;
unsigned long
u32to_u64(const unsigned int clr);
unsigned int
u64to_u32(const unsigned long clr, const unsigned long u64_div);
#endif