#pragma once

#include "pxl8_types.h"

#ifdef __cplusplus
extern "C" {
#endif

static inline u8 pxl8_blend_indexed(u8 src, u8 dst) {
    u8 m = (u8)(-(src != 0));
    return (src & m) | (dst & ~m);
}

static inline u16 pxl8_blend_hicolor(u16 src, u16 dst) {
    u16 m = (u16)(-(src != 0));
    return (src & m) | (dst & ~m);
}

void pxl8_blit_hicolor(
    u16* fb, u32 fb_width,
    const u16* sprite, u32 atlas_width,
    i32 x, i32 y, u32 w, u32 h
);
void pxl8_blit_indexed(
    u8* fb, u32 fb_width,
    const u8* sprite, u32 atlas_width,
    i32 x, i32 y, u32 w, u32 h
);

#ifdef __cplusplus
}
#endif
