Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_png.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_PNG_H
8#define _DS_PNG_H
9
10
11#include <stdint.h>
12#include <stddef.h>
13
14#include <ds_surface.h>
15
16
17typedef enum
18{
19 PNG_STS_SUCCESS = 0,
20 PNG_STS_INVALID,
21 PNG_STS_UNSUPPORTED,
22 PNG_STS_INVALID_SURFACE,
23}ds_png_sts_t;
24
25
26enum
27{
28 PNG_IHDR_CT_GRAYSCALE = 0,
29 PNG_IHDR_CT_TRUECOLOR = 2,
30 PNG_IHDR_CT_INDEXED = 3,
31 PNG_IHDR_CT_GRAYSCALE_ALPHA = 4,
32 PNG_IHDR_CT_TRUECOLOR_ALPHA = 6
33};
34
35
36enum
37{
38 PNG_IHDR_COMPRESSION_DEFLATE = 0
39};
40
41
42enum
43{
44 PNG_IHDR_FILTER_STANDARD = 0,
45};
46
47
48enum
49{
50 PNG_IHDR_INTERLACE_NONE = 0,
51 PNG_IHDR_INTERLACE_ADAM7 = 1,
52};
53
54
55
56typedef struct
57{
58 uint32_t width;
59 uint32_t height;
60 uint8_t bit_depth;
61 uint8_t color_type;
62 uint8_t compression;
63 uint8_t filter;
64 uint8_t interlace;
65
66 bool plte_has_alpha;
67
68 DsColorMode color_mode;
69 uint16_t plte_size;
70
72
73
83DsSurface* ds_create_surface_from_png(const void* source, size_t size, bool alpha_only = false, DsRotation rotation = DsRotation::R0_DEG);
84
85
94bool ds_update_surface_from_png(const void *source, size_t size, bool alpha_only, DsSurface &surface);
95
96#endif
DsSurface is a class that represents a drawing surface.
Definition ds_surface.h:30
DsColorMode
DsColorMode is an enumeration of all possible color modes. These modes determine the color format use...
Definition ds_color.h:25
DsRotation
DsRotation is an enumeration of all possible values of the rotation used in drawing operations.
Definition ds_types.h:34
@ R0_DEG
all drawing is done on an unrotated framebuffer
Definition ds_png.h:57