2
* IMB_imbuf_types.h (mar-2001 nzc)
4
* Types needed for using the image buffer.
6
* Imbuf is external code, slightly adapted to live in the Blender
7
* context. It requires an external jpeg module, and the avi-module
8
* (also external code) in order to function correctly.
10
* This file contains types and some constants that go with them. Most
11
* are self-explanatory (e.g. IS_amiga tests whether the buffer
12
* contains an Amiga-format file).
15
2
* ***** BEGIN GPL LICENSE BLOCK *****
17
4
* This program is free software; you can redistribute it and/or
38
25
* ***** END GPL LICENSE BLOCK *****
28
#ifndef __IMB_IMBUF_TYPES_H__
29
#define __IMB_IMBUF_TYPES_H__
31
#include "DNA_vec_types.h" /* for rcti */
41
34
* \file IMB_imbuf_types.h
43
36
* \brief Contains defines and structs used throughout the imbuf module.
44
37
* \todo Clean up includes.
39
* Types needed for using the image buffer.
41
* Imbuf is external code, slightly adapted to live in the Blender
42
* context. It requires an external jpeg module, and the avi-module
43
* (also external code) in order to function correctly.
45
* This file contains types and some constants that go with them. Most
46
* are self-explanatory (e.g. IS_amiga tests whether the buffer
47
* contains an Amiga-format file).
47
#ifndef __IMB_IMBUF_TYPES_H__
48
#define __IMB_IMBUF_TYPES_H__
52
52
#define IB_MIPMAP_LEVELS 20
53
53
#define IB_FILENAME_SIZE 1024
55
typedef struct DDSData {
56
unsigned int fourcc; /* DDS fourcc info */
57
unsigned int nummipmaps; /* The number of mipmaps in the dds file */
58
unsigned char *data; /* The compressed image data */
59
unsigned int size; /* The size of the compressed data */
57
64
* This is the abstraction of an image. ImBuf is the basic type used for all
58
65
* imbuf operations.
60
* REMINDER: if any changes take place, they need to be carried over
61
* to source/blender/blenpluginapi/iff.h too, OTHERWISE PLUGINS WON'T
64
67
* Also; add new variables to the end to save pain!
66
* Also, that iff.h needs to be in the final release "plugins/include" dir, too!
68
70
typedef struct ImBuf {
69
71
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
102
104
/* parameters used by conversion between byte and float */
103
105
float dither; /* random dither value, for conversion from float -> byte rect */
104
short profile; /* color space/profile preset that the byte rect buffer represents */
107
108
struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /* MipMap levels, a series of halved images */
126
127
unsigned char *encodedbuffer; /* Compressed image only used with png currently */
127
128
unsigned int encodedsize; /* Size of data written to encodedbuffer */
128
129
unsigned int encodedbuffersize; /* Size of encodedbuffer */
131
/* color management */
132
struct ColorSpace *rect_colorspace; /* color space of byte buffer */
133
struct ColorSpace *float_colorspace; /* color space of float buffer, used by sequencer only */
134
unsigned int *display_buffer_flags; /* array of per-display display buffers dirty flags */
135
struct ColormanageCache *colormanage_cache; /* cache used by color management */
136
int colormanage_flag;
139
/* information for compressed textures */
140
struct DDSData dds_data;
131
143
/* Moved from BKE_bmfont_types.h because it is a userflag bit mask. */
133
145
* \brief userflags: Flags used internally by blender for imagebuffers
136
#define IB_BITMAPFONT (1 << 0) /* this image is a font */
137
#define IB_BITMAPDIRTY (1 << 1) /* image needs to be saved is not the same as filename */
138
#define IB_MIPMAP_INVALID (1 << 2) /* image mipmaps are invalid, need recreate */
139
#define IB_RECT_INVALID (1 << 3) /* float buffer changed, needs recreation of byte rect */
148
#define IB_BITMAPFONT (1 << 0) /* this image is a font */
149
#define IB_BITMAPDIRTY (1 << 1) /* image needs to be saved is not the same as filename */
150
#define IB_MIPMAP_INVALID (1 << 2) /* image mipmaps are invalid, need recreate */
151
#define IB_RECT_INVALID (1 << 3) /* float buffer changed, needs recreation of byte rect */
152
#define IB_DISPLAY_BUFFER_INVALID (1 << 4) /* either float or byte buffer changed, need to re-calculate display buffers */
142
155
* \name Imbuf Component flags
157
170
#define IB_animdeinterlace (1 << 9)
158
171
#define IB_tiles (1 << 10)
159
172
#define IB_tilecache (1 << 11)
160
#define IB_premul (1 << 12)
161
#define IB_cm_predivide (1 << 13)
173
#define IB_alphamode_premul (1 << 12) /* indicates whether image on disk have premul alpha */
174
#define IB_alphamode_detect (1 << 13) /* if this flag is set, alpha mode would be guessed from file */
175
#define IB_ignore_alpha (1 << 14) /* ignore alpha on load and substitude it with 1.0f */
164
178
* The bit flag is stored in the ImBuf.ftype variable.
165
* Note that the lower 10 bits is used for storing custom flags
179
* Note that the lower 11 bits is used for storing custom flags
181
#define IB_CUSTOM_FLAGS_MASK 0x7ff
167
183
#define PNG (1 << 30)
168
184
#define TGA (1 << 28)
169
185
#define JPG (1 << 27)
201
221
#define JP2_YCC (1 << 15)
202
222
#define JP2_CINE (1 << 14)
203
223
#define JP2_CINE_48FPS (1 << 13)
224
#define JP2_JP2 (1 << 12)
225
#define JP2_J2K (1 << 11)
228
#define PNG_16BIT (1 << 10)
206
230
#define RAWTGA (TGA | 1)
208
232
#define JPG_STD (JPG | (0 << 8))
222
246
#define IB_PROFILE_SRGB 2
223
247
#define IB_PROFILE_CUSTOM 3
252
#define MAKEFOURCC(ch0, ch1, ch2, ch3)\
253
((unsigned long)(unsigned char)(ch0) | \
254
((unsigned long)(unsigned char)(ch1) << 8) | \
255
((unsigned long)(unsigned char)(ch2) << 16) | \
256
((unsigned long)(unsigned char)(ch3) << 24))
257
#endif /* MAKEFOURCC */
260
* FOURCC codes for DX compressed-texture pixel formats
263
#define FOURCC_DDS (MAKEFOURCC('D','D','S',' '))
264
#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1'))
265
#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2'))
266
#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3'))
267
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
268
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
225
271
extern const char *imb_ext_image[];
226
272
extern const char *imb_ext_image_qt[];
227
273
extern const char *imb_ext_movie[];
228
274
extern const char *imb_ext_audio[];
277
IMB_COLORMANAGE_IS_DATA = (1 << 0)