Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/python3.12/Imaging.h
$ cat -n /usr/include/python3.12/Imaging.h 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 #include "ImPlatform.h" 14 15 #if defined(__cplusplus) 16 extern "C" { 17 #endif 18 19 #ifndef M_PI 20 #define M_PI 3.1415926535897932384626433832795 21 #endif 22 23 /* -------------------------------------------------------------------- */ 24 25 /* 26 * Image data organization: 27 * 28 * mode bytes byte order 29 * ------------------------------- 30 * 1 1 1 31 * L 1 L 32 * P 1 P 33 * I 4 I (32-bit integer, native byte order) 34 * F 4 F (32-bit IEEE float, native byte order) 35 * RGB 4 R, G, B, - 36 * RGBA 4 R, G, B, A 37 * CMYK 4 C, M, Y, K 38 * YCbCr 4 Y, Cb, Cr, - 39 * Lab 4 L, a, b, - 40 * 41 * experimental modes (incomplete): 42 * LA 4 L, -, -, A 43 * PA 4 P, -, -, A 44 * I;16 2 I (16-bit integer, native byte order) 45 * 46 * "P" is an 8-bit palette mode, which should be mapped through the 47 * palette member to get an output image. Check palette->mode to 48 * find the corresponding "real" mode. 49 * 50 * For information on how to access Imaging objects from your own C 51 * extensions, see http://www.effbot.org/zone/pil-extending.htm 52 */ 53 54 /* Handles */ 55 56 typedef struct ImagingMemoryInstance *Imaging; 57 58 typedef struct ImagingAccessInstance *ImagingAccess; 59 typedef struct ImagingHistogramInstance *ImagingHistogram; 60 typedef struct ImagingOutlineInstance *ImagingOutline; 61 typedef struct ImagingPaletteInstance *ImagingPalette; 62 63 /* handle magics (used with PyCObject). */ 64 #define IMAGING_MAGIC "PIL Imaging" 65 66 /* pixel types */ 67 #define IMAGING_TYPE_UINT8 0 68 #define IMAGING_TYPE_INT32 1 69 #define IMAGING_TYPE_FLOAT32 2 70 #define IMAGING_TYPE_SPECIAL 3 /* check mode for details */ 71 72 #define IMAGING_MODE_LENGTH \ 73 6 + 1 /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */ 74 75 typedef struct { 76 char *ptr; 77 int size; 78 } ImagingMemoryBlock; 79 80 struct ImagingMemoryInstance { 81 /* Format */ 82 char mode[IMAGING_MODE_LENGTH]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", 83 "YCbCr", "BGR;xy") */ 84 int type; /* Data type (IMAGING_TYPE_*) */ 85 int depth; /* Depth (ignored in this version) */ 86 int bands; /* Number of bands (1, 2, 3, or 4) */ 87 int xsize; /* Image dimension. */ 88 int ysize; 89 90 /* Colour palette (for "P" images only) */ 91 ImagingPalette palette; 92 93 /* Data pointers */ 94 UINT8 **image8; /* Set for 8-bit images (pixelsize=1). */ 95 INT32 **image32; /* Set for 32-bit images (pixelsize=4). */ 96 97 /* Internals */ 98 char **image; /* Actual raster data. */ 99 char *block; /* Set if data is allocated in a single block. */ 100 ImagingMemoryBlock *blocks; /* Memory blocks for pixel storage */ 101 102 int pixelsize; /* Size of a pixel, in bytes (1, 2 or 4) */ 103 int linesize; /* Size of a line, in bytes (xsize * pixelsize) */ 104 105 /* Virtual methods */ 106 void (*destroy)(Imaging im); 107 }; 108 109 #define IMAGING_PIXEL_1(im, x, y) ((im)->image8[(y)][(x)]) 110 #define IMAGING_PIXEL_L(im, x, y) ((im)->image8[(y)][(x)]) 111 #define IMAGING_PIXEL_LA(im, x, y) ((im)->image[(y)][(x)*4]) 112 #define IMAGING_PIXEL_P(im, x, y) ((im)->image8[(y)][(x)]) 113 #define IMAGING_PIXEL_PA(im, x, y) ((im)->image[(y)][(x)*4]) 114 #define IMAGING_PIXEL_I(im, x, y) ((im)->image32[(y)][(x)]) 115 #define IMAGING_PIXEL_F(im, x, y) (((FLOAT32 *)(im)->image32[y])[x]) 116 #define IMAGING_PIXEL_RGB(im, x, y) ((im)->image[(y)][(x)*4]) 117 #define IMAGING_PIXEL_RGBA(im, x, y) ((im)->image[(y)][(x)*4]) 118 #define IMAGING_PIXEL_CMYK(im, x, y) ((im)->image[(y)][(x)*4]) 119 #define IMAGING_PIXEL_YCbCr(im, x, y) ((im)->image[(y)][(x)*4]) 120 121 #define IMAGING_PIXEL_UINT8(im, x, y) ((im)->image8[(y)][(x)]) 122 #define IMAGING_PIXEL_INT32(im, x, y) ((im)->image32[(y)][(x)]) 123 #define IMAGING_PIXEL_FLOAT32(im, x, y) (((FLOAT32 *)(im)->image32[y])[x]) 124 125 struct ImagingAccessInstance { 126 const char *mode; 127 void (*get_pixel)(Imaging im, int x, int y, void *pixel); 128 void (*put_pixel)(Imaging im, int x, int y, const void *pixel); 129 }; 130 131 struct ImagingHistogramInstance { 132 /* Format */ 133 char mode[IMAGING_MODE_LENGTH]; /* Band names (of corresponding source image) */ 134 int bands; /* Number of bands (1, 3, or 4) */ 135 136 /* Data */ 137 long *histogram; /* Histogram (bands*256 longs) */ 138 }; 139 140 struct ImagingPaletteInstance { 141 /* Format */ 142 char mode[IMAGING_MODE_LENGTH]; /* Band names */ 143 144 /* Data */ 145 int size; 146 UINT8 palette[1024]; /* Palette data (same format as image data) */ 147 148 INT16 *cache; /* Palette cache (used for predefined palettes) */ 149 int keep_cache; /* This palette will be reused; keep cache */ 150 }; 151 152 typedef struct ImagingMemoryArena { 153 int alignment; /* Alignment in memory of each line of an image */ 154 int block_size; /* Preferred block size, bytes */ 155 int blocks_max; /* Maximum number of cached blocks */ 156 int blocks_cached; /* Current number of blocks not associated with images */ 157 ImagingMemoryBlock *blocks_pool; 158 int stats_new_count; /* Number of new allocated images */ 159 int stats_allocated_blocks; /* Number of allocated blocks */ 160 int stats_reused_blocks; /* Number of blocks which were retrieved from a pool */ 161 int stats_reallocated_blocks; /* Number of blocks which were actually reallocated 162 after retrieving */ 163 int stats_freed_blocks; /* Number of freed blocks */ 164 } * ImagingMemoryArena; 165 166 /* Objects */ 167 /* ------- */ 168 169 extern struct ImagingMemoryArena ImagingDefaultArena; 170 extern int 171 ImagingMemorySetBlocksMax(ImagingMemoryArena arena, int blocks_max); 172 extern void 173 ImagingMemoryClearCache(ImagingMemoryArena arena, int new_size); 174 175 extern Imaging 176 ImagingNew(const char *mode, int xsize, int ysize); 177 extern Imaging 178 ImagingNewDirty(const char *mode, int xsize, int ysize); 179 extern Imaging 180 ImagingNew2Dirty(const char *mode, Imaging imOut, Imaging imIn); 181 extern void 182 ImagingDelete(Imaging im); 183 184 extern Imaging 185 ImagingNewBlock(const char *mode, int xsize, int ysize); 186 187 extern Imaging 188 ImagingNewPrologue(const char *mode, int xsize, int ysize); 189 extern Imaging 190 ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize, int structure_size); 191 192 extern void 193 ImagingCopyPalette(Imaging destination, Imaging source); 194 195 extern void 196 ImagingHistogramDelete(ImagingHistogram histogram); 197 198 extern void 199 ImagingAccessInit(void); 200 extern ImagingAccess 201 ImagingAccessNew(Imaging im); 202 extern void 203 _ImagingAccessDelete(Imaging im, ImagingAccess access); 204 #define ImagingAccessDelete(im, access) /* nop, for now */ 205 206 extern ImagingPalette 207 ImagingPaletteNew(const char *mode); 208 extern ImagingPalette 209 ImagingPaletteNewBrowser(void); 210 extern ImagingPalette 211 ImagingPaletteDuplicate(ImagingPalette palette); 212 extern void 213 ImagingPaletteDelete(ImagingPalette palette); 214 215 extern int 216 ImagingPaletteCachePrepare(ImagingPalette palette); 217 extern void 218 ImagingPaletteCacheUpdate(ImagingPalette palette, int r, int g, int b); 219 extern void 220 ImagingPaletteCacheDelete(ImagingPalette palette); 221 222 #define ImagingPaletteCache(p, r, g, b) \ 223 p->cache[(r >> 2) + (g >> 2) * 64 + (b >> 2) * 64 * 64] 224 225 extern Imaging 226 ImagingQuantize(Imaging im, int colours, int mode, int kmeans); 227 228 /* Threading */ 229 /* --------- */ 230 231 typedef void *ImagingSectionCookie; 232 233 extern void 234 ImagingSectionEnter(ImagingSectionCookie *cookie); 235 extern void 236 ImagingSectionLeave(ImagingSectionCookie *cookie); 237 238 /* Exceptions */ 239 /* ---------- */ 240 241 extern void * 242 ImagingError_OSError(void); 243 extern void * 244 ImagingError_MemoryError(void); 245 extern void * 246 ImagingError_ModeError(void); /* maps to ValueError by default */ 247 extern void * 248 ImagingError_Mismatch(void); /* maps to ValueError by default */ 249 extern void * 250 ImagingError_ValueError(const char *message); 251 extern void 252 ImagingError_Clear(void); 253 254 /* Transform callbacks */ 255 /* ------------------- */ 256 257 /* standard transforms */ 258 #define IMAGING_TRANSFORM_AFFINE 0 259 #define IMAGING_TRANSFORM_PERSPECTIVE 2 260 #define IMAGING_TRANSFORM_QUAD 3 261 262 /* standard filters */ 263 #define IMAGING_TRANSFORM_NEAREST 0 264 #define IMAGING_TRANSFORM_BOX 4 265 #define IMAGING_TRANSFORM_BILINEAR 2 266 #define IMAGING_TRANSFORM_HAMMING 5 267 #define IMAGING_TRANSFORM_BICUBIC 3 268 #define IMAGING_TRANSFORM_LANCZOS 1 269 270 typedef int (*ImagingTransformMap)(double *X, double *Y, int x, int y, void *data); 271 typedef int (*ImagingTransformFilter)(void *out, Imaging im, double x, double y); 272 273 /* Image Manipulation Methods */ 274 /* -------------------------- */ 275 276 extern Imaging 277 ImagingAlphaComposite(Imaging imIn1, Imaging imIn2); 278 extern Imaging 279 ImagingBlend(Imaging imIn1, Imaging imIn2, float alpha); 280 extern Imaging 281 ImagingCopy(Imaging im); 282 extern Imaging 283 ImagingConvert(Imaging im, const char *mode, ImagingPalette palette, int dither); 284 extern Imaging 285 ImagingConvertInPlace(Imaging im, const char *mode); 286 extern Imaging 287 ImagingConvertMatrix(Imaging im, const char *mode, float m[]); 288 extern Imaging 289 ImagingConvertTransparent(Imaging im, const char *mode, int r, int g, int b); 290 extern Imaging 291 ImagingCrop(Imaging im, int x0, int y0, int x1, int y1); 292 extern Imaging 293 ImagingExpand(Imaging im, int x, int y); 294 extern Imaging 295 ImagingFill(Imaging im, const void *ink); 296 extern int 297 ImagingFill2( 298 Imaging into, const void *ink, Imaging mask, int x0, int y0, int x1, int y1); 299 extern Imaging 300 ImagingFillBand(Imaging im, int band, int color); 301 extern Imaging 302 ImagingFillLinearGradient(const char *mode); 303 extern Imaging 304 ImagingFillRadialGradient(const char *mode); 305 extern Imaging 306 ImagingFilter(Imaging im, int xsize, int ysize, const FLOAT32 *kernel, FLOAT32 offset); 307 extern Imaging 308 ImagingFlipLeftRight(Imaging imOut, Imaging imIn); 309 extern Imaging 310 ImagingFlipTopBottom(Imaging imOut, Imaging imIn); 311 extern Imaging 312 ImagingGaussianBlur(Imaging imOut, Imaging imIn, float xradius, float yradius, int passes); 313 extern Imaging 314 ImagingGetBand(Imaging im, int band); 315 extern Imaging 316 ImagingMerge(const char *mode, Imaging bands[4]); 317 extern int 318 ImagingSplit(Imaging im, Imaging bands[4]); 319 extern int 320 ImagingGetBBox(Imaging im, int bbox[4], int alpha_only); 321 typedef struct { 322 int x, y; 323 INT32 count; 324 INT32 pixel; 325 } ImagingColorItem; 326 extern ImagingColorItem * 327 ImagingGetColors(Imaging im, int maxcolors, int *colors); 328 extern int 329 ImagingGetExtrema(Imaging im, void *extrema); 330 extern int 331 ImagingGetProjection(Imaging im, UINT8 *xproj, UINT8 *yproj); 332 extern ImagingHistogram 333 ImagingGetHistogram(Imaging im, Imaging mask, void *extrema); 334 extern Imaging 335 ImagingModeFilter(Imaging im, int size); 336 extern Imaging 337 ImagingNegative(Imaging im); 338 extern Imaging 339 ImagingOffset(Imaging im, int xoffset, int yoffset); 340 extern int 341 ImagingPaste(Imaging into, Imaging im, Imaging mask, int x0, int y0, int x1, int y1); 342 extern Imaging 343 ImagingPoint(Imaging im, const char *tablemode, const void *table); 344 extern Imaging 345 ImagingPointTransform(Imaging imIn, double scale, double offset); 346 extern Imaging 347 ImagingPutBand(Imaging im, Imaging imIn, int band); 348 extern Imaging 349 ImagingRankFilter(Imaging im, int size, int rank); 350 extern Imaging 351 ImagingRotate90(Imaging imOut, Imaging imIn); 352 extern Imaging 353 ImagingRotate180(Imaging imOut, Imaging imIn); 354 extern Imaging 355 ImagingRotate270(Imaging imOut, Imaging imIn); 356 extern Imaging 357 ImagingTranspose(Imaging imOut, Imaging imIn); 358 extern Imaging 359 ImagingTransverse(Imaging imOut, Imaging imIn); 360 extern Imaging 361 ImagingResample(Imaging imIn, int xsize, int ysize, int filter, float box[4]); 362 extern Imaging 363 ImagingReduce(Imaging imIn, int xscale, int yscale, int box[4]); 364 extern Imaging 365 ImagingTransform( 366 Imaging imOut, 367 Imaging imIn, 368 int method, 369 int x0, 370 int y0, 371 int x1, 372 int y1, 373 double a[8], 374 int filter, 375 int fill); 376 extern Imaging 377 ImagingUnsharpMask(Imaging imOut, Imaging im, float radius, int percent, int threshold); 378 extern Imaging 379 ImagingBoxBlur(Imaging imOut, Imaging imIn, float xradius, float yradius, int n); 380 extern Imaging 381 ImagingColorLUT3D_linear( 382 Imaging imOut, 383 Imaging imIn, 384 int table_channels, 385 int size1D, 386 int size2D, 387 int size3D, 388 INT16 *table); 389 390 extern Imaging 391 ImagingCopy2(Imaging imOut, Imaging imIn); 392 extern Imaging 393 ImagingConvert2(Imaging imOut, Imaging imIn); 394 395 /* Channel operations */ 396 /* any mode, except "F" */ 397 extern Imaging 398 ImagingChopLighter(Imaging imIn1, Imaging imIn2); 399 extern Imaging 400 ImagingChopDarker(Imaging imIn1, Imaging imIn2); 401 extern Imaging 402 ImagingChopDifference(Imaging imIn1, Imaging imIn2); 403 extern Imaging 404 ImagingChopMultiply(Imaging imIn1, Imaging imIn2); 405 extern Imaging 406 ImagingChopScreen(Imaging imIn1, Imaging imIn2); 407 extern Imaging 408 ImagingChopAdd(Imaging imIn1, Imaging imIn2, float scale, int offset); 409 extern Imaging 410 ImagingChopSubtract(Imaging imIn1, Imaging imIn2, float scale, int offset); 411 extern Imaging 412 ImagingChopAddModulo(Imaging imIn1, Imaging imIn2); 413 extern Imaging 414 ImagingChopSubtractModulo(Imaging imIn1, Imaging imIn2); 415 extern Imaging 416 ImagingChopSoftLight(Imaging imIn1, Imaging imIn2); 417 extern Imaging 418 ImagingChopHardLight(Imaging imIn1, Imaging imIn2); 419 extern Imaging 420 ImagingOverlay(Imaging imIn1, Imaging imIn2); 421 422 /* "1" images only */ 423 extern Imaging 424 ImagingChopAnd(Imaging imIn1, Imaging imIn2); 425 extern Imaging 426 ImagingChopOr(Imaging imIn1, Imaging imIn2); 427 extern Imaging 428 ImagingChopXor(Imaging imIn1, Imaging imIn2); 429 430 /* Graphics */ 431 extern int 432 ImagingDrawArc( 433 Imaging im, 434 int x0, 435 int y0, 436 int x1, 437 int y1, 438 float start, 439 float end, 440 const void *ink, 441 int width, 442 int op); 443 extern int 444 ImagingDrawBitmap(Imaging im, int x0, int y0, Imaging bitmap, const void *ink, int op); 445 extern int 446 ImagingDrawChord( 447 Imaging im, 448 int x0, 449 int y0, 450 int x1, 451 int y1, 452 float start, 453 float end, 454 const void *ink, 455 int fill, 456 int width, 457 int op); 458 extern int 459 ImagingDrawEllipse( 460 Imaging im, 461 int x0, 462 int y0, 463 int x1, 464 int y1, 465 const void *ink, 466 int fill, 467 int width, 468 int op); 469 extern int 470 ImagingDrawLine(Imaging im, int x0, int y0, int x1, int y1, const void *ink, int op); 471 extern int 472 ImagingDrawWideLine( 473 Imaging im, int x0, int y0, int x1, int y1, const void *ink, int width, int op); 474 extern int 475 ImagingDrawPieslice( 476 Imaging im, 477 int x0, 478 int y0, 479 int x1, 480 int y1, 481 float start, 482 float end, 483 const void *ink, 484 int fill, 485 int width, 486 int op); 487 extern int 488 ImagingDrawPoint(Imaging im, int x, int y, const void *ink, int op); 489 extern int 490 ImagingDrawPolygon(Imaging im, int points, int *xy, const void *ink, int fill, int width, int op); 491 extern int 492 ImagingDrawRectangle( 493 Imaging im, 494 int x0, 495 int y0, 496 int x1, 497 int y1, 498 const void *ink, 499 int fill, 500 int width, 501 int op); 502 503 /* Level 2 graphics (WORK IN PROGRESS) */ 504 extern ImagingOutline 505 ImagingOutlineNew(void); 506 extern void 507 ImagingOutlineDelete(ImagingOutline outline); 508 509 extern int 510 ImagingDrawOutline( 511 Imaging im, ImagingOutline outline, const void *ink, int fill, int op); 512 513 extern int 514 ImagingOutlineMove(ImagingOutline outline, float x, float y); 515 extern int 516 ImagingOutlineLine(ImagingOutline outline, float x, float y); 517 extern int 518 ImagingOutlineCurve( 519 ImagingOutline outline, float x1, float y1, float x2, float y2, float x3, float y3); 520 extern int 521 ImagingOutlineTransform(ImagingOutline outline, double a[6]); 522 523 extern int 524 ImagingOutlineClose(ImagingOutline outline); 525 526 /* Special effects */ 527 extern Imaging 528 ImagingEffectSpread(Imaging imIn, int distance); 529 extern Imaging 530 ImagingEffectNoise(int xsize, int ysize, float sigma); 531 extern Imaging 532 ImagingEffectMandelbrot(int xsize, int ysize, double extent[4], int quality); 533 534 /* File I/O */ 535 /* -------- */ 536 537 /* Built-in drivers */ 538 extern Imaging 539 ImagingOpenPPM(const char *filename); 540 extern int 541 ImagingSavePPM(Imaging im, const char *filename); 542 543 /* Codecs */ 544 typedef struct ImagingCodecStateInstance *ImagingCodecState; 545 typedef int (*ImagingCodec)( 546 Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 547 548 extern int 549 ImagingBcnDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 550 extern int 551 ImagingBitDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 552 extern int 553 ImagingEpsEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 554 extern int 555 ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 556 extern int 557 ImagingGifDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 558 extern int 559 ImagingGifEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 560 extern int 561 ImagingHexDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 562 #ifdef HAVE_LIBJPEG 563 extern int 564 ImagingJpegDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 565 extern int 566 ImagingJpegDecodeCleanup(ImagingCodecState state); 567 extern int 568 ImagingJpegUseJCSExtensions(void); 569 570 extern int 571 ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 572 #endif 573 #ifdef HAVE_OPENJPEG 574 extern int 575 ImagingJpeg2KDecode( 576 Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 577 extern int 578 ImagingJpeg2KDecodeCleanup(ImagingCodecState state); 579 extern int 580 ImagingJpeg2KEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 581 extern int 582 ImagingJpeg2KEncodeCleanup(ImagingCodecState state); 583 #endif 584 #ifdef HAVE_LIBTIFF 585 extern int 586 ImagingLibTiffDecode( 587 Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 588 extern int 589 ImagingLibTiffEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 590 #endif 591 #ifdef HAVE_LIBMPEG 592 extern int 593 ImagingMpegDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 594 #endif 595 extern int 596 ImagingMspDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 597 extern int 598 ImagingPackbitsDecode( 599 Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 600 extern int 601 ImagingPcdDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 602 extern int 603 ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 604 extern int 605 ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 606 extern int 607 ImagingRawDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 608 extern int 609 ImagingRawEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 610 extern int 611 ImagingSgiRleDecode( 612 Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 613 extern int 614 ImagingSunRleDecode( 615 Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 616 extern int 617 ImagingTgaRleDecode( 618 Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 619 extern int 620 ImagingTgaRleEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 621 extern int 622 ImagingXbmDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 623 extern int 624 ImagingXbmEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 625 #ifdef HAVE_LIBZ 626 extern int 627 ImagingZipDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes); 628 extern int 629 ImagingZipDecodeCleanup(ImagingCodecState state); 630 extern int 631 ImagingZipEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes); 632 extern int 633 ImagingZipEncodeCleanup(ImagingCodecState state); 634 #endif 635 636 typedef void (*ImagingShuffler)(UINT8 *out, const UINT8 *in, int pixels); 637 638 /* Public shufflers */ 639 extern void 640 ImagingPackBGR(UINT8 *out, const UINT8 *in, int pixels); 641 extern void 642 ImagingUnpackYCC(UINT8 *out, const UINT8 *in, int pixels); 643 extern void 644 ImagingUnpackYCCA(UINT8 *out, const UINT8 *in, int pixels); 645 646 extern void 647 ImagingConvertRGB2YCbCr(UINT8 *out, const UINT8 *in, int pixels); 648 extern void 649 ImagingConvertYCbCr2RGB(UINT8 *out, const UINT8 *in, int pixels); 650 651 extern ImagingShuffler 652 ImagingFindUnpacker(const char *mode, const char *rawmode, int *bits_out); 653 extern ImagingShuffler 654 ImagingFindPacker(const char *mode, const char *rawmode, int *bits_out); 655 656 struct ImagingCodecStateInstance { 657 int count; 658 int state; 659 int errcode; 660 int x, y; 661 int ystep; 662 int xsize, ysize, xoff, yoff; 663 ImagingShuffler shuffle; 664 int bits, bytes; 665 UINT8 *buffer; 666 void *context; 667 PyObject *fd; 668 }; 669 670 /* Codec read/write python fd */ 671 extern Py_ssize_t 672 _imaging_read_pyFd(PyObject *fd, char *dest, Py_ssize_t bytes); 673 extern Py_ssize_t 674 _imaging_write_pyFd(PyObject *fd, char *src, Py_ssize_t bytes); 675 extern int 676 _imaging_seek_pyFd(PyObject *fd, Py_ssize_t offset, int whence); 677 extern Py_ssize_t 678 _imaging_tell_pyFd(PyObject *fd); 679 680 /* Errcodes */ 681 #define IMAGING_CODEC_END 1 682 #define IMAGING_CODEC_OVERRUN -1 683 #define IMAGING_CODEC_BROKEN -2 684 #define IMAGING_CODEC_UNKNOWN -3 685 #define IMAGING_CODEC_CONFIG -8 686 #define IMAGING_CODEC_MEMORY -9 687 688 #include "ImagingUtils.h" 689 extern UINT8 *clip8_lookups; 690 691 #if defined(__cplusplus) 692 } 693 #endif
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™