// A library to load and save 24 bit Windows bitmap files.
// Written by Nils Liaaen Corneliusen 2019.
// https://www.ignorantus.com
// License: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication license

#ifndef BMPH
#define BMPH

#include <stdint.h>
#include <stdbool.h>

typedef struct {
    int w, h;
    int stride;
    uint8_t *argb;
} bmp_argb;

bmp_argb *bmp_alloc( int w, int h );

void bmp_free( bmp_argb *bp );

bmp_argb *bmp_load( const char *fname, bool flip );

bool bmp_save( bmp_argb *bp, const char *fname, bool flip );
bool bmp_save_jpg( bmp_argb *bp, const char *fname, bool flip, int quality );

void bmp_blend( bmp_argb *src, bmp_argb *dst, float wt );
void bmp_blend_2( bmp_argb *src, bmp_argb *dst, float wt_src );

void bmp_fade( bmp_argb *src, bmp_argb *dst, float wt );

#endif
