LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
gd.h
1#ifndef GD_H
2#define GD_H 1
3
4#include <stdlib.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10/* Version information. This gets parsed by build scripts as well as
11 * gcc so each #define line in this group must also be splittable on
12 * whitespace, take the form GD_*_VERSION and contain the magical
13 * trailing comment. */
14#define GD_MAJOR_VERSION 2 /*version605b5d1778*/
15#define GD_MINOR_VERSION 4 /*version605b5d1778*/
16#define GD_RELEASE_VERSION 0 /*version605b5d1778*/
17#define GD_EXTRA_VERSION "-dev" /*version605b5d1778*/
18
19/* End parsable section. */
20
21/* The version string. This is constructed from the version number
22 * parts above via macro abuse^Wtrickery. */
23#define GDXXX_VERSION_STR(mjr, mnr, rev, ext) mjr "." mnr "." rev ext
24#define GDXXX_STR(s) GDXXX_SSTR(s) /* Two levels needed to expand args. */
25#define GDXXX_SSTR(s) #s
26
27#define GD_VERSION_STRING \
28 GDXXX_VERSION_STR(GDXXX_STR(GD_MAJOR_VERSION), GDXXX_STR(GD_MINOR_VERSION), \
29 GDXXX_STR(GD_RELEASE_VERSION), GD_EXTRA_VERSION)
30
31/* Do the DLL dance: dllexport when building the DLL,
32 dllimport when importing from it, nothing when
33 not on Silly Silly Windows (tm Aardman Productions). */
34
35/* 2.0.20: for headers */
36
37/* 2.0.24: __stdcall also needed for Visual BASIC
38 and other languages. This breaks ABI compatibility
39 with previous DLL revs, but it's necessary. */
40
41/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
42 wish to build gd as a static library or by directly including
43 the gd sources in a project. */
44
45/* http://gcc.gnu.org/wiki/Visibility */
46#if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
47#ifdef BGDWIN32
48#ifdef NONDLL
49#define BGD_EXPORT_DATA_PROT
50#else
51#ifdef __GNUC__
52#define BGD_EXPORT_DATA_PROT __attribute__((__dllexport__))
53#else
54#define BGD_EXPORT_DATA_PROT __declspec(dllexport)
55#endif
56#endif
57#else
58#ifdef __GNUC__
59#define BGD_EXPORT_DATA_PROT __attribute__((__dllimport__))
60#else
61#define BGD_EXPORT_DATA_PROT __declspec(dllimport)
62#endif
63#endif
64#define BGD_STDCALL __stdcall
65#define BGD_EXPORT_DATA_IMPL
66#define BGD_MALLOC
67#else
68#if defined(__GNUC__) || defined(__clang__)
69#define BGD_EXPORT_DATA_PROT __attribute__((__visibility__("default")))
70#define BGD_EXPORT_DATA_IMPL __attribute__((__visibility__("hidden")))
71#else
72#define BGD_EXPORT_DATA_PROT
73#define BGD_EXPORT_DATA_IMPL
74#endif
75#define BGD_STDCALL
76#define BGD_MALLOC __attribute__((__malloc__))
77#endif
78
79#define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL
80
81/* VS2012+ disable keyword macroizing unless _ALLOW_KEYWORD_MACROS is set
82 We define inline, and strcasecmp if they're missing
83*/
84#ifdef _MSC_VER
85#define _ALLOW_KEYWORD_MACROS
86#ifndef inline
87#define inline __inline
88#endif
89#ifndef strcasecmp
90#define strcasecmp _stricmp
91#endif
92#endif
93
94#undef ARG_NOT_USED
95#define ARG_NOT_USED(arg) (void)arg
96
97/* gd.h: declarations file for the graphic-draw module.
98 * Permission to use, copy, modify, and distribute this software and its
99 * documentation for any purpose and without fee is hereby granted, provided
100 * that the above copyright notice appear in all copies and that both that
101 * copyright notice and this permission notice appear in supporting
102 * documentation. This software is provided "AS IS." Thomas Boutell and
103 * Boutell.Com, Inc. disclaim all warranties, either express or implied,
104 * including but not limited to implied warranties of merchantability and
105 * fitness for a particular purpose, with respect to this code and accompanying
106 * documentation. */
107
108/* stdio is needed for file I/O. */
109#include "gd_io.h"
110#include <stdarg.h>
111#include <stdio.h>
112
113/* The maximum number of palette entries in palette-based images.
114 In the wonderful new world of gd 2.0, you can of course have
115 many more colors when using truecolor mode. */
116
117#define gdMaxColors 256
118
119/* Image type. See functions below; you will not need to change
120 the elements directly. Use the provided macros to
121 access sx, sy, the color table, and colorsTotal for
122 read-only purposes. */
123
124/* If 'truecolor' is set true, the image is truecolor;
125 pixels are represented by integers, which
126 must be 32 bits wide or more.
127
128 True colors are represented as follows:
129
130 ARGB
131
132 Where 'A' (alpha channel) occupies only the
133 LOWER 7 BITS of the MSB. This very small
134 loss of alpha channel resolution allows gd 2.x
135 to keep backwards compatibility by allowing
136 signed integers to be used to represent colors,
137 and negative numbers to represent special cases,
138 just as in gd 1.x. */
139
140#define gdAlphaMax 127
141#define gdAlphaOpaque 0
142#define gdAlphaTransparent 127
143#define gdRedMax 255
144#define gdGreenMax 255
145#define gdBlueMax 255
146
162#define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
163
175#define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
176
188#define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
189
201#define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
202
225#define gdEffectReplace 0
226#define gdEffectAlphaBlend 1
227#define gdEffectNormal 2
228#define gdEffectOverlay 3
229#define gdEffectMultiply 4
230
231#define GD_TRUE 1
232#define GD_FALSE 0
233
234#define GD_EPSILON 1e-6
235#ifndef M_PI
236#define M_PI 3.14159265358979323846
237#endif
238
239/* This function accepts truecolor pixel values only. The
240 source color is composited with the destination color
241 based on the alpha channel value of the source color.
242 The resulting color is opaque. */
243
256BGD_DECLARE(int) gdAlphaBlend(int dest, int src);
257
268BGD_DECLARE(int) gdLayerOverlay(int dest, int src);
269
280BGD_DECLARE(int) gdLayerMultiply(int dest, int src);
281
293#define GD_SCALE_INTERPOLATION_AUTO -1
294
349
350/* Interpolation function ptr */
351typedef double (*interpolation_method)(double, double);
354/*
355 Group: Types
356
357 typedef: gdImage
358
359 typedef: gdImagePtr
360
361 The data structure in which gd stores images. <gdImageCreate>,
362 <gdImageCreateTrueColor> and the various image file-loading functions
363 return a pointer to this type, and the other functions expect to
364 receive a pointer to this type as their first argument.
365
366 *gdImagePtr* is a pointer to *gdImage*.
367
368 See also:
369 <Accessor Macros>
370
371 (Previous versions of this library encouraged directly manipulating
372 the contents of the struct.
373 We are attempting to move away from this practice so the fields
374 will be considered private in 2.5 and later. )
375*/
376typedef struct gdImageStruct {
377 /* Palette-based image pixels */
378 unsigned char **pixels;
379 int sx;
380 int sy;
381 /* These are valid in palette images only. See also
382 'alpha', which appears later in the structure to
383 preserve binary backwards compatibility */
384 int colorsTotal;
385 int red[gdMaxColors];
386 int green[gdMaxColors];
387 int blue[gdMaxColors];
388 int open[gdMaxColors];
389 /* For backwards compatibility, this is set to the
390 first palette entry with 100% transparency,
391 and is also set and reset by the
392 gdImageColorTransparent function. Newer
393 applications can allocate palette entries
394 with any desired level of transparency; however,
395 bear in mind that many viewers, notably
396 many web browsers, fail to implement
397 full alpha channel for PNG and provide
398 support for full opacity or transparency only. */
399 int transparent;
400 int *polyInts;
401 int polyAllocated;
402 struct gdImageStruct *brush;
403 struct gdImageStruct *tile;
404 int brushColorMap[gdMaxColors];
405 int tileColorMap[gdMaxColors];
406 int styleLength;
407 int stylePos;
408 int *style;
409 int interlace;
410 /* New in 2.0: thickness of line. Initialized to 1. */
411 int thick;
412 /* New in 2.0: alpha channel for palettes. Note that only
413 Macintosh Internet Explorer and (possibly) Netscape 6
414 really support multiple levels of transparency in
415 palettes, to my knowledge, as of 2/15/01. Most
416 common browsers will display 100% opaque and
417 100% transparent correctly, and do something
418 unpredictable and/or undesirable for levels
419 in between. TBB */
420 int alpha[gdMaxColors];
421 /* Truecolor flag and pixels. New 2.0 fields appear here at the
422 end to minimize breakage of existing object code. */
423 int trueColor;
424 int **tpixels;
425 /* Should alpha channel be copied, or applied, each time a
426 pixel is drawn? This applies to truecolor images only.
427 No attempt is made to alpha-blend in palette images,
428 even if semitransparent palette entries exist.
429 To do that, build your image as a truecolor image,
430 then quantize down to 8 bits. */
431 int alphaBlendingFlag;
432 /* Should the alpha channel of the image be saved? This affects
433 PNG at the moment; other future formats may also
434 have that capability. JPEG doesn't. */
435 int saveAlphaFlag;
436
437 /* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this
438 part of the structure can be safely changed in new releases. */
439
440 /* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after
441 switching to the fast, memory-cheap implementation from PHP-gd. */
442 int AA;
443 int AA_color;
444 int AA_dont_blend;
445
446 /* 2.0.12: simple clipping rectangle. These values
447 must be checked for safety when set; please use
448 gdImageSetClip */
449 int cx1;
450 int cy1;
451 int cx2;
452 int cy2;
453
454 /* 2.1.0: allows to specify resolution in dpi */
455 unsigned int res_x;
456 unsigned int res_y;
457
458 /* Selects quantization method, see gdImageTrueColorToPaletteSetMethod() and
459 * gdPaletteQuantizationMethod enum. */
460 int paletteQuantizationMethod;
461 /* speed/quality trade-off. 1 = best quality, 10 = best speed. 0 =
462 method-specific default. Applicable to GD_QUANT_LIQ and
463 GD_QUANT_NEUQUANT. */
464 int paletteQuantizationSpeed;
465 /* Image will remain true-color if conversion to palette cannot achieve
466 given quality. Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable
467 to GD_QUANT_LIQ.*/
468 int paletteQuantizationMinQuality;
469 /* Image will use minimum number of palette colors needed to achieve given
470 quality. Must be higher than paletteQuantizationMinQuality Value from 1
471 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
472 int paletteQuantizationMaxQuality;
473 gdInterpolationMethod interpolation_id;
474 interpolation_method interpolation;
475} gdImage;
476
477typedef gdImage *gdImagePtr;
478
479typedef struct gdImageMetadata gdImageMetadata;
480
481#define GD_META_OK 0
482#define GD_META_ERR_FORMAT -1
483#define GD_META_ERR_PARSE -2
484#define GD_META_ERR_NOMEM -3
485#define GD_META_ERR_LIMIT -4
486#define GD_META_ERR_UNSUPPORTED -5
487#define GD_META_ERR_INVALID -6
488
489#define GD_METADATA_DEFAULT_MAX_PROFILE_SIZE ((size_t)64 * 1024 * 1024)
490#define GD_METADATA_DEFAULT_MAX_TOTAL_SIZE ((size_t)256 * 1024 * 1024)
491
492BGD_DECLARE(gdImageMetadata *) gdImageMetadataCreate(void);
493BGD_DECLARE(void) gdImageMetadataFree(gdImageMetadata *metadata);
494BGD_DECLARE(void) gdImageMetadataReset(gdImageMetadata *metadata);
495BGD_DECLARE(int)
496gdImageMetadataSetLimits(gdImageMetadata *metadata, size_t max_profile_size, size_t max_total_size);
497BGD_DECLARE(void)
498gdImageMetadataGetLimits(const gdImageMetadata *metadata, size_t *max_profile_size,
499 size_t *max_total_size);
500BGD_DECLARE(int)
501gdImageMetadataSetProfile(gdImageMetadata *metadata, const char *key, const unsigned char *data,
502 size_t size);
503BGD_DECLARE(const unsigned char *)
504gdImageMetadataGetProfile(const gdImageMetadata *metadata, const char *key, size_t *size);
505BGD_DECLARE(int)
506gdImageMetadataRemoveProfile(gdImageMetadata *metadata, const char *key);
507BGD_DECLARE(size_t)
508gdImageMetadataGetProfileCount(const gdImageMetadata *metadata);
509BGD_DECLARE(int)
510gdImageMetadataGetProfileAt(const gdImageMetadata *metadata, size_t index, const char **key,
511 const unsigned char **data, size_t *size);
512
513/* Point type for use in polygon drawing. */
514
518typedef struct {
519 double x, y;
521
522/*
523 Group: Types
524
525 typedef: gdFont
526
527 typedef: gdFontPtr
528
529 A font structure, containing the bitmaps of all characters in a
530 font. Used to declare the characteristics of a font. Text-output
531 functions expect these as their second argument, following the
532 <gdImagePtr> argument. <gdFontGetSmall> and <gdFontGetLarge> both
533 return one.
534
535 You can provide your own font data by providing such a structure and
536 the associated pixel array. You can determine the width and height
537 of a single character in a font by examining the w and h members of
538 the structure. If you will not be creating your own fonts, you will
539 not need to concern yourself with the rest of the components of this
540 structure.
541
542 Please see the files gdfontl.c and gdfontl.h for an example of
543 the proper declaration of this structure.
544
545 > typedef struct {
546 > // # of characters in font
547 > int nchars;
548 > // First character is numbered... (usually 32 = space)
549 > int offset;
550 > // Character width and height
551 > int w;
552 > int h;
553 > // Font data; array of characters, one row after another.
554 > // Easily included in code, also easily loaded from
555 > // data files.
556 > char *data;
557 > } gdFont;
558
559 gdFontPtr is a pointer to gdFont.
560
561*/
562typedef struct {
563 /* # of characters in font */
564 int nchars;
565 /* First character is numbered... (usually 32 = space) */
566 int offset;
567 /* Character width and height */
568 int w;
569 int h;
570 /* Font data; array of characters, one row after another.
571 Easily included in code, also easily loaded from
572 data files. */
573 char *data;
574} gdFont;
575
576/* Text functions take these. */
577typedef gdFont *gdFontPtr;
578
579typedef void (*gdErrorMethod)(int, const char *, va_list);
580
581BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod);
582BGD_DECLARE(void) gdClearErrorMethod(void);
583
612/* For backwards compatibility only. Use gdImageSetStyle()
613 for MUCH more flexible line drawing. Also see
614 gdImageSetBrush(). */
615#define gdDashSize 4
616#define gdStyled (-2)
617#define gdBrushed (-3)
618#define gdStyledBrushed (-4)
619#define gdTiled (-5)
620
621/* NOT the same as the transparent color index.
622 This is used in line styles only. */
623#define gdTransparent (-6)
624
625#define gdAntiAliased (-7)
626
627/* Functions to manipulate images. */
628
629/* Creates a palette-based image (up to 256 colors). */
630BGD_DECLARE(gdImagePtr) gdImageCreate(int sx, int sy);
631
632/* An alternate name for the above (2.0). */
633#define gdImageCreatePalette gdImageCreate
634
635/* Creates a truecolor image (millions of colors). */
636BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor(int sx, int sy);
637
638/* Creates an image from various file types. These functions
639 return a palette or truecolor image based on the
640 nature of the file being loaded. Truecolor PNG
641 stays truecolor; palette PNG stays palette-based;
642 JPEG is always truecolor. */
698BGD_DECLARE(gdImagePtr) gdImageCreateFromPng(FILE *fd);
699
707BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx(gdIOCtxPtr in);
708
717BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr(int size, void *data);
718
725BGD_DECLARE(void) gdImagePng(gdImagePtr im, FILE *out);
726
733BGD_DECLARE(void) gdImagePngCtx(gdImagePtr im, gdIOCtxPtr out);
734
735/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
736 1 is FASTEST but produces larger files, 9 provides the best
737 compression (smallest files) but takes a long time to compress, and
738 -1 selects the default compiled into the zlib library. */
746BGD_DECLARE(void) gdImagePngEx(gdImagePtr im, FILE *out, int level);
747
755BGD_DECLARE(void) gdImagePngCtxEx(gdImagePtr im, gdIOCtxPtr out, int level);
756
757/* Best to free this memory with gdFree(), not free() */
766BGD_DECLARE(void *) gdImagePngPtr(gdImagePtr im, int *size);
767
777BGD_DECLARE(void *) gdImagePngPtrEx(gdImagePtr im, int *size, int level);
778
780#define GD_PNG_FILTER_AUTO 0U
782#define GD_PNG_FILTER_NONE (1U << 0)
784#define GD_PNG_FILTER_SUB (1U << 1)
786#define GD_PNG_FILTER_UP (1U << 2)
788#define GD_PNG_FILTER_AVERAGE (1U << 3)
790#define GD_PNG_FILTER_PAETH (1U << 4)
792#define GD_PNG_FILTER_ALL \
793 (GD_PNG_FILTER_NONE | GD_PNG_FILTER_SUB | GD_PNG_FILTER_UP | GD_PNG_FILTER_AVERAGE | \
794 GD_PNG_FILTER_PAETH)
795
799enum {
806
810typedef struct {
812 unsigned int filters;
814 const gdImageMetadata *metadata;
815 unsigned int resolution_x;
816 unsigned int resolution_y;
818
846
852BGD_DECLARE(void) gdPngWriteOptionsInit(gdPngWriteOptions *options);
853
859BGD_DECLARE(void) gdPngInfoInit(gdPngInfo *info);
860
870BGD_DECLARE(int) gdImagePngWithOptions(gdImagePtr im, FILE *out, const gdPngWriteOptions *options);
871
881BGD_DECLARE(int)
882gdImagePngCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdPngWriteOptions *options);
883
893BGD_DECLARE(void *)
894gdImagePngPtrWithOptions(gdImagePtr im, int *size, const gdPngWriteOptions *options);
895
904BGD_DECLARE(int) gdPngGetInfo(FILE *in, gdPngInfo *info);
905
914BGD_DECLARE(int) gdPngGetInfoCtx(gdIOCtxPtr in, gdPngInfo *info);
915
925BGD_DECLARE(int) gdPngGetInfoPtr(int size, const void *data, gdPngInfo *info);
926
932BGD_DECLARE(const char *) gdPngGetVersionString(void);
983BGD_DECLARE(gdImagePtr) gdImageCreateFromQoi(FILE *fd);
984
992BGD_DECLARE(gdImagePtr) gdImageCreateFromQoiCtx(gdIOCtxPtr in);
993
1002BGD_DECLARE(gdImagePtr) gdImageCreateFromQoiPtr(int size, void *data);
1003
1007typedef struct {
1008 unsigned int width;
1009 unsigned int height;
1012} gdQoiInfo;
1013
1022BGD_DECLARE(void) gdQoiInfoInit(gdQoiInfo *info);
1023
1032BGD_DECLARE(int) gdQoiGetInfo(FILE *infile, gdQoiInfo *info);
1033
1042BGD_DECLARE(int) gdQoiGetInfoCtx(gdIOCtxPtr infile, gdQoiInfo *info);
1043
1053BGD_DECLARE(int) gdQoiGetInfoPtr(int size, const void *data, gdQoiInfo *info);
1054
1058typedef struct {
1060 const gdImageMetadata *metadata;
1062
1071BGD_DECLARE(void) gdQoiWriteOptionsInit(gdQoiWriteOptions *options);
1072
1082BGD_DECLARE(int)
1083gdImageQoiWithOptions(gdImagePtr im, FILE *out, const gdQoiWriteOptions *options);
1084
1094BGD_DECLARE(int)
1095gdImageQoiCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdQoiWriteOptions *options);
1096
1106BGD_DECLARE(void *)
1107gdImageQoiPtrWithOptions(gdImagePtr im, int *size, const gdQoiWriteOptions *options);
1108
1117BGD_DECLARE(void *) gdImageQoiPtr(gdImagePtr im, int *size);
1118
1128BGD_DECLARE(void *) gdImageQoiPtrEx(gdImagePtr im, int *size, int colorspace);
1129
1145BGD_DECLARE(void) gdImageQoi(gdImagePtr im, FILE *out);
1146
1153BGD_DECLARE(void) gdImageQoiCtx(gdImagePtr im, gdIOCtxPtr out);
1154
1158enum {
1160 GD_QOI_LINEAR = 1
1162
1169BGD_DECLARE(void) gdImageQoi(gdImagePtr im, FILE *out);
1170
1177BGD_DECLARE(void) gdImageQoiCtx(gdImagePtr im, gdIOCtxPtr out);
1178
1186BGD_DECLARE(void) gdImageQoiEx(gdImagePtr im, FILE *out, int colorspace);
1187
1195BGD_DECLARE(void)
1196gdImageQoiCtxEx(gdImagePtr im, gdIOCtxPtr out, int colorspace);
1197
1272BGD_DECLARE(gdImagePtr) gdImageCreateFromGif(FILE *fd);
1273
1281BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr in);
1282
1291BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr(int size, void *data);
1292
1299BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out);
1300
1307BGD_DECLARE(void) gdImageGif(gdImagePtr im, FILE *out);
1308
1318BGD_DECLARE(void *) gdImageGifPtr(gdImagePtr im, int *size);
1319
1330typedef struct gdGifReadStruct *gdGifReadPtr;
1331
1346
1362
1370BGD_DECLARE(int) gdGifIsAnimated(FILE *fd);
1371
1379BGD_DECLARE(int) gdGifIsAnimatedCtx(gdIOCtxPtr in);
1380
1389BGD_DECLARE(int) gdGifIsAnimatedPtr(int size, void *data);
1390
1399BGD_DECLARE(gdGifReadPtr) gdGifReadOpen(FILE *fd);
1400
1410BGD_DECLARE(gdGifReadPtr) gdGifReadOpenCtx(gdIOCtxPtr in);
1411
1421BGD_DECLARE(gdGifReadPtr) gdGifReadOpenPtr(int size, void *data);
1422
1428BGD_DECLARE(void) gdGifReadClose(gdGifReadPtr gif);
1429
1438BGD_DECLARE(int) gdGifReadGetInfo(gdGifReadPtr gif, gdGifInfo *info);
1439
1445BGD_DECLARE(int) gdGifGetInfo(FILE *file, gdGifInfo *info);
1446
1452BGD_DECLARE(int) gdGifGetInfoCtx(gdIOCtxPtr input, gdGifInfo *info);
1453
1457BGD_DECLARE(int) gdGifGetInfoPtr(int size, const void *data, gdGifInfo *info);
1458
1469BGD_DECLARE(int)
1470gdGifReadNextFrame(gdGifReadPtr gif, gdGifFrameInfo *info, gdImagePtr *frame);
1471
1482BGD_DECLARE(int)
1483gdGifReadNextImage(gdGifReadPtr gif, gdGifFrameInfo *info, gdImagePtr *image);
1484
1495enum {
1501
1503#define GD_GIF_DISPOSAL_UNKNOWN gdDisposalUnknown
1505#define GD_GIF_DISPOSAL_NONE gdDisposalNone
1507#define GD_GIF_DISPOSAL_RESTORE_BACKGROUND gdDisposalRestoreBackground
1509#define GD_GIF_DISPOSAL_RESTORE_PREVIOUS gdDisposalRestorePrevious
1510
1529BGD_DECLARE(void)
1530gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
1531
1545BGD_DECLARE(void)
1546gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay,
1547 int Disposal, gdImagePtr previm);
1548
1554BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile);
1555
1567BGD_DECLARE(void)
1568gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtxPtr out, int GlobalCM, int Loops);
1569
1583BGD_DECLARE(void)
1584gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay,
1585 int Disposal, gdImagePtr previm);
1586
1592BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtxPtr out);
1593
1608BGD_DECLARE(void *)
1609gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops);
1610
1627BGD_DECLARE(void *)
1628gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay,
1629 int Disposal, gdImagePtr previm);
1630
1639BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
1640
1698BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP(FILE *inFile);
1699
1710BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx(gdIOCtxPtr infile);
1711
1723BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr(int size, void *data);
1724
1778enum {
1786
1790enum {
1795
1799enum {
1805
1820
1826typedef struct {
1828 unsigned int scale_num;
1829 unsigned int scale_denom;
1832
1836typedef struct {
1840 const gdImageMetadata *metadata;
1842
1848BGD_DECLARE(void) gdJpegInfoInit(gdJpegInfo *info);
1849
1855BGD_DECLARE(void) gdJpegReadOptionsInit(gdJpegReadOptions *options);
1856
1862BGD_DECLARE(void) gdJpegWriteOptionsInit(gdJpegWriteOptions *options);
1863
1872BGD_DECLARE(int) gdJpegGetInfo(FILE *infile, gdJpegInfo *info);
1873
1874
1883BGD_DECLARE(int) gdJpegGetInfoCtx(gdIOCtxPtr infile, gdJpegInfo *info);
1884
1894BGD_DECLARE(int) gdJpegGetInfoPtr(int size, const void *data, gdJpegInfo *info);
1895
1896BGD_DECLARE(int) gdJpegGetMetadata(FILE *infile, gdImageMetadata *metadata);
1897BGD_DECLARE(int) gdJpegGetMetadataCtx(gdIOCtxPtr infile, gdImageMetadata *metadata);
1898BGD_DECLARE(int) gdJpegGetMetadataPtr(int size, const void *data, gdImageMetadata *metadata);
1899
1907BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg(FILE *infile);
1908
1917BGD_DECLARE(gdImagePtr)
1918gdImageCreateFromJpegEx(FILE *infile, int ignore_warning);
1919
1927BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx(gdIOCtxPtr infile);
1928
1937BGD_DECLARE(gdImagePtr)
1938gdImageCreateFromJpegCtxEx(gdIOCtxPtr infile, int ignore_warning);
1939
1967BGD_DECLARE(gdImagePtr)
1969
1978BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr(int size, void *data);
1988BGD_DECLARE(gdImagePtr)
1989gdImageCreateFromJpegPtrEx(int size, void *data, int ignore_warning);
1990
2000BGD_DECLARE(gdImagePtr)
2001gdImageCreateFromJpegPtrWithOptions(int size, void *data, const gdJpegReadOptions *options);
2002
2031BGD_DECLARE(const char *) gdJpegGetVersionString();
2122BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp(FILE *inFile);
2123
2135BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr(int size, void *data);
2136
2147BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx(gdIOCtxPtr infile);
2148
2160typedef struct gdWebpRead *gdWebpReadPtr;
2161
2169typedef struct gdWebpWrite *gdWebpWritePtr;
2170
2183
2200
2204typedef struct {
2207
2211typedef struct {
2213 const gdImageMetadata *metadata;
2215
2232
2242BGD_DECLARE(void) gdWebpReadOptionsInit(gdWebpReadOptions *options);
2243
2251BGD_DECLARE(void) gdWebpWriteOptionsInit(gdWebpWriteOptions *options);
2252
2262BGD_DECLARE(void) gdWebpAnimWriteOptionsInit(gdWebpAnimWriteOptions *options);
2263
2267enum {
2271
2275enum {
2279
2295BGD_DECLARE(int) gdWebpIsAnimated(FILE *fd);
2296
2307BGD_DECLARE(int) gdWebpIsAnimatedCtx(gdIOCtxPtr in);
2308
2319BGD_DECLARE(int) gdWebpIsAnimatedPtr(int size, void *data);
2320
2333BGD_DECLARE(gdWebpReadPtr) gdWebpReadOpen(FILE *fd, const gdWebpReadOptions *options);
2334
2347BGD_DECLARE(gdWebpReadPtr) gdWebpReadOpenCtx(gdIOCtxPtr in, const gdWebpReadOptions *options);
2348
2362BGD_DECLARE(gdWebpReadPtr)
2363gdWebpReadOpenPtr(int size, void *data, const gdWebpReadOptions *options);
2364
2370BGD_DECLARE(void) gdWebpReadClose(gdWebpReadPtr webp);
2371
2380BGD_DECLARE(int) gdWebpReadGetInfo(gdWebpReadPtr webp, gdWebpInfo *info);
2381
2389BGD_DECLARE(int) gdWebpReadGetMetadata(gdWebpReadPtr webp, gdImageMetadata *metadata);
2390
2404BGD_DECLARE(int)
2405gdWebpReadNextFrame(gdWebpReadPtr webp, gdWebpFrameInfo *info, gdImagePtr *frame);
2406
2421BGD_DECLARE(int)
2422gdWebpReadNextImage(gdWebpReadPtr webp, gdWebpFrameInfo *info, gdImagePtr *image);
2423
2440BGD_DECLARE(gdWebpWritePtr)
2441gdWebpWriteOpen(FILE *outFile, const gdWebpAnimWriteOptions *options);
2442
2455BGD_DECLARE(gdWebpWritePtr)
2456gdWebpWriteOpenCtx(gdIOCtxPtr out, const gdWebpAnimWriteOptions *options);
2457
2467BGD_DECLARE(gdWebpWritePtr)
2469
2482BGD_DECLARE(int)
2483gdWebpWriteAddImage(gdWebpWritePtr webp, gdImagePtr image, int durationMs);
2484
2493BGD_DECLARE(void) gdWebpWriteClose(gdWebpWritePtr webp);
2494
2506BGD_DECLARE(void *) gdWebpWritePtrFinish(gdWebpWritePtr webp, int *size);
2507
2577BGD_DECLARE(gdImagePtr) gdImageCreateFromJxl(FILE *inFile);
2578
2590BGD_DECLARE(gdImagePtr) gdImageCreateFromJxlPtr(int size, void *data);
2591
2602BGD_DECLARE(gdImagePtr) gdImageCreateFromJxlCtx(gdIOCtxPtr infile);
2603
2618BGD_DECLARE(void) gdImageJxl(gdImagePtr im, FILE *outFile);
2619
2633BGD_DECLARE(void)
2634gdImageJxlEx(gdImagePtr im, FILE *outFile, int lossless, float distance, int effort);
2635
2648BGD_DECLARE(void *) gdImageJxlPtr(gdImagePtr im, int *size);
2649
2665BGD_DECLARE(void *)
2666gdImageJxlPtrEx(gdImagePtr im, int *size, int lossless, float distance, int effort);
2667
2678BGD_DECLARE(void) gdImageJxlCtx(gdImagePtr im, gdIOCtxPtr outfile);
2679
2693BGD_DECLARE(void)
2694gdImageJxlCtxEx(gdImagePtr im, gdIOCtxPtr outfile, int lossless, float distance, int effort);
2695
2699typedef struct {
2701 float distance;
2703 const gdImageMetadata *metadata;
2705
2711BGD_DECLARE(void) gdJxlWriteOptionsInit(gdJxlWriteOptions *options);
2712
2722BGD_DECLARE(int)
2723gdImageJxlWithOptions(gdImagePtr im, FILE *outFile, const gdJxlWriteOptions *options);
2724
2734BGD_DECLARE(int)
2735gdImageJxlCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdJxlWriteOptions *options);
2736
2750BGD_DECLARE(void *)
2751gdImageJxlPtrWithOptions(gdImagePtr im, int *size, const gdJxlWriteOptions *options);
2752
2764typedef struct gdJxlRead *gdJxlReadPtr;
2765
2773typedef struct gdJxlWrite *gdJxlWritePtr;
2774
2781typedef struct {
2782 int width;
2786} gdJxlInfo;
2787
2800
2804enum {
2811
2815typedef struct {
2818
2830
2840BGD_DECLARE(void) gdJxlReadOptionsInit(gdJxlReadOptions *options);
2841
2851BGD_DECLARE(void) gdJxlAnimWriteOptionsInit(gdJxlAnimWriteOptions *options);
2852
2870BGD_DECLARE(gdJxlReadPtr) gdJxlReadOpen(FILE *inFile, const gdJxlReadOptions *options);
2871
2884BGD_DECLARE(gdJxlReadPtr) gdJxlReadOpenCtx(gdIOCtxPtr inCtx, const gdJxlReadOptions *options);
2885
2899BGD_DECLARE(gdJxlReadPtr)
2900gdJxlReadOpenPtr(int size, void *data, const gdJxlReadOptions *options);
2901
2913BGD_DECLARE(int) gdJxlReadGetInfo(gdJxlReadPtr reader, gdJxlInfo *info);
2914
2920BGD_DECLARE(int) gdJxlReadGetMetadata(gdJxlReadPtr reader, gdImageMetadata *metadata);
2921
2936BGD_DECLARE(int) gdJxlReadNextImage(gdJxlReadPtr reader, int *delay_ms, gdImagePtr *image);
2937
2952BGD_DECLARE(int) gdJxlReadNextFrame(gdJxlReadPtr reader, gdJxlFrameInfo *info, gdImagePtr *frame);
2953
2959BGD_DECLARE(void) gdJxlReadClose(gdJxlReadPtr reader);
2960
2977BGD_DECLARE(gdJxlWritePtr) gdJxlWriteOpen(FILE *outFile, const gdJxlAnimWriteOptions *options);
2978
2991BGD_DECLARE(gdJxlWritePtr) gdJxlWriteOpenCtx(gdIOCtxPtr outCtx, const gdJxlAnimWriteOptions *options);
2992
3003BGD_DECLARE(gdJxlWritePtr) gdJxlWriteOpenPtr(const gdJxlAnimWriteOptions *options);
3004
3018BGD_DECLARE(int) gdJxlWriteAddImage(gdJxlWritePtr writer, gdImagePtr image, int delay_ms);
3019
3028BGD_DECLARE(void) gdJxlWriteClose(gdJxlWritePtr writer);
3029
3041BGD_DECLARE(void *) gdJxlWritePtrFinish(gdJxlWritePtr writer, int *size);
3042
3101
3103typedef const char *gdHeifChroma;
3104
3106#define GD_HEIF_CHROMA_420 "420"
3108#define GD_HEIF_CHROMA_422 "422"
3110#define GD_HEIF_CHROMA_444 "444"
3111
3116
3125
3137typedef struct {
3138 int width;
3139 int height;
3140 int top_level_image_count;
3141 int has_alpha;
3142 int bit_depth;
3143 int is_animation;
3144 gdImageMetadata *metadata;
3145} gdHeifInfo;
3146
3153BGD_DECLARE(void) gdHeifInfoInit(gdHeifInfo *info);
3154
3161BGD_DECLARE(int) gdHeifGetInfo(FILE *inFile, gdHeifInfo *info);
3162
3164BGD_DECLARE(int) gdHeifGetInfoCtx(gdIOCtxPtr in, gdHeifInfo *info);
3165
3167BGD_DECLARE(int) gdHeifGetInfoPtr(int size, const void *data, gdHeifInfo *info);
3168
3169
3178BGD_DECLARE(void) gdHeifReadOptionsInit(gdHeifReadOptions *options);
3179
3188BGD_DECLARE(void) gdHeifWriteOptionsInit(gdHeifWriteOptions *options);
3189
3205BGD_DECLARE(gdImagePtr) gdImageCreateFromHeif(FILE *inFile);
3206
3219BGD_DECLARE(gdImagePtr) gdImageCreateFromHeifPtr(int size, void *data);
3220
3234BGD_DECLARE(gdImagePtr)
3235gdImageCreateFromHeifPtrWithOptions(int size, void *data, const gdHeifReadOptions *options);
3236
3247BGD_DECLARE(gdImagePtr) gdImageCreateFromHeifCtx(gdIOCtxPtr infile);
3248
3268BGD_DECLARE(void)
3269gdImageHeifEx(gdImagePtr im, FILE *outFile, int quality, gdHeifCodec codec, gdHeifChroma chroma);
3270
3281BGD_DECLARE(void) gdImageHeif(gdImagePtr im, FILE *outFile);
3282
3294BGD_DECLARE(void *) gdImageHeifPtr(gdImagePtr im, int *size);
3295
3312BGD_DECLARE(void *)
3313gdImageHeifPtrEx(gdImagePtr im, int *size, int quality, gdHeifCodec codec, gdHeifChroma chroma);
3314
3327BGD_DECLARE(void *)
3328gdImageHeifPtrWithOptions(gdImagePtr im, int *size, const gdHeifWriteOptions *options);
3329
3336BGD_DECLARE(int)
3337gdImageHeifWithOptions(gdImagePtr im, FILE *outFile, const gdHeifWriteOptions *options);
3338
3345BGD_DECLARE(int)
3346gdImageHeifCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdHeifWriteOptions *options);
3347
3362BGD_DECLARE(void)
3363gdImageHeifCtx(gdImagePtr im, gdIOCtxPtr outfile, int quality, gdHeifCodec codec,
3364 gdHeifChroma chroma);
3365
3428BGD_DECLARE(gdImagePtr) gdImageCreateFromAvif(FILE *inFile);
3429
3442BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifPtr(int size, void *data);
3443
3455BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifCtx(gdIOCtxPtr infile);
3456
3463enum {
3468
3470enum {
3471 GD_AVIF_PIXEL_FORMAT_NONE = 0,
3472 GD_AVIF_PIXEL_FORMAT_YUV444 = 1,
3473 GD_AVIF_PIXEL_FORMAT_YUV422 = 2,
3474 GD_AVIF_PIXEL_FORMAT_YUV420 = 3,
3475 GD_AVIF_PIXEL_FORMAT_YUV400 = 4
3476};
3477
3479typedef struct {
3481 int speed;
3484 const gdImageMetadata *metadata;
3486
3508
3513BGD_DECLARE(void) gdAvifInfoInit(gdAvifInfo *info);
3514
3522BGD_DECLARE(int) gdAvifGetInfo(FILE *inFile, gdAvifInfo *info);
3523
3531BGD_DECLARE(int) gdAvifGetInfoCtx(gdIOCtxPtr in, gdAvifInfo *info);
3532
3541BGD_DECLARE(int) gdAvifGetInfoPtr(int size, const void *data, gdAvifInfo *info);
3542
3551BGD_DECLARE(void) gdAvifWriteOptionsInit(gdAvifWriteOptions *options);
3552
3567BGD_DECLARE(void) gdImageAvif(gdImagePtr im, FILE *outFile);
3568
3583BGD_DECLARE(void)
3584gdImageAvifEx(gdImagePtr im, FILE *outFile, int quality, int speed);
3585
3597BGD_DECLARE(void *) gdImageAvifPtr(gdImagePtr im, int *size);
3598
3615BGD_DECLARE(void *)
3616gdImageAvifPtrEx(gdImagePtr im, int *size, int quality, int speed);
3617
3630BGD_DECLARE(void *)
3631gdImageAvifPtrWithOptions(gdImagePtr im, int *size, const gdAvifWriteOptions *options);
3632
3634BGD_DECLARE(int)
3635gdImageAvifWithOptions(gdImagePtr im, FILE *outFile, const gdAvifWriteOptions *options);
3636
3638BGD_DECLARE(int)
3639gdImageAvifCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdAvifWriteOptions *options);
3640
3655BGD_DECLARE(void)
3656gdImageAvifCtx(gdImagePtr im, gdIOCtxPtr outfile, int quality, int speed);
3657
3722BGD_DECLARE(gdImagePtr) gdImageCreateFromTiff(FILE *inFile);
3723
3734BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffCtx(gdIOCtxPtr infile);
3735
3747BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffPtr(int size, void *data);
3748
3760typedef struct gdTiffReadStruct *gdTiffReadPtr;
3761
3767typedef struct {
3770
3786
3805
3821BGD_DECLARE(int) gdTiffIsMultiPage(FILE *fd);
3822
3833BGD_DECLARE(int) gdTiffIsMultiPageCtx(gdIOCtxPtr in);
3834
3845BGD_DECLARE(int) gdTiffIsMultiPagePtr(int size, void *data);
3846
3852BGD_DECLARE(void) gdTiffReadOptionsInit(gdTiffReadOptions *options);
3853
3865BGD_DECLARE(gdTiffReadPtr) gdTiffReadOpen(FILE *fd, const gdTiffReadOptions *options);
3866
3878BGD_DECLARE(gdTiffReadPtr) gdTiffReadOpenCtx(gdIOCtxPtr in, const gdTiffReadOptions *options);
3879
3893BGD_DECLARE(gdTiffReadPtr) gdTiffReadOpenPtr(int size, void *data, const gdTiffReadOptions *options);
3894
3900BGD_DECLARE(void) gdTiffReadClose(gdTiffReadPtr tiff);
3901
3910BGD_DECLARE(int) gdTiffReadGetInfo(gdTiffReadPtr tiff, gdTiffInfo *info);
3911
3913BGD_DECLARE(int) gdTiffReadGetMetadata(gdTiffReadPtr tiff, gdImageMetadata *metadata);
3914
3928BGD_DECLARE(int)
3929gdTiffReadNextImage(gdTiffReadPtr tiff, gdTiffPageInfo *info, gdImagePtr *image);
3930
3945
3960
3974
3982
3991
3999
4024
4032typedef struct gdTiffWriteStruct *gdTiffWritePtr;
4033
4044BGD_DECLARE(void) gdTiffWriteOptionsInit(gdTiffWriteOptions *options);
4045
4057BGD_DECLARE(gdTiffWritePtr)
4058gdTiffWriteOpen(FILE *outFile, const gdTiffWriteOptions *options);
4059
4071BGD_DECLARE(gdTiffWritePtr)
4072gdTiffWriteOpenCtx(gdIOCtxPtr out, const gdTiffWriteOptions *options);
4073
4083BGD_DECLARE(gdTiffWritePtr)
4085
4097BGD_DECLARE(int) gdTiffWriteAddImage(gdTiffWritePtr write, gdImagePtr image);
4098
4108BGD_DECLARE(void) gdTiffWriteClose(gdTiffWritePtr write);
4109
4121BGD_DECLARE(void *) gdTiffWritePtrFinish(gdTiffWritePtr write, int *size);
4122
4137BGD_DECLARE(void) gdImageTiff(gdImagePtr im, FILE *outFile);
4138
4150BGD_DECLARE(void *) gdImageTiffPtr(gdImagePtr im, int *size);
4151
4161BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtxPtr out);
4162
4227BGD_DECLARE(gdImagePtr) gdImageCreateFromTga(FILE *fp);
4228
4239BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtxPtr ctx);
4240
4252BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaPtr(int size, void *data);
4253
4308BGD_DECLARE(gdImagePtr) gdImageCreateFromBmp(FILE *inFile);
4309
4321BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpPtr(int size, void *data);
4322
4333BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpCtx(gdIOCtxPtr infile);
4334
4356
4362BGD_DECLARE(void) gdBmpInfoInit(gdBmpInfo *info);
4363
4372BGD_DECLARE(int) gdBmpGetInfo(FILE *infile, gdBmpInfo *info);
4373
4382BGD_DECLARE(int) gdBmpGetInfoCtx(gdIOCtxPtr infile, gdBmpInfo *info);
4383
4393BGD_DECLARE(int) gdBmpGetInfoPtr(int size, const void *data, gdBmpInfo *info);
4394
4410BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression);
4411
4426BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression);
4427
4442BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
4443
4445#define GD_BMP_COMPRESS_NONE 0
4447#define GD_BMP_COMPRESS_RLE8 1
4449#define GD_BMP_COMPRESS_RLE4 2
4450
4452#define GD_BMP_FLAG_NONE 0
4454#define GD_BMP_FLAG_FORCE_V4HDR (1 << 0)
4456#define GD_BMP_FLAG_QUANTIZE (1 << 1)
4458#define GD_BMP_FLAG_RGB555 (1 << 2)
4459
4463typedef struct {
4466 int flags;
4467 const gdImageMetadata *metadata;
4469
4476BGD_DECLARE(void) gdBmpWriteOptionsInit(gdBmpWriteOptions *options);
4477
4489BGD_DECLARE(int) gdImageBmpWithOptions(gdImagePtr im, FILE *outFile, const gdBmpWriteOptions *options);
4490
4501BGD_DECLARE(int) gdImageBmpCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdBmpWriteOptions *options);
4502
4514BGD_DECLARE(void *) gdImageBmpPtrWithOptions(gdImagePtr im, int *size, const gdBmpWriteOptions *options);
4515
4534BGD_DECLARE(void *)
4535gdImageBmpPtrEx(gdImagePtr im, int *size, int bpp, int compression, int flags);
4536
4553BGD_DECLARE(void)
4554gdImageBmpEx(gdImagePtr im, FILE *outFile, int bpp, int compression, int flags);
4555
4573BGD_DECLARE(void)
4574gdImageBmpCtxEx(gdImagePtr im, gdIOCtxPtr out, int bpp, int compression, int flags);
4575
4636#define GD_UHDR_SUCCESS 0
4637#define GD_UHDR_NOT_AVAILABLE -1
4638#define GD_UHDR_E_INVALID -2
4639#define GD_UHDR_E_UNSUPPORTED -3
4640#define GD_UHDR_E_ENCODE -4
4641#define GD_UHDR_E_DECODE -5
4648#define GD_UHDR_MIRROR_HORIZONTAL 0
4650#define GD_UHDR_MIRROR_VERTICAL 1
4651
4663
4665typedef struct gdUhdrImageStruct gdUhdrImage;
4666
4669
4671typedef struct {
4672 int code;
4674 char message[128];
4675} gdUhdrError;
4676
4679
4698BGD_DECLARE(gdUhdrImagePtr)
4699gdUhdrImageCreateFromFile(const char *filename, int format, gdUhdrErrorPtr err);
4700
4714BGD_DECLARE(gdUhdrImagePtr)
4715gdUhdrImageCreateFromCtx(gdIOCtxPtr ctx, int format, gdUhdrErrorPtr err);
4716
4731BGD_DECLARE(gdUhdrImagePtr)
4732gdUhdrImageCreateFromPtr(int size, void *data, int format, gdUhdrErrorPtr err);
4733
4743BGD_DECLARE(void) gdUhdrImageDestroy(gdUhdrImagePtr im);
4744
4749/*
4750 Group: Types
4751
4752 typedef: gdSource
4753
4754 typedef: gdSourcePtr
4755
4756 *Note:* This interface is *obsolete* and kept only for
4757 *compatibility. Use <gdIOCtx> instead.
4758
4759 Represents a source from which a PNG can be read. Programmers who
4760 do not wish to read PNGs from a file can provide their own
4761 alternate input mechanism, using the @ref gdImageCreateFromPngSource
4762 function. See the documentation of that function for an example of
4763 the proper use of this type.
4764
4765 > typedef struct {
4766 > int (*source) (void *context, char *buffer, int len);
4767 > void *context;
4768 > } gdSource, *gdSourcePtr;
4769
4770 The source function must return -1 on error, otherwise the number
4771 of bytes fetched. 0 is EOF, not an error!
4772
4773 'context' will be passed to your source function.
4774
4775*/
4777typedef struct {
4778 int (*source)(void *context, char *buffer, int len);
4779 void *context;
4781
4783BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource(gdSourcePtr in);
4784
4786BGD_DECLARE(gdImagePtr) gdImageCreateFromQoiSource(gdSourcePtr in);
4787
4841BGD_DECLARE(gdImagePtr) gdImageCreateFromGd(FILE *in);
4842
4853BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx(gdIOCtxPtr in);
4854
4866BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr(int size, void *data);
4867
4884BGD_DECLARE(void *) gdImageGdPtr(gdImagePtr im, int *size);
4885
4895BGD_DECLARE(void) gdImageGd(gdImagePtr im, FILE *out);
4896
4961BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2(FILE *in);
4962
4973BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx(gdIOCtxPtr in);
4974
4986BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr(int size, void *data);
4987
5003BGD_DECLARE(gdImagePtr)
5004gdImageCreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h);
5005
5021BGD_DECLARE(gdImagePtr)
5022gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, int h);
5023
5039BGD_DECLARE(gdImagePtr)
5040gdImageCreateFromGd2PartPtr(int size, void *data, int srcx, int srcy, int w, int h);
5041
5101BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm(FILE *in);
5102
5122BGD_DECLARE(void)
5123gdImageXbmCtx(gdImagePtr image, char *file_name, int fg, gdIOCtxPtr out);
5124
5168BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm(char *filename);
5169
5186BGD_DECLARE(void) gdImageWBMP(gdImagePtr image, int fg, FILE *out);
5187
5200BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtxPtr out);
5201
5218BGD_DECLARE(int) gdUhdrIsAvailable(void);
5219
5227BGD_DECLARE(int) gdUhdrImageWidth(gdUhdrImagePtr im);
5228
5236BGD_DECLARE(int) gdUhdrImageHeight(gdUhdrImagePtr im);
5237
5245BGD_DECLARE(int) gdUhdrImageHasGainMap(gdUhdrImagePtr im);
5246
5266BGD_DECLARE(int)
5267gdUhdrImageResize(gdUhdrImagePtr im, int width, int height, gdUhdrErrorPtr err);
5268
5285BGD_DECLARE(int)
5286gdUhdrImageCrop(gdUhdrImagePtr im, int left, int top, int width, int height, gdUhdrErrorPtr err);
5287
5301BGD_DECLARE(int)
5303
5317BGD_DECLARE(int)
5319
5341BGD_DECLARE(int)
5342gdUhdrImageFile(gdUhdrImagePtr im, const char *filename, int format, int quality,
5343 gdUhdrErrorPtr err);
5344
5361BGD_DECLARE(int)
5362gdUhdrImageCtx(gdUhdrImagePtr im, gdIOCtxPtr ctx, int format, int quality, gdUhdrErrorPtr err);
5363
5378BGD_DECLARE(void *)
5379gdUhdrImageWritePtr(gdUhdrImagePtr im, int *size, int format, int quality, gdUhdrErrorPtr err);
5380
5399BGD_DECLARE(gdImagePtr)
5401
5433BGD_DECLARE(gdImagePtr) gdImageCreateFromFile(const char *filename);
5434
5452BGD_DECLARE(gdImagePtr) gdImageReadFile(const char *filename);
5453
5470BGD_DECLARE(gdImagePtr) gdImageReadCtx(gdIOCtxPtr ctx);
5471
5482
5484#define GD_IMAGE_READ_RESTRICT_CODEC_API 1
5485
5500BGD_DECLARE(gdImagePtr) gdImageReadCtxEx(gdIOCtxPtr ctx, int flags, gdImageReadStatus *status, const char **format_name);
5501
5523BGD_DECLARE(int) gdImageFile(gdImagePtr im, const char *filename);
5524
5542BGD_DECLARE(int) gdSupportsFileType(const char *filename, int writing);
5543
5546/* Guaranteed to correctly free memory returned by the gdImage*Ptr
5547 functions */
5548BGD_DECLARE(void) gdFree(void *m);
5549
5564BGD_DECLARE(void *) gdImageWBMPPtr(gdImagePtr im, int *size, int fg);
5565
5580BGD_DECLARE(void) gdImageJpeg(gdImagePtr im, FILE *out, int quality);
5588BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtxPtr out, int quality);
5589
5607BGD_DECLARE(int)
5608gdImageJpegWithOptions(gdImagePtr im, FILE *out, const gdJpegWriteOptions *options);
5609
5619BGD_DECLARE(int)
5620gdImageJpegCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdJpegWriteOptions *options);
5621
5633BGD_DECLARE(void *) gdImageJpegPtr(gdImagePtr im, int *size, int quality);
5654BGD_DECLARE(void *)
5655gdImageJpegPtrWithOptions(gdImagePtr im, int *size, const gdJpegWriteOptions *options);
5666#define gdWebpLossless 101
5667
5679BGD_DECLARE(void) gdImageWebpEx(gdImagePtr im, FILE *outFile, int quantization);
5680
5691BGD_DECLARE(void) gdImageWebp(gdImagePtr im, FILE *outFile);
5692
5705BGD_DECLARE(void *) gdImageWebpPtr(gdImagePtr im, int *size);
5706
5720BGD_DECLARE(void *)
5721gdImageWebpPtrEx(gdImagePtr im, int *size, int quantization);
5722
5736BGD_DECLARE(int)
5737gdImageWebpWithOptions(gdImagePtr im, FILE *outFile, const gdWebpWriteOptions *options);
5738
5752BGD_DECLARE(int)
5753gdImageWebpCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdWebpWriteOptions *options);
5754
5768BGD_DECLARE(void *)
5769gdImageWebpPtrWithOptions(gdImagePtr im, int *size, const gdWebpWriteOptions *options);
5770
5782BGD_DECLARE(void)
5783gdImageWebpCtx(gdImagePtr im, gdIOCtxPtr outfile, int quantization);
5784
5785/*
5786 Group: Types
5787
5788 typedef: gdSink
5789
5790 typedef: gdSinkPtr
5791
5792 *Note:* This interface is *obsolete* and kept only for
5793 *compatibility*. Use <gdIOCtx> instead.
5794
5795 Represents a "sink" (destination) to which a PNG can be
5796 written. Programmers who do not wish to write PNGs to a file can
5797 provide their own alternate output mechanism, using the
5798 <gdImagePngToSink> function. See the documentation of that
5799 function for an example of the proper use of this type.
5800
5801 > typedef struct {
5802 > int (*sink) (void *context, char *buffer, int len);
5803 > void *context;
5804 > } gdSink, *gdSinkPtr;
5805
5806 The _sink_ function must return -1 on error, otherwise the number of
5807 bytes written, which must be equal to len.
5808
5809 _context_ will be passed to your sink function.
5810
5811*/
5812
5814typedef struct {
5815 int (*sink)(void *context, const char *buffer, int len);
5816 void *context;
5817} gdSink, *gdSinkPtr;
5818
5820BGD_DECLARE(void) gdImagePngToSink(gdImagePtr im, gdSinkPtr out);
5822BGD_DECLARE(void) gdImageQoiToSink(gdImagePtr im, gdSinkPtr out);
5823
5847BGD_DECLARE(void) gdImageGd2(gdImagePtr im, FILE *out, int cs, int fmt);
5848
5865BGD_DECLARE(void *) gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size);
5866
5876BGD_DECLARE(void) gdImageDestroy(gdImagePtr im);
5877
5893BGD_DECLARE(int) gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
5894
5910BGD_DECLARE(int)
5911gdImageColorAllocateAlpha(gdImagePtr im, int r, int g, int b, int a);
5912
5928BGD_DECLARE(int) gdImageColorClosest(gdImagePtr im, int r, int g, int b);
5929
5944BGD_DECLARE(int)
5945gdImageColorClosestAlpha(gdImagePtr im, int r, int g, int b, int a);
5946
5963BGD_DECLARE(int) gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
5964
5982BGD_DECLARE(int) gdImageColorExact(gdImagePtr im, int r, int g, int b);
5983
6002BGD_DECLARE(int)
6003gdImageColorExactAlpha(gdImagePtr im, int r, int g, int b, int a);
6004
6016BGD_DECLARE(int) gdImageColorResolve(gdImagePtr im, int r, int g, int b);
6017
6031BGD_DECLARE(int)
6032gdImageColorResolveAlpha(gdImagePtr im, int r, int g, int b, int a);
6033
6044#define gdTrueColor(r, g, b) (((r) << 16) + ((g) << 8) + (b))
6045
6061#define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
6062
6078BGD_DECLARE(void) gdImageColorDeallocate(gdImagePtr im, int color);
6079
6088BGD_DECLARE(int) gdImageColorMatch(gdImagePtr im1, gdImagePtr im2);
6089
6109BGD_DECLARE(void) gdImageColorTransparent(gdImagePtr im, int color);
6110
6117BGD_DECLARE(void) gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src);
6118
6119typedef int (*gdCallbackImageColor)(gdImagePtr im, int src);
6120
6128BGD_DECLARE(int) gdImageColorReplace(gdImagePtr im, int src, int dst);
6129
6148BGD_DECLARE(int)
6149gdImageColorReplaceThreshold(gdImagePtr im, int src, int dst, float threshold);
6150
6161BGD_DECLARE(int)
6162gdImageColorReplaceArray(gdImagePtr im, int len, int *src, int *dst);
6163
6172BGD_DECLARE(int)
6173gdImageColorReplaceCallback(gdImagePtr im, gdCallbackImageColor callback);
6174
6197BGD_DECLARE(void) gdImageSetPixel(gdImagePtr im, int x, int y, int color);
6198
6208BGD_DECLARE(int) gdImageGetPixel(gdImagePtr im, int x, int y);
6209
6219BGD_DECLARE(int) gdImageGetTrueColorPixel(gdImagePtr im, int x, int y);
6231BGD_DECLARE(void)
6232gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y);
6233
6242BGD_DECLARE(gdFontPtr) gdFontGetGiant(void);
6246BGD_DECLARE(gdFontPtr) gdFontGetLarge(void);
6250BGD_DECLARE(gdFontPtr) gdFontGetMediumBold(void);
6254BGD_DECLARE(gdFontPtr) gdFontGetSmall(void);
6258BGD_DECLARE(gdFontPtr) gdFontGetTiny(void);
6273BGD_DECLARE(void) gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
6274
6285BGD_DECLARE(void) gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
6286
6304BGD_DECLARE(void)
6305gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
6306
6317BGD_DECLARE(void)
6318gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
6319
6330BGD_DECLARE(void)
6331gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
6332
6343BGD_DECLARE(void)
6344gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
6359BGD_DECLARE(int) gdFontCacheSetup(void);
6360
6366BGD_DECLARE(void) gdFontCacheShutdown(void);
6367
6372BGD_DECLARE(void) gdFreeFontCache(void);
6373
6374
6379BGD_DECLARE(char *)
6380gdImageStringTTF(gdImagePtr im, int *brect, int fg, const char *fontlist, double ptsize,
6381 double angle, int x, int y, const char *string);
6382
6383
6406BGD_DECLARE(char *)
6407gdImageStringFT(gdImagePtr im, int *brect, int fg, const char *fontlist, double ptsize,
6408 double angle, int x, int y, const char *string);
6409
6410/* 2.0.5: provides an extensible way to pass additional parameters.
6411 Thanks to Wez Furlong, sorry for the delay. */
6433
6442#define gdFTEX_LINESPACE 1
6446#define gdFTEX_CHARMAP 2
6450#define gdFTEX_RESOLUTION 4
6454#define gdFTEX_DISABLE_KERNING 8
6456#define gdFTEX_XSHOW 16
6459#define gdFTEX_FONTPATHNAME 32
6463#define gdFTEX_FONTCONFIG 64
6467#define gdFTEX_RETURNFONTPATHNAME 128
6488BGD_DECLARE(int) gdFTUseFontConfig(int flag);
6489
6499#define gdFTEX_Unicode 0
6502#define gdFTEX_Shift_JIS 1
6503#define gdFTEX_Big5 2
6504#define gdFTEX_Adobe_Custom 3
6507#define gdFTEX_MacRoman gdFTEX_Adobe_Custom
6597BGD_DECLARE(char *)
6598gdImageStringFTEx(gdImagePtr im, int *brect, int fg, const char *fontlist, double ptsize,
6599 double angle, int x, int y, const char *string, gdFTStringExtraPtr strex);
6600
6614typedef struct {
6615 int x, y;
6621typedef struct {
6622 int x, y;
6623 int width, height;
6640#define gdArc 0
6641#define gdPie gdArc
6642#define gdChord 1
6643#define gdNoFill 2
6644#define gdEdged 4
6656BGD_DECLARE(void) gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
6657
6668BGD_DECLARE(void) gdImageOpenPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
6669
6670
6685BGD_DECLARE(void)
6686gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
6687
6704BGD_DECLARE(void)
6705gdImageFilledArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style);
6706
6721BGD_DECLARE(void)
6722gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color);
6723
6741BGD_DECLARE(void)
6742gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
6743
6755BGD_DECLARE(void)
6756gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
6757
6758BGD_DECLARE(void) gdImageAABlend(gdImagePtr im);
6759
6760BGD_DECLARE(void) gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
6761
6762/* For backwards compatibility only. Use gdImageSetStyle()
6763 for much more flexible line drawing. */
6764BGD_DECLARE(void) gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
6765
6780BGD_DECLARE(void) gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
6781
6792BGD_DECLARE(void) gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
6793
6808BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
6809
6821BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
6822
6829BGD_DECLARE(void) gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
6830
6839BGD_DECLARE(void) gdImageSetTile(gdImagePtr im, gdImagePtr tile);
6840
6841
6860BGD_DECLARE(void) gdImageSetAntiAliased(gdImagePtr im, int c);
6861
6873BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend);
6874
6882BGD_DECLARE(void) gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
6883
6884
6891BGD_DECLARE(void) gdImageSetThickness(gdImagePtr im, int thickness);
6892
6893
6896BGD_DECLARE(void)
6897gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
6898
6907BGD_DECLARE(void) gdImageFill(gdImagePtr im, int x, int y, int color);
6908
6909
6926BGD_DECLARE(void)
6927gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
6928
6948BGD_DECLARE(void)
6949gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w,
6950 int h, int pct);
6951
6952
6973BGD_DECLARE(void)
6974gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w,
6975 int h, int pct);
6976
6977
6997BGD_DECLARE(void)
6998gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW,
6999 int dstH, int srcW, int srcH);
7000
7021BGD_DECLARE(void)
7022gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY,
7023 int dstW, int dstH, int srcW, int srcH);
7024
7042BGD_DECLARE(void)
7043gdImageCopyRotated(gdImagePtr dst, gdImagePtr src, double dstX, double dstY, int srcX, int srcY,
7044 int srcWidth, int srcHeight, int angle);
7045
7055BGD_DECLARE(gdImagePtr) gdImageClone(gdImagePtr src);
7056
7068BGD_DECLARE(void) gdImageInterlace(gdImagePtr im, int interlaceArg);
7069
7086BGD_DECLARE(void) gdImageAlphaBlending(gdImagePtr im, int alphaBlendingArg);
7087
7098BGD_DECLARE(void) gdImageSaveAlpha(gdImagePtr im, int saveAlphaArg);
7099
7117
7118
7132BGD_DECLARE(gdImagePtr)
7133gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor);
7134
7135
7148BGD_DECLARE(int)
7149gdImageTrueColorToPaletteSetMethod(gdImagePtr im, int method, int speed);
7150
7170BGD_DECLARE(void)
7171gdImageTrueColorToPaletteSetQuality(gdImagePtr im, int min_quality, int max_quality);
7172
7173
7202BGD_DECLARE(gdImagePtr)
7203gdImageCreatePaletteFromTrueColor(gdImagePtr im, int ditherFlag, int colorsWanted);
7204
7205
7217BGD_DECLARE(int)
7218gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted);
7219
7229BGD_DECLARE(int) gdImagePaletteToTrueColor(gdImagePtr src);
7230
7247
7260BGD_DECLARE(int)
7261gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode);
7262
7266typedef struct {
7267 int sub;
7268 int plus;
7269 unsigned int num_colors;
7270 int *colors;
7271 unsigned int seed;
7273
7285BGD_DECLARE(int) gdImageScatter(gdImagePtr im, int sub, int plus);
7286
7300BGD_DECLARE(int) gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors);
7301
7312BGD_DECLARE(int) gdImageScatterEx(gdImagePtr im, gdScatterPtr s);
7313
7341 BGD_DECLARE(int) gdImageSmooth(gdImagePtr im, float weight);
7342
7354 BGD_DECLARE(int) gdImageMeanRemoval(gdImagePtr im);
7355
7367BGD_DECLARE(int) gdImageEmboss(gdImagePtr im);
7368
7386BGD_DECLARE(int) gdImageGaussianBlur(gdImagePtr im);
7387
7399BGD_DECLARE(int) gdImageEdgeDetectQuick(gdImagePtr src);
7400
7408BGD_DECLARE(int) gdImageSelectiveBlur(gdImagePtr src);
7409
7429BGD_DECLARE(int)
7430gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, float offset);
7431
7445BGD_DECLARE(int)
7446gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
7447
7460BGD_DECLARE(int) gdImageContrast(gdImagePtr src, double contrast);
7461
7472BGD_DECLARE(int) gdImageBrightness(gdImagePtr src, int brightness);
7473
7474
7488BGD_DECLARE(int) gdImageGrayScale(gdImagePtr src);
7489
7497BGD_DECLARE(int) gdImageNegate(gdImagePtr src);
7498
7558BGD_DECLARE(gdImagePtr)
7559gdImageCopyGaussianBlurred(gdImagePtr src, int radius, double sigma);
7577#define gdImageTrueColor(im) ((im)->trueColor)
7578
7587#define gdImageSX(im) ((im)->sx)
7588
7597#define gdImageSY(im) ((im)->sy)
7598
7609#define gdImageColorsTotal(im) ((im)->colorsTotal)
7610
7620#define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : (im)->red[(c)])
7621
7631#define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : (im)->green[(c)])
7632
7642#define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : (im)->blue[(c)])
7643
7653#define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : (im)->alpha[(c)])
7654
7666#define gdImageGetTransparent(im) ((im)->transparent)
7667
7682#define gdImageGetInterlaced(im) ((im)->interlace)
7683
7701#define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
7702
7720#define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
7721
7734#define gdImageResolutionX(im) (im)->res_x
7735
7748#define gdImageResolutionY(im) (im)->res_y
7749
7750/* I/O Support routines. */
7762BGD_DECLARE(gdIOCtxPtr) gdNewFileCtx(FILE *);
7763
7777BGD_DECLARE(gdIOCtxPtr) gdNewDynamicCtx(int size, void *data);
7778
7796BGD_DECLARE(gdIOCtxPtr) gdNewDynamicCtxEx(int size, void *data, int freeFlag);
7797
7799BGD_DECLARE(gdIOCtxPtr) gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
7800BGD_DECLARE(void *) gdDPExtractData(gdIOCtxPtr ctx, int *size);
7812#define GD2_CHUNKSIZE 128
7814#define GD2_CHUNKSIZE_MIN 64
7816#define GD2_CHUNKSIZE_MAX 4096
7817
7819#define GD2_VERS 2
7821#define GD2_ID "gd2"
7823#define GD2_FMT_RAW 1
7825#define GD2_FMT_COMPRESSED 2
7826
7835#define GD_CMP_IMAGE 1
7836#define GD_CMP_NUM_COLORS 2
7837#define GD_CMP_COLOR 4
7838#define GD_CMP_SIZE_X 8
7839#define GD_CMP_SIZE_Y 16
7840#define GD_CMP_TRANSPARENT 32
7841#define GD_CMP_BACKGROUND 64
7842#define GD_CMP_INTERLACE 128
7843#define GD_CMP_TRUECOLOR 256
7856BGD_DECLARE(int) gdImageCompare(gdImagePtr im1, gdImagePtr im2);
7857
7865
7871
7873typedef struct {
7874 unsigned int pixels_changed;
7875 /* Largest normalized perceptual distance, in the range 0.0 to 1.0. */
7878
7879/*
7880 * Compare two equally sized images using a perceptual YIQ distance.
7881 *
7882 * A NULL options pointer selects an overlay with opaque red highlights. A
7883 * non-NULL diff_image receives a newly allocated truecolor image for overlay
7884 * and mask modes; the caller owns it and must call @ref gdImageDestroy. Passing
7885 * NULL for diff_image computes statistics only. The result is always reset,
7886 * including on failure.
7887 *
7888 * Returns 1 on success, or 0 for invalid arguments or allocation failure.
7889 */
7890BGD_DECLARE(int)
7891gdImagePerceptualDiff(gdImagePtr image1, gdImagePtr image2, double threshold,
7892 const gdImagePerceptualDiffOptions *options,
7893 gdImagePtr *diff_image,
7930BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im);
7931
7940BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im);
7941
7950BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im);
7951
7965
7976BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop);
7977
7978
7991BGD_DECLARE(gdImagePtr) gdImageCropAuto(gdImagePtr im, const unsigned int mode);
7992
7993
8009BGD_DECLARE(gdImagePtr)
8010gdImageCropThreshold(gdImagePtr im, const unsigned int color, const float threshold);
8011
8017typedef struct {
8020 int color;
8022
8033BGD_DECLARE(gdImagePtr)
8034gdImageAutoCropWithOptions(gdImagePtr src, const gdAutoCropOptions *options);
8035
8059BGD_DECLARE(int)
8061
8076
8105BGD_DECLARE(gdImagePtr)
8106gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height);
8107
8125
8147
8170
8203
8225BGD_DECLARE(gdImagePtr)
8226gdImageScaleWithOptions(const gdImagePtr src, const unsigned int new_width,
8227 const unsigned int new_height, const gdScaleOptions *options);
8228
8237
8252BGD_DECLARE(int)
8253gdImageInterestingCropRegion(const gdImagePtr src, unsigned int target_width,
8254 unsigned int target_height, gdInterestingMethod method,
8255 gdRectPtr crop);
8256
8269BGD_DECLARE(int)
8270gdImageEntropyCropRegion(const gdImagePtr src, unsigned int target_width,
8271 unsigned int target_height, gdRectPtr crop);
8272
8291BGD_DECLARE(gdImagePtr)
8292gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
8293
8304
8314BGD_DECLARE(int)
8315gdAffineApplyToPointF(gdPointFPtr dst, const gdPointFPtr src, const double affine[6]);
8316
8325BGD_DECLARE(int) gdAffineInvert(double dst[6], const double src[6]);
8326
8337BGD_DECLARE(int)
8338gdAffineFlip(double dst_affine[6], const double src_affine[6], const int flip_h, const int flip_v);
8339
8352BGD_DECLARE(int)
8353gdAffineConcat(double dst[6], const double m1[6], const double m2[6]);
8354
8361BGD_DECLARE(int) gdAffineIdentity(double dst[6]);
8362
8372BGD_DECLARE(int)
8373gdAffineScale(double dst[6], const double scale_x, const double scale_y);
8374
8386BGD_DECLARE(int) gdAffineRotate(double dst[6], const double angle);
8387
8396BGD_DECLARE(int) gdAffineShearHorizontal(double dst[6], const double angle);
8397
8406BGD_DECLARE(int) gdAffineShearVertical(double dst[6], const double angle);
8407
8417BGD_DECLARE(int)
8418gdAffineTranslate(double dst[6], const double offset_x, const double offset_y);
8419
8429BGD_DECLARE(double) gdAffineExpansion(const double src[6]);
8430
8438BGD_DECLARE(int) gdAffineRectilinear(const double src[6]);
8439
8449BGD_DECLARE(int)
8450gdAffineEqual(const double matrix1[6], const double matrix2[6]);
8451
8470BGD_DECLARE(int)
8471gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area,
8472 const double affine[6]);
8473
8493BGD_DECLARE(int)
8494gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src,
8495 gdRectPtr src_region, const double affine[6]);
8496/*
8497gdTransformAffineCopy(gdImagePtr dst, int x0, int y0, int x1, int y1,
8498 const gdImagePtr src, int src_width, int src_height,
8499 const double affine[6]);
8500*/
8511BGD_DECLARE(int)
8512gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox);
8513
8516/* resolution affects ttf font rendering, particularly hinting */
8517#define GD_RESOLUTION 96 /* pixels per inch */
8518
8519/* Version information functions */
8520BGD_DECLARE(int) gdMajorVersion(void);
8521BGD_DECLARE(int) gdMinorVersion(void);
8522BGD_DECLARE(int) gdReleaseVersion(void);
8523BGD_DECLARE(const char *) gdExtraVersion(void);
8524BGD_DECLARE(const char *) gdVersionString(void);
8525
8526/* newfangled special effects */
8527#include "gdfx.h"
8528
8529#ifdef __cplusplus
8530}
8531#endif
8532
8533#endif /* GD_H */
int gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted)
Converts a truecolor image to a palette image.
Definition gd_topal.c:1382
int gdImageTrueColorToPaletteSetMethod(gdImagePtr im, int method, int speed)
Selects quantization method used for subsequent gdImageTrueColorToPalette calls.
Definition gd_topal.c:1339
gdImagePtr gdImageCreatePaletteFromTrueColor(gdImagePtr im, int ditherFlag, int colorsWanted)
Converts a truecolor image to a palette-based image.
Definition gd_topal.c:1372
int gdImagePaletteToTrueColor(gdImagePtr src)
Converts a palette-based image to a truecolor image.
Definition gd.c:3611
gdImagePtr gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor)
Creates a new palette image from a truecolor image.
Definition gd_nnquant.c:512
void gdImageTrueColorToPaletteSetQuality(gdImagePtr im, int min_quality, int max_quality)
Sets the quality range for subsequent gdImageTrueColorToPalette calls.
Definition gd_topal.c:1359
gdPaletteQuantizationMethod
Definition gd.h:7111
@ GD_QUANT_LIQ
Definition gd.h:7115
@ GD_QUANT_JQUANT
Definition gd.h:7113
@ GD_QUANT_DEFAULT
Definition gd.h:7112
@ GD_QUANT_NEUQUANT
Definition gd.h:7114
void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color)
Draws a character string.
Definition gd.c:1595
void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
Draws a single character rotated 90 degrees counterclockwise.
Definition gd.c:1566
void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color)
Draws a string rotated 90 degrees counterclockwise with 16-bit characters.
Definition gd.c:1633
gdFontPtr gdFontGetLarge(void)
Gets the built-in large font.
Definition gdfontl.c:4644
gdFontPtr gdFontGetGiant(void)
Gets the built-in giant font.
Definition gdfontg.c:4387
gdFontPtr gdFontGetTiny(void)
Gets the built-in tiny font.
Definition gdfontt.c:2598
void gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color)
Draws a string rotated 90 degrees counterclockwise.
Definition gd.c:1607
gdFontPtr gdFontGetMediumBold(void)
Gets the built-in medium bold font.
Definition gdfontmb.c:3877
void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color)
Draws a character string with 16-bit characters.
Definition gd.c:1621
gdFontPtr gdFontGetSmall(void)
Gets the built-in small font.
Definition gdfonts.c:3877
void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
Draws a single character.
Definition gd.c:1538
int gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors)
Scatter an image with specified colors.
Definition gd_filter.c:65
int gdImageScatterEx(gdImagePtr im, gdScatterPtr s)
Scatter an image with extended options.
Definition gd_filter.c:77
int gdImageEdgeDetectQuick(gdImagePtr src)
Edge detection of an image.
Definition gd_filter.c:592
int gdImageNegate(gdImagePtr src)
Invert an image.
Definition gd_filter.c:193
gdPixelateMode
gdImagePixelate options
Definition gd.h:7243
int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, float offset)
Apply a convolution matrix to an image.
Definition gd_filter.c:409
int gdImageGaussianBlur(gdImagePtr im)
Gaussian blur of an image Performs a Gaussian blur of radius 1 on the image. The image is modified in...
Definition gd_filter.c:599
int gdImageEmboss(gdImagePtr im)
Emboss an image.
Definition gd_filter.c:606
int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode)
Pixelates an image.
Definition gd_filter.c:137
int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha)
Change channel values of an image.
Definition gd_filter.c:366
int gdImageMeanRemoval(gdImagePtr im)
Mean removal of an image.
Definition gd_filter.c:618
int gdImageContrast(gdImagePtr src, double contrast)
Change the contrast of an image.
Definition gd_filter.c:306
gdImagePtr gdImageCopyGaussianBlurred(gdImagePtr src, int radius, double sigma)
Return a copy of the source image src blurred according to the parameters using the Gaussian Blur alg...
Definition gd_filter.c:727
int gdImageBrightness(gdImagePtr src, int brightness)
Change the brightness of an image.
Definition gd_filter.c:262
int gdImageSmooth(gdImagePtr im, float weight)
Smooth an image.
Definition gd_filter.c:625
int gdImageGrayScale(gdImagePtr src)
Convert an image to grayscale.
Definition gd_filter.c:224
int gdImageSelectiveBlur(gdImagePtr src)
Selective blur of an image.
Definition gd_filter.c:471
int gdImageScatter(gdImagePtr im, int sub, int plus)
Scatter an image.
Definition gd_filter.c:53
@ GD_PIXELATE_UPPERLEFT
Definition gd.h:7244
@ GD_PIXELATE_AVERAGE
Definition gd.h:7245
int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y)
Gets the truecolor value of the pixel at the specified coordinates.
Definition gd.c:1153
int gdImageGetPixel(gdImagePtr im, int x, int y)
Gets the color of the pixel at the specified coordinates.
Definition gd.c:1140
void gdImageSetPixel(gdImagePtr im, int x, int y, int color)
Sets the pixel at the specified coordinates to the given color. Replaces or blends with the backgroun...
Definition gd.c:965
void gdImageSetTile(gdImagePtr im, gdImagePtr tile)
Sets the tile for following drawing operations.
Definition gd.c:3189
void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c)
Draws a filled polygon.
Definition gd.c:3017
void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color)
Draws a rectangle.
Definition gd.c:2239
void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color)
Draws a filled rectangle.
Definition gd.c:2403
void gdImageSetBrush(gdImagePtr im, gdImagePtr brush)
Sets the brush for following drawing operations.
Definition gd.c:3175
struct gdRect * gdRectPtr
void gdImageFilledArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style)
Draws a filled arc or a filled chord.
Definition gd.c:1665
void gdImageOpenPolygon(gdImagePtr im, gdPointPtr p, int n, int c)
Draws an open polygon.
Definition gd.c:2992
void gdImageSetAntiAliased(gdImagePtr im, int c)
Set the color for subsequent anti-aliased drawing.
Definition gd.c:3203
void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2)
Sets the clipping rectangle.
Definition gd.c:3416
void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend)
Definition gd.c:3210
void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color)
Draws an arc or a chord.
Definition gd.c:1659
void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color)
Draw an ellipse, stroke only.
Definition gd.c:1781
void gdImageSetThickness(gdImagePtr im, int thickness)
Definition gd.c:3173
void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P)
Gets the current clipping rectangle.
Definition gd.c:3448
void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c)
Draws a closed polygon.
Definition gd.c:2982
void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color)
Draw a filled ellipse.
Definition gd.c:1828
void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels)
Sets the style for following drawing operations.
Definition gd.c:3156
struct gdPoint * gdPointPtr
void gdImageAABlend(gdImagePtr im)
Definition gd.c:1173
int gdAffineInvert(double dst[6], const double src[6])
Invert an affine matrix.
Definition gd_matrix.c:47
int gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6])
Apply an affine transform to a source region and create an image containing the complete transformed ...
Definition gd_interpolation.c:2400
int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id)
Set the interpolation method stored on an image.
Definition gd_interpolation.c:2711
int gdAffineApplyToPointF(gdPointFPtr dst, const gdPointFPtr src, const double affine[6])
Apply an affine matrix to a floating-point point.
Definition gd_matrix.c:38
int gdAffineShearVertical(double dst[6], const double angle)
Store a vertical shear affine matrix.
Definition gd_matrix.c:148
gdScaleStrategy
Definition gd.h:8165
int gdAffineIdentity(double dst[6])
Store an identity affine matrix.
Definition gd_matrix.c:100
gdImagePtr gdImageCrop(gdImagePtr src, const gdRect *crop)
Crop an image to a given rectangle.
Definition gd_crop.c:31
gdImagePtr gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height)
Scale an image to an exact width and height using the source image's current gdInterpolationMethod.
Definition gd_interpolation.c:1831
gdCropMode
Definition gd.h:7957
int gdAffineFlip(double dst_affine[6], const double src_affine[6], const int flip_h, const int flip_v)
Build a horizontal and/or vertical flip from an affine matrix.
Definition gd_matrix.c:69
int gdAffineRectilinear(const double src[6])
Test whether an affine matrix preserves axis-aligned rectangles.
Definition gd_matrix.c:176
int gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6])
Apply an affine transform to a source region and copy the transformed pixels into an existing destina...
Definition gd_interpolation.c:2531
int gdAffineConcat(double dst[6], const double m1[6], const double m2[6])
Concatenate two affine matrices.
Definition gd_matrix.c:81
int gdAffineRotate(double dst[6], const double angle)
Store a rotation affine matrix.
Definition gd_matrix.c:123
gdInterpolationMethod gdImageGetInterpolationMethod(gdImagePtr im)
Return the interpolation method currently stored on an image.
Definition gd_interpolation.c:2818
int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox)
Compute the bounding box of a source rectangle after applying an affine transform.
Definition gd_interpolation.c:2647
int gdImageEntropyCropRegion(const gdImagePtr src, unsigned int target_width, unsigned int target_height, gdRectPtr crop)
Find a high-entropy source crop region with the requested aspect ratio.
Definition gd_interesting.c:393
void gdImageFlipVertical(gdImagePtr im)
Flip an image horizontally.
Definition gd_transform.c:11
gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor)
Rotate an image by an arbitrary angle using the source image's current gdInterpolationMethod.
Definition gd_interpolation.c:2308
int gdAffineTranslate(double dst[6], const double offset_x, const double offset_y)
Store a translation affine matrix.
Definition gd_matrix.c:160
int gdAffineEqual(const double matrix1[6], const double matrix2[6])
Compare two affine matrices.
Definition gd_matrix.c:182
gdImagePtr gdImageCropAuto(gdImagePtr im, const unsigned int mode)
Crop an image automatically.
Definition gd_crop.c:52
int gdAffineShearHorizontal(double dst[6], const double angle)
Store a horizontal shear affine matrix.
Definition gd_matrix.c:137
gdImagePtr gdImageAutoCropWithOptions(gdImagePtr src, const gdAutoCropOptions *options)
Crop an image automatically with options.
Definition gd_crop.c:217
double gdAffineExpansion(const double src[6])
Return the linear expansion factor of an affine matrix.
Definition gd_matrix.c:171
void gdImageFlipBoth(gdImagePtr im)
Flip an image vertically and horizontally.
Definition gd_transform.c:75
gdAffineStandardMatrix
Standard affine matrix operations.
Definition gd.h:8297
gdInterpolationMethod
gdInterpolationMethod
Definition gd.h:315
gdImagePtr gdImageCropThreshold(gdImagePtr im, const unsigned int color, const float threshold)
Crop an image using a given color.
Definition gd_crop.c:142
gdScaleFit
Definition gd.h:8118
gdScaleGravity
Definition gd.h:8135
void gdImageFlipHorizontal(gdImagePtr im)
Flip an image vertically.
Definition gd_transform.c:39
gdInterestingMethod
Methods used to find an interesting crop region.
Definition gd.h:8233
int gdAffineScale(double dst[6], const double scale_x, const double scale_y)
Store a scale affine matrix.
Definition gd_matrix.c:112
int gdImageInterestingCropRegion(const gdImagePtr src, unsigned int target_width, unsigned int target_height, gdInterestingMethod method, gdRectPtr crop)
Find a source crop region with the requested aspect ratio using an interesting-region method.
Definition gd_interesting.c:336
gdImagePtr gdImageScaleWithOptions(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height, const gdScaleOptions *options)
Scale an image using aspect-ratio, gravity, crop-strategy and interpolation options.
Definition gd_interpolation.c:2125
@ GD_SCALE_STRATEGY_NONE
Definition gd.h:8166
@ GD_SCALE_STRATEGY_ATTENTION
Definition gd.h:8168
@ GD_SCALE_STRATEGY_ENTROPY
Definition gd.h:8167
@ GD_CROP_TRANSPARENT
Definition gd.h:7959
@ GD_CROP_THRESHOLD
Definition gd.h:7963
@ GD_CROP_WHITE
Definition gd.h:7961
@ GD_CROP_BLACK
Definition gd.h:7960
@ GD_CROP_SIDES
Definition gd.h:7962
@ GD_CROP_DEFAULT
Definition gd.h:7958
@ GD_AFFINE_SCALE
Definition gd.h:8299
@ GD_AFFINE_SHEAR_HORIZONTAL
Definition gd.h:8301
@ GD_AFFINE_SHEAR_VERTICAL
Definition gd.h:8302
@ GD_AFFINE_TRANSLATE
Definition gd.h:8298
@ GD_AFFINE_ROTATE
Definition gd.h:8300
@ GD_BELL
Definition gd.h:317
@ GD_QUADRATIC_BSPLINE
Definition gd.h:343
@ GD_TRIANGLE
Definition gd.h:336
@ GD_BESSEL
Definition gd.h:318
@ GD_CATMULLROM
Definition gd.h:325
@ GD_BSPLINE
Definition gd.h:324
@ GD_HAMMING
Definition gd.h:329
@ GD_CUBIC_SPLINE
Definition gd.h:344
@ GD_BICUBIC
Definition gd.h:320
@ GD_DEFAULT
Definition gd.h:316
@ GD_BILINEAR_FIXED
Definition gd.h:319
@ GD_BLACKMAN_SINC
Definition gd.h:342
@ GD_QUADRATIC
Definition gd.h:334
@ GD_LINEAR
Definition gd.h:338
@ GD_POWER
Definition gd.h:333
@ GD_BLACKMAN
Definition gd.h:322
@ GD_NEAREST_NEIGHBOUR
Definition gd.h:332
@ GD_BOX
Definition gd.h:323
@ GD_HERMITE
Definition gd.h:328
@ GD_WEIGHTED4
Definition gd.h:337
@ GD_COSINE
Definition gd.h:345
@ GD_LANCZOS3
Definition gd.h:339
@ GD_GENERALIZED_CUBIC
Definition gd.h:327
@ GD_BICUBIC_FIXED
Definition gd.h:321
@ GD_HANNING
Definition gd.h:330
@ GD_SINC
Definition gd.h:335
@ GD_LANCZOS8
Definition gd.h:340
@ GD_MITCHELL
Definition gd.h:331
@ GD_GAUSSIAN
Definition gd.h:326
@ GD_BLACKMAN_BESSEL
Definition gd.h:341
@ GD_WELSH
Definition gd.h:346
@ GD_SCALE_FIT_CONTAIN
Definition gd.h:8120
@ GD_SCALE_FIT_FILL
Definition gd.h:8121
@ GD_SCALE_FIT_COVER
Definition gd.h:8119
@ GD_SCALE_FIT_OUTSIDE
Definition gd.h:8123
@ GD_SCALE_FIT_INSIDE
Definition gd.h:8122
@ GD_SCALE_GRAVITY_SOUTH
Definition gd.h:8144
@ GD_SCALE_GRAVITY_SOUTHWEST
Definition gd.h:8143
@ GD_SCALE_GRAVITY_NORTH
Definition gd.h:8138
@ GD_SCALE_GRAVITY_WEST
Definition gd.h:8140
@ GD_SCALE_GRAVITY_EAST
Definition gd.h:8142
@ GD_SCALE_GRAVITY_NORTHWEST
Definition gd.h:8137
@ GD_SCALE_GRAVITY_CENTER
Definition gd.h:8141
@ GD_SCALE_GRAVITY_NORTHEAST
Definition gd.h:8139
@ GD_SCALE_GRAVITY_SOUTHEAST
Definition gd.h:8145
@ GD_INTERESTING_ENTROPY
Definition gd.h:8234
@ GD_INTERESTING_ATTENTION
Definition gd.h:8235
void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
Copy a resized area from an image to another image.
Definition gd.c:2693
gdImagePtr gdImageClone(gdImagePtr src)
Clones an image.
Definition gd.c:2412
void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
Copy a resampled area from an image to another image.
Definition gd.c:2889
void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct)
Copy an area of an image to another image ignoring alpha.
Definition gd.c:2589
void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct)
Copy an area of an image to another image ignoring alpha.
Definition gd.c:2634
void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h)
Copy an area of an image to another image.
Definition gd.c:2503
void gdImageCopyRotated(gdImagePtr dst, gdImagePtr src, double dstX, double dstY, int srcX, int srcY, int srcWidth, int srcHeight, int angle)
Copy a rotated area from an image to another image.
Definition gd.c:2809
void gdImageInterlace(gdImagePtr im, int interlaceArg)
Sets whether an image is interlaced.
Definition gd.c:3217
int gdFontCacheSetup(void)
Set up the font cache.
void gdFreeFontCache(void)
Alias of gdFontCacheShutdown.
char * gdImageStringTTF(gdImagePtr im, int *brect, int fg, const char *fontlist, double ptsize, double angle, int x, int y, const char *string)
Draws a string using FreeType 2 fonts. Alias of gdImageStringFT. Provided for backwards compatibility...
void gdFontCacheShutdown(void)
Shut down the font cache and free the allocated resources.
char * gdImageStringFT(gdImagePtr im, int *brect, int fg, const char *fontlist, double ptsize, double angle, int x, int y, const char *string)
Render an UTF-8 string onto a gd image.
Definition gdft.c:62
int gdFTUseFontConfig(int flag)
Enable or disable fontconfig by default.
Definition gdft.c:1670
char * gdImageStringFTEx(gdImagePtr im, int *brect, int fg, const char *fontlist, double ptsize, double angle, int x, int y, const char *string, gdFTStringExtraPtr strex)
Draws a string using FreeType 2 fonts with additional parameters.
Definition gdft.c:44
void gdImageAvifCtx(gdImagePtr im, gdIOCtxPtr outfile, int quality, int speed)
Write a truecolor image as AVIF data to an IO context.
int gdImageAvifWithOptions(gdImagePtr im, FILE *outFile, const gdAvifWriteOptions *options)
Write AVIF data to a stdio stream using write options.
Definition gd_avif.c:769
gdImagePtr gdImageCreateFromAvifCtx(gdIOCtxPtr infile)
Create a truecolor image from AVIF data in an IO context.
void gdAvifWriteOptionsInit(gdAvifWriteOptions *options)
Initialize AVIF write options with gd defaults.
Definition gd_avif.c:674
void * gdImageAvifPtrEx(gdImagePtr im, int *size, int quality, int speed)
Encode a truecolor image as AVIF data in memory.
Definition gd_avif.c:740
int gdAvifGetInfo(FILE *inFile, gdAvifInfo *info)
Read AVIF information from a stdio stream without closing it. *.
Definition gd_avif_metadata.c:253
void gdImageAvif(gdImagePtr im, FILE *outFile)
Write a truecolor image as AVIF data to a stdio stream.
Definition gd_avif.c:724
int gdImageAvifCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdAvifWriteOptions *options)
Write AVIF data to a gdIOCtx using write options.
gdImagePtr gdImageCreateFromAvifPtr(int size, void *data)
Create a truecolor image from AVIF data in memory.
Definition gd_avif.c:691
void * gdImageAvifPtrWithOptions(gdImagePtr im, int *size, const gdAvifWriteOptions *options)
Encode a truecolor image as AVIF data in memory using write options.
Definition gd_avif.c:750
void gdImageAvifEx(gdImagePtr im, FILE *outFile, int quality, int speed)
Write a truecolor image as AVIF data to a stdio stream.
Definition gd_avif.c:715
void * gdImageAvifPtr(gdImagePtr im, int *size)
Encode a truecolor image as AVIF data in memory.
Definition gd_avif.c:731
int gdAvifGetInfoCtx(gdIOCtxPtr in, gdAvifInfo *info)
Read AVIF information from a gdIOCtx without closing it.
Definition gd_avif_metadata.c:246
void gdAvifInfoInit(gdAvifInfo *info)
Initialize AVIF information and clear the metadata pointer.
Definition gd_avif_metadata.c:231
int gdAvifGetInfoPtr(int size, const void *data, gdAvifInfo *info)
Read AVIF information from memory without taking ownership.
Definition gd_avif_metadata.c:238
gdImagePtr gdImageCreateFromAvif(FILE *inFile)
Create a truecolor image from AVIF data in a stdio stream.
Definition gd_avif.c:685
@ GD_AVIF_CHROMA_SUBSAMPLING_YUV420
Definition gd.h:3465
@ GD_AVIF_CHROMA_SUBSAMPLING_AUTO
Definition gd.h:3464
@ GD_AVIF_CHROMA_SUBSAMPLING_YUV444
Definition gd.h:3466
void * gdImageBmpPtr(gdImagePtr im, int *size, int compression)
Write an image as BMP data to a newly allocated memory buffer.
Definition gd_bmp.c:269
void gdBmpWriteOptionsInit(gdBmpWriteOptions *options)
Initialize a gdBmpWriteOptions structure to default values.
Definition gd_bmp.c:220
void gdImageBmp(gdImagePtr im, FILE *outFile, int compression)
Write an image as BMP data to a stdio file.
Definition gd_bmp.c:288
gdImagePtr gdImageCreateFromBmpCtx(gdIOCtxPtr infile)
Create an image from BMP data read through a gdIOCtx.
Definition gd_bmp.c:1061
int gdImageBmpCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdBmpWriteOptions *options)
Write an image as BMP data to a gdIOCtx with explicit options.
Definition gd_bmp.c:230
void * gdImageBmpPtrEx(gdImagePtr im, int *size, int bpp, int compression, int flags)
Write an image as BMP data to a newly allocated memory buffer.
Definition gd_bmp.c:278
int gdBmpGetInfoPtr(int size, const void *data, gdBmpInfo *info)
Read BMP file information from a memory buffer.
Definition gd_bmp.c:203
int gdBmpGetInfoCtx(gdIOCtxPtr infile, gdBmpInfo *info)
Read BMP file information from a gdIOCtx.
Definition gd_bmp.c:181
gdImagePtr gdImageCreateFromBmpPtr(int size, void *data)
Create an image from a BMP memory buffer.
Definition gd_bmp.c:1050
void gdBmpInfoInit(gdBmpInfo *info)
Initialize a gdBmpInfo structure to default values.
Definition gd_bmp.c:132
void gdImageBmpCtxEx(gdImagePtr im, gdIOCtxPtr out, int bpp, int compression, int flags)
Write an image as BMP data to a gdIOCtx.
Definition gd_bmp.c:317
gdImagePtr gdImageCreateFromBmp(FILE *inFile)
Create an image from a BMP stdio file.
Definition gd_bmp.c:1039
int gdBmpGetInfo(FILE *infile, gdBmpInfo *info)
Read BMP file information from a stdio file.
Definition gd_bmp.c:186
void gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
Write an image as BMP data to a gdIOCtx.
Definition gd_bmp.c:308
void * gdImageBmpPtrWithOptions(gdImagePtr im, int *size, const gdBmpWriteOptions *options)
Write an image as BMP data to a newly allocated memory buffer with explicit options.
Definition gd_bmp.c:256
int gdImageBmpWithOptions(gdImagePtr im, FILE *outFile, const gdBmpWriteOptions *options)
Write an image as BMP data to a stdio file with explicit options.
Definition gd_bmp.c:240
void gdImageBmpEx(gdImagePtr im, FILE *outFile, int bpp, int compression, int flags)
Write an image as BMP data to a stdio file.
Definition gd_bmp.c:297
gdImagePtr gdImageCreateFromGd2Ctx(gdIOCtxPtr in)
Create an image from GD2 data read through a gdIOCtx.
Definition gd_gd2.c:969
gdImagePtr gdImageCreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h)
Create an image from a rectangular region of a GD2 stdio file.
Definition gd_gd2.c:977
gdImagePtr gdImageCreateFromGd2Ptr(int size, void *data)
Create an image from a GD2 memory buffer.
Definition gd_gd2.c:988
gdImagePtr gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, int h)
Create an image from a rectangular GD2 region read through a gdIOCtx.
gdImagePtr gdImageCreateFromGd2PartPtr(int size, void *data, int srcx, int srcy, int w, int h)
Create an image from a rectangular region of a GD2 memory buffer.
Definition gd_gd2.c:1009
void gdImageGd2(gdImagePtr im, FILE *out, int cs, int fmt)
Write an image as GD2 data to a stdio file.
Definition gd_gd2.c:1021
void * gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size)
Write an image as GD2 data to a newly allocated memory buffer.
Definition gd_gd2.c:1030
gdImagePtr gdImageCreateFromGd2(FILE *in)
Create an image from a GD2 stdio file.
Definition gd_gd2.c:962
void * gdImageGdPtr(gdImagePtr im, int *size)
Write an image as GD data to a newly allocated memory buffer.
Definition gd_gd.c:376
gdImagePtr gdImageCreateFromGdPtr(int size, void *data)
Create an image from a GD memory buffer.
Definition gd_gd.c:354
void gdImageGd(gdImagePtr im, FILE *out)
Write an image as GD data to a stdio file.
Definition gd_gd.c:369
gdImagePtr gdImageCreateFromGdCtx(gdIOCtxPtr in)
Create an image from GD data read through a gdIOCtx.
Definition gd_gd.c:362
gdImagePtr gdImageCreateFromGd(FILE *in)
Create an image from a GD stdio file.
Definition gd_gd.c:347
void gdGifReadClose(gdGifReadPtr gif)
Close an animated GIF reader.
Definition gd_gif_in.c:700
gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in)
Create an image from the first frame of GIF data read through a gdIOCtx.
Definition gd_gif_in.c:979
void * gdImageGifPtr(gdImagePtr im, int *size)
Write an image as GIF data to a newly allocated memory buffer.
Definition gd_gif_out.c:111
int gdGifGetInfo(FILE *file, gdGifInfo *info)
Read logical screen and loop information from a GIF stdio file.
Definition gd_gif_in.c:754
void gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm)
Add a frame to a GIF animation written to a stdio file.
Definition gd_gif_out.c:275
gdImagePtr gdImageCreateFromGif(FILE *fd)
Create an image from the first frame of a GIF stdio file.
Definition gd_gif_in.c:953
void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
Write an image as GIF data to a gdIOCtx.
Definition gd_gif_out.c:135
void * gdImageGifAnimEndPtr(int *size)
Finish a GIF animation into a newly allocated memory buffer.
Definition gd_gif_out.c:518
int gdGifReadGetInfo(gdGifReadPtr gif, gdGifInfo *info)
Read logical screen and loop information from a GIF reader.
Definition gd_gif_in.c:717
int gdGifIsAnimated(FILE *fd)
Test whether a seekable GIF stdio file contains more than one frame.
Definition gd_gif_in.c:580
void gdImageGifAnimEndCtx(gdIOCtxPtr out)
Finish writing a GIF animation to a gdIOCtx.
void gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtxPtr out, int GlobalCM, int Loops)
Begin writing a GIF animation to a gdIOCtx.
Definition gd_gif_out.c:193
gdGifReadPtr gdGifReadOpenPtr(int size, void *data)
Open an animated GIF reader from a memory buffer.
Definition gd_gif_in.c:656
gdGifReadPtr gdGifReadOpenCtx(gdIOCtxPtr in)
Open an animated GIF reader from a gdIOCtx.
Definition gd_gif_in.c:677
int gdGifReadNextImage(gdGifReadPtr gif, gdGifFrameInfo *info, gdImagePtr *image)
Read the next GIF frame composited onto the logical screen.
Definition gd_gif_in.c:918
int gdGifIsAnimatedCtx(gdIOCtxPtr in)
Test whether a seekable GIF gdIOCtx contains more than one frame.
Definition gd_gif_in.c:604
void gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops)
Begin writing a GIF animation to a stdio file.
Definition gd_gif_out.c:183
gdGifReadPtr gdGifReadOpen(FILE *fd)
Open an animated GIF reader from a stdio file.
Definition gd_gif_in.c:635
void * gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops)
Begin writing a GIF animation to a newly allocated memory buffer.
Definition gd_gif_out.c:170
void * gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm)
Add a GIF animation frame to a newly allocated memory buffer.
Definition gd_gif_out.c:258
int gdGifIsAnimatedPtr(int size, void *data)
Test whether a GIF memory buffer contains more than one frame.
Definition gd_gif_in.c:618
int gdGifGetInfoCtx(gdIOCtxPtr input, gdGifInfo *info)
Read logical screen and loop information from a seekable gdIOCtx.
Definition gd_gif_in.c:734
void gdImageGif(gdImagePtr im, FILE *out)
Write an image as GIF data to a stdio file.
Definition gd_gif_out.c:126
int gdGifReadNextFrame(gdGifReadPtr gif, gdGifFrameInfo *info, gdImagePtr *frame)
Read the next raw GIF frame.
Definition gd_gif_in.c:794
void gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm)
Add a frame to a GIF animation written to a gdIOCtx.
Definition gd_gif_out.c:300
int gdGifGetInfoPtr(int size, const void *data, gdGifInfo *info)
Read logical screen and loop information from a GIF memory buffer.
Definition gd_gif_in.c:771
struct gdGifReadStruct * gdGifReadPtr
Opaque animated GIF reader handle.
Definition gd.h:1330
gdImagePtr gdImageCreateFromGifPtr(int size, void *data)
Create an image from the first frame of a GIF memory buffer.
Definition gd_gif_in.c:967
void gdImageGifAnimEnd(FILE *outFile)
Finish writing a GIF animation to a stdio file.
Definition gd_gif_out.c:505
@ gdDisposalUnknown
Definition gd.h:1496
@ gdDisposalRestorePrevious
Definition gd.h:1499
@ gdDisposalNone
Definition gd.h:1497
@ gdDisposalRestoreBackground
Definition gd.h:1498
gdImagePtr gdImageCreateFromHeif(FILE *inFile)
Create a truecolor image from HEIF data in a stdio stream.
Definition gd_heif.c:580
void gdImageHeifCtx(gdImagePtr im, gdIOCtxPtr outfile, int quality, gdHeifCodec codec, gdHeifChroma chroma)
Write a truecolor image as HEIF data to an IO context.
gdImagePtr gdImageCreateFromHeifPtrWithOptions(int size, void *data, const gdHeifReadOptions *options)
Create a truecolor image from HEIF data in memory using read options.
Definition gd_heif.c:593
void gdHeifReadOptionsInit(gdHeifReadOptions *options)
Initialize HEIF read options with gd defaults.
Definition gd_heif.c:561
int gdImageHeifWithOptions(gdImagePtr im, FILE *outFile, const gdHeifWriteOptions *options)
Write HEIF data to a stdio stream using write options.
Definition gd_heif.c:650
int gdHeifGetInfoCtx(gdIOCtxPtr in, gdHeifInfo *info)
Read HEIF information from a gdIOCtx without closing it.
Definition gd_heif_metadata.c:333
const char * gdHeifChroma
HEIF chroma-subsampling string used by gdHeifWriteOptions::chroma.
Definition gd.h:3103
void gdImageHeifEx(gdImagePtr im, FILE *outFile, int quality, gdHeifCodec codec, gdHeifChroma chroma)
Write a truecolor image as HEIF data to a stdio stream.
Definition gd_heif.c:612
void * gdImageHeifPtrWithOptions(gdImagePtr im, int *size, const gdHeifWriteOptions *options)
Encode a truecolor image as HEIF data in memory using write options.
Definition gd_heif.c:633
gdHeifCodec
HEIF coding formats for gdHeifWriteOptions::codec.
Definition gd.h:3096
void gdImageHeif(gdImagePtr im, FILE *outFile)
Write a truecolor image as HEIF data to a stdio stream.
Definition gd_heif.c:617
int gdImageHeifCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdHeifWriteOptions *options)
Write HEIF data to a gdIOCtx using write options.
int gdHeifGetInfo(FILE *inFile, gdHeifInfo *info)
Read HEIF information from a stdio stream.
Definition gd_heif_metadata.c:340
int gdHeifGetInfoPtr(int size, const void *data, gdHeifInfo *info)
Read HEIF information from an in-memory buffer without taking ownership.
Definition gd_heif_metadata.c:325
void * gdImageHeifPtrEx(gdImagePtr im, int *size, int quality, gdHeifCodec codec, gdHeifChroma chroma)
Encode a truecolor image as HEIF data in memory.
Definition gd_heif.c:626
void * gdImageHeifPtr(gdImagePtr im, int *size)
Encode a truecolor image as HEIF data in memory.
Definition gd_heif.c:619
void gdHeifWriteOptionsInit(gdHeifWriteOptions *options)
Initialize HEIF write options with gd defaults.
Definition gd_heif.c:569
gdImagePtr gdImageCreateFromHeifPtr(int size, void *data)
Create a truecolor image from HEIF data in memory.
Definition gd_heif.c:586
gdImagePtr gdImageCreateFromHeifCtx(gdIOCtxPtr infile)
Create a truecolor image from HEIF data in an IO context.
void gdHeifInfoInit(gdHeifInfo *info)
Initialize HEIF information with gd defaults.
Definition gd_heif_metadata.c:318
@ GD_HEIF_CODEC_HEVC
Definition gd.h:3098
@ GD_HEIF_CODEC_UNKNOWN
Definition gd.h:3097
@ GD_HEIF_CODEC_AV1
Definition gd.h:3099
gdImagePtr gdImageCreateFromJpegPtrWithOptions(int size, void *data, const gdJpegReadOptions *options)
Create an image from a JPEG memory buffer using read options.
Definition gd_jpeg.c:1820
void * gdImageJpegPtr(gdImagePtr im, int *size, int quality)
Write an image as JPEG data to a newly allocated memory buffer.
Definition gd_jpeg.c:1738
void gdJpegInfoInit(gdJpegInfo *info)
Initialize a gdJpegInfo structure with default values.
Definition gd_jpeg.c:1654
const char * gdJpegGetVersionString()
Create an image from a JPEG memory buffer and collect metadata.
void * gdImageJpegPtrWithOptions(gdImagePtr im, int *size, const gdJpegWriteOptions *options)
Write an image as JPEG data to a memory buffer with metadata.
Definition gd_jpeg.c:1776
int gdJpegGetInfo(FILE *infile, gdJpegInfo *info)
Read JPEG header information from a stdio file.
Definition gd_jpeg.c:1680
gdImagePtr gdImageCreateFromJpegCtxWithOptions(gdIOCtxPtr infile, const gdJpegReadOptions *options)
Create an image from a JPEG gdIOCtx and collect metadata.
int gdJpegGetInfoCtx(gdIOCtxPtr infile, gdJpegInfo *info)
Read JPEG header information from a gdIOCtx.
Definition gd_jpeg.c:1688
gdImagePtr gdImageCreateFromJpeg(FILE *infile)
Create an image from a JPEG stdio file.
Definition gd_jpeg.c:1785
gdImagePtr gdImageCreateFromJpegPtr(int size, void *data)
Create an image from a JPEG memory buffer.
Definition gd_jpeg.c:1801
int gdImageJpegWithOptions(gdImagePtr im, FILE *out, const gdJpegWriteOptions *options)
Write an image as JPEG data to a gdIOCtx with metadata.
Definition gd_jpeg.c:1756
void gdJpegWriteOptionsInit(gdJpegWriteOptions *options)
Initialize JPEG write options with default values.
Definition gd_jpeg.c:1672
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtxPtr infile)
Create an image from JPEG data read through a gdIOCtx.
gdImagePtr gdImageCreateFromJpegEx(FILE *infile, int ignore_warning)
Create an image from a JPEG stdio file, controlling warning handling.
Definition gd_jpeg.c:1793
void gdImageJpeg(gdImagePtr im, FILE *out, int quality)
Write an image as JPEG data to a stdio file.
Definition gd_jpeg.c:1730
int gdImageJpegCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdJpegWriteOptions *options)
Write an image as JPEG data to a gdIOCtx using write options.
int gdJpegGetInfoPtr(int size, const void *data, gdJpegInfo *info)
Read JPEG header information from a memory buffer.
Definition gd_jpeg.c:1696
gdImagePtr gdImageCreateFromJpegPtrEx(int size, void *data, int ignore_warning)
Create an image from a JPEG memory buffer, controlling warning handling.
Definition gd_jpeg.c:1810
void gdJpegReadOptionsInit(gdJpegReadOptions *options)
Initialize JPEG read options with default values.
Definition gd_jpeg.c:1661
gdImagePtr gdImageCreateFromJpegCtxEx(gdIOCtxPtr infile, int ignore_warning)
Create an image from a JPEG gdIOCtx, controlling warning handling.
@ GD_JPEG_DENSITY_UNIT_NONE
Definition gd.h:1791
@ GD_JPEG_DENSITY_UNIT_DPCM
Definition gd.h:1793
@ GD_JPEG_DENSITY_UNIT_DPI
Definition gd.h:1792
@ GD_JPEG_DCT_FAST
Definition gd.h:1802
@ GD_JPEG_DCT_SLOW
Definition gd.h:1801
@ GD_JPEG_DCT_DEFAULT
Definition gd.h:1800
@ GD_JPEG_DCT_FLOAT
Definition gd.h:1803
@ GD_JPEG_COLOR_SPACE_RGB
Definition gd.h:1781
@ GD_JPEG_COLOR_SPACE_GRAYSCALE
Definition gd.h:1780
@ GD_JPEG_COLOR_SPACE_YCBCR
Definition gd.h:1782
@ GD_JPEG_COLOR_SPACE_UNKNOWN
Definition gd.h:1779
@ GD_JPEG_COLOR_SPACE_CMYK
Definition gd.h:1783
@ GD_JPEG_COLOR_SPACE_YCCK
Definition gd.h:1784
void gdImageJxlCtxEx(gdImagePtr im, gdIOCtxPtr outfile, int lossless, float distance, int effort)
Write an image as JPEG XL data to a gdIOCtx with encoder settings.
Definition gd_jxl.c:1825
void gdJxlReadClose(gdJxlReadPtr reader)
Close a JPEG XL multi-image reader.
Definition gd_jxl.c:1894
gdJxlReadPtr gdJxlReadOpenPtr(int size, void *data, const gdJxlReadOptions *options)
Open a JPEG XL multi-image/animation reader from a memory buffer.
Definition gd_jxl.c:1853
struct gdJxlRead * gdJxlReadPtr
Opaque JPEG XL multi-image/animation reader handle.
Definition gd.h:2764
void gdImageJxl(gdImagePtr im, FILE *outFile)
Write an image as JPEG XL data to a stdio file.
Definition gd_jxl.c:1741
int gdJxlReadGetInfo(gdJxlReadPtr reader, gdJxlInfo *info)
Get JPEG XL image or animation information from a reader.
Definition gd_jxl.c:1862
gdImagePtr gdImageCreateFromJxlPtr(int size, void *data)
Create a truecolor image from a JPEG XL memory buffer.
Definition gd_jxl.c:1726
void gdImageJxlCtx(gdImagePtr im, gdIOCtxPtr outfile)
Write an image as JPEG XL data to a gdIOCtx.
Definition gd_jxl.c:1817
gdImagePtr gdImageCreateFromJxlCtx(gdIOCtxPtr infile)
Create a truecolor image from JPEG XL data read through a gdIOCtx.
void * gdImageJxlPtr(gdImagePtr im, int *size)
Write an image as JPEG XL data to a newly allocated memory buffer.
Definition gd_jxl.c:1797
void gdImageJxlEx(gdImagePtr im, FILE *outFile, int lossless, float distance, int effort)
Write an image as JPEG XL data to a stdio file with encoder settings.
Definition gd_jxl.c:1787
int gdImageJxlWithOptions(gdImagePtr im, FILE *outFile, const gdJxlWriteOptions *options)
Write an image as JPEG XL data to a stdio file with write options.
Definition gd_jxl.c:1749
gdJxlWritePtr gdJxlWriteOpen(FILE *outFile, const gdJxlAnimWriteOptions *options)
Open a JPEG XL multi-image/animation writer for a stdio file.
Definition gd_jxl.c:1900
gdJxlWritePtr gdJxlWriteOpenCtx(gdIOCtxPtr outCtx, const gdJxlAnimWriteOptions *options)
Open a JPEG XL multi-image/animation writer for a gdIOCtx.
Definition gd_jxl.c:1908
void * gdJxlWritePtrFinish(gdJxlWritePtr writer, int *size)
Finish a JPEG XL multi-image/animation memory writer and return the encoded buffer.
Definition gd_jxl.c:1938
void gdJxlReadOptionsInit(gdJxlReadOptions *options)
Initialize JPEG XL multi-image/animation read options with gd defaults.
Definition gd_jxl.c:1690
void gdJxlWriteClose(gdJxlWritePtr writer)
Add a full-canvas image to a JPEG XL multi-image/animation writer.
Definition gd_jxl.c:1932
void gdJxlAnimWriteOptionsInit(gdJxlAnimWriteOptions *options)
Initialize JPEG XL multi-image/animation write options with gd defaults.
Definition gd_jxl.c:1709
gdJxlWritePtr gdJxlWriteOpenPtr(const gdJxlAnimWriteOptions *options)
Open a JPEG XL multi-image/animation writer that returns a memory buffer.
Definition gd_jxl.c:1916
int gdJxlWriteAddImage(gdJxlWritePtr writer, gdImagePtr image, int delay_ms)
Add a full-canvas image to a JPEG XL multi-image/animation writer.
Definition gd_jxl.c:1923
int gdJxlReadNextFrame(gdJxlReadPtr reader, gdJxlFrameInfo *info, gdImagePtr *frame)
Read the next raw JPEG XL frame rectangle.
Definition gd_jxl.c:1883
int gdImageJxlCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdJxlWriteOptions *options)
Write an image as JPEG XL data to a gdIOCtx with write options.
Definition gd_jxl.c:1767
gdImagePtr gdImageCreateFromJxl(FILE *inFile)
Create a truecolor image from a JPEG XL stdio file.
Definition gd_jxl.c:1719
struct gdJxlWrite * gdJxlWritePtr
Opaque JPEG XL multi-image/animation writer handle.
Definition gd.h:2773
void * gdImageJxlPtrEx(gdImagePtr im, int *size, int lossless, float distance, int effort)
Write an image as JPEG XL data to a newly allocated memory buffer with encoder settings.
Definition gd_jxl.c:1806
int gdJxlReadNextImage(gdJxlReadPtr reader, int *delay_ms, gdImagePtr *image)
Read the next coalesced JPEG XL image.
Definition gd_jxl.c:1871
gdJxlReadPtr gdJxlReadOpenCtx(gdIOCtxPtr inCtx, const gdJxlReadOptions *options)
Open a JPEG XL multi-image/animation reader from a gdIOCtx.
Definition gd_jxl.c:1844
void gdJxlWriteOptionsInit(gdJxlWriteOptions *options)
Initialize JPEG XL still-image write options with gd defaults.
Definition gd_jxl.c:1699
void * gdImageJxlPtrWithOptions(gdImagePtr im, int *size, const gdJxlWriteOptions *options)
Write an image as JPEG XL data to a newly allocated memory buffer with write options.
Definition gd_jxl.c:1777
int gdJxlReadGetMetadata(gdJxlReadPtr reader, gdImageMetadata *metadata)
Extract supported still-image metadata from a JPEG XL reader.
Definition gd_jxl.c:1758
gdJxlReadPtr gdJxlReadOpen(FILE *inFile, const gdJxlReadOptions *options)
Open a JPEG XL multi-image/animation reader from a stdio file.
Definition gd_jxl.c:1836
@ gdJxlBlendAdd
Definition gd.h:2806
@ gdJxlBlendReplace
Definition gd.h:2805
@ gdJxlBlendMuladd
Definition gd.h:2808
@ gdJxlBlendBlend
Definition gd.h:2807
@ gdJxlBlendMul
Definition gd.h:2809
void * gdImagePngPtrEx(gdImagePtr im, int *size, int level)
Write an image as PNG data to a memory buffer with a compression level.
Definition gd_png.c:1705
void * gdImagePngPtr(gdImagePtr im, int *size)
Write an image as PNG data to a newly allocated memory buffer.
Definition gd_png.c:1698
gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in)
Create an image from PNG data read through a gdIOCtx.
int gdImagePngWithOptions(gdImagePtr im, FILE *out, const gdPngWriteOptions *options)
Write an image as PNG data to a stdio file using write options.
Definition gd_png.c:1633
int gdPngGetInfoPtr(int size, const void *data, gdPngInfo *info)
Read PNG header information from a memory buffer.
Definition gd_png.c:1623
void gdImagePngEx(gdImagePtr im, FILE *out, int level)
Write an image as PNG data to a stdio file with a compression level.
Definition gd_png.c:1683
void gdImagePngCtx(gdImagePtr im, gdIOCtxPtr out)
Write an image as PNG data to a gdIOCtx.
int gdImagePngCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdPngWriteOptions *options)
Write an image as PNG data to a gdIOCtx using write options.
void gdImagePng(gdImagePtr im, FILE *out)
Write an image as PNG data to a stdio file.
Definition gd_png.c:1691
void gdPngInfoInit(gdPngInfo *info)
Initialize a gdPngInfo structure with default values.
Definition gd_png.c:1590
void gdImagePngCtxEx(gdImagePtr im, gdIOCtxPtr out, int level)
Write an image as PNG data to a gdIOCtx with a compression level.
int gdPngGetInfo(FILE *in, gdPngInfo *info)
Read PNG header information from a stdio file.
Definition gd_png.c:1607
void * gdImagePngPtrWithOptions(gdImagePtr im, int *size, const gdPngWriteOptions *options)
Write an image as PNG data to a memory buffer using write options.
Definition gd_png.c:1653
gdImagePtr gdImageCreateFromPngPtr(int size, void *data)
Create an image from a PNG memory buffer.
Definition gd_png.c:1670
const char * gdPngGetVersionString(void)
Return a string describing the linked libpng version.
void gdPngWriteOptionsInit(gdPngWriteOptions *options)
Initialize PNG write options with default values.
Definition gd_png.c:1582
int gdPngGetInfoCtx(gdIOCtxPtr in, gdPngInfo *info)
Read PNG header information from a gdIOCtx.
gdImagePtr gdImageCreateFromPng(FILE *fd)
Create an image from a PNG stdio file.
Definition gd_png.c:1663
@ GD_PNG_COMPRESSION_STRATEGY_DEFAULT
Definition gd.h:800
@ GD_PNG_COMPRESSION_STRATEGY_HUFFMAN_ONLY
Definition gd.h:802
@ GD_PNG_COMPRESSION_STRATEGY_FIXED
Definition gd.h:804
@ GD_PNG_COMPRESSION_STRATEGY_FILTERED
Definition gd.h:801
@ GD_PNG_COMPRESSION_STRATEGY_RLE
Definition gd.h:803
int gdQoiGetInfoPtr(int size, const void *data, gdQoiInfo *info)
Read QOI header information from a memory buffer.
Definition gd_qoi.c:177
gdImagePtr gdImageCreateFromQoi(FILE *fd)
Create an image from a QOI stdio file.
Definition gd_qoi.c:299
void gdImageQoi(gdImagePtr im, FILE *out)
Write an image as QOI data to a memory buffer.
Definition gd_qoi.c:358
void gdImageQoiCtxEx(gdImagePtr im, gdIOCtxPtr out, int colorspace)
Write an image as QOI data to a gdIOCtx with an explicit colorspace flag.
void * gdImageQoiPtr(gdImagePtr im, int *size)
Write an image as QOI data to a newly allocated memory buffer.
Definition gd_qoi.c:394
void gdQoiInfoInit(gdQoiInfo *info)
Initialize a gdQoiInfo structure to default values.
Definition gd_qoi.c:170
void gdImageQoiCtx(gdImagePtr im, gdIOCtxPtr out)
Write an image as QOI data to a gdIOCtx.
int gdImageQoiCtxWithOptions(gdImagePtr im, gdIOCtxPtr out, const gdQoiWriteOptions *options)
Write an image as QOI data to a gdIOCtx with options.
gdImagePtr gdImageCreateFromQoiCtx(gdIOCtxPtr in)
Create an image from QOI data read through a gdIOCtx.
int gdImageQoiWithOptions(gdImagePtr im, FILE *out, const gdQoiWriteOptions *options)
Write an image as QOI data to a stdio file with options.
Definition gd_qoi.c:347
int gdQoiGetInfoCtx(gdIOCtxPtr infile, gdQoiInfo *info)
Read QOI header information from a gdIOCtx.
Definition gd_qoi.c:209
gdImagePtr gdImageCreateFromQoiPtr(int size, void *data)
Create an image from a QOI memory buffer.
Definition gd_qoi.c:311
void gdImageQoiEx(gdImagePtr im, FILE *out, int colorspace)
Write an image as QOI data to a stdio file with an explicit colorspace flag.
Definition gd_qoi.c:363
void * gdImageQoiPtrWithOptions(gdImagePtr im, int *size, const gdQoiWriteOptions *options)
Write an image as QOI data to a newly allocated memory buffer with options.
Definition gd_qoi.c:371
int gdQoiGetInfo(FILE *infile, gdQoiInfo *info)
Read QOI header information from a stdio file.
Definition gd_qoi.c:228
void gdQoiWriteOptionsInit(gdQoiWriteOptions *options)
Initialize a gdQoiWriteOptions structure to default values.
Definition gd_qoi.c:245
void * gdImageQoiPtrEx(gdImagePtr im, int *size, int colorspace)
Write an image as QOI data to a memory buffer with an explicit colorspace flag.
Definition gd_qoi.c:399
@ GD_QOI_LINEAR
Definition gd.h:1160
@ GD_QOI_SRGB
Definition gd.h:1159
gdImagePtr gdImageCreateFromTga(FILE *fp)
Create an image from TGA data in a stdio stream.
Definition gd_tga.c:42
gdImagePtr gdImageCreateFromTgaCtx(gdIOCtxPtr ctx)
Create an image from TGA data in a gdIOCtx.
gdImagePtr gdImageCreateFromTgaPtr(int size, void *data)
Create an image from a TGA memory buffer.
Definition gd_tga.c:56
void gdTiffWriteOptionsInit(gdTiffWriteOptions *options)
Initialize TIFF write options with defaults.
Definition gd_tiff.c:2631
gdTiffWritePtr gdTiffWriteOpen(FILE *outFile, const gdTiffWriteOptions *options)
Open a TIFF writer for a stdio file.
Definition gd_tiff.c:2647
gdTiffPlanarConfig
TIFF planar configuration tag values.
Definition gd.h:3978
int gdTiffReadGetInfo(gdTiffReadPtr tiff, gdTiffInfo *info)
Get TIFF file information from a reader.
Definition gd_tiff.c:2591
void gdTiffReadOptionsInit(gdTiffReadOptions *options)
Initialize TIFF read options with defaults.
Definition gd_tiff.c:2552
void * gdImageTiffPtr(gdImagePtr im, int *size)
Write an image as TIFF data to a newly allocated memory buffer.
Definition gd_tiff.c:2544
gdTiffReadPtr gdTiffReadOpenPtr(int size, void *data, const gdTiffReadOptions *options)
Open a TIFF multi-page reader from a memory buffer.
Definition gd_tiff.c:2576
gdImagePtr gdImageCreateFromTiffPtr(int size, void *data)
Create an image from a TIFF memory buffer.
Definition gd_tiff.c:2529
void gdTiffWriteClose(gdTiffWritePtr write)
Close a file or gdIOCtx TIFF writer.
Definition gd_tiff.c:2680
gdTiffPhotometric
TIFF photometric interpretation tag values.
Definition gd.h:3964
int gdTiffWriteAddImage(gdTiffWritePtr write, gdImagePtr image)
Add an image as the next TIFF page.
Definition gd_tiff.c:2672
void gdImageTiffCtx(gdImagePtr image, gdIOCtxPtr out)
Write an image as TIFF data to a gdIOCtx.
gdTiffWritePtr gdTiffWriteOpenCtx(gdIOCtxPtr out, const gdTiffWriteOptions *options)
Open a TIFF writer for a gdIOCtx.
Definition gd_tiff.c:2656
gdTiffCompression
TIFF compression tag values.
Definition gd.h:3949
int gdTiffIsMultiPageCtx(gdIOCtxPtr in)
Test whether TIFF data read through a seekable gdIOCtx has more than one page.
Definition gd_tiff.c:2616
int gdTiffReadGetMetadata(gdTiffReadPtr tiff, gdImageMetadata *metadata)
gdTiffWritePtr gdTiffWriteOpenPtr(const gdTiffWriteOptions *options)
Open a TIFF writer that returns a memory buffer.
Definition gd_tiff.c:2665
struct gdTiffReadStruct * gdTiffReadPtr
Opaque TIFF multi-page reader handle.
Definition gd.h:3760
gdImagePtr gdImageCreateFromTiffCtx(gdIOCtxPtr infile)
Create an image from TIFF data read through a gdIOCtx.
int gdTiffReadNextImage(gdTiffReadPtr tiff, gdTiffPageInfo *info, gdImagePtr *image)
Read the next TIFF page image.
Definition gd_tiff.c:2600
int gdTiffIsMultiPagePtr(int size, void *data)
Test whether a TIFF memory buffer has more than one page.
Definition gd_tiff.c:2623
struct gdTiffWriteStruct * gdTiffWritePtr
Opaque TIFF writer handle.
Definition gd.h:4032
void gdImageTiff(gdImagePtr im, FILE *outFile)
Write an image as TIFF data to a stdio file.
Definition gd_tiff.c:2537
gdTiffColorSpace
TIFF writer color spaces.
Definition gd.h:3939
gdTiffReadPtr gdTiffReadOpenCtx(gdIOCtxPtr in, const gdTiffReadOptions *options)
Open a TIFF multi-page reader from a gdIOCtx.
Definition gd_tiff.c:2568
gdTiffResolutionUnit
TIFF resolution unit tag values.
Definition gd.h:3986
void * gdTiffWritePtrFinish(gdTiffWritePtr write, int *size)
Finish a TIFF memory writer and return the encoded buffer.
Definition gd_tiff.c:2686
gdImagePtr gdImageCreateFromTiff(FILE *inFile)
Create an image from a TIFF stdio file.
Definition gd_tiff.c:2522
gdTiffAlphaType
TIFF alpha sample types.
Definition gd.h:3995
int gdTiffIsMultiPage(FILE *fd)
Test whether a TIFF stdio file has more than one page.
Definition gd_tiff.c:2609
gdTiffReadPtr gdTiffReadOpen(FILE *fd, const gdTiffReadOptions *options)
Open a TIFF multi-page reader from a stdio file.
Definition gd_tiff.c:2560
void gdTiffReadClose(gdTiffReadPtr tiff)
Close a TIFF multi-page reader.
Definition gd_tiff.c:2585
@ GD_TIFF_PLANARCONFIG_CONTIG
Definition gd.h:3979
@ GD_TIFF_PLANARCONFIG_SEPARATE
Definition gd.h:3980
@ GD_TIFF_PHOTOMETRIC_YCBCR
Definition gd.h:3971
@ GD_TIFF_PHOTOMETRIC_CIELAB
Definition gd.h:3972
@ GD_TIFF_PHOTOMETRIC_RGB
Definition gd.h:3967
@ GD_TIFF_PHOTOMETRIC_SEPARATED
Definition gd.h:3970
@ GD_TIFF_PHOTOMETRIC_MINISWHITE
Definition gd.h:3965
@ GD_TIFF_PHOTOMETRIC_MINISBLACK
Definition gd.h:3966
@ GD_TIFF_PHOTOMETRIC_TRANSPARENCY_MASK
Definition gd.h:3969
@ GD_TIFF_PHOTOMETRIC_PALETTE
Definition gd.h:3968
@ GD_TIFF_COMPRESSION_LZW
Definition gd.h:3954
@ GD_TIFF_COMPRESSION_NONE
Definition gd.h:3950
@ GD_TIFF_COMPRESSION_CCITT_FAX3
Definition gd.h:3952
@ GD_TIFF_COMPRESSION_ADOBE_DEFLATE
Definition gd.h:3956
@ GD_TIFF_COMPRESSION_CCITT_FAX4
Definition gd.h:3953
@ GD_TIFF_COMPRESSION_CCITT_RLE
Definition gd.h:3951
@ GD_TIFF_COMPRESSION_JPEG
Definition gd.h:3955
@ GD_TIFF_COMPRESSION_PACKBITS
Definition gd.h:3958
@ GD_TIFF_COMPRESSION_DEFLATE
Definition gd.h:3957
@ GD_TIFF_GRAY
Definition gd.h:3942
@ GD_TIFF_RGB
Definition gd.h:3940
@ GD_TIFF_BILEVEL
Definition gd.h:3943
@ GD_TIFF_RGBA
Definition gd.h:3941
@ GD_TIFF_RESUNIT_INCH
Definition gd.h:3988
@ GD_TIFF_RESUNIT_NONE
Definition gd.h:3987
@ GD_TIFF_RESUNIT_CENTIMETER
Definition gd.h:3989
@ GD_TIFF_ALPHA_UNASSOCIATED
Definition gd.h:3996
@ GD_TIFF_ALPHA_ASSOCIATED
Definition gd.h:3997
int gdUhdrImageWidth(gdUhdrImagePtr im)
Return the UltraHDR image width.
Definition gd_uhdr.c:695
int gdUhdrImageHasGainMap(gdUhdrImagePtr im)
Return whether the UltraHDR image has a gain map.
Definition gd_uhdr.c:711
void gdUhdrImageDestroy(gdUhdrImagePtr im)
Destroy an UltraHDR image handle.
Definition gd_uhdr.c:684
void * gdUhdrImageWritePtr(gdUhdrImagePtr im, int *size, int format, int quality, gdUhdrErrorPtr err)
Write an UltraHDR image to a newly allocated memory buffer.
Definition gd_uhdr.c:1079
int gdUhdrImageHeight(gdUhdrImagePtr im)
Return the UltraHDR image height.
Definition gd_uhdr.c:703
gdUhdrImage * gdUhdrImagePtr
Pointer to an opaque UltraHDR image handle.
Definition gd.h:4668
gdImagePtr gdUhdrImageGetSdr(gdUhdrImagePtr im, gdUhdrErrorPtr err)
Decode the SDR view of an UltraHDR image as a gdImage.
Definition gd_uhdr.c:1117
int gdUhdrImageMirror(gdUhdrImagePtr im, int axis, gdUhdrErrorPtr err)
Queue an UltraHDR-preserving mirror operation.
Definition gd_uhdr.c:813
int gdUhdrImageRotate(gdUhdrImagePtr im, int degrees, gdUhdrErrorPtr err)
Queue an UltraHDR-preserving right-angle rotation.
Definition gd_uhdr.c:787
int gdUhdrImageCrop(gdUhdrImagePtr im, int left, int top, int width, int height, gdUhdrErrorPtr err)
Queue an UltraHDR-preserving crop operation.
Definition gd_uhdr.c:747
gdUhdrFormat
UltraHDR container format selector.
Definition gd.h:4658
gdUhdrImagePtr gdUhdrImageCreateFromFile(const char *filename, int format, gdUhdrErrorPtr err)
Create an UltraHDR image handle from a file path.
Definition gd_uhdr.c:597
gdUhdrImagePtr gdUhdrImageCreateFromCtx(gdIOCtxPtr ctx, int format, gdUhdrErrorPtr err)
Create an UltraHDR image handle from an IO context.
Definition gd_uhdr.c:635
int gdUhdrImageFile(gdUhdrImagePtr im, const char *filename, int format, int quality, gdUhdrErrorPtr err)
Write an UltraHDR image to a file path.
Definition gd_uhdr.c:839
int gdUhdrImageResize(gdUhdrImagePtr im, int width, int height, gdUhdrErrorPtr err)
Queue an UltraHDR-preserving resize operation.
Definition gd_uhdr.c:720
int gdUhdrIsAvailable(void)
Return whether UltraHDR support is available in this build.
Definition gd_uhdr.c:587
int gdUhdrImageCtx(gdUhdrImagePtr im, gdIOCtxPtr ctx, int format, int quality, gdUhdrErrorPtr err)
Write an UltraHDR image to an IO context.
Definition gd_uhdr.c:880
gdUhdrError * gdUhdrErrorPtr
Pointer to a gdUhdrError structure.
Definition gd.h:4678
struct gdUhdrImageStruct gdUhdrImage
Opaque UltraHDR image handle.
Definition gd.h:4665
gdUhdrImagePtr gdUhdrImageCreateFromPtr(int size, void *data, int format, gdUhdrErrorPtr err)
Create an UltraHDR image handle from memory.
Definition gd_uhdr.c:666
@ GD_UHDR_FORMAT_JPEG
Definition gd.h:4659
@ GD_UHDR_FORMAT_WEBP
Definition gd.h:4660
@ GD_UHDR_FORMAT_HEIF
Definition gd.h:4661
void * gdImageWBMPPtr(gdImagePtr im, int *size, int fg)
Write an image as WBMP data to a newly allocated memory buffer.
Definition gd_wbmp.c:198
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtxPtr infile)
Create an image from WBMP data read through a gdIOCtx.
void gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtxPtr out)
Write an image as WBMP data to a gdIOCtx.
gdImagePtr gdImageCreateFromWBMP(FILE *inFile)
Create an image from a WBMP stdio file.
Definition gd_wbmp.c:166
void gdImageWBMP(gdImagePtr image, int fg, FILE *out)
Write an image as WBMP data to a stdio file.
Definition gd_wbmp.c:189
gdImagePtr gdImageCreateFromWBMPPtr(int size, void *data)
Create an image from a WBMP memory buffer.
Definition gd_wbmp.c:177
void gdImageWebpCtx(gdImagePtr im, gdIOCtxPtr outfile, int quantization)
Write an image as WebP data to a gdIOCtx with a quality setting.
gdWebpReadPtr gdWebpReadOpenCtx(gdIOCtxPtr in, const gdWebpReadOptions *options)
Open a WebP animation reader from a gdIOCtx.
Definition gd_webp.c:1376
void gdWebpAnimWriteOptionsInit(gdWebpAnimWriteOptions *options)
Initialize WebP multi-image/animation write options with gd defaults.
Definition gd_webp.c:1243
struct gdWebpWrite * gdWebpWritePtr
Opaque WebP animation writer handle.
Definition gd.h:2169
int gdWebpReadGetMetadata(gdWebpReadPtr webp, gdImageMetadata *metadata)
Extract opaque EXIF, XMP, and ICC metadata from a WebP reader.
Definition gd_webp.c:1408
int gdWebpIsAnimated(FILE *fd)
Test whether a WebP stdio file contains animation.
Definition gd_webp.c:1345
int gdWebpWriteAddImage(gdWebpWritePtr webp, gdImagePtr image, int durationMs)
Add an image to a WebP animation writer.
Definition gd_webp.c:1467
void gdImageWebpEx(gdImagePtr im, FILE *outFile, int quantization)
Write an image as WebP data to a stdio file with a quality setting.
Definition gd_webp.c:1283
void gdImageWebp(gdImagePtr im, FILE *outFile)
Write an image as WebP data to a stdio file with default quality.
Definition gd_webp.c:1291
int gdImageWebpWithOptions(gdImagePtr im, FILE *outFile, const gdWebpWriteOptions *options)
Write an image as WebP data to a stdio file using write options.
Definition gd_webp.c:1316
void * gdImageWebpPtrWithOptions(gdImagePtr im, int *size, const gdWebpWriteOptions *options)
Write an image as WebP data to a newly allocated memory buffer using write options.
Definition gd_webp.c:1336
int gdWebpReadNextFrame(gdWebpReadPtr webp, gdWebpFrameInfo *info, gdImagePtr *frame)
Read the next raw WebP animation frame rectangle.
Definition gd_webp.c:1417
gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr infile)
Create a truecolor image from WebP data read through a gdIOCtx.
void gdWebpReadClose(gdWebpReadPtr webp)
Close a WebP animation reader.
Definition gd_webp.c:1394
struct gdWebpRead * gdWebpReadPtr
Opaque WebP animation reader handle.
Definition gd.h:2160
void gdWebpWriteOptionsInit(gdWebpWriteOptions *options)
Initialize WebP still-image write options with gd defaults.
Definition gd_webp.c:1233
int gdImageWebpCtxWithOptions(gdImagePtr im, gdIOCtxPtr outfile, const gdWebpWriteOptions *options)
Write an image as WebP data to a gdIOCtx using write options.
Definition gd_webp.c:1326
int gdWebpReadNextImage(gdWebpReadPtr webp, gdWebpFrameInfo *info, gdImagePtr *image)
Read the next coalesced WebP animation image.
Definition gd_webp.c:1429
void * gdWebpWritePtrFinish(gdWebpWritePtr webp, int *size)
Finish a WebP memory writer and return the encoded buffer.
Definition gd_webp.c:1482
int gdWebpIsAnimatedPtr(int size, void *data)
Test whether a WebP memory buffer contains animation.
Definition gd_webp.c:1359
gdWebpReadPtr gdWebpReadOpenPtr(int size, void *data, const gdWebpReadOptions *options)
Open a WebP animation reader from a memory buffer.
Definition gd_webp.c:1385
gdImagePtr gdImageCreateFromWebp(FILE *inFile)
Create a truecolor image from a WebP stdio file.
Definition gd_webp.c:1253
gdImagePtr gdImageCreateFromWebpPtr(int size, void *data)
Create a truecolor image from a WebP memory buffer.
Definition gd_webp.c:1260
void gdWebpReadOptionsInit(gdWebpReadOptions *options)
Initialize WebP multi-image/animation read options with gd defaults.
Definition gd_webp.c:1224
gdWebpWritePtr gdWebpWriteOpenCtx(gdIOCtxPtr out, const gdWebpAnimWriteOptions *options)
Open a WebP animation writer for a gdIOCtx.
Definition gd_webp.c:1450
void gdWebpWriteClose(gdWebpWritePtr webp)
Finish, write, and close a WebP animation writer.
Definition gd_webp.c:1476
gdWebpReadPtr gdWebpReadOpen(FILE *fd, const gdWebpReadOptions *options)
Open a WebP animation reader from a stdio file.
Definition gd_webp.c:1367
void * gdImageWebpPtr(gdImagePtr im, int *size)
Write an image as WebP data to a newly allocated memory buffer.
Definition gd_webp.c:1298
int gdWebpIsAnimatedCtx(gdIOCtxPtr in)
Test whether a seekable gdIOCtx contains animated WebP data.
Definition gd_webp.c:1352
int gdWebpReadGetInfo(gdWebpReadPtr webp, gdWebpInfo *info)
Get WebP container information from a WebP reader.
Definition gd_webp.c:1400
gdWebpWritePtr gdWebpWriteOpenPtr(const gdWebpAnimWriteOptions *options)
Open a WebP animation writer that returns a memory buffer.
Definition gd_webp.c:1459
void * gdImageWebpPtrEx(gdImagePtr im, int *size, int quantization)
Write an image as WebP data to a newly allocated memory buffer with a quality setting.
Definition gd_webp.c:1306
gdWebpWritePtr gdWebpWriteOpen(FILE *outFile, const gdWebpAnimWriteOptions *options)
Open a WebP animation writer for a stdio file.
Definition gd_webp.c:1441
@ gdWebpDisposeNone
Definition gd.h:2268
@ gdWebpDisposeBackground
Definition gd.h:2269
@ gdWebpBlendNone
Definition gd.h:2277
@ gdWebpBlendAlpha
Definition gd.h:2276
void gdImageXbmCtx(gdImagePtr image, char *file_name, int fg, gdIOCtxPtr out)
Write an image to an IO context in X11 bitmap format.
gdImagePtr gdImageCreateFromXbm(FILE *in)
Create an image from XBM data in a stdio stream.
Definition gd_xbm.c:23
gdIOCtxPtr gdNewDynamicCtxEx(int size, void *data, int freeFlag)
Creates a new I/O context for reading/writing to a dynamic memory buffer with control over memory man...
Definition gd_io_dp.c:80
gdIOCtxPtr gdNewSSCtx(gdSourcePtr in, gdSinkPtr out)
Definition gd_io_ss.c:54
gdIOCtxPtr gdNewDynamicCtx(int size, void *data)
Creates a new I/O context for reading/writing to a dynamic memory buffer.
Definition gd_io_dp.c:70
gdIOCtxPtr gdNewFileCtx(FILE *)
Creates a new I/O context for reading/writing to a file.
Definition gd_io_file.c:50
gdImageReadStatus
Status values for extended automatic image readers.
Definition gd.h:5475
gdImagePtr gdImageReadCtxEx(gdIOCtxPtr ctx, int flags, gdImageReadStatus *status, const char **format_name)
Read an image from a gdIOCtx with extended status information.
Definition gd_readimage.c:214
gdImagePtr gdImageReadFile(const char *filename)
Read an image file by probing its binary signature.
Definition gd_readimage.c:274
gdImagePtr gdImageCreateFromFile(const char *filename)
Create an image from a file using the filename extension.
Definition gd_filename.c:125
int gdSupportsFileType(const char *filename, int writing)
Test if a given file type is supported by GD.
Definition gd_filename.c:118
int gdImageFile(gdImagePtr im, const char *filename)
Write an image to a file in the format indicated by the filename.
Definition gd_filename.c:150
gdImagePtr gdImageReadCtx(gdIOCtxPtr ctx)
Read an image from a gdIOCtx by probing its binary signature.
Definition gd_readimage.c:193
@ gdImageReadStatusOk
Definition gd.h:5476
@ gdImageReadStatusCodecUnavailable
Definition gd.h:5479
@ gdImageReadStatusDecodeFailed
Definition gd.h:5480
@ gdImageReadStatusUnsupportedFormat
Definition gd.h:5478
@ gdImageReadStatusUnrecognized
Definition gd.h:5477
gdImageDiffMode
Options for perceptual image comparison mode.
Definition gd.h:7860
int gdImageCompare(gdImagePtr im1, gdImagePtr im2)
Compare two images.
Definition gd.c:3222
@ GD_IMAGE_DIFF_NONE
Definition gd.h:7861
@ GD_IMAGE_DIFF_MASK
Definition gd.h:7863
@ GD_IMAGE_DIFF_OVERLAY
Definition gd.h:7862
Write an image as JPEG data to a gdIOCtx.
Options for automatic cropping.
Definition gd.h:8017
int color
Definition gd.h:8020
float threshold
Definition gd.h:8019
enum gdCropMode mode
Definition gd.h:8018
Information extracted from the AVIF image and container.
Definition gd.h:3496
int width
Definition gd.h:3497
int bit_depth
Definition gd.h:3504
int is_animation
Definition gd.h:3499
int height
Definition gd.h:3498
int has_alpha
Definition gd.h:3503
gdImageMetadata * metadata
Definition gd.h:3506
int frame_count
Definition gd.h:3501
double duration
Definition gd.h:3502
int is_progressive
Definition gd.h:3500
int yuv_format
Definition gd.h:3505
AVIF encoder options used by gdImageAvifPtrWithOptions().
Definition gd.h:3479
int lossless
Definition gd.h:3482
int speed
Definition gd.h:3481
const gdImageMetadata * metadata
Definition gd.h:3484
int chroma_subsampling
Definition gd.h:3483
int quality
Definition gd.h:3480
Definition gd.h:4336
int planes
Definition gd.h:4341
unsigned int red_mask
Definition gd.h:4351
int compression
Definition gd.h:4343
int colors_used
Definition gd.h:4347
unsigned int green_mask
Definition gd.h:4352
int image_size
Definition gd.h:4344
int important_colors
Definition gd.h:4348
int bits_per_pixel
Definition gd.h:4342
int width
Definition gd.h:4338
int header_type
Definition gd.h:4337
unsigned int alpha_mask
Definition gd.h:4354
unsigned int blue_mask
Definition gd.h:4353
int horizontal_resolution
Definition gd.h:4345
int top_down
Definition gd.h:4340
int vertical_resolution
Definition gd.h:4346
int palette_entries
Definition gd.h:4350
int palette_type
Definition gd.h:4349
int height
Definition gd.h:4339
Structured BMP writer options.
Definition gd.h:4463
int flags
Definition gd.h:4466
int bits_per_pixel
Definition gd.h:4464
int compression
Definition gd.h:4465
const gdImageMetadata * metadata
Definition gd.h:4467
Structure for passing additional parameters to FreeType 2 string rendering functions.
Definition gd.h:6417
int vdpi
Definition gd.h:6424
int hdpi
Definition gd.h:6423
char * fontpath
Definition gd.h:6428
char * xshow
Definition gd.h:6425
int charmap
Definition gd.h:6420
double linespacing
Definition gd.h:6419
int flags
Definition gd.h:6418
Per-frame information read from a GIF animation.
Definition gd.h:1350
int x
Definition gd.h:1352
int delay
Definition gd.h:1356
int frame_index
Definition gd.h:1351
int width
Definition gd.h:1354
int y
Definition gd.h:1353
int transparent_index
Definition gd.h:1358
int local_color_table
Definition gd.h:1359
int interlace
Definition gd.h:1360
int height
Definition gd.h:1355
int disposal
Definition gd.h:1357
Basic information read from a GIF stream.
Definition gd.h:1335
int background_index
Definition gd.h:1339
double pixel_aspect_ratio
Definition gd.h:1342
int global_color_table
Definition gd.h:1340
int height
Definition gd.h:1338
int color_resolution
Definition gd.h:1341
int loop_count_present
Definition gd.h:1344
int width
Definition gd.h:1337
int loop_count
Definition gd.h:1343
Information extracted from a HEIF image and its container.
Definition gd.h:3137
HEIF decoder options used by gdImageCreateFromHeifPtrWithOptions().
Definition gd.h:3113
int ignore_transformations
Definition gd.h:3114
HEIF encoder options used by gdImageHeifPtrWithOptions().
Definition gd.h:3118
int lossless
Definition gd.h:3120
gdHeifCodec codec
Definition gd.h:3121
int quality
Definition gd.h:3119
const gdImageMetadata * metadata
Definition gd.h:3123
gdHeifChroma chroma
Definition gd.h:3122
Options for perceptual image comparison.
Definition gd.h:7867
gdImageDiffMode mode
Definition gd.h:7868
int highlight_color
Definition gd.h:7869
Result of perceptual image comparison.
Definition gd.h:7873
unsigned int pixels_changed
Definition gd.h:7874
double maximum_delta
Definition gd.h:7876
Basic information read from a JPEG header.
Definition gd.h:1809
int bits_per_sample
Definition gd.h:1812
int progressive
Definition gd.h:1815
int components
Definition gd.h:1813
int height
Definition gd.h:1811
int width
Definition gd.h:1810
int y_density
Definition gd.h:1818
int density_unit
Definition gd.h:1816
int x_density
Definition gd.h:1817
int color_space
Definition gd.h:1814
Options for reading JPEG data.
Definition gd.h:1826
int dct_method
Definition gd.h:1830
int ignore_warning
Definition gd.h:1827
unsigned int scale_num
Definition gd.h:1828
unsigned int scale_denom
Definition gd.h:1829
Options for writing JPEG data.
Definition gd.h:1836
int force_no_subsampling
Definition gd.h:1839
const gdImageMetadata * metadata
Definition gd.h:1840
int quality
Definition gd.h:1837
int progressive
Definition gd.h:1838
JPEG XL animation writer options.
Definition gd.h:2822
int canvas_height
Definition gd.h:2824
int lossless
Definition gd.h:2825
int canvas_width
Definition gd.h:2823
float distance
Definition gd.h:2826
int loop_count
Definition gd.h:2828
int effort
Definition gd.h:2827
JPEG XL raw frame information.
Definition gd.h:2791
int width
Definition gd.h:2795
int height
Definition gd.h:2796
int blend_mode
Definition gd.h:2797
int delay_ms
Definition gd.h:2792
int is_last
Definition gd.h:2798
int x_offset
Definition gd.h:2793
int y_offset
Definition gd.h:2794
JPEG XL top-level file information.
Definition gd.h:2781
int width
Definition gd.h:2782
int height
Definition gd.h:2783
int animated
Definition gd.h:2784
int loop_count
Definition gd.h:2785
JPEG XL multi-image/animation reader options.
Definition gd.h:2815
int coalesced
Definition gd.h:2816
JPEG XL still-image writer options.
Definition gd.h:2699
float distance
Definition gd.h:2701
const gdImageMetadata * metadata
Definition gd.h:2703
int lossless
Definition gd.h:2700
int effort
Definition gd.h:2702
Basic information read from a PNG stream.
Definition gd.h:829
int bit_depth
Definition gd.h:832
int has_alpha
Definition gd.h:834
int decoded_truecolor
Definition gd.h:842
int x_pixels_per_unit
Definition gd.h:838
int y_pixels_per_unit
Definition gd.h:839
int width
Definition gd.h:830
int has_transparency
Definition gd.h:835
gdImageMetadata * metadata
Definition gd.h:841
int color_type
Definition gd.h:833
int palette_entries
Definition gd.h:836
int resolution_x
Definition gd.h:843
int resolution_y
Definition gd.h:844
int height
Definition gd.h:831
int physical_unit
Definition gd.h:840
int interlace_method
Definition gd.h:837
Options for writing PNG data.
Definition gd.h:810
int compression_strategy
Definition gd.h:813
unsigned int filters
Definition gd.h:812
int compression_level
Definition gd.h:811
unsigned int resolution_y
Definition gd.h:816
unsigned int resolution_x
Definition gd.h:815
const gdImageMetadata * metadata
Definition gd.h:814
Defines a point in a 2D coordinate system using floating point values.
Definition gd.h:518
double y
Definition gd.h:519
A point in the coordinate space of the image.
Definition gd.h:6614
int y
Definition gd.h:6615
Information read from a QOI data.
Definition gd.h:1007
int colorspace
Definition gd.h:1011
int channels
Definition gd.h:1010
unsigned int height
Definition gd.h:1009
unsigned int width
Definition gd.h:1008
Options for writing QOI data.
Definition gd.h:1058
const gdImageMetadata * metadata
Definition gd.h:1060
int colorspace
Definition gd.h:1059
A rectangle in the coordinate space of the image.
Definition gd.h:6621
int height
Definition gd.h:6623
int y
Definition gd.h:6622
Definition gd.h:8196
gdScaleStrategy strategy
Definition gd.h:8199
gdScaleGravity gravity
Definition gd.h:8198
int interpolation
Definition gd.h:8201
gdScaleFit fit
Definition gd.h:8197
int background_color
Definition gd.h:8200
Options to Scatter an image.
Definition gd.h:7266
int sub
Definition gd.h:7267
unsigned int seed
Definition gd.h:7271
int * colors
Definition gd.h:7270
unsigned int num_colors
Definition gd.h:7269
int plus
Definition gd.h:7268
Definition gd.h:5814
Definition gd.h:4777
TIFF file information from the first page and container.
Definition gd.h:3774
int bits_per_sample
Definition gd.h:3778
int samples_per_pixel
Definition gd.h:3779
int photometric
Definition gd.h:3781
int height
Definition gd.h:3776
float x_resolution
Definition gd.h:3782
int compression
Definition gd.h:3780
float y_resolution
Definition gd.h:3783
int page_count
Definition gd.h:3777
int width
Definition gd.h:3775
int resolution_unit
Definition gd.h:3784
TIFF page information returned while reading pages.
Definition gd.h:3790
int has_alpha
Definition gd.h:3799
int photometric
Definition gd.h:3797
int width
Definition gd.h:3792
int page_index
Definition gd.h:3791
int planar
Definition gd.h:3798
int resolution_unit
Definition gd.h:3803
float y_resolution
Definition gd.h:3802
int is_tiled
Definition gd.h:3800
int bits_per_sample
Definition gd.h:3794
float x_resolution
Definition gd.h:3801
int height
Definition gd.h:3793
int compression
Definition gd.h:3796
int samples_per_pixel
Definition gd.h:3795
Options for reading TIFF data with the gdTiffRead*() API.
Definition gd.h:3767
int notused
Definition gd.h:3768
Options for writing TIFF data with the gdTiffWrite*() API.
Definition gd.h:4012
int minIsWhite
Definition gd.h:4017
float xResolution
Definition gd.h:4019
int jpegQuality
Definition gd.h:4016
gdTiffCompression compression
Definition gd.h:4015
gdTiffResolutionUnit resolutionUnit
Definition gd.h:4018
const gdImageMetadata * metadata
Definition gd.h:4022
gdTiffAlphaType alphaType
Definition gd.h:4021
int bitDepth
Definition gd.h:4013
gdTiffColorSpace colorspace
Definition gd.h:4014
float yResolution
Definition gd.h:4020
Structured error details for UltraHDR APIs.
Definition gd.h:4671
int code
Definition gd.h:4672
int provider_code
Definition gd.h:4673
WebP animation writer options.
Definition gd.h:2219
int loop_count
Definition gd.h:2222
int quality
Definition gd.h:2224
int background_color
Definition gd.h:2223
int canvas_width
Definition gd.h:2220
int lossless
Definition gd.h:2225
int kmin
Definition gd.h:2228
int kmax
Definition gd.h:2229
int minimize_size
Definition gd.h:2227
int canvas_height
Definition gd.h:2221
int allow_mixed
Definition gd.h:2230
int method
Definition gd.h:2226
WebP animation frame information.
Definition gd.h:2187
int has_alpha
Definition gd.h:2197
int frame_index
Definition gd.h:2188
int height
Definition gd.h:2192
int x
Definition gd.h:2189
int complete
Definition gd.h:2198
int dispose
Definition gd.h:2195
int duration
Definition gd.h:2193
int timestamp
Definition gd.h:2194
int width
Definition gd.h:2191
int y
Definition gd.h:2190
int blend
Definition gd.h:2196
WebP container information.
Definition gd.h:2174
int format_flags
Definition gd.h:2180
int background_color
Definition gd.h:2179
int frame_count
Definition gd.h:2177
int loop_count
Definition gd.h:2178
int height
Definition gd.h:2176
int width
Definition gd.h:2175
int is_animation
Definition gd.h:2181
WebP multi-image/animation reader options.
Definition gd.h:2204
int coalesced
Definition gd.h:2205
WebP still-image writer options.
Definition gd.h:2211
int quality
Definition gd.h:2212
const gdImageMetadata * metadata
Definition gd.h:2213