home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / python2.6 / Imaging.h next >
Encoding:
C/C++ Source or Header  |  2010-07-26  |  18.7 KB  |  498 lines

  1. /*
  2.  * The Python Imaging Library
  3.  * $Id$
  4.  * 
  5.  * declarations for the imaging core library
  6.  *
  7.  * Copyright (c) 1997-2005 by Secret Labs AB
  8.  * Copyright (c) 1995-2005 by Fredrik Lundh
  9.  *
  10.  * See the README file for information on usage and redistribution.
  11.  */
  12.  
  13.  
  14. #include "ImPlatform.h"
  15.  
  16.  
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20.  
  21.  
  22. #ifndef M_PI
  23. #define    M_PI    3.14159265359
  24. #endif
  25.  
  26.  
  27. /* -------------------------------------------------------------------- */
  28.  
  29. /*
  30.  * Image data organization:
  31.  *
  32.  * mode        bytes    byte order
  33.  * -------------------------------
  34.  * 1        1        1
  35.  * L        1        L
  36.  * P        1        P
  37.  * I        4           I (32-bit integer, native byte order)
  38.  * F        4           F (32-bit IEEE float, native byte order)
  39.  * RGB        4        R, G, B, -
  40.  * RGBA        4        R, G, B, A
  41.  * CMYK        4        C, M, Y, K
  42.  * YCbCr    4        Y, Cb, Cr, -
  43.  *
  44.  * experimental modes (incomplete):
  45.  * LA       4           L, -, -, A
  46.  * PA       4           P, -, -, A
  47.  * I;16     2           I (16-bit integer, native byte order)
  48.  *
  49.  * "P" is an 8-bit palette mode, which should be mapped through the
  50.  * palette member to get an output image.  Check palette->mode to
  51.  * find the corresponding "real" mode.
  52.  *
  53.  * For information on how to access Imaging objects from your own C
  54.  * extensions, see http://www.effbot.org/zone/pil-extending.htm
  55.  */
  56.  
  57. /* Handles */
  58.  
  59. typedef struct ImagingMemoryInstance* Imaging;
  60.  
  61. typedef struct ImagingAccessInstance* ImagingAccess;
  62. typedef struct ImagingHistogramInstance* ImagingHistogram;
  63. typedef struct ImagingOutlineInstance* ImagingOutline;
  64. typedef struct ImagingPaletteInstance* ImagingPalette;
  65.  
  66. /* handle magics (used with PyCObject). */
  67. #define IMAGING_MAGIC "PIL Imaging"
  68.  
  69. /* pixel types */
  70. #define IMAGING_TYPE_UINT8 0
  71. #define IMAGING_TYPE_INT32 1
  72. #define IMAGING_TYPE_FLOAT32 2
  73. #define IMAGING_TYPE_SPECIAL 3 /* check mode for details */
  74.  
  75. struct ImagingMemoryInstance {
  76.  
  77.     /* Format */
  78.     char mode[4+1];    /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK") */
  79.     int type;        /* Data type (IMAGING_TYPE_*) */
  80.     int depth;        /* Depth (ignored in this version) */
  81.     int bands;        /* Number of bands (1, 2, 3, or 4) */
  82.     int xsize;        /* Image dimension. */
  83.     int ysize;
  84.  
  85.     /* Colour palette (for "P" images only) */
  86.     ImagingPalette palette;
  87.  
  88.     /* Data pointers */
  89.     UINT8 **image8;    /* Set for 8-bit images (pixelsize=1). */
  90.     INT32 **image32;    /* Set for 32-bit images (pixelsize=4). */
  91.  
  92.     /* Internals */
  93.     char **image;    /* Actual raster data. */
  94.     char *block;    /* Set if data is allocated in a single block. */
  95.  
  96.     int pixelsize;    /* Size of a pixel, in bytes (1, 2 or 4) */
  97.     int linesize;    /* Size of a line, in bytes (xsize * pixelsize) */
  98.  
  99.     /* Virtual methods */
  100.     void (*destroy)(Imaging im);
  101. };
  102.  
  103.  
  104. #define IMAGING_PIXEL_1(im,x,y) ((im)->image8[(y)][(x)])
  105. #define IMAGING_PIXEL_L(im,x,y) ((im)->image8[(y)][(x)])
  106. #define IMAGING_PIXEL_LA(im,x,y) ((im)->image[(y)][(x)*4])
  107. #define IMAGING_PIXEL_P(im,x,y) ((im)->image8[(y)][(x)])
  108. #define IMAGING_PIXEL_PA(im,x,y) ((im)->image[(y)][(x)*4])
  109. #define IMAGING_PIXEL_I(im,x,y) ((im)->image32[(y)][(x)])
  110. #define IMAGING_PIXEL_F(im,x,y) (((FLOAT32*)(im)->image32[y])[x])
  111. #define IMAGING_PIXEL_RGB(im,x,y) ((im)->image[(y)][(x)*4])
  112. #define IMAGING_PIXEL_RGBA(im,x,y) ((im)->image[(y)][(x)*4])
  113. #define IMAGING_PIXEL_CMYK(im,x,y) ((im)->image[(y)][(x)*4])
  114. #define IMAGING_PIXEL_YCbCr(im,x,y) ((im)->image[(y)][(x)*4])
  115.  
  116. #define IMAGING_PIXEL_UINT8(im,x,y) ((im)->image8[(y)][(x)])
  117. #define IMAGING_PIXEL_INT32(im,x,y) ((im)->image32[(y)][(x)])
  118. #define IMAGING_PIXEL_FLOAT32(im,x,y) (((FLOAT32*)(im)->image32[y])[x])
  119.  
  120. struct ImagingAccessInstance {
  121.   const char* mode;
  122.   void* (*line)(Imaging im, int x, int y);
  123.   void (*get_pixel)(Imaging im, int x, int y, void* pixel);
  124.   void (*put_pixel)(Imaging im, int x, int y, const void* pixel);
  125. };
  126.  
  127. struct ImagingHistogramInstance {
  128.  
  129.     /* Format */
  130.     char mode[4+1];    /* Band names (of corresponding source image) */
  131.     int bands;        /* Number of bands (1, 3, or 4) */
  132.  
  133.     /* Data */
  134.     long *histogram;    /* Histogram (bands*256 longs) */
  135.  
  136. };
  137.  
  138.  
  139. struct ImagingPaletteInstance {
  140.  
  141.     /* Format */
  142.     char mode[4+1];    /* Band names */
  143.  
  144.     /* Data */
  145.     UINT8 palette[1024];/* Palette data (same format as image data) */
  146.  
  147.     INT16* cache;    /* Palette cache (used for predefined palettes) */
  148.     int keep_cache;    /* This palette will be reused; keep cache */
  149.  
  150. };
  151.  
  152.  
  153. /* Objects */
  154. /* ------- */
  155.  
  156. extern int ImagingNewCount;
  157.  
  158. extern Imaging ImagingNew(const char* mode, int xsize, int ysize);
  159. extern Imaging ImagingNew2(const char* mode, Imaging imOut, Imaging imIn);
  160. extern void    ImagingDelete(Imaging im);
  161.  
  162. extern Imaging ImagingNewBlock(const char* mode, int xsize, int ysize);
  163. extern Imaging ImagingNewArray(const char* mode, int xsize, int ysize);
  164. extern Imaging ImagingNewMap(const char* filename, int readonly,
  165.                              const char* mode, int xsize, int ysize);
  166.  
  167. extern Imaging ImagingNewPrologue(const char *mode,
  168.                                   unsigned xsize, unsigned ysize);
  169. extern Imaging ImagingNewPrologueSubtype(const char *mode,
  170.                                   unsigned xsize, unsigned ysize,
  171.                                   int structure_size);
  172. extern Imaging ImagingNewEpilogue(Imaging im);
  173.  
  174. extern void ImagingCopyInfo(Imaging destination, Imaging source);
  175.  
  176. extern void ImagingHistogramDelete(ImagingHistogram histogram);
  177.  
  178. extern void ImagingAccessInit(void);
  179. extern ImagingAccess ImagingAccessNew(Imaging im);
  180. extern void _ImagingAccessDelete(Imaging im, ImagingAccess access);
  181. #define ImagingAccessDelete(im, access) /* nop, for now */
  182. /*#define ImagingAccessDelete(im, access) \
  183.   ((access)->dynamic ? _ImagingAccessDelete((im), (access)), 0 : 0)) */
  184.  
  185. extern ImagingPalette ImagingPaletteNew(const char *mode);
  186. extern ImagingPalette ImagingPaletteNewBrowser(void);
  187. extern ImagingPalette ImagingPaletteDuplicate(ImagingPalette palette);
  188. extern void           ImagingPaletteDelete(ImagingPalette palette);
  189.  
  190. extern int  ImagingPaletteCachePrepare(ImagingPalette palette);
  191. extern void ImagingPaletteCacheUpdate(ImagingPalette palette,
  192.                       int r, int g, int b);
  193. extern void ImagingPaletteCacheDelete(ImagingPalette palette);
  194.  
  195. #define    ImagingPaletteCache(p, r, g, b)\
  196.     p->cache[(r>>2) + (g>>2)*64 + (b>>2)*64*64]
  197.  
  198. extern Imaging ImagingQuantize(Imaging im, int colours, int mode, int kmeans);
  199.  
  200. /* Threading */
  201. /* --------- */
  202.  
  203. typedef void* ImagingSectionCookie;
  204.  
  205. extern void ImagingSectionEnter(ImagingSectionCookie* cookie);
  206. extern void ImagingSectionLeave(ImagingSectionCookie* cookie);
  207.  
  208. /* Exceptions */
  209. /* ---------- */
  210.  
  211. extern void* ImagingError_IOError(void);
  212. extern void* ImagingError_MemoryError(void);
  213. extern void* ImagingError_ModeError(void); /* maps to ValueError by default */
  214. extern void* ImagingError_Mismatch(void); /* maps to ValueError by default */
  215. extern void* ImagingError_ValueError(const char* message);
  216. extern void ImagingError_Clear(void);
  217.  
  218. /* Transform callbacks */
  219. /* ------------------- */
  220.  
  221. /* standard transforms */
  222. #define IMAGING_TRANSFORM_AFFINE 0
  223. #define IMAGING_TRANSFORM_PERSPECTIVE 2
  224. #define IMAGING_TRANSFORM_QUAD 3
  225.  
  226.  
  227. /* standard filters */
  228. #define IMAGING_TRANSFORM_NEAREST 0
  229. #define IMAGING_TRANSFORM_ANTIALIAS 1
  230. #define IMAGING_TRANSFORM_BILINEAR 2
  231. #define IMAGING_TRANSFORM_BICUBIC 3
  232.  
  233. typedef int (*ImagingTransformMap)(double* X, double* Y,
  234.                                    int x, int y, void* data);
  235. typedef int (*ImagingTransformFilter)(void* out, Imaging im,
  236.                                       double x, double y,
  237.                                       void* data);
  238.  
  239. /* Image Manipulation Methods */
  240. /* -------------------------- */
  241.  
  242. extern Imaging ImagingBlend(Imaging imIn1, Imaging imIn2, float alpha);
  243. extern Imaging ImagingCopy(Imaging im);
  244. extern Imaging ImagingConvert(Imaging im, const char* mode, ImagingPalette palette, int dither);
  245. extern Imaging ImagingConvertInPlace(Imaging im, const char* mode);
  246. extern Imaging ImagingConvertMatrix(Imaging im, const char *mode, float m[]);
  247. extern Imaging ImagingCrop(Imaging im, int x0, int y0, int x1, int y1);
  248. extern Imaging ImagingExpand(Imaging im, int x, int y, int mode);
  249. extern Imaging ImagingFill(Imaging im, const void* ink);
  250. extern int ImagingFill2(
  251.     Imaging into, const void* ink, Imaging mask,
  252.     int x0, int y0, int x1, int y1);
  253. extern Imaging ImagingFillBand(Imaging im, int band, int color);
  254. extern Imaging ImagingFillLinearGradient(const char* mode);
  255. extern Imaging ImagingFillRadialGradient(const char* mode);
  256. extern Imaging ImagingFilter(
  257.     Imaging im, int xsize, int ysize, const FLOAT32* kernel,
  258.     FLOAT32 offset, FLOAT32 divisor);
  259. extern Imaging ImagingFlipLeftRight(Imaging imOut, Imaging imIn);
  260. extern Imaging ImagingFlipTopBottom(Imaging imOut, Imaging imIn);
  261. extern Imaging ImagingGaussianBlur(Imaging im, Imaging imOut, float radius);
  262. extern Imaging ImagingGetBand(Imaging im, int band);
  263. extern int ImagingGetBBox(Imaging im, int bbox[4]);
  264. typedef struct { int x, y; INT32 count; INT32 pixel; } ImagingColorItem;
  265. extern ImagingColorItem* ImagingGetColors(Imaging im, int maxcolors,
  266.     int *colors);
  267. extern int ImagingGetExtrema(Imaging im, void *extrema);
  268. extern int ImagingGetProjection(Imaging im, UINT8* xproj, UINT8* yproj);
  269. extern ImagingHistogram ImagingGetHistogram(
  270.     Imaging im, Imaging mask, void *extrema);
  271. extern Imaging ImagingModeFilter(Imaging im, int size);
  272. extern Imaging ImagingNegative(Imaging im);
  273. extern Imaging ImagingOffset(Imaging im, int xoffset, int yoffset);
  274. extern int ImagingPaste(
  275.     Imaging into, Imaging im, Imaging mask,
  276.     int x0, int y0, int x1, int y1);
  277. extern Imaging ImagingPoint(
  278.     Imaging im, const char* tablemode, const void* table);
  279. extern Imaging ImagingPointTransform(
  280.     Imaging imIn, double scale, double offset);
  281. extern Imaging ImagingPutBand(Imaging im, Imaging imIn, int band);
  282. extern Imaging ImagingRankFilter(Imaging im, int size, int rank);
  283. extern Imaging ImagingResize(Imaging imOut, Imaging imIn, int filter);
  284. extern Imaging ImagingRotate(
  285.     Imaging imOut, Imaging imIn, double theta, int filter);
  286. extern Imaging ImagingRotate90(Imaging imOut, Imaging imIn);
  287. extern Imaging ImagingRotate180(Imaging imOut, Imaging imIn);
  288. extern Imaging ImagingRotate270(Imaging imOut, Imaging imIn);
  289. extern Imaging ImagingStretch(Imaging imOut, Imaging imIn, int filter);
  290. extern Imaging ImagingTransformPerspective(
  291.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  292.     double a[8], int filter, int fill);
  293. extern Imaging ImagingTransformAffine(
  294.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  295.     double a[6], int filter, int fill);
  296. extern Imaging ImagingTransformQuad(
  297.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  298.     double a[8], int filter, int fill);
  299. extern Imaging ImagingTransform(
  300.     Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1, 
  301.     ImagingTransformMap transform, void* transform_data,
  302.     ImagingTransformFilter filter, void* filter_data,
  303.     int fill);
  304. extern Imaging ImagingUnsharpMask(
  305.     Imaging im, Imaging imOut, float radius, int percent, int threshold);
  306.  
  307. extern Imaging ImagingCopy2(Imaging imOut, Imaging imIn);
  308. extern Imaging ImagingConvert2(Imaging imOut, Imaging imIn);
  309.  
  310. /* Channel operations */
  311. /* any mode, except "F" */
  312. extern Imaging ImagingChopLighter(Imaging imIn1, Imaging imIn2);
  313. extern Imaging ImagingChopDarker(Imaging imIn1, Imaging imIn2);
  314. extern Imaging ImagingChopDifference(Imaging imIn1, Imaging imIn2);
  315. extern Imaging ImagingChopMultiply(Imaging imIn1, Imaging imIn2);
  316. extern Imaging ImagingChopScreen(Imaging imIn1, Imaging imIn2);
  317. extern Imaging ImagingChopAdd(
  318.     Imaging imIn1, Imaging imIn2, float scale, int offset);
  319. extern Imaging ImagingChopSubtract(
  320.     Imaging imIn1, Imaging imIn2, float scale, int offset);
  321. extern Imaging ImagingChopAddModulo(Imaging imIn1, Imaging imIn2);
  322. extern Imaging ImagingChopSubtractModulo(Imaging imIn1, Imaging imIn2);
  323.  
  324. /* "1" images only */
  325. extern Imaging ImagingChopAnd(Imaging imIn1, Imaging imIn2);
  326. extern Imaging ImagingChopOr(Imaging imIn1, Imaging imIn2);
  327. extern Imaging ImagingChopXor(Imaging imIn1, Imaging imIn2);
  328.  
  329. /* Image measurement */
  330. extern void ImagingCrack(Imaging im, int x0, int y0);
  331.  
  332. /* Graphics */
  333. struct ImagingAffineMatrixInstance {
  334.     float a[9];
  335. };
  336.  
  337. typedef struct ImagingAffineMatrixInstance *ImagingAffineMatrix;
  338.  
  339. extern int ImagingDrawArc(Imaging im, int x0, int y0, int x1, int y1,
  340.                           int start, int end, const void* ink, int op);
  341. extern int ImagingDrawBitmap(Imaging im, int x0, int y0, Imaging bitmap,
  342.                              const void* ink, int op);
  343. extern int ImagingDrawChord(Imaging im, int x0, int y0, int x1, int y1,
  344.                             int start, int end, const void* ink, int fill,
  345.                             int op);
  346. extern int ImagingDrawEllipse(Imaging im, int x0, int y0, int x1, int y1,
  347.                               const void* ink, int fill, int op);
  348. extern int ImagingDrawLine(Imaging im, int x0, int y0, int x1, int y1,
  349.                const void* ink, int op);
  350. extern int ImagingDrawWideLine(Imaging im, int x0, int y0, int x1, int y1,
  351.                                const void* ink, int width, int op);
  352. extern int ImagingDrawPieslice(Imaging im, int x0, int y0, int x1, int y1,
  353.                                int start, int end, const void* ink, int fill,
  354.                                int op);
  355. extern int ImagingDrawPoint(Imaging im, int x, int y, const void* ink, int op);
  356. extern int ImagingDrawPolygon(Imaging im, int points, int *xy,
  357.                   const void* ink, int fill, int op);
  358. extern int ImagingDrawRectangle(Imaging im, int x0, int y0, int x1, int y1,
  359.                 const void* ink, int fill, int op);
  360.  
  361. /* Level 2 graphics (WORK IN PROGRESS) */
  362. extern ImagingOutline ImagingOutlineNew(void);
  363. extern void ImagingOutlineDelete(ImagingOutline outline);
  364.  
  365. extern int ImagingDrawOutline(Imaging im, ImagingOutline outline,
  366.                               const void* ink, int fill, int op);
  367.  
  368. extern int ImagingOutlineMove(ImagingOutline outline, float x, float y);
  369. extern int ImagingOutlineLine(ImagingOutline outline, float x, float y);
  370. extern int ImagingOutlineCurve(ImagingOutline outline, float x1, float y1,
  371.                                 float x2, float y2, float x3, float y3);
  372. extern int ImagingOutlineTransform(ImagingOutline outline, double a[6]);
  373.                                    
  374. extern int ImagingOutlineClose(ImagingOutline outline);
  375.  
  376. /* Special effects */
  377. extern Imaging ImagingEffectSpread(Imaging imIn, int distance);
  378. extern Imaging ImagingEffectNoise(int xsize, int ysize, float sigma);
  379. extern Imaging ImagingEffectMandelbrot(int xsize, int ysize,
  380.                                        double extent[4], int quality);
  381.  
  382. /* Obsolete */
  383. extern int ImagingToString(Imaging im, int orientation, char *buffer);
  384. extern int ImagingFromString(Imaging im, int orientation, char *buffer);
  385.  
  386.  
  387. /* File I/O */
  388. /* -------- */
  389.  
  390. /* Built-in drivers */
  391. extern Imaging ImagingOpenPPM(const char* filename);
  392. extern int ImagingSavePPM(Imaging im, const char* filename);
  393.  
  394. /* Utility functions */
  395. extern UINT32 ImagingCRC32(UINT32 crc, UINT8* buffer, int bytes);
  396.  
  397. /* Codecs */
  398. typedef struct ImagingCodecStateInstance *ImagingCodecState;
  399. typedef int (*ImagingCodec)(Imaging im, ImagingCodecState state,
  400.                 UINT8* buffer, int bytes);
  401.  
  402. extern int ImagingBitDecode(Imaging im, ImagingCodecState state,
  403.                 UINT8* buffer, int bytes);
  404. extern int ImagingEpsEncode(Imaging im, ImagingCodecState state,
  405.                 UINT8* buffer, int bytes);
  406. extern int ImagingFliDecode(Imaging im, ImagingCodecState state,
  407.                 UINT8* buffer, int bytes);
  408. extern int ImagingGifDecode(Imaging im, ImagingCodecState state,
  409.                 UINT8* buffer, int bytes);
  410. extern int ImagingGifEncode(Imaging im, ImagingCodecState state,
  411.                 UINT8* buffer, int bytes);
  412. extern int ImagingHexDecode(Imaging im, ImagingCodecState state,
  413.                 UINT8* buffer, int bytes);
  414. #ifdef    HAVE_LIBJPEG
  415. extern int ImagingJpegDecode(Imaging im, ImagingCodecState state,
  416.                  UINT8* buffer, int bytes);
  417. extern int ImagingJpegEncode(Imaging im, ImagingCodecState state,
  418.                  UINT8* buffer, int bytes);
  419. #endif
  420. extern int ImagingLzwDecode(Imaging im, ImagingCodecState state,
  421.                 UINT8* buffer, int bytes);
  422. #ifdef    HAVE_LIBMPEG
  423. extern int ImagingMpegDecode(Imaging im, ImagingCodecState state,
  424.                  UINT8* buffer, int bytes);
  425. #endif
  426. extern int ImagingMspDecode(Imaging im, ImagingCodecState state,
  427.                 UINT8* buffer, int bytes);
  428. extern int ImagingPackbitsDecode(Imaging im, ImagingCodecState state,
  429.                  UINT8* buffer, int bytes);
  430. extern int ImagingPcdDecode(Imaging im, ImagingCodecState state,
  431.                 UINT8* buffer, int bytes);
  432. extern int ImagingPcxDecode(Imaging im, ImagingCodecState state,
  433.                 UINT8* buffer, int bytes);
  434. extern int ImagingPcxEncode(Imaging im, ImagingCodecState state,
  435.                 UINT8* buffer, int bytes);
  436. extern int ImagingRawDecode(Imaging im, ImagingCodecState state,
  437.                 UINT8* buffer, int bytes);
  438. extern int ImagingRawEncode(Imaging im, ImagingCodecState state,
  439.                 UINT8* buffer, int bytes);
  440. extern int ImagingSunRleDecode(Imaging im, ImagingCodecState state,
  441.                    UINT8* buffer, int bytes);
  442. extern int ImagingTgaRleDecode(Imaging im, ImagingCodecState state,
  443.                    UINT8* buffer, int bytes);
  444. extern int ImagingXbmDecode(Imaging im, ImagingCodecState state,
  445.                 UINT8* buffer, int bytes);
  446. extern int ImagingXbmEncode(Imaging im, ImagingCodecState state,
  447.                 UINT8* buffer, int bytes);
  448. #ifdef    HAVE_LIBZ
  449. extern int ImagingZipDecode(Imaging im, ImagingCodecState state,
  450.                 UINT8* buffer, int bytes);
  451. extern int ImagingZipEncode(Imaging im, ImagingCodecState state,
  452.                 UINT8* buffer, int bytes);
  453. #endif
  454.  
  455. typedef void (*ImagingShuffler)(UINT8* out, const UINT8* in, int pixels);
  456.  
  457. /* Public shufflers */
  458. extern void ImagingPackRGB(UINT8* out, const UINT8* in, int pixels);
  459. extern void ImagingPackBGR(UINT8* out, const UINT8* in, int pixels);
  460. extern void ImagingUnpackRGB(UINT8* out, const UINT8* in, int pixels);
  461. extern void ImagingUnpackBGR(UINT8* out, const UINT8* in, int pixels);
  462. extern void ImagingUnpackYCC(UINT8* out, const UINT8* in, int pixels);
  463. extern void ImagingUnpackYCCA(UINT8* out, const UINT8* in, int pixels);
  464. extern void ImagingUnpackYCbCr(UINT8* out, const UINT8* in, int pixels);
  465.  
  466. extern void ImagingConvertRGB2YCbCr(UINT8* out, const UINT8* in, int pixels);
  467. extern void ImagingConvertYCbCr2RGB(UINT8* out, const UINT8* in, int pixels);
  468.  
  469. extern ImagingShuffler ImagingFindUnpacker(const char* mode,
  470.                                            const char* rawmode, int* bits_out);
  471. extern ImagingShuffler ImagingFindPacker(const char* mode,
  472.                                          const char* rawmode, int* bits_out);
  473.  
  474. struct ImagingCodecStateInstance {
  475.     int count;
  476.     int state;
  477.     int errcode;
  478.     int x, y;
  479.     int ystep;
  480.     int xsize, ysize, xoff, yoff;
  481.     ImagingShuffler shuffle;
  482.     int bits, bytes;
  483.     UINT8 *buffer;
  484.     void *context;
  485. };
  486.  
  487. /* Errcodes */
  488. #define    IMAGING_CODEC_END     1
  489. #define    IMAGING_CODEC_OVERRUN    -1
  490. #define    IMAGING_CODEC_BROKEN    -2
  491. #define    IMAGING_CODEC_UNKNOWN    -3
  492. #define    IMAGING_CODEC_CONFIG    -8
  493. #define    IMAGING_CODEC_MEMORY    -9
  494.  
  495. #if defined(__cplusplus)
  496. }
  497. #endif
  498.