home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2005 November / WNnov2005.iso / Windows / Equipement / Blender / blender-2.37a-windows.exe / $_5_ / plugins / include / iff.h < prev    next >
C/C++ Source or Header  |  2005-06-14  |  7KB  |  196 lines

  1. /* Copyright (c) 1999, Not a Number / NeoGeo b.v. 
  2.  * $Id: iff.h,v 1.7 2003/05/14 13:25:47 ton Exp $
  3.  * 
  4.  * All rights reserved.
  5.  * 
  6.  * Contact:      info@blender.org   
  7.  * Information:  http://www.blender.org
  8.  *
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in the
  16.  *    documentation and/or other materials provided with the distribution.
  17.  *
  18.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  19.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  22.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28.  * SUCH DAMAGE.
  29.  */
  30.  
  31. #ifndef IFF_H
  32. #define IFF_H
  33.  
  34. #include <sys/types.h>
  35. #include "util.h"
  36.  
  37. #define IB_rect            (1 << 0)
  38. #define IB_planes        (1 << 1)
  39. #define IB_cmap            (1 << 2)
  40. #define IB_test            (1 << 7)
  41.  
  42. #define IB_fields        (1 << 11)
  43. #define IB_yuv            (1 << 12)
  44. #define IB_zbuf            (1 << 13)
  45. #define IB_rgba            (1 << 14)
  46.  
  47. #define AMI        (1 << 31)
  48. #define Anim    (1 << 29)
  49. #define TGA        (1 << 28)
  50. #define JPG        (1 << 27)
  51.  
  52. #define RAWTGA    (TGA | 1)
  53.  
  54. #define JPG_STD    (JPG | (0 << 8))
  55. #define JPG_VID    (JPG | (1 << 8))
  56. #define JPG_JST    (JPG | (2 << 8))
  57. #define JPG_MAX    (JPG | (3 << 8))
  58. #define JPG_MSK    (0xffffff00)
  59.  
  60. #define AM_ham        (0x0800 | AMI)
  61. #define AM_hbrite   (0x0080 | AMI)
  62. #define AM_lace        (0x0004 | AMI)
  63. #define AM_hires    (0x8000 | AMI)
  64. #define AM_hblace   (AM_hbrite | AM_lace)
  65. #define AM_hilace   (AM_hires | AM_lace)
  66. #define AM_hamlace  (AM_ham | AM_lace)
  67.  
  68. #define RGB888    1
  69. #define RGB555    2
  70. #define DYUV    3
  71. #define CLUT8    4
  72. #define CLUT7    5
  73. #define CLUT4    6
  74. #define CLUT3    7
  75. #define RL7    8
  76. #define RL3    9
  77. #define MPLTE    10
  78.  
  79. #define DYUV1    0
  80. #define C233    1
  81. #define YUVX    2
  82. #define HAMX    3
  83. #define TANX    4
  84.  
  85. #define AN_c233            (Anim | C233)
  86. #define AN_yuvx            (Anim | YUVX)
  87. #define AN_hamx            (Anim | HAMX)
  88. #define AN_tanx            (Anim | TANX)
  89.  
  90. #define IS_amiga(x)        (x->ftype & AMI)
  91. #define IS_ham(x)        ((x->ftype & AM_ham) == AM_ham)
  92. #define IS_hbrite(x)    ((x->ftype & AM_hbrite) == AM_hbrite)
  93. #define IS_lace(x)        ((x->ftype & AM_lace) == AM_lace)
  94. #define IS_hires(x)        ((x->ftype & AM_hires) == AM_hires)
  95. #define IS_hblace(x)    ((x->ftype & AM_hblace) == AM_hblace)
  96. #define IS_hilace(x)    ((x->ftype & AM_hilace) == AM_hilace)
  97. #define IS_hamlace(x)    ((x->ftype & AM_hamlace) == AM_hamlace)
  98.  
  99. #define IS_anim(x)        (x->ftype & Anim)
  100. #define IS_hamx(x)        (x->ftype == AN_hamx)
  101.  
  102. #define IS_tga(x)        (x->ftype & TGA)
  103. #define IS_tim(x)        (x->ftype & TIM)
  104.  
  105. #define IMAGIC     0732
  106. #define IS_iris(x)        (x->ftype == IMAGIC)
  107.  
  108. #define IS_jpg(x)        (x->ftype & JPG)
  109. #define IS_stdjpg(x)    ((x->ftype & JPG_MSK) == JPG_STD)
  110. #define IS_vidjpg(x)    ((x->ftype & JPG_MSK) == JPG_VID)
  111. #define IS_jstjpg(x)    ((x->ftype & JPG_MSK) == JPG_JST)
  112. #define IS_maxjpg(x)    ((x->ftype & JPG_MSK) == JPG_MAX)
  113.  
  114. #define AN_INIT an_stringdec = stringdec; an_stringenc = stringenc;
  115.  
  116. typedef struct ImBuf{
  117.     short    x,y;        /* width in pixels, height in scanlines */
  118.     short    skipx;        /* width in ints to get to the next scanline */
  119.     unsigned char    depth;        /* active amount of bits/bitplanes */
  120.     unsigned char    cbits;        /* amount of active bits in cmap */
  121.     unsigned short    mincol;
  122.     unsigned short    maxcol;
  123.     int    type;        /* 0=abgr, 1=bitplanes */
  124.     int    ftype;
  125.     unsigned int    *cmap;        /* int array van kleuren */
  126.     unsigned int    *rect;        /* databuffer */
  127.     unsigned int    **planes;    /* bitplanes */
  128.     int    flags;
  129.     int    mall;        /* what is malloced internal, and can be freed */
  130.     short    xorig, yorig;
  131.     char    name[1023];
  132.     char    namenull;
  133.     int    userflags;
  134.     int    *zbuf;
  135.     void *userdata;
  136.     unsigned char *encodedbuffer;
  137.     unsigned int   encodedsize;
  138.     unsigned int   encodedbuffersize;
  139. } ImBuf;
  140.  
  141. extern struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
  142. extern struct ImBuf *dupImBuf(struct ImBuf *);
  143. extern void freeImBuf(struct ImBuf*);
  144.  
  145. extern short converttocmap(struct ImBuf* ibuf);
  146.  
  147. extern short saveiff(struct ImBuf *,char *,int);
  148.  
  149. extern struct ImBuf *loadiffmem(int *,int);
  150. extern struct ImBuf *loadifffile(int,int);
  151. extern struct ImBuf *loadiffname(char *,int);
  152. extern struct ImBuf *testiffname(char *,int);
  153.  
  154. extern struct ImBuf *onehalf(struct ImBuf *);
  155. extern struct ImBuf *onethird(struct ImBuf *);
  156. extern struct ImBuf *halflace(struct ImBuf *);
  157. extern struct ImBuf *half_x(struct ImBuf *);
  158. extern struct ImBuf *half_y(struct ImBuf *);
  159. extern struct ImBuf *double_x(struct ImBuf *);
  160. extern struct ImBuf *double_y(struct ImBuf *);
  161. extern struct ImBuf *double_fast_x(struct ImBuf *);
  162. extern struct ImBuf *double_fast_y(struct ImBuf *);
  163.  
  164. extern int ispic(char *);
  165.  
  166. extern void dit2(struct ImBuf *, short, short);
  167. extern void dit0(struct ImBuf *, short, short);
  168.  
  169. extern struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
  170. extern struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
  171. extern struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
  172. extern struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
  173.  
  174. /* Not sure if needed or not... was in the release version of this header.
  175. I think its old but figured I'd leave it for a bit just incase.
  176. mein@cs.umn.edu
  177. extern void floyd(struct ImBuf *, short, short);
  178. extern void dit3(struct ImBuf *, short, short);
  179. extern void dit4(struct ImBuf *, short, short);
  180. extern void (*ditherfunc)(struct ImBuf *, short, short);
  181. extern long getdither();
  182. */
  183.  
  184. extern void de_interlace(struct ImBuf *ib);
  185. extern void interlace(struct ImBuf *ib);
  186. extern void gamwarp(struct ImBuf *ibuf, double gamma);
  187.  
  188. extern void rectop(struct ImBuf *dbuf, struct ImBuf *sbuf,
  189.            int destx, int desty, int srcx,
  190.            int srcy, int width, int height,
  191.            void (*operation)(unsigned int *, unsigned int*, int, int),
  192.            int value);
  193.  
  194. #endif /* IFF_H */
  195.  
  196.