1 /** \file blender/blenpluginapi/iff.h
4 /* Copyright (c) 1999, Not a Number / NeoGeo b.v.
8 * Contact: info@blender.org
9 * Information: http://www.blender.org
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <sys/types.h>
38 #include "externdef.h"
42 #define IB_MIPMAP_LEVELS 20
43 #define IB_FILENAME_SIZE 1023
45 typedef struct ImBuf {
46 struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
47 short x, y; /**< width and Height of our image buffer */
48 unsigned char depth; /**< Active amount of bits/bitplanes */
49 unsigned int *rect; /**< pixel values stored here */
50 unsigned int *crect; /**< color corrected pixel values stored here */
51 int flags; /**< Controls which components should exist. */
52 int mall; /**< what is malloced internal, and can be freed */
53 int *zbuf; /**< z buffer data, original zbuffer */
54 float *zbuf_float; /**< z buffer data, camera coordinates */
55 void *userdata; /**< temporary storage, only used by baking at the moment */
56 unsigned char *encodedbuffer; /**< Compressed image only used with png currently */
57 unsigned int encodedsize; /**< Size of data written to encodedbuffer */
58 unsigned int encodedbuffersize; /**< Size of encodedbuffer */
60 float *rect_float; /** < floating point Rect equivalent
61 * Linear RGB color space - may need gamma correction to
62 * sRGB when generating 8bit representations */
63 int channels; /**< amount of channels in rect_float (0 = 4 channel default) */
64 float dither; /**< random dither value, for conversion from float -> byte rect */
65 short profile; /** color space/profile preset that the byte rect buffer represents */
66 char profile_filename[1024]; /** to be implemented properly, specific filename for custom profiles */
69 struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /**< MipMap levels, a series of halved images */
72 /* externally used flags */
73 int index; /* reference index for ImBuf lists */
74 int userflags; /* used to set imbuf to dirty and other stuff */
75 struct ImMetaData *metadata;
77 /* file information */
78 int ftype; /* file type we are going to save as */
79 char name[IB_FILENAME_SIZE]; /* filename associated with this image */
81 /* memory cache limiter */
82 struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
83 int refcounter; /* reference counter for multiple users */
86 LIBIMPORT struct ImBuf *allocImBuf(short, short, uchar, uint);
87 LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
88 LIBIMPORT void freeImBuf(struct ImBuf*);
90 LIBIMPORT short saveiff(struct ImBuf *, char *, int);
92 LIBIMPORT struct ImBuf *loadifffile(int, int);
93 LIBIMPORT struct ImBuf *loadiffname(char *, int);
94 LIBIMPORT struct ImBuf *testiffname(char *, int);
96 LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
97 LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
98 LIBIMPORT struct ImBuf *half_y(struct ImBuf *);
99 LIBIMPORT struct ImBuf *double_x(struct ImBuf *);
100 LIBIMPORT struct ImBuf *double_y(struct ImBuf *);
101 LIBIMPORT struct ImBuf *double_fast_x(struct ImBuf *);
102 LIBIMPORT struct ImBuf *double_fast_y(struct ImBuf *);
104 LIBIMPORT int ispic(char *);
106 LIBIMPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
107 LIBIMPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
109 LIBIMPORT void de_interlace(struct ImBuf *ib);
110 LIBIMPORT void interlace(struct ImBuf *ib);
112 LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
113 int destx, int desty, int srcx, int srcy, int width, int height);
115 LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
116 LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
117 LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
118 LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
120 #endif /* __IFF_H__ */