Blender V2.61 - r43446

IMB_imbuf_types.h

Go to the documentation of this file.
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  *
00015  * ***** BEGIN GPL LICENSE BLOCK *****
00016  *
00017  * This program is free software; you can redistribute it and/or
00018  * modify it under the terms of the GNU General Public License
00019  * as published by the Free Software Foundation; either version 2
00020  * of the License, or (at your option) any later version.
00021  *
00022  * This program is distributed in the hope that it will be useful,
00023  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025  * GNU General Public License for more details.
00026  *
00027  * You should have received a copy of the GNU General Public License
00028  * along with this program; if not, write to the Free Software Foundation,
00029  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00030  *
00031  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00032  * All rights reserved.
00033  *
00034  * The Original Code is: all of this file.
00035  *
00036  * Contributor(s): none yet.
00037  *
00038  * ***** END GPL LICENSE BLOCK *****
00039  */
00047 #ifndef IMB_IMBUF_TYPES_H
00048 #define IMB_IMBUF_TYPES_H
00049 
00050 struct ImMetaData;
00051 
00052 #define IB_MIPMAP_LEVELS    20
00053 #define IB_FILENAME_SIZE    1023
00054 
00068 typedef struct ImBuf {
00069     struct ImBuf *next, *prev;  
00071     /* dimensions */
00072     int x, y;               /* width and Height of our image buffer.
00073                              * Should be 'unsigned int' since most formats use this.
00074                              * but this is problematic with texture math in imagetexture.c
00075                              * avoid problems and use int. - campbell */
00076 
00077     unsigned char planes;   /* Active amount of bits/bitplanes */
00078     int channels;           /* amount of channels in rect_float (0 = 4 channel default) */
00079 
00080     /* flags */
00081     int flags;              /* Controls which components should exist. */
00082     int mall;               /* what is malloced internal, and can be freed */
00083 
00084     /* pixels */
00085     unsigned int *rect;     /* pixel values stored here */
00086     float *rect_float;      /* floating point Rect equivalent
00087                             Linear RGB color space - may need gamma correction to 
00088                             sRGB when generating 8bit representations */
00089 
00090     /* resolution - pixels per meter */
00091     double ppm[2];
00092 
00093     /* tiled pixel storage */
00094     int tilex, tiley;
00095     int xtiles, ytiles;
00096     unsigned int **tiles;   
00097 
00098     /* zbuffer */
00099     int *zbuf;              /* z buffer data, original zbuffer */
00100     float *zbuf_float;      /* z buffer data, camera coordinates */
00101 
00102     /* parameters used by conversion between byte and float */
00103     float dither;               /* random dither value, for conversion from float -> byte rect */
00104     short profile;              /* color space/profile preset that the byte rect buffer represents */
00105 
00106     /* mipmapping */
00107     struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /* MipMap levels, a series of halved images */
00108     int miptot, miplevel;
00109 
00110     /* externally used data */
00111     int index;                      /* reference index for ImBuf lists */
00112     int userflags;                  /* used to set imbuf to dirty and other stuff */
00113     struct ImMetaData *metadata;    /* image metadata */
00114     void *userdata;                 /* temporary storage, only used by baking at the moment */
00115 
00116     /* file information */
00117     int ftype;                          /* file type we are going to save as */
00118     char name[IB_FILENAME_SIZE];        /* filename associated with this image */
00119     char cachename[IB_FILENAME_SIZE];   /* full filename used for reading from cache */
00120 
00121     /* memory cache limiter */
00122     struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
00123     int refcounter; /* reference counter for multiple users */
00124 
00125     /* some parameters to pass along for packing images */
00126     unsigned char *encodedbuffer;     /* Compressed image only used with png currently */
00127     unsigned int   encodedsize;       /* Size of data written to encodedbuffer */
00128     unsigned int   encodedbuffersize; /* Size of encodedbuffer */
00129 } ImBuf;
00130 
00131 /* Moved from BKE_bmfont_types.h because it is a userflag bit mask. */
00136 #define IB_BITMAPFONT       (1 << 0)    /* this image is a font */
00137 #define IB_BITMAPDIRTY      (1 << 1)    /* image needs to be saved is not the same as filename */
00138 #define IB_MIPMAP_INVALID   (1 << 2)    /* image mipmaps are invalid, need recreate */
00139 #define IB_RECT_INVALID     (1 << 3)    /* float buffer changed, needs recreation of byte rect */
00140 
00148 #define IB_rect             (1 << 0)
00149 #define IB_test             (1 << 1)
00150 #define IB_fields           (1 << 2)
00151 #define IB_zbuf             (1 << 3)
00152 #define IB_mem              (1 << 4)
00153 #define IB_rectfloat        (1 << 5)
00154 #define IB_zbuffloat        (1 << 6)
00155 #define IB_multilayer       (1 << 7)
00156 #define IB_metadata         (1 << 8)
00157 #define IB_animdeinterlace  (1 << 9)
00158 #define IB_tiles            (1 << 10)
00159 #define IB_tilecache        (1 << 11)
00160 #define IB_premul           (1 << 12)
00161 #define IB_cm_predivide     (1 << 13)
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