2011-02-27 20:32:12 +00:00
|
|
|
/** \file blender/blenpluginapi/iff.h
|
|
|
|
* \ingroup blpluginapi
|
|
|
|
*/
|
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
|
|
|
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
struct ImMetaData;
|
|
|
|
|
|
|
|
#define IB_MIPMAP_LEVELS 20
|
|
|
|
#define IB_FILENAME_SIZE 1023
|
2006-02-05 19:36:32 +00:00
|
|
|
|
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 */
|
|
|
|
unsigned char depth; /**< Active amount of bits/bitplanes */
|
|
|
|
unsigned int *rect; /**< pixel values stored here */
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
unsigned int *crect; /**< color corrected pixel values stored here */
|
2007-01-05 07:35:16 +00:00
|
|
|
int flags; /**< Controls which components should exist. */
|
|
|
|
int mall; /**< what is malloced internal, and can be freed */
|
|
|
|
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 */
|
|
|
|
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
float *rect_float; /**< floating point Rect equivalent
|
|
|
|
Linear RGB color space - may need gamma correction to
|
|
|
|
sRGB when generating 8bit representations */
|
2007-01-05 07:35:16 +00:00
|
|
|
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 */
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
short profile; /** color space/profile preset that the byte rect buffer represents */
|
|
|
|
char profile_filename[256]; /** to be implemented properly, specific filename for custom profiles */
|
|
|
|
|
|
|
|
/* mipmapping */
|
2007-01-05 07:35:16 +00:00
|
|
|
struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /**< MipMap levels, a series of halved images */
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
int miplevels;
|
|
|
|
|
|
|
|
/* externally used flags */
|
|
|
|
int index; /* reference index for ImBuf lists */
|
|
|
|
int userflags; /* used to set imbuf to dirty and other stuff */
|
|
|
|
struct ImMetaData *metadata;
|
|
|
|
|
|
|
|
/* file information */
|
|
|
|
int ftype; /* file type we are going to save as */
|
|
|
|
char name[IB_FILENAME_SIZE]; /* filename associated with this image */
|
|
|
|
|
|
|
|
/* memory cache limiter */
|
|
|
|
struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
|
|
|
|
int refcounter; /* reference counter for multiple users */
|
2002-10-12 11:37:38 +00:00
|
|
|
} ImBuf;
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint);
|
2008-04-18 19:10:03 +00:00
|
|
|
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 saveiff(struct ImBuf *,char *,int);
|
2006-06-16 20:00:00 +00:00
|
|
|
|
2008-04-18 19:10:03 +00:00
|
|
|
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 *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 struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
|
|
|
|
LIBIMPORT struct ImBuf *scalefastImBuf(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);
|
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);
|
|
|
|
|
2011-06-15 01:56:49 +00:00
|
|
|
LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
|
2008-04-18 19:10:03 +00:00
|
|
|
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);
|
2011-06-15 01:56:49 +00:00
|
|
|
LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#endif /* IFF_H */
|
2002-10-30 02:07:20 +00:00
|
|
|
|