Blender V2.27

IMB_imbuf_types.h

Go to the documentation of this file.
00001 
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 
00070 typedef struct ImBuf {
00071         struct ImBuf *next, *prev;      
00073         /* dimensions */
00074         int x, y;                               /* width and Height of our image buffer.
00075                                                          * Should be 'unsigned int' since most formats use this.
00076                                                          * but this is problematic with texture math in imagetexture.c
00077                                                          * avoid problems and use int. - campbell */
00078 
00079         unsigned char depth;    /* Active amount of bits/bitplanes */
00080         int channels;                   /* amount of channels in rect_float (0 = 4 channel default) */
00081 
00082         /* flags */
00083         int     flags;                          /* Controls which components should exist. */
00084         int     mall;                           /* what is malloced internal, and can be freed */
00085 
00086         /* pixels */
00087         unsigned int *rect;             /* pixel values stored here */
00088         unsigned int *crect;    /* color corrected pixel values stored here */
00089         float *rect_float;              /* floating point Rect equivalent
00090                                                         Linear RGB color space - may need gamma correction to 
00091                                                         sRGB when generating 8bit representations */
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         char profile_filename[256];     /* to be implemented properly, specific filename for custom profiles */
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