|
Blender
V2.59
|
00001 /* 00002 * IMB_imbuf_types.h (mar-2001 nzc) 00003 * 00004 * Types needed for using the image buffer. 00005 * 00006 * Imbuf is external code, slightly adapted to live in the Blender 00007 * context. It requires an external jpeg module, and the avi-module 00008 * (also external code) in order to function correctly. 00009 * 00010 * This file contains types and some constants that go with them. Most 00011 * are self-explanatory (e.g. IS_amiga tests whether the buffer 00012 * contains an Amiga-format file). 00013 * 00014 * $Id: IMB_imbuf_types.h 36715 2011-05-16 13:34:42Z blendix $ 00015 * 00016 * ***** BEGIN GPL LICENSE BLOCK ***** 00017 * 00018 * This program is free software; you can redistribute it and/or 00019 * modify it under the terms of the GNU General Public License 00020 * as published by the Free Software Foundation; either version 2 00021 * of the License, or (at your option) any later version. 00022 * 00023 * This program is distributed in the hope that it will be useful, 00024 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00025 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00026 * GNU General Public License for more details. 00027 * 00028 * You should have received a copy of the GNU General Public License 00029 * along with this program; if not, write to the Free Software Foundation, 00030 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00031 * 00032 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00033 * All rights reserved. 00034 * 00035 * The Original Code is: all of this file. 00036 * 00037 * Contributor(s): none yet. 00038 * 00039 * ***** END GPL LICENSE BLOCK ***** 00040 */ 00048 #ifndef IMB_IMBUF_TYPES_H 00049 #define IMB_IMBUF_TYPES_H 00050 00051 struct ImMetaData; 00052 00053 #define IB_MIPMAP_LEVELS 20 00054 #define IB_FILENAME_SIZE 1023 00055 00069 typedef struct ImBuf { 00070 struct ImBuf *next, *prev; 00072 /* dimensions */ 00073 int x, y; /* width and Height of our image buffer. 00074 * Should be 'unsigned int' since most formats use this. 00075 * but this is problematic with texture math in imagetexture.c 00076 * avoid problems and use int. - campbell */ 00077 00078 unsigned char depth; /* Active amount of bits/bitplanes */ 00079 int channels; /* amount of channels in rect_float (0 = 4 channel default) */ 00080 00081 /* flags */ 00082 int flags; /* Controls which components should exist. */ 00083 int mall; /* what is malloced internal, and can be freed */ 00084 00085 /* pixels */ 00086 unsigned int *rect; /* pixel values stored here */ 00087 float *rect_float; /* floating point Rect equivalent 00088 Linear RGB color space - may need gamma correction to 00089 sRGB when generating 8bit representations */ 00090 00091 /* resolution - pixels per meter */ 00092 double ppm[2]; 00093 00094 /* tiled pixel storage */ 00095 int tilex, tiley; 00096 int xtiles, ytiles; 00097 unsigned int **tiles; 00098 00099 /* zbuffer */ 00100 int *zbuf; /* z buffer data, original zbuffer */ 00101 float *zbuf_float; /* z buffer data, camera coordinates */ 00102 00103 /* parameters used by conversion between byte and float */ 00104 float dither; /* random dither value, for conversion from float -> byte rect */ 00105 short profile; /* color space/profile preset that the byte rect buffer represents */ 00106 00107 /* mipmapping */ 00108 struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /* MipMap levels, a series of halved images */ 00109 int miptot, miplevel; 00110 00111 /* externally used data */ 00112 int index; /* reference index for ImBuf lists */ 00113 int userflags; /* used to set imbuf to dirty and other stuff */ 00114 struct ImMetaData *metadata; /* image metadata */ 00115 void *userdata; /* temporary storage, only used by baking at the moment */ 00116 00117 /* file information */ 00118 int ftype; /* file type we are going to save as */ 00119 char name[IB_FILENAME_SIZE]; /* filename associated with this image */ 00120 char cachename[IB_FILENAME_SIZE]; /* full filename used for reading from cache */ 00121 00122 /* memory cache limiter */ 00123 struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */ 00124 int refcounter; /* reference counter for multiple users */ 00125 00126 /* some parameters to pass along for packing images */ 00127 unsigned char *encodedbuffer; /* Compressed image only used with png currently */ 00128 unsigned int encodedsize; /* Size of data written to encodedbuffer */ 00129 unsigned int encodedbuffersize; /* Size of encodedbuffer */ 00130 } ImBuf; 00131 00132 /* Moved from BKE_bmfont_types.h because it is a userflag bit mask. */ 00137 #define IB_BITMAPFONT (1 << 0) /* this image is a font */ 00138 #define IB_BITMAPDIRTY (1 << 1) /* image needs to be saved is not the same as filename */ 00139 #define IB_MIPMAP_INVALID (1 << 2) /* image mipmaps are invalid, need recreate */ 00140 #define IB_RECT_INVALID (1 << 3) /* float buffer changed, needs recreation of byte rect */ 00141 00149 #define IB_rect (1 << 0) 00150 #define IB_test (1 << 1) 00151 #define IB_fields (1 << 2) 00152 #define IB_zbuf (1 << 3) 00153 #define IB_mem (1 << 4) 00154 #define IB_rectfloat (1 << 5) 00155 #define IB_zbuffloat (1 << 6) 00156 #define IB_multilayer (1 << 7) 00157 #define IB_metadata (1 << 8) 00158 #define IB_animdeinterlace (1 << 9) 00159 #define IB_tiles (1 << 10) 00160 #define IB_tilecache (1 << 11) 00161 #define IB_premul (1 << 12) 00162 00163 /* 00164 * The bit flag is stored in the ImBuf.ftype variable. 00165 * Note that the lower 10 bits is used for storing custom flags 00166 */ 00167 #define PNG (1 << 30) 00168 #define TGA (1 << 28) 00169 #define JPG (1 << 27) 00170 #define BMP (1 << 26) 00171 00172 #ifdef WITH_QUICKTIME 00173 #define QUICKTIME (1 << 25) 00174 #endif 00175 00176 #ifdef WITH_HDR 00177 #define RADHDR (1 << 24) 00178 #endif 00179 #ifdef WITH_TIFF 00180 #define TIF (1 << 23) 00181 #define TIF_16BIT (1 << 8 ) 00182 #endif 00183 00184 #define OPENEXR (1 << 22) 00185 #define OPENEXR_HALF (1 << 8 ) 00186 #define OPENEXR_COMPRESS (7) 00187 00188 #ifdef WITH_CINEON 00189 #define CINEON (1 << 21) 00190 #define DPX (1 << 20) 00191 #endif 00192 00193 #ifdef WITH_DDS 00194 #define DDS (1 << 19) 00195 #endif 00196 00197 #ifdef WITH_OPENJPEG 00198 #define JP2 (1 << 18) 00199 #define JP2_12BIT (1 << 17) 00200 #define JP2_16BIT (1 << 16) 00201 #define JP2_YCC (1 << 15) 00202 #define JP2_CINE (1 << 14) 00203 #define JP2_CINE_48FPS (1 << 13) 00204 #endif 00205 00206 #define RAWTGA (TGA | 1) 00207 00208 #define JPG_STD (JPG | (0 << 8)) 00209 #define JPG_VID (JPG | (1 << 8)) 00210 #define JPG_JST (JPG | (2 << 8)) 00211 #define JPG_MAX (JPG | (3 << 8)) 00212 #define JPG_MSK (0xffffff00) 00213 00214 #define IMAGIC 0732 00215 00220 #define IB_PROFILE_NONE 0 00221 #define IB_PROFILE_LINEAR_RGB 1 00222 #define IB_PROFILE_SRGB 2 00223 #define IB_PROFILE_CUSTOM 3 00224 00225 extern const char *imb_ext_image[]; 00226 extern const char *imb_ext_image_qt[]; 00227 extern const char *imb_ext_movie[]; 00228 extern const char *imb_ext_audio[]; 00229 00230 #endif