2002-10-12 11:37:38 +00:00
|
|
|
/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2003-04-30 13:22:26 +00:00
|
|
|
* Contact: info@blender.org
|
|
|
|
* Information: http://www.blender.org
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef IFF_H
|
|
|
|
#define IFF_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include "util.h"
|
2006-06-16 20:00:00 +00:00
|
|
|
#include "externdef.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#define IB_rect (1 << 0)
|
|
|
|
#define IB_planes (1 << 1)
|
|
|
|
#define IB_cmap (1 << 2)
|
|
|
|
#define IB_test (1 << 7)
|
|
|
|
|
|
|
|
#define IB_fields (1 << 11)
|
|
|
|
#define IB_yuv (1 << 12)
|
|
|
|
#define IB_zbuf (1 << 13)
|
|
|
|
#define IB_rgba (1 << 14)
|
|
|
|
|
2009-03-06 15:46:13 +00:00
|
|
|
#define JP2 (1 << 18)
|
|
|
|
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
#define AMI (1 << 31)
|
|
|
|
#define PNG (1 << 30)
|
|
|
|
#define Anim (1 << 29)
|
|
|
|
#define TGA (1 << 28)
|
|
|
|
#define JPG (1 << 27)
|
|
|
|
#define BMP (1 << 26)
|
|
|
|
#ifdef WITH_QUICKTIME
|
|
|
|
#define QUICKTIME (1 << 25)
|
|
|
|
#endif
|
|
|
|
#define RADHDR (1<<24)
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#define RAWTGA (TGA | 1)
|
|
|
|
|
|
|
|
#define JPG_STD (JPG | (0 << 8))
|
|
|
|
#define JPG_VID (JPG | (1 << 8))
|
|
|
|
#define JPG_JST (JPG | (2 << 8))
|
|
|
|
#define JPG_MAX (JPG | (3 << 8))
|
|
|
|
#define JPG_MSK (0xffffff00)
|
|
|
|
|
|
|
|
#define AM_ham (0x0800 | AMI)
|
|
|
|
#define AM_hbrite (0x0080 | AMI)
|
|
|
|
#define AM_lace (0x0004 | AMI)
|
|
|
|
#define AM_hires (0x8000 | AMI)
|
|
|
|
#define AM_hblace (AM_hbrite | AM_lace)
|
|
|
|
#define AM_hilace (AM_hires | AM_lace)
|
|
|
|
#define AM_hamlace (AM_ham | AM_lace)
|
|
|
|
|
|
|
|
#define RGB888 1
|
|
|
|
#define RGB555 2
|
|
|
|
#define DYUV 3
|
|
|
|
#define CLUT8 4
|
|
|
|
#define CLUT7 5
|
|
|
|
#define CLUT4 6
|
|
|
|
#define CLUT3 7
|
|
|
|
#define RL7 8
|
|
|
|
#define RL3 9
|
|
|
|
#define MPLTE 10
|
|
|
|
|
|
|
|
#define DYUV1 0
|
|
|
|
#define C233 1
|
|
|
|
#define YUVX 2
|
|
|
|
#define HAMX 3
|
|
|
|
#define TANX 4
|
|
|
|
|
|
|
|
#define AN_c233 (Anim | C233)
|
|
|
|
#define AN_yuvx (Anim | YUVX)
|
|
|
|
#define AN_hamx (Anim | HAMX)
|
|
|
|
#define AN_tanx (Anim | TANX)
|
|
|
|
|
|
|
|
#define IS_amiga(x) (x->ftype & AMI)
|
|
|
|
#define IS_ham(x) ((x->ftype & AM_ham) == AM_ham)
|
|
|
|
#define IS_hbrite(x) ((x->ftype & AM_hbrite) == AM_hbrite)
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#define IS_lace(x) ((x->ftype & AM_lace) == AM_lace)
|
|
|
|
#define IS_hires(x) ((x->ftype & AM_hires) == AM_hires)
|
|
|
|
#define IS_hblace(x) ((x->ftype & AM_hblace) == AM_hblace)
|
|
|
|
#define IS_hilace(x) ((x->ftype & AM_hilace) == AM_hilace)
|
|
|
|
#define IS_hamlace(x) ((x->ftype & AM_hamlace) == AM_hamlace)
|
|
|
|
|
|
|
|
#define IS_anim(x) (x->ftype & Anim)
|
|
|
|
#define IS_hamx(x) (x->ftype == AN_hamx)
|
|
|
|
#define IS_tga(x) (x->ftype & TGA)
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
#define IS_png(x) (x->ftype & PNG)
|
|
|
|
#define IS_bmp(x) (x->ftype & BMP)
|
|
|
|
#define IS_radhdr(x) (x->ftype & RADHDR)
|
2002-10-12 11:37:38 +00:00
|
|
|
#define IS_tim(x) (x->ftype & TIM)
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
#define IS_tiff(x) (x->ftype & TIFF)
|
|
|
|
#define IS_openexr(x) (x->ftype & OPENEXR)
|
2009-01-23 21:08:01 +00:00
|
|
|
#define IS_jp2(x) (x->ftype & JP2)
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#define IMAGIC 0732
|
|
|
|
#define IS_iris(x) (x->ftype == IMAGIC)
|
|
|
|
|
|
|
|
#define IS_jpg(x) (x->ftype & JPG)
|
|
|
|
#define IS_stdjpg(x) ((x->ftype & JPG_MSK) == JPG_STD)
|
|
|
|
#define IS_vidjpg(x) ((x->ftype & JPG_MSK) == JPG_VID)
|
|
|
|
#define IS_jstjpg(x) ((x->ftype & JPG_MSK) == JPG_JST)
|
|
|
|
#define IS_maxjpg(x) ((x->ftype & JPG_MSK) == JPG_MAX)
|
|
|
|
|
|
|
|
#define AN_INIT an_stringdec = stringdec; an_stringenc = stringenc;
|
|
|
|
|
2007-01-05 07:35:16 +00:00
|
|
|
#define IB_MIPMAP_LEVELS 10
|
|
|
|
|
2006-02-05 19:36:32 +00:00
|
|
|
struct MEM_CacheLimiterHandle_s;
|
|
|
|
|
2007-01-05 07:35:16 +00:00
|
|
|
typedef struct ImBuf {
|
|
|
|
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
|
|
|
|
short x, y; /**< width and Height of our image buffer */
|
|
|
|
short skipx; /**< Width in ints to get to the next scanline */
|
|
|
|
unsigned char depth; /**< Active amount of bits/bitplanes */
|
|
|
|
unsigned char cbits; /**< Amount of active bits in cmap */
|
|
|
|
unsigned short mincol; /**< smallest color in colormap */
|
|
|
|
unsigned short maxcol; /**< Largest color in colormap */
|
|
|
|
int type; /**< 0=abgr, 1=bitplanes */
|
|
|
|
int ftype; /**< File type we are going to save as */
|
|
|
|
unsigned int *cmap; /**< Color map data. */
|
|
|
|
unsigned int *rect; /**< pixel values stored here */
|
|
|
|
unsigned int **planes; /**< bitplanes */
|
|
|
|
int flags; /**< Controls which components should exist. */
|
|
|
|
int mall; /**< what is malloced internal, and can be freed */
|
|
|
|
short xorig, yorig; /**< Cordinates of first pixel of an image used in some formats (example: targa) */
|
|
|
|
char name[1023]; /**< The file name assocated with this image */
|
|
|
|
char namenull; /**< Unused don't want to remove it thought messes things up */
|
|
|
|
int userflags; /**< Used to set imbuf to Dirty and other stuff */
|
|
|
|
int *zbuf; /**< z buffer data, original zbuffer */
|
|
|
|
float *zbuf_float; /**< z buffer data, camera coordinates */
|
2008-04-22 14:53:15 +00:00
|
|
|
void *userdata; /**< temporary storage, only used by baking at the moment */
|
2007-01-05 07:35:16 +00:00
|
|
|
unsigned char *encodedbuffer; /**< Compressed image only used with png currently */
|
|
|
|
unsigned int encodedsize; /**< Size of data written to encodedbuffer */
|
|
|
|
unsigned int encodedbuffersize; /**< Size of encodedbuffer */
|
|
|
|
|
|
|
|
float *rect_float; /**< floating point Rect equivilant */
|
|
|
|
int channels; /**< amount of channels in rect_float (0 = 4 channel default) */
|
2006-04-02 18:11:02 +00:00
|
|
|
float dither; /**< random dither value, for conversion from float -> byte rect */
|
2007-01-05 07:35:16 +00:00
|
|
|
|
|
|
|
struct MEM_CacheLimiterHandle_s * c_handle; /**< handle for cache limiter */
|
2008-04-22 14:53:15 +00:00
|
|
|
struct ImgInfo * img_info;
|
2007-01-05 07:35:16 +00:00
|
|
|
int refcounter; /**< Refcounter for multiple users */
|
|
|
|
int index; /**< reference index for ImBuf lists */
|
|
|
|
|
|
|
|
struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /**< MipMap levels, a series of halved images */
|
2002-10-12 11:37:38 +00:00
|
|
|
} ImBuf;
|
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
|
|
|
|
LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
|
|
|
|
LIBIMPORT void freeImBuf(struct ImBuf*);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT short converttocmap(struct ImBuf* ibuf);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT short saveiff(struct ImBuf *,char *,int);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT struct ImBuf *loadiffmem(int *,int);
|
|
|
|
LIBIMPORT struct ImBuf *loadifffile(int,int);
|
|
|
|
LIBIMPORT struct ImBuf *loadiffname(char *,int);
|
|
|
|
LIBIMPORT struct ImBuf *testiffname(char *,int);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *onethird(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *halflace(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *half_y(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *double_x(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *double_y(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *double_fast_x(struct ImBuf *);
|
|
|
|
LIBIMPORT struct ImBuf *double_fast_y(struct ImBuf *);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT int ispic(char *);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT void dit2(struct ImBuf *, short, short);
|
|
|
|
LIBIMPORT void dit0(struct ImBuf *, short, short);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
|
|
|
|
LIBIMPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
|
|
|
|
LIBIMPORT struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
|
|
|
|
LIBIMPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT void de_interlace(struct ImBuf *ib);
|
|
|
|
LIBIMPORT void interlace(struct ImBuf *ib);
|
|
|
|
LIBIMPORT void gamwarp(struct ImBuf *ibuf, double gamma);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
|
2006-06-16 20:00:00 +00:00
|
|
|
int destx, int desty, int srcx, int srcy, int width, int height);
|
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
LIBIMPORT void IMB_rectfill(struct ImBuf *drect, float col[4]);
|
|
|
|
LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
|
|
|
|
LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#endif /* IFF_H */
|
2002-10-30 02:07:20 +00:00
|
|
|
|