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).
16 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version. The Blender
22 * Foundation also sells licenses for use in proprietary software under
23 * the Blender License. See http://www.blender.org/BL/ for information
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software Foundation,
33 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
36 * All rights reserved.
38 * The Original Code is: all of this file.
40 * Contributor(s): none yet.
42 * ***** END GPL/BL DUAL LICENSE BLOCK *****
45 #ifndef IMB_IMBUF_TYPES_H
46 #define IMB_IMBUF_TYPES_H
48 #include <stdio.h> /* for size_t */
49 #include "DNA_listBase.h" /* for ListBase */
54 * \brief The basic imbuf type
56 * This is the abstraction of an image. ImBuf is the basic type used for all
61 short x; /**< Width in pixels */
62 short y; /**< Height in scanlines */
63 short skipx; /**< Width in ints to get to the next scanline */
64 unsigned char depth; /**< Active amount of bits/bitplanes */
65 unsigned char cbits; /**< Amount of active bits in cmap */
66 unsigned short mincol; /**< First active color?*/
67 unsigned short maxcol; /**< Last active color?*/
68 int type; /**< 0=abgr, 1=bitplanes */
69 int ftype; /**< File type */
70 unsigned int *cmap; /**< Color map data. */
71 unsigned int *rect; /**< databuffer */
72 unsigned int **planes; /**< bitplanes */
73 int flags; /**< Controls which components should exist. */
74 int mall; /**< what is malloced internal, and can be freed */
75 short xorig: /**< X origin. What is this relative to? */
76 short yorig; /**< Y origin. What is this relative to? */
77 char name[1023]; /**< The file name */
78 char namenull; /**< What does this do?*/
79 int userflags; /**< What does this do? Holds an enum ImBuf_userflagsMask?*/
80 int *zbuf; /**< A z buffer */
81 void *userdata; /**< What does this do?*/
82 unsigned char *encodedbuffer; /** What is an encoded buffer? */
83 unsigned int encodedsize; /** What is an encoded buffer? */
84 unsigned int encodedbuffersize; /** What is an encoded buffer? */
87 /* Moved from BKE_bmfont_types.h because it is a userflag bit mask. */
89 * \brief Flags for the user?
92 IB_BITMAPFONT = 1 << 0,
93 IB_BITMAPDIRTY = 1 << 1
94 } ImBuf_userflagsMask;
97 /* From iff.h. This was once moved away by Frank, now Nzc moves it
98 * back. Such is the way it is... It is a long list of defines, and
99 * there are a few external defines in the back. Most of the stuff is
100 * probably imbuf_intern only. This will need to be merged later
104 * \brief Rectangle flag
106 #define IB_rect (1 << 0)
108 * \brief Bitmap Planes flag
110 #define IB_planes (1 << 1)
112 * \brief Color map flag
114 #define IB_cmap (1 << 2)
119 #define IB_vert (1 << 4)
121 * \brief Free Memory flag
123 #define IB_freem (1 << 6)
127 #define IB_test (1 << 7)
130 * \brief True Type object??
132 #define IB_ttob (1 << 8)
133 #define IB_subdlta (1 << 9)
135 * \brief Video fields flag
137 #define IB_fields (1 << 11)
139 * \brief Zbuffer flag
141 #define IB_zbuf (1 << 13)
144 * \brief Memory flag?
146 #define IB_mem (1 << 14)
149 * \brief .ami (amiga) filetype
151 #define AMI (1 << 31)
153 * \brief .png filetype
155 #define PNG (1 << 30)
157 * \brief .??? (Anim) filetype
159 #define Anim (1 << 29)
161 * \brief .tga (targa) filetype
163 #define TGA (1 << 28)
165 * \brief .jpg (JPEG) filetype
167 #define JPG (1 << 27)
169 * \brief .bmp filetype
171 #define BMP (1 << 26)
172 #ifdef WITH_QUICKTIME
174 * \brief .mov? (Quicktime) filetype
176 #define QUICKTIME (1 << 25)
178 #ifdef WITH_FREEIMAGE
180 * \brief .??? (Freeimage) filetype
182 #define FREEIMAGE (1 << 24)
184 #ifdef WITH_IMAGEMAGICK
186 * \brief .im? (ImageMagick) filetype
188 #define IMAGEMAGICK (1 << 23)
192 * \brief tga of type "raw"
194 #define RAWTGA (TGA | 1)
197 * \brief jpg of type "standard"?
199 #define JPG_STD (JPG | (0 << 8))
201 * \brief jpg of type "video"?
203 #define JPG_VID (JPG | (1 << 8))
205 * \brief jpg of type "jst"?
207 #define JPG_JST (JPG | (2 << 8))
209 * \brief jpg of type "max"?
211 #define JPG_MAX (JPG | (3 << 8))
213 * \brief Masks off the last two bytes.
215 #define JPG_MSK (0xffffff00)
218 * \brief .ham? Anim filetype
220 #define AM_ham (0x0800 | AMI)
222 * \brief .??? Anim filetype
224 #define AM_hbrite (0x0080 | AMI)
227 * \brief c233 type for Anim filetype
231 * \brief c233 type for Anim filetype
235 * \brief c233 type for Anim filetype
239 * \brief c233 type for Anim filetype
244 * \brief Anim file of type c233
246 #define AN_c233 (Anim | C233)
248 * \brief Anim file of type YUVX
250 #define AN_yuvx (Anim | YUVX)
252 * \brief Anim file of type HAMX
254 #define AN_hamx (Anim | HAMX)
256 * \brief Anim file of type TANX
258 #define AN_tanx (Anim | TANX)
261 * \brief Tests if an ImBuf is an Amiga file.
262 * \param x Must be an ImBuf*
264 #define IS_amiga(x) (x->ftype & AMI)
266 * \brief Tests if an ImBuf is a ham file.
267 * \param x Must be an ImBuf*
269 #define IS_ham(x) ((x->ftype & AM_ham) == AM_ham)
271 * \brief Tests if an ImBuf is an hbrite file.
272 * \param x Must be an ImBuf*
274 #define IS_hbrite(x) ((x->ftype & AM_hbrite) == AM_hbrite)
277 * \brief Tests if an ImBuf is an Anim file.
278 * \param x Must be an ImBuf*
280 #define IS_anim(x) (x->ftype & Anim)
282 * \brief Tests if an ImBuf is an Anim hamx.
283 * \param x Must be an ImBuf*
285 #define IS_hamx(x) (x->ftype == AN_hamx)
287 * \brief Tests if an ImBuf is a tga file.
288 * \param x Must be an ImBuf*
290 #define IS_tga(x) (x->ftype & TGA)
292 * \brief Tests if an ImBuf is a png file.
293 * \param x Must be an ImBuf*
295 #define IS_png(x) (x->ftype & PNG)
297 * \brief Tests if an ImBuf is a bmp file.
298 * \param x Must be an ImBuf*
300 #define IS_bmp(x) (x->ftype & BMP)
303 * \brief Iris filetype.
307 * \brief Tests if an ImBuf is an Iris file.
308 * \param x Must be an ImBuf*
310 #define IS_iris(x) (x->ftype == IMAGIC)
313 * \brief Tests if an ImBuf is a JPEG file.
314 * \param x Must be an ImBuf*
316 #define IS_jpg(x) (x->ftype & JPG)
318 * \brief Tests if an ImBuf is a standard JPEG file.
319 * \param x Must be an ImBuf*
321 #define IS_stdjpg(x) ((x->ftype & JPG_MSK) == JPG_STD)
323 * \brief Tests if an ImBuf is a video JPEG file.
324 * \param x Must be an ImBuf*
326 #define IS_vidjpg(x) ((x->ftype & JPG_MSK) == JPG_VID)
328 * \brief Tests if an ImBuf is a jst JPEG file.
329 * \param x Must be an ImBuf*
331 #define IS_jstjpg(x) ((x->ftype & JPG_MSK) == JPG_JST)
333 * \brief Tests if an ImBuf is a max JPEG file.
334 * \param x Must be an ImBuf*
336 #define IS_maxjpg(x) ((x->ftype & JPG_MSK) == JPG_MAX)