annotate tools/libgfx.h @ 1628:a549d33d543a

Add image aspect ratio information.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 16 May 2018 15:42:24 +0300
parents 36d073c45327
children 59c2b08a80a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Functions for loading and saving bitmap images
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * (C) Copyright 2012 Tecnic Software productions (TNSP)
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 *
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Please read file 'COPYING' for information on license and distribution.
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 */
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 #ifndef LIBMGFX_H
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #define LIBMGFX_H 1
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #include "dmlib.h"
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
12 #include "dmres.h"
947
5ac8f5513978 Delete useless include line.
Matti Hamalainen <ccr@tnsp.org>
parents: 929
diff changeset
13
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #ifdef __cplusplus
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 extern "C" {
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 #endif
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 enum
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 {
1543
416d7b3ba3b2 Rename libgfx IMGFMT_* constants to DM_IMGFMT_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 1341
diff changeset
22 DM_IMGFMT_PNG,
416d7b3ba3b2 Rename libgfx IMGFMT_* constants to DM_IMGFMT_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 1341
diff changeset
23 DM_IMGFMT_PPM,
416d7b3ba3b2 Rename libgfx IMGFMT_* constants to DM_IMGFMT_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 1341
diff changeset
24 DM_IMGFMT_PCX,
416d7b3ba3b2 Rename libgfx IMGFMT_* constants to DM_IMGFMT_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 1341
diff changeset
25 DM_IMGFMT_ILBM,
416d7b3ba3b2 Rename libgfx IMGFMT_* constants to DM_IMGFMT_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 1341
diff changeset
26 DM_IMGFMT_RAW,
416d7b3ba3b2 Rename libgfx IMGFMT_* constants to DM_IMGFMT_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 1341
diff changeset
27 DM_IMGFMT_ARAW,
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 };
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 enum
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 {
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 DM_IFMT_PALETTE,
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 DM_IFMT_RGB,
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 DM_IFMT_RGBA,
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 };
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
1544
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
39 // Error handling modes
1285
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
40 enum
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
41 {
1544
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
42 DM_ERRMODE_FAIL = 0,
1285
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
43 DM_ERRMODE_RECOV_1,
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
44 DM_ERRMODE_RECOV_2,
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
45 };
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
46
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
47
1544
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
48 // Probe scores
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
49 enum
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
50 {
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
51 DM_PROBE_SCORE_FALSE = 0,
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
52 DM_PROBE_SCORE_MAYBE = 250,
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
53 DM_PROBE_SCORE_AVG = 500,
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
54 DM_PROBE_SCORE_GOOD = 750,
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
55 DM_PROBE_SCORE_MAX = 1000,
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
56 };
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
57
48823642c4fb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1543
diff changeset
58
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
59 // Flags for readability/writeability of formats
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
60 enum
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
61 {
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
62 DM_FMT_WR = 0x0001,
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
63 DM_FMT_RD = 0x0002,
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
64 DM_FMT_RDWR = (DM_FMT_RD | DM_FMT_WR),
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
65 };
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
66
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1544
diff changeset
67
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
68 // Bitmapped image struct
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 typedef struct
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 {
1286
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
71 int format; // one of types specified by DM_IFMT_*
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
72 int width, height;
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
73 int pitch; // bytes per scanline
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
74 int bpp; // bits per pixel
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
75
1628
a549d33d543a Add image aspect ratio information.
Matti Hamalainen <ccr@tnsp.org>
parents: 1616
diff changeset
76 float aspect; // aspect ratio (vert / horiz), <= 0 if not set
a549d33d543a Add image aspect ratio information.
Matti Hamalainen <ccr@tnsp.org>
parents: 1616
diff changeset
77
1286
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
78 int ncolors; // number of colors in palette, if any
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
79 int ctransp; // transparency color index
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
80 BOOL constpal; // is the palette a const?
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
81 DMColor *pal; // pointer to palette struct, NULL if no palette
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
82
929
e1378398be0f Add size field for allocated data size in DMImage.
Matti Hamalainen <ccr@tnsp.org>
parents: 902
diff changeset
83 size_t size;
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 Uint8 *data;
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 } DMImage;
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 typedef struct
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 {
1288
6c8b19d1d196 More work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1286
diff changeset
90 int format;
6c8b19d1d196 More work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1286
diff changeset
91 int scaleX, scaleY;
6c8b19d1d196 More work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1286
diff changeset
92 int nplanes, bpp;
1291
2c4acbc3e7bf More work on libgfx etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1290
diff changeset
93 BOOL planar, paletted;
1290
e7dc9bb9777e Rename struct DMImageSpec to DMImageConvSpec.
Matti Hamalainen <ccr@tnsp.org>
parents: 1288
diff changeset
94 } DMImageConvSpec;
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 typedef struct
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 {
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 char *fext;
1616
36d073c45327 Refactor the format handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1609
diff changeset
100 char *name;
36d073c45327 Refactor the format handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1609
diff changeset
101 int fmtid; // DM_IMGFMT_*
36d073c45327 Refactor the format handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1609
diff changeset
102 int flags; // DM_FMT_* flags
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 int (*probe)(const Uint8 *buf, const size_t len);
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 int (*read)(const char *filename, DMImage **pimg);
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
105 int (*readFILE)(DMResource *fp, DMImage **pimg);
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
106 int (*write)(const char *filename, const DMImage *pimg, const DMImageConvSpec *spec);
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
107 int (*writeFILE)(DMResource *fp, const DMImage *pimg, const DMImageConvSpec *spec);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 } DMImageFormat;
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110
1616
36d073c45327 Refactor the format handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1609
diff changeset
111 extern const DMImageFormat dmImageFormatList[];
36d073c45327 Refactor the format handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1609
diff changeset
112 extern const int ndmImageFormatList;
1285
e4bda4909d72 Make libgfx error mode a global variable, at least for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 971
diff changeset
113 extern int dmGFXErrorMode;
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115
1286
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
116 DMImage * dmImageAlloc(const int width, const int height, const int format, const int bpp);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 void dmImageFree(DMImage *img);
1286
b812fad6f33e Work on libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 1285
diff changeset
118 int dmImageGetBytesPerPixel(const int format);
1616
36d073c45327 Refactor the format handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1609
diff changeset
119 int dmImageProbeGeneric(const Uint8 *buf, const size_t len, const DMImageFormat **fmt, int *index);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
487
b89598501cec Move dmCompareColor() to libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
121 BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, BOOL alpha);
b89598501cec Move dmCompareColor() to libgfx.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
122
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
124 int dmWriteImageData(const DMImage *img, void *cbdata, int (*writeRowCB)(void *, const Uint8 *, const size_t), const DMImageConvSpec *spec);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
126 int dmWriteRAWImageFILE(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec);
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
127 int dmWriteRAWImage(const char *filename, const DMImage *img, const DMImageConvSpec *spec);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
129 int dmWritePPMImageFILE(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec);
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
130 int dmWritePPMImage(const char *filename, const DMImage *img, const DMImageConvSpec *spec);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 #ifdef DM_USE_LIBPNG
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
133 int dmWritePNGImageFILE(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec);
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
134 int dmWritePNGImage(const char *filename, const DMImage *img, const DMImageConvSpec *spec);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 #endif
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
137 int dmReadILBMImageFILE(DMResource *fp, DMImage **pimg);
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
138 int dmReadILBMImage(const char *filename, DMImage **pimg);
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
139
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
140 int dmWritePCXImageFILE(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec);
1341
ae2ba8cb510f Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 1309
diff changeset
141 int dmWritePCXImage(const char *filename, const DMImage *img, const DMImageConvSpec *spec);
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
142 int dmReadPCXImageFILE(DMResource *fp, DMImage **pimg);
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 int dmReadPCXImage(const char *filename, DMImage **pimg);
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145
1309
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
146 typedef struct _DMBitStreamContext
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
147 {
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
148 void *handle;
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
149
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
150 BOOL (*putByte)(struct _DMBitStreamContext *ctx, Uint8 val);
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
151
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
152 int outBuf, outBitCount, outByteCount;
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
153 } DMBitStreamContext;
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
154
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
155
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
156 void dmInitBitStreamContext(DMBitStreamContext *ctx);
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
157 int dmFlushBitStream(DMBitStreamContext *ctx);
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
158 BOOL dmPutBits(DMBitStreamContext *ctx, const int val, const int n);
1609
c29adf5ce240 Convert libgfx file format routines to use DMResource instead of stdio FILE.
Matti Hamalainen <ccr@tnsp.org>
parents: 1545
diff changeset
159 int dmInitBitStreamFILE(DMBitStreamContext *ctx, DMResource *fp);
1309
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
160
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
161
5ad7d780a09b Move bitstream reading functions to libgfx, as they were only used there.
Matti Hamalainen <ccr@tnsp.org>
parents: 1307
diff changeset
162
435
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 #ifdef __cplusplus
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 }
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 #endif
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166
e4a3f183e463 Modularize some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 #endif // LIBMGFX_H