Functions
mk_image_blitfunction
void mk_image_blit(mk_image *dst, const mk_image *src, int dx, int dy)
Alpha-blend src over dst at (dx,dy) (clipped).
| Parameter | Type | Description |
|---|
dst | mk_image * | Value for dst. |
src | const mk_image * | Value for src. |
dx | int | Value for dx. |
dy | int | Value for dy. |
mk_image_copyfunction
mk_image mk_image_copy(const mk_image *src)
Deep copy.
| Parameter | Type | Description |
|---|
src | const mk_image * | Value for src. |
Returns The resulting value.
mk_image_createfunction
mk_image mk_image_create(int w, int h, mk_color fill)
Allocate a w*h image filled with a solid color.
| Parameter | Type | Description |
|---|
w | int | Value for w. |
h | int | Value for h. |
fill | mk_color | Value for fill. |
Returns The resulting value.
mk_image_cropfunction
mk_image mk_image_crop(const mk_image *src, int x, int y, int w, int h)
Crop a sub-rectangle (clamped to source bounds).
| Parameter | Type | Description |
|---|
src | const mk_image * | Value for src. |
x | int | Value for x. |
y | int | Value for y. |
w | int | Value for w. |
h | int | Value for h. |
Returns The resulting value.
mk_image_fillfunction
void mk_image_fill(mk_image *img, mk_color c)
Fill the whole image with a color.
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
c | mk_color | Value for c. |
mk_image_fill_rectfunction
void mk_image_fill_rect(mk_image *img, int x, int y, int w, int h, mk_color c)
Fill a rectangle with a color (clipped).
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
x | int | Value for x. |
y | int | Value for y. |
w | int | Value for w. |
h | int | Value for h. |
c | mk_color | Value for c. |
mk_image_flip_hfunction
void mk_image_flip_h(mk_image *img)
Perform the image flip h operation.
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
mk_image_flip_vfunction
void mk_image_flip_v(mk_image *img)
Perform the image flip v operation.
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
mk_image_freefunction
void mk_image_free(mk_image *img)
Free pixels and zero the struct.
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
mk_image_gen_checkerfunction
mk_image mk_image_gen_checker(int w, int h, int checks, mk_color a, mk_color b)
Checkerboard of checks cells across the width.
| Parameter | Type | Description |
|---|
w | int | Value for w. |
h | int | Value for h. |
checks | int | Value for checks. |
a | mk_color | Value for a. |
b | mk_color | Value for b. |
Returns The resulting value.
mk_image_gen_gradient_vfunction
mk_image mk_image_gen_gradient_v(int w, int h, mk_color top, mk_color bottom)
Vertical gradient from top color to bottom color.
| Parameter | Type | Description |
|---|
w | int | Value for w. |
h | int | Value for h. |
top | mk_color | Value for top. |
bottom | mk_color | Value for bottom. |
Returns The resulting value.
mk_image_gen_perlinfunction
mk_image mk_image_gen_perlin(int w, int h, float scale)
Grayscale Perlin noise (stb_perlin).
| Parameter | Type | Description |
|---|
w | int | Value for w. |
h | int | Value for h. |
scale | float | Value for scale. |
Returns The resulting value.
mk_image_getfunction
mk_color mk_image_get(const mk_image *img, int x, int y)
Get state from the image.
| Parameter | Type | Description |
|---|
img | const mk_image * | Value for img. |
x | int | Value for x. |
y | int | Value for y. |
Returns The resulting value.
mk_image_grayscalefunction
void mk_image_grayscale(mk_image *img)
Convert to luminance grayscale (alpha preserved).
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
mk_image_invertfunction
void mk_image_invert(mk_image *img)
Invert RGB (alpha preserved).
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
mk_image_loadfunction
mk_image mk_image_load(const char *path)
Decode an image file (PNG/JPG/...) to an RGBA8 image.
| Parameter | Type | Description |
|---|
path | const char * | Value for path. |
Returns The resulting value.
mk_image_load_memfunction
mk_image mk_image_load_mem(const void *data, size_t size)
Decode encoded image bytes (PNG/JPG/...) to an RGBA8 image.
| Parameter | Type | Description |
|---|
data | const void * | Data buffer. |
size | size_t | Size in bytes. |
Returns The resulting value.
mk_image_resizefunction
mk_image mk_image_resize(const mk_image *src, int new_w, int new_h)
High-quality resize (stb_image_resize2, sRGB-aware).
| Parameter | Type | Description |
|---|
src | const mk_image * | Value for src. |
new_w | int | Value for new w. |
new_h | int | Value for new h. |
Returns The resulting value.
mk_image_save_pngfunction
bool mk_image_save_png(const mk_image *img, const char *path)
Write a PNG to disk (stb_image_write).
| Parameter | Type | Description |
|---|
img | const mk_image * | Value for img. |
path | const char * | Value for path. |
Returns True when the operation succeeds.
mk_image_setfunction
void mk_image_set(mk_image *img, int x, int y, mk_color c)
Set state on the image.
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
x | int | Value for x. |
y | int | Value for y. |
c | mk_color | Value for c. |
mk_image_tintfunction
void mk_image_tint(mk_image *img, mk_color tint)
Multiply every pixel (incl.
| Parameter | Type | Description |
|---|
img | mk_image * | Value for img. |
tint | mk_color | Value for tint. |
mk_image_uploadfunction
mk_texture_t mk_image_upload(const mk_image *img, uint32_t flags)
Upload as an RGBA8 GPU texture (wraps mk_texture_create).
| Parameter | Type | Description |
|---|
img | const mk_image * | Value for img. |
flags | uint32_t | Value for flags. |
Returns The resulting handle or value.
mk_image_validfunction
bool mk_image_valid(const mk_image *img)
True if the image holds a valid pixel buffer.
| Parameter | Type | Description |
|---|
img | const mk_image * | Value for img. |
Returns True when the operation succeeds.