2017-07-18 20:53:00 +00:00
|
|
|
#ifndef __PNGWRITE_H__
|
|
|
|
#define __PNGWRITE_H__
|
|
|
|
|
|
|
|
#include "miniz.h"
|
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
#include "vfs.h"
|
|
|
|
|
2017-07-18 20:53:00 +00:00
|
|
|
#define CHUNK_COMPRESSED 1
|
|
|
|
#define CHUNK_ROW 2
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PNG_TRUECOLOR = 2,
|
|
|
|
PNG_INDEXED = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
z_stream *zs;
|
2019-03-01 08:51:50 +00:00
|
|
|
buildvfs_FILE file;
|
2017-07-18 20:53:00 +00:00
|
|
|
uint8_t *pal_data;
|
|
|
|
uint16_t pal_entries;
|
|
|
|
uint8_t *text;
|
|
|
|
uint8_t textlen;
|
|
|
|
} pngwrite_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t width, height;
|
|
|
|
uint8_t depth, type, filler[3];
|
|
|
|
} png_ihdr_t;
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2018-10-16 06:09:20 +00:00
|
|
|
void png_set_pal(uint8_t const * data, int numentries);
|
|
|
|
void png_set_text(char const * keyword, char const * text);
|
2019-05-19 03:56:13 +00:00
|
|
|
void png_write(buildvfs_FILE const file, int const width, int const height, uint8_t const type, uint8_t const * const data);
|
2017-07-18 20:53:00 +00:00
|
|
|
|
|
|
|
#endif
|