Blender  V2.59
iff.h
Go to the documentation of this file.
00001 
00004 /* Copyright (c) 1999, Not a Number / NeoGeo b.v. 
00005  * $Id: iff.h 37492 2011-06-15 01:56:49Z campbellbarton $
00006  * 
00007  * All rights reserved.
00008  * 
00009  * Contact:      info@blender.org   
00010  * Information:  http://www.blender.org
00011  *
00012  * Redistribution and use in source and binary forms, with or without
00013  * modification, are permitted provided that the following conditions
00014  * are met:
00015  * 1. Redistributions of source code must retain the above copyright
00016  *    notice, this list of conditions and the following disclaimer.
00017  * 2. Redistributions in binary form must reproduce the above copyright
00018  *    notice, this list of conditions and the following disclaimer in the
00019  *    documentation and/or other materials provided with the distribution.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  */
00033 
00034 #ifndef IFF_H
00035 #define IFF_H
00036 
00037 #include <sys/types.h>
00038 #include "util.h"
00039 #include "externdef.h"
00040 
00041 struct ImMetaData;
00042 
00043 #define IB_MIPMAP_LEVELS        20
00044 #define IB_FILENAME_SIZE        1023
00045 
00046 typedef struct ImBuf {
00047         struct ImBuf *next, *prev;      
00048         short   x, y;                           
00049         unsigned char   depth;          
00050         unsigned int    *rect;          
00051         unsigned int    *crect;         
00052         int     flags;                          
00053         int     mall;                           
00054         int     *zbuf;                          
00055         float *zbuf_float;              
00056         void *userdata;                 
00057         unsigned char *encodedbuffer;     
00058         unsigned int   encodedsize;       
00059         unsigned int   encodedbuffersize; 
00061         float *rect_float;              
00064         int channels;                   
00065         float dither;                   
00066         short profile;                  
00067         char profile_filename[256];             
00069         /* mipmapping */
00070         struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; 
00071         int miplevels;
00072 
00073         /* externally used flags */
00074         int index;                              /* reference index for ImBuf lists */
00075         int     userflags;                      /* used to set imbuf to dirty and other stuff */
00076         struct ImMetaData *metadata;
00077 
00078         /* file information */
00079         int     ftype;                                          /* file type we are going to save as */
00080         char name[IB_FILENAME_SIZE];    /* filename associated with this image */
00081 
00082         /* memory cache limiter */
00083         struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
00084         int refcounter; /* reference counter for multiple users */
00085 } ImBuf;
00086 
00087 LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint);
00088 LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
00089 LIBIMPORT void freeImBuf(struct ImBuf*);
00090 
00091 LIBIMPORT short saveiff(struct ImBuf *,char *,int);
00092 
00093 LIBIMPORT struct ImBuf *loadifffile(int,int);
00094 LIBIMPORT struct ImBuf *loadiffname(char *,int);
00095 LIBIMPORT struct ImBuf *testiffname(char *,int);
00096 
00097 LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
00098 LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
00099 LIBIMPORT struct ImBuf *half_y(struct ImBuf *);
00100 LIBIMPORT struct ImBuf *double_x(struct ImBuf *);
00101 LIBIMPORT struct ImBuf *double_y(struct ImBuf *);
00102 LIBIMPORT struct ImBuf *double_fast_x(struct ImBuf *);
00103 LIBIMPORT struct ImBuf *double_fast_y(struct ImBuf *);
00104 
00105 LIBIMPORT int ispic(char *);
00106 
00107 LIBIMPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
00108 LIBIMPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
00109 
00110 LIBIMPORT void de_interlace(struct ImBuf *ib);
00111 LIBIMPORT void interlace(struct ImBuf *ib);
00112 
00113 LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf, 
00114         int destx, int desty, int srcx, int srcy, int width, int height);
00115 
00116 LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
00117 LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
00118 LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
00119 LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
00120 
00121 #endif /* IFF_H */
00122