| 1 | #ifdef __cplusplus
|
|---|
| 2 | extern "C" {
|
|---|
| 3 | #endif
|
|---|
| 4 |
|
|---|
| 5 | #ifndef GD_H
|
|---|
| 6 | #define GD_H 1
|
|---|
| 7 |
|
|---|
| 8 | #define GD_MAJOR_VERSION 2
|
|---|
| 9 | #define GD_MINOR_VERSION 1
|
|---|
| 10 | #define GD_RELEASE_VERSION 0
|
|---|
| 11 | #define GD_EXTRA_VERSION "alpha"
|
|---|
| 12 | #define GD_VERSION_STRING "2.1.0-alpha"
|
|---|
| 13 |
|
|---|
| 14 | /* Do the DLL dance: dllexport when building the DLL,
|
|---|
| 15 | dllimport when importing from it, nothing when
|
|---|
| 16 | not on Silly Silly Windows (tm Aardman Productions). */
|
|---|
| 17 |
|
|---|
| 18 | /* 2.0.20: for headers */
|
|---|
| 19 |
|
|---|
| 20 | /* 2.0.24: __stdcall also needed for Visual BASIC
|
|---|
| 21 | and other languages. This breaks ABI compatibility
|
|---|
| 22 | with previous DLL revs, but it's necessary. */
|
|---|
| 23 |
|
|---|
| 24 | /* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
|
|---|
| 25 | wish to build gd as a static library or by directly including
|
|---|
| 26 | the gd sources in a project. */
|
|---|
| 27 |
|
|---|
| 28 | /* http://gcc.gnu.org/wiki/Visibility */
|
|---|
| 29 | #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
|
|---|
| 30 | # ifdef BGDWIN32
|
|---|
| 31 | # ifdef NONDLL
|
|---|
| 32 | # define BGD_EXPORT_DATA_PROT
|
|---|
| 33 | # else
|
|---|
| 34 | # ifdef __GNUC__
|
|---|
| 35 | # define BGD_EXPORT_DATA_PROT __attribute__ ((dllexport))
|
|---|
| 36 | # else
|
|---|
| 37 | # define BGD_EXPORT_DATA_PROT __declspec(dllexport)
|
|---|
| 38 | # endif
|
|---|
| 39 | # endif
|
|---|
| 40 | # else
|
|---|
| 41 | # ifdef __GNUC__
|
|---|
| 42 | # define BGD_EXPORT_DATA_PROT __attribute__ ((dllimport))
|
|---|
| 43 | # else
|
|---|
| 44 | # define BGD_EXPORT_DATA_PROT __declspec(dllimport)
|
|---|
| 45 | # endif
|
|---|
| 46 | # endif
|
|---|
| 47 | # define BGD_STDCALL __stdcall
|
|---|
| 48 | # define BGD_EXPORT_DATA_IMPL
|
|---|
| 49 | #else
|
|---|
| 50 | # ifdef HAVE_VISIBILITY
|
|---|
| 51 | # define BGD_EXPORT_DATA_PROT __attribute__ ((visibility ("default")))
|
|---|
| 52 | # define BGD_EXPORT_DATA_IMPL __attribute__ ((visibility ("hidden")))
|
|---|
| 53 | # else
|
|---|
| 54 | # define BGD_EXPORT_DATA_PROT
|
|---|
| 55 | # define BGD_EXPORT_DATA_IMPL
|
|---|
| 56 | # endif
|
|---|
| 57 | # define BGD_STDCALL
|
|---|
| 58 | #endif
|
|---|
| 59 |
|
|---|
| 60 | #define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL
|
|---|
| 61 |
|
|---|
| 62 | #ifdef __cplusplus
|
|---|
| 63 | extern "C"
|
|---|
| 64 | {
|
|---|
| 65 | #endif
|
|---|
| 66 |
|
|---|
| 67 | /* gd.h: declarations file for the graphic-draw module.
|
|---|
| 68 | * Permission to use, copy, modify, and distribute this software and its
|
|---|
| 69 | * documentation for any purpose and without fee is hereby granted, provided
|
|---|
| 70 | * that the above copyright notice appear in all copies and that both that
|
|---|
| 71 | * copyright notice and this permission notice appear in supporting
|
|---|
| 72 | * documentation. This software is provided "AS IS." Thomas Boutell and
|
|---|
| 73 | * Boutell.Com, Inc. disclaim all warranties, either express or implied,
|
|---|
| 74 | * including but not limited to implied warranties of merchantability and
|
|---|
| 75 | * fitness for a particular purpose, with respect to this code and accompanying
|
|---|
| 76 | * documentation. */
|
|---|
| 77 |
|
|---|
| 78 | /* stdio is needed for file I/O. */
|
|---|
| 79 | #include <stdio.h>
|
|---|
| 80 | #include <stdarg.h>
|
|---|
| 81 | #include "gd_io.h"
|
|---|
| 82 |
|
|---|
| 83 | /* The maximum number of palette entries in palette-based images.
|
|---|
| 84 | In the wonderful new world of gd 2.0, you can of course have
|
|---|
| 85 | many more colors when using truecolor mode. */
|
|---|
| 86 |
|
|---|
| 87 | #define gdMaxColors 256
|
|---|
| 88 |
|
|---|
| 89 | /* Image type. See functions below; you will not need to change
|
|---|
| 90 | the elements directly. Use the provided macros to
|
|---|
| 91 | access sx, sy, the color table, and colorsTotal for
|
|---|
| 92 | read-only purposes. */
|
|---|
| 93 |
|
|---|
| 94 | /* If 'truecolor' is set true, the image is truecolor;
|
|---|
| 95 | pixels are represented by integers, which
|
|---|
| 96 | must be 32 bits wide or more.
|
|---|
| 97 |
|
|---|
| 98 | True colors are repsented as follows:
|
|---|
| 99 |
|
|---|
| 100 | ARGB
|
|---|
| 101 |
|
|---|
| 102 | Where 'A' (alpha channel) occupies only the
|
|---|
| 103 | LOWER 7 BITS of the MSB. This very small
|
|---|
| 104 | loss of alpha channel resolution allows gd 2.x
|
|---|
| 105 | to keep backwards compatibility by allowing
|
|---|
| 106 | signed integers to be used to represent colors,
|
|---|
| 107 | and negative numbers to represent special cases,
|
|---|
| 108 | just as in gd 1.x. */
|
|---|
| 109 |
|
|---|
| 110 | #define gdAlphaMax 127
|
|---|
| 111 | #define gdAlphaOpaque 0
|
|---|
| 112 | #define gdAlphaTransparent 127
|
|---|
| 113 | #define gdRedMax 255
|
|---|
| 114 | #define gdGreenMax 255
|
|---|
| 115 | #define gdBlueMax 255
|
|---|
| 116 | #define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
|
|---|
| 117 | #define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
|
|---|
| 118 | #define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
|
|---|
| 119 | #define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
|
|---|
| 120 | #define gdEffectReplace 0
|
|---|
| 121 | #define gdEffectAlphaBlend 1
|
|---|
| 122 | #define gdEffectNormal 2
|
|---|
| 123 | #define gdEffectOverlay 3
|
|---|
| 124 |
|
|---|
| 125 | #define GD_TRUE 1
|
|---|
| 126 | #define GD_FALSE 0
|
|---|
| 127 |
|
|---|
| 128 | #define GD_EPSILON 1e-6
|
|---|
| 129 | #ifndef M_PI
|
|---|
| 130 | # define M_PI 3.14159265358979323846
|
|---|
| 131 | #endif
|
|---|
| 132 |
|
|---|
| 133 | /* This function accepts truecolor pixel values only. The
|
|---|
| 134 | source color is composited with the destination color
|
|---|
| 135 | based on the alpha channel value of the source color.
|
|---|
| 136 | The resulting color is opaque. */
|
|---|
| 137 |
|
|---|
| 138 | BGD_DECLARE(int) gdAlphaBlend (int dest, int src);
|
|---|
| 139 |
|
|---|
| 140 | enum gdPaletteQuantizationMethod {
|
|---|
| 141 | GD_QUANT_DEFAULT = 0,
|
|---|
| 142 | GD_QUANT_JQUANT = 1, /* libjpeg's old median cut. Fast, but only uses 16-bit color. */
|
|---|
| 143 | GD_QUANT_NEUQUANT = 2, /* neuquant - approximation using kohonen neural network. */
|
|---|
| 144 | GD_QUANT_LIQ = 3 /* combination of algorithms used in libimagequant/pngquant2 aiming for highest quality at cost of speed */
|
|---|
| 145 | };
|
|---|
| 146 |
|
|---|
| 147 | /**
|
|---|
| 148 | * Group: Transform
|
|---|
| 149 | *
|
|---|
| 150 | * Constants: gdInterpolationMethod
|
|---|
| 151 |
|
|---|
| 152 | * GD_BELL - Bell
|
|---|
| 153 | * GD_BESSEL - Bessel
|
|---|
| 154 | * GD_BILINEAR_FIXED - fixed point bilinear
|
|---|
| 155 | * GD_BICUBIC - Bicubic
|
|---|
| 156 | * GD_BICUBIC_FIXED - fixed point bicubic integer
|
|---|
| 157 | * GD_BLACKMAN - Blackman
|
|---|
| 158 | * GD_BOX - Box
|
|---|
| 159 | * GD_BSPLINE - BSpline
|
|---|
| 160 | * GD_CATMULLROM - Catmullrom
|
|---|
| 161 | * GD_GAUSSIAN - Gaussian
|
|---|
| 162 | * GD_GENERALIZED_CUBIC - Generalized cubic
|
|---|
| 163 | * GD_HERMITE - Hermite
|
|---|
| 164 | * GD_HAMMING - Hamming
|
|---|
| 165 | * GD_HANNING - Hannig
|
|---|
| 166 | * GD_MITCHELL - Mitchell
|
|---|
| 167 | * GD_NEAREST_NEIGHBOUR - Nearest neighbour interpolation
|
|---|
| 168 | * GD_POWER - Power
|
|---|
| 169 | * GD_QUADRATIC - Quadratic
|
|---|
| 170 | * GD_SINC - Sinc
|
|---|
| 171 | * GD_TRIANGLE - Triangle
|
|---|
| 172 | * GD_WEIGHTED4 - 4 pixels weighted bilinear interpolation
|
|---|
| 173 | *
|
|---|
| 174 | * See also:
|
|---|
| 175 | * <gdSetInterpolationMethod>
|
|---|
| 176 | **/
|
|---|
| 177 | typedef enum {
|
|---|
| 178 | GD_DEFAULT = 0,
|
|---|
| 179 | GD_BELL,
|
|---|
| 180 | GD_BESSEL,
|
|---|
| 181 | GD_BILINEAR_FIXED,
|
|---|
| 182 | GD_BICUBIC,
|
|---|
| 183 | GD_BICUBIC_FIXED,
|
|---|
| 184 | GD_BLACKMAN,
|
|---|
| 185 | GD_BOX,
|
|---|
| 186 | GD_BSPLINE,
|
|---|
| 187 | GD_CATMULLROM,
|
|---|
| 188 | GD_GAUSSIAN,
|
|---|
| 189 | GD_GENERALIZED_CUBIC,
|
|---|
| 190 | GD_HERMITE,
|
|---|
| 191 | GD_HAMMING,
|
|---|
| 192 | GD_HANNING,
|
|---|
| 193 | GD_MITCHELL,
|
|---|
| 194 | GD_NEAREST_NEIGHBOUR,
|
|---|
| 195 | GD_POWER,
|
|---|
| 196 | GD_QUADRATIC,
|
|---|
| 197 | GD_SINC,
|
|---|
| 198 | GD_TRIANGLE,
|
|---|
| 199 | GD_WEIGHTED4,
|
|---|
| 200 | GD_METHOD_COUNT = 21
|
|---|
| 201 | } gdInterpolationMethod;
|
|---|
| 202 |
|
|---|
| 203 | /* define struct with name and func ptr and add it to gdImageStruct gdInterpolationMethod interpolation; */
|
|---|
| 204 |
|
|---|
| 205 | /* Interpolation function ptr */
|
|---|
| 206 | typedef double (* interpolation_method )(double);
|
|---|
| 207 |
|
|---|
| 208 | typedef struct gdImageStruct {
|
|---|
| 209 | /* Palette-based image pixels */
|
|---|
| 210 | unsigned char **pixels;
|
|---|
| 211 | int sx;
|
|---|
| 212 | int sy;
|
|---|
| 213 | /* These are valid in palette images only. See also
|
|---|
| 214 | 'alpha', which appears later in the structure to
|
|---|
| 215 | preserve binary backwards compatibility */
|
|---|
| 216 | int colorsTotal;
|
|---|
| 217 | int red[gdMaxColors];
|
|---|
| 218 | int green[gdMaxColors];
|
|---|
| 219 | int blue[gdMaxColors];
|
|---|
| 220 | int open[gdMaxColors];
|
|---|
| 221 | /* For backwards compatibility, this is set to the
|
|---|
| 222 | first palette entry with 100% transparency,
|
|---|
| 223 | and is also set and reset by the
|
|---|
| 224 | gdImageColorTransparent function. Newer
|
|---|
| 225 | applications can allocate palette entries
|
|---|
| 226 | with any desired level of transparency; however,
|
|---|
| 227 | bear in mind that many viewers, notably
|
|---|
| 228 | many web browsers, fail to implement
|
|---|
| 229 | full alpha channel for PNG and provide
|
|---|
| 230 | support for full opacity or transparency only. */
|
|---|
| 231 | int transparent;
|
|---|
| 232 | int *polyInts;
|
|---|
| 233 | int polyAllocated;
|
|---|
| 234 | struct gdImageStruct *brush;
|
|---|
| 235 | struct gdImageStruct *tile;
|
|---|
| 236 | int brushColorMap[gdMaxColors];
|
|---|
| 237 | int tileColorMap[gdMaxColors];
|
|---|
| 238 | int styleLength;
|
|---|
| 239 | int stylePos;
|
|---|
| 240 | int *style;
|
|---|
| 241 | int interlace;
|
|---|
| 242 | /* New in 2.0: thickness of line. Initialized to 1. */
|
|---|
| 243 | int thick;
|
|---|
| 244 | /* New in 2.0: alpha channel for palettes. Note that only
|
|---|
| 245 | Macintosh Internet Explorer and (possibly) Netscape 6
|
|---|
| 246 | really support multiple levels of transparency in
|
|---|
| 247 | palettes, to my knowledge, as of 2/15/01. Most
|
|---|
| 248 | common browsers will display 100% opaque and
|
|---|
| 249 | 100% transparent correctly, and do something
|
|---|
| 250 | unpredictable and/or undesirable for levels
|
|---|
| 251 | in between. TBB */
|
|---|
| 252 | int alpha[gdMaxColors];
|
|---|
| 253 | /* Truecolor flag and pixels. New 2.0 fields appear here at the
|
|---|
| 254 | end to minimize breakage of existing object code. */
|
|---|
| 255 | int trueColor;
|
|---|
| 256 | int **tpixels;
|
|---|
| 257 | /* Should alpha channel be copied, or applied, each time a
|
|---|
| 258 | pixel is drawn? This applies to truecolor images only.
|
|---|
| 259 | No attempt is made to alpha-blend in palette images,
|
|---|
| 260 | even if semitransparent palette entries exist.
|
|---|
| 261 | To do that, build your image as a truecolor image,
|
|---|
| 262 | then quantize down to 8 bits. */
|
|---|
| 263 | int alphaBlendingFlag;
|
|---|
| 264 | /* Should the alpha channel of the image be saved? This affects
|
|---|
| 265 | PNG at the moment; other future formats may also
|
|---|
| 266 | have that capability. JPEG doesn't. */
|
|---|
| 267 | int saveAlphaFlag;
|
|---|
| 268 |
|
|---|
| 269 | /* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this
|
|---|
| 270 | part of the structure can be safely changed in new releases. */
|
|---|
| 271 |
|
|---|
| 272 | /* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after
|
|---|
| 273 | switching to the fast, memory-cheap implementation from PHP-gd. */
|
|---|
| 274 | int AA;
|
|---|
| 275 | int AA_color;
|
|---|
| 276 | int AA_dont_blend;
|
|---|
| 277 |
|
|---|
| 278 | /* 2.0.12: simple clipping rectangle. These values
|
|---|
| 279 | must be checked for safety when set; please use
|
|---|
| 280 | gdImageSetClip */
|
|---|
| 281 | int cx1;
|
|---|
| 282 | int cy1;
|
|---|
| 283 | int cx2;
|
|---|
| 284 | int cy2;
|
|---|
| 285 |
|
|---|
| 286 | /* 2.1.0: allows to specify resolution in dpi */
|
|---|
| 287 | unsigned int res_x;
|
|---|
| 288 | unsigned int res_y;
|
|---|
| 289 |
|
|---|
| 290 | /* Selects quantization method, see gdImageTrueColorToPaletteSetMethod() and gdPaletteQuantizationMethod enum. */
|
|---|
| 291 | int paletteQuantizationMethod;
|
|---|
| 292 | /* speed/quality trade-off. 1 = best quality, 10 = best speed. 0 = method-specific default.
|
|---|
| 293 | Applicable to GD_QUANT_LIQ and GD_QUANT_NEUQUANT. */
|
|---|
| 294 | int paletteQuantizationSpeed;
|
|---|
| 295 | /* Image will remain true-color if conversion to palette cannot achieve given quality.
|
|---|
| 296 | Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
|
|---|
| 297 | int paletteQuantizationMinQuality;
|
|---|
| 298 | /* Image will use minimum number of palette colors needed to achieve given quality. Must be higher than paletteQuantizationMinQuality
|
|---|
| 299 | Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
|
|---|
| 300 | int paletteQuantizationMaxQuality;
|
|---|
| 301 | gdInterpolationMethod interpolation_id;
|
|---|
| 302 | interpolation_method interpolation;
|
|---|
| 303 | }
|
|---|
| 304 | gdImage;
|
|---|
| 305 |
|
|---|
| 306 | typedef gdImage *gdImagePtr;
|
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 | /* Point type for use in polygon drawing. */
|
|---|
| 310 |
|
|---|
| 311 | /**
|
|---|
| 312 | * Group: Types
|
|---|
| 313 | *
|
|---|
| 314 | * typedef: gdPointF
|
|---|
| 315 | * Defines a point in a 2D coordinate system using floating point
|
|---|
| 316 | * values.
|
|---|
| 317 | * x - Floating point position (increase from left to right)
|
|---|
| 318 | * y - Floating point Row position (increase from top to bottom)
|
|---|
| 319 | *
|
|---|
| 320 | * typedef: gdPointFPtr
|
|---|
| 321 | * Pointer to a <gdPointF>
|
|---|
| 322 | *
|
|---|
| 323 | * See also:
|
|---|
| 324 | * <gdImageCreate>, <gdImageCreateTrueColor>,
|
|---|
| 325 | **/
|
|---|
| 326 | typedef struct
|
|---|
| 327 | {
|
|---|
| 328 | double x, y;
|
|---|
| 329 | }
|
|---|
| 330 | gdPointF, *gdPointFPtr;
|
|---|
| 331 |
|
|---|
| 332 | typedef struct {
|
|---|
| 333 | /* # of characters in font */
|
|---|
| 334 | int nchars;
|
|---|
| 335 | /* First character is numbered... (usually 32 = space) */
|
|---|
| 336 | int offset;
|
|---|
| 337 | /* Character width and height */
|
|---|
| 338 | int w;
|
|---|
| 339 | int h;
|
|---|
| 340 | /* Font data; array of characters, one row after another.
|
|---|
| 341 | Easily included in code, also easily loaded from
|
|---|
| 342 | data files. */
|
|---|
| 343 | char *data;
|
|---|
| 344 | }
|
|---|
| 345 | gdFont;
|
|---|
| 346 |
|
|---|
| 347 | /* Text functions take these. */
|
|---|
| 348 | typedef gdFont *gdFontPtr;
|
|---|
| 349 |
|
|---|
| 350 | typedef void(*gdErrorMethod)(int, const char *, va_list);
|
|---|
| 351 |
|
|---|
| 352 | BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod);
|
|---|
| 353 | BGD_DECLARE(void) gdClearErrorMethod(void);
|
|---|
| 354 |
|
|---|
| 355 | /* For backwards compatibility only. Use gdImageSetStyle()
|
|---|
| 356 | for MUCH more flexible line drawing. Also see
|
|---|
| 357 | gdImageSetBrush(). */
|
|---|
| 358 | #define gdDashSize 4
|
|---|
| 359 |
|
|---|
| 360 | /* Special colors. */
|
|---|
| 361 |
|
|---|
| 362 | #define gdStyled (-2)
|
|---|
| 363 | #define gdBrushed (-3)
|
|---|
| 364 | #define gdStyledBrushed (-4)
|
|---|
| 365 | #define gdTiled (-5)
|
|---|
| 366 |
|
|---|
| 367 | /* NOT the same as the transparent color index.
|
|---|
| 368 | This is used in line styles only. */
|
|---|
| 369 | #define gdTransparent (-6)
|
|---|
| 370 |
|
|---|
| 371 | #define gdAntiAliased (-7)
|
|---|
| 372 |
|
|---|
| 373 | /* Functions to manipulate images. */
|
|---|
| 374 |
|
|---|
| 375 | /* Creates a palette-based image (up to 256 colors). */
|
|---|
| 376 | BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy);
|
|---|
| 377 |
|
|---|
| 378 | /* An alternate name for the above (2.0). */
|
|---|
| 379 | #define gdImageCreatePalette gdImageCreate
|
|---|
| 380 |
|
|---|
| 381 | /* Creates a truecolor image (millions of colors). */
|
|---|
| 382 | BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
|
|---|
| 383 |
|
|---|
| 384 | /* Creates an image from various file types. These functions
|
|---|
| 385 | return a palette or truecolor image based on the
|
|---|
| 386 | nature of the file being loaded. Truecolor PNG
|
|---|
| 387 | stays truecolor; palette PNG stays palette-based;
|
|---|
| 388 | JPEG is always truecolor. */
|
|---|
| 389 | BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd);
|
|---|
| 390 | BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in);
|
|---|
| 391 | BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data);
|
|---|
| 392 |
|
|---|
| 393 | /* These read the first frame only */
|
|---|
| 394 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGif (FILE * fd);
|
|---|
| 395 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx (gdIOCtxPtr in);
|
|---|
| 396 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr (int size, void *data);
|
|---|
| 397 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP (FILE * inFile);
|
|---|
| 398 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx (gdIOCtx * infile);
|
|---|
| 399 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr (int size, void *data);
|
|---|
| 400 | BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg (FILE * infile);
|
|---|
| 401 | BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegEx (FILE * infile, int ignore_warning);
|
|---|
| 402 | BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx (gdIOCtx * infile);
|
|---|
| 403 | BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning);
|
|---|
| 404 | BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr (int size, void *data);
|
|---|
| 405 | BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning);
|
|---|
| 406 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp (FILE * inFile);
|
|---|
| 407 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr (int size, void *data);
|
|---|
| 408 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile);
|
|---|
| 409 |
|
|---|
| 410 | BGD_DECLARE(gdImagePtr) gdImageCreateFromTiff(FILE *inFile);
|
|---|
| 411 | BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffCtx(gdIOCtx *infile);
|
|---|
| 412 | BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffPtr(int size, void *data);
|
|---|
| 413 |
|
|---|
| 414 | BGD_DECLARE(gdImagePtr) gdImageCreateFromTga( FILE * fp );
|
|---|
| 415 | BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtx* ctx);
|
|---|
| 416 | BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaPtr(int size, void *data);
|
|---|
| 417 |
|
|---|
| 418 | BGD_DECLARE(gdImagePtr) gdImageCreateFromBmp (FILE * inFile);
|
|---|
| 419 | BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpPtr (int size, void *data);
|
|---|
| 420 | BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpCtx (gdIOCtxPtr infile);
|
|---|
| 421 |
|
|---|
| 422 | /* A custom data source. */
|
|---|
| 423 | /* The source function must return -1 on error, otherwise the number
|
|---|
| 424 | of bytes fetched. 0 is EOF, not an error! */
|
|---|
| 425 | /* context will be passed to your source function. */
|
|---|
| 426 |
|
|---|
| 427 | typedef struct {
|
|---|
| 428 | int (*source) (void *context, char *buffer, int len);
|
|---|
| 429 | void *context;
|
|---|
| 430 | }
|
|---|
| 431 | gdSource, *gdSourcePtr;
|
|---|
| 432 |
|
|---|
| 433 | /* Deprecated in favor of gdImageCreateFromPngCtx */
|
|---|
| 434 | BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr in);
|
|---|
| 435 |
|
|---|
| 436 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd (FILE * in);
|
|---|
| 437 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx (gdIOCtxPtr in);
|
|---|
| 438 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr (int size, void *data);
|
|---|
| 439 |
|
|---|
| 440 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * in);
|
|---|
| 441 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in);
|
|---|
| 442 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data);
|
|---|
| 443 |
|
|---|
| 444 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
|
|---|
| 445 | int h);
|
|---|
| 446 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
|
|---|
| 447 | int w, int h);
|
|---|
| 448 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
|
|---|
| 449 | int w, int h);
|
|---|
| 450 | /* 2.0.10: prototype was missing */
|
|---|
| 451 | BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in);
|
|---|
| 452 | BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
|
|---|
| 453 |
|
|---|
| 454 | /* NOTE: filename, not FILE */
|
|---|
| 455 | BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename);
|
|---|
| 456 |
|
|---|
| 457 | BGD_DECLARE(void) gdImageDestroy (gdImagePtr im);
|
|---|
| 458 |
|
|---|
| 459 | /* Replaces or blends with the background depending on the
|
|---|
| 460 | most recent call to gdImageAlphaBlending and the
|
|---|
| 461 | alpha channel value of 'color'; default is to overwrite.
|
|---|
| 462 | Tiling and line styling are also implemented
|
|---|
| 463 | here. All other gd drawing functions pass through this call,
|
|---|
| 464 | allowing for many useful effects. */
|
|---|
| 465 |
|
|---|
| 466 | BGD_DECLARE(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color);
|
|---|
| 467 | /* FreeType 2 text output with hook to extra flags */
|
|---|
| 468 |
|
|---|
| 469 | BGD_DECLARE(int) gdImageGetPixel (gdImagePtr im, int x, int y);
|
|---|
| 470 | BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y);
|
|---|
| 471 |
|
|---|
| 472 | BGD_DECLARE(void) gdImageAABlend (gdImagePtr im);
|
|---|
| 473 |
|
|---|
| 474 | BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
|
|---|
| 475 |
|
|---|
| 476 | /* For backwards compatibility only. Use gdImageSetStyle()
|
|---|
| 477 | for much more flexible line drawing. */
|
|---|
| 478 | BGD_DECLARE(void) gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2,
|
|---|
| 479 | int color);
|
|---|
| 480 | /* Corners specified (not width and height). Upper left first, lower right
|
|---|
| 481 | second. */
|
|---|
| 482 | BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
|
|---|
| 483 | int color);
|
|---|
| 484 | /* Solid bar. Upper left corner first, lower right corner second. */
|
|---|
| 485 | BGD_DECLARE(void) gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
|
|---|
| 486 | int color);
|
|---|
| 487 | BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
|
|---|
| 488 | BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
|
|---|
| 489 | BGD_DECLARE(void) gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y);
|
|---|
| 490 | BGD_DECLARE(int) gdImageBoundsSafe (gdImagePtr im, int x, int y);
|
|---|
| 491 | BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c,
|
|---|
| 492 | int color);
|
|---|
| 493 | BGD_DECLARE(void) gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c,
|
|---|
| 494 | int color);
|
|---|
| 495 | BGD_DECLARE(void) gdImageString (gdImagePtr im, gdFontPtr f, int x, int y,
|
|---|
| 496 | unsigned char *s, int color);
|
|---|
| 497 | BGD_DECLARE(void) gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y,
|
|---|
| 498 | unsigned char *s, int color);
|
|---|
| 499 | BGD_DECLARE(void) gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y,
|
|---|
| 500 | unsigned short *s, int color);
|
|---|
| 501 | BGD_DECLARE(void) gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y,
|
|---|
| 502 | unsigned short *s, int color);
|
|---|
| 503 |
|
|---|
| 504 | /* 2.0.16: for thread-safe use of gdImageStringFT and friends,
|
|---|
| 505 | call this before allowing any thread to call gdImageStringFT.
|
|---|
| 506 | Otherwise it is invoked by the first thread to invoke
|
|---|
| 507 | gdImageStringFT, with a very small but real risk of a race condition.
|
|---|
| 508 | Return 0 on success, nonzero on failure to initialize freetype. */
|
|---|
| 509 | BGD_DECLARE(int) gdFontCacheSetup (void);
|
|---|
| 510 |
|
|---|
| 511 | /* Optional: clean up after application is done using fonts in
|
|---|
| 512 | gdImageStringFT(). */
|
|---|
| 513 | BGD_DECLARE(void) gdFontCacheShutdown (void);
|
|---|
| 514 | /* 2.0.20: for backwards compatibility. A few applications did start calling
|
|---|
| 515 | this function when it first appeared although it was never documented.
|
|---|
| 516 | Simply invokes gdFontCacheShutdown. */
|
|---|
| 517 | BGD_DECLARE(void) gdFreeFontCache (void);
|
|---|
| 518 |
|
|---|
| 519 | /* Calls gdImageStringFT. Provided for backwards compatibility only. */
|
|---|
| 520 | BGD_DECLARE(char *) gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist,
|
|---|
| 521 | double ptsize, double angle, int x, int y,
|
|---|
| 522 | char *string);
|
|---|
| 523 |
|
|---|
| 524 | /* FreeType 2 text output */
|
|---|
| 525 | BGD_DECLARE(char *) gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
|
|---|
| 526 | double ptsize, double angle, int x, int y,
|
|---|
| 527 | char *string);
|
|---|
| 528 |
|
|---|
| 529 | /* 2.0.5: provides an extensible way to pass additional parameters.
|
|---|
| 530 | Thanks to Wez Furlong, sorry for the delay. */
|
|---|
| 531 |
|
|---|
| 532 | typedef struct {
|
|---|
| 533 | int flags; /* Logical OR of gdFTEX_ values */
|
|---|
| 534 | double linespacing; /* fine tune line spacing for '\n' */
|
|---|
| 535 | int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode,
|
|---|
| 536 | gdFTEX_Shift_JIS, gdFTEX_Big5,
|
|---|
| 537 | or gdFTEX_Adobe_Custom;
|
|---|
| 538 | when not specified, maps are searched
|
|---|
| 539 | for in the above order. */
|
|---|
| 540 | int hdpi; /* if (flags & gdFTEX_RESOLUTION) */
|
|---|
| 541 | int vdpi; /* if (flags & gdFTEX_RESOLUTION) */
|
|---|
| 542 | char *xshow; /* if (flags & gdFTEX_XSHOW)
|
|---|
| 543 | then, on return, xshow is a malloc'ed
|
|---|
| 544 | string containing xshow position data for
|
|---|
| 545 | the last string.
|
|---|
| 546 |
|
|---|
| 547 | NB. The caller is responsible for gdFree'ing
|
|---|
| 548 | the xshow string.
|
|---|
| 549 | */
|
|---|
| 550 | char *fontpath; /* if (flags & gdFTEX_RETURNFONTPATHNAME)
|
|---|
| 551 | then, on return, fontpath is a malloc'ed
|
|---|
| 552 | string containing the actual font file path name
|
|---|
| 553 | used, which can be interesting when fontconfig
|
|---|
| 554 | is in use.
|
|---|
| 555 |
|
|---|
| 556 | The caller is responsible for gdFree'ing the
|
|---|
| 557 | fontpath string.
|
|---|
| 558 | */
|
|---|
| 559 |
|
|---|
| 560 | }
|
|---|
| 561 | gdFTStringExtra, *gdFTStringExtraPtr;
|
|---|
| 562 |
|
|---|
| 563 | #define gdFTEX_LINESPACE 1
|
|---|
| 564 | #define gdFTEX_CHARMAP 2
|
|---|
| 565 | #define gdFTEX_RESOLUTION 4
|
|---|
| 566 | #define gdFTEX_DISABLE_KERNING 8
|
|---|
| 567 | #define gdFTEX_XSHOW 16
|
|---|
| 568 | /* The default unless gdFTUseFontConfig(1); has been called:
|
|---|
| 569 | fontlist is a full or partial font file pathname or list thereof
|
|---|
| 570 | (i.e. just like before 2.0.29) */
|
|---|
| 571 | #define gdFTEX_FONTPATHNAME 32
|
|---|
| 572 | /* Necessary to use fontconfig patterns instead of font pathnames
|
|---|
| 573 | as the fontlist argument, unless gdFTUseFontConfig(1); has
|
|---|
| 574 | been called. New in 2.0.29 */
|
|---|
| 575 | #define gdFTEX_FONTCONFIG 64
|
|---|
| 576 | /* Sometimes interesting when fontconfig is used: the fontpath
|
|---|
| 577 | element of the structure above will contain a gdMalloc'd string
|
|---|
| 578 | copy of the actual font file pathname used, if this flag is set
|
|---|
| 579 | when the call is made */
|
|---|
| 580 | #define gdFTEX_RETURNFONTPATHNAME 128
|
|---|
| 581 |
|
|---|
| 582 | /* If flag is nonzero, the fontlist parameter to gdImageStringFT
|
|---|
| 583 | and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
|
|---|
| 584 | if fontconfig was compiled into gd. This function returns zero
|
|---|
| 585 | if fontconfig is not available, nonzero otherwise. */
|
|---|
| 586 | BGD_DECLARE(int) gdFTUseFontConfig(int flag);
|
|---|
| 587 |
|
|---|
| 588 | /* These are NOT flags; set one in 'charmap' if you set the
|
|---|
| 589 | gdFTEX_CHARMAP bit in 'flags'. */
|
|---|
| 590 | #define gdFTEX_Unicode 0
|
|---|
| 591 | #define gdFTEX_Shift_JIS 1
|
|---|
| 592 | #define gdFTEX_Big5 2
|
|---|
| 593 | #define gdFTEX_Adobe_Custom 3
|
|---|
| 594 |
|
|---|
| 595 | BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
|
|---|
| 596 | double ptsize, double angle, int x, int y,
|
|---|
| 597 | char *string, gdFTStringExtraPtr strex);
|
|---|
| 598 |
|
|---|
| 599 | /* Point type for use in polygon drawing. */
|
|---|
| 600 | typedef struct {
|
|---|
| 601 | int x, y;
|
|---|
| 602 | }
|
|---|
| 603 | gdPoint, *gdPointPtr;
|
|---|
| 604 |
|
|---|
| 605 | typedef struct {
|
|---|
| 606 | int x, y;
|
|---|
| 607 | int width, height;
|
|---|
| 608 | }
|
|---|
| 609 | gdRect, *gdRectPtr;
|
|---|
| 610 |
|
|---|
| 611 |
|
|---|
| 612 | BGD_DECLARE(void) gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c);
|
|---|
| 613 | BGD_DECLARE(void) gdImageOpenPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
|
|---|
| 614 | BGD_DECLARE(void) gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
|
|---|
| 615 |
|
|---|
| 616 | /* These functions still work with truecolor images,
|
|---|
| 617 | for which they never return error. */
|
|---|
| 618 | BGD_DECLARE(int) gdImageColorAllocate (gdImagePtr im, int r, int g, int b);
|
|---|
| 619 | /* gd 2.0: palette entries with non-opaque transparency are permitted. */
|
|---|
| 620 | BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a);
|
|---|
| 621 | /* Assumes opaque is the preferred alpha channel value */
|
|---|
| 622 | BGD_DECLARE(int) gdImageColorClosest (gdImagePtr im, int r, int g, int b);
|
|---|
| 623 | /* Closest match taking all four parameters into account.
|
|---|
| 624 | A slightly different color with the same transparency
|
|---|
| 625 | beats the exact same color with radically different
|
|---|
| 626 | transparency */
|
|---|
| 627 | BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a);
|
|---|
| 628 | /* An alternate method */
|
|---|
| 629 | BGD_DECLARE(int) gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b);
|
|---|
| 630 | /* Returns exact, 100% opaque matches only */
|
|---|
| 631 | BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b);
|
|---|
| 632 | /* Returns an exact match only, including alpha */
|
|---|
| 633 | BGD_DECLARE(int) gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a);
|
|---|
| 634 | /* Opaque only */
|
|---|
| 635 | BGD_DECLARE(int) gdImageColorResolve (gdImagePtr im, int r, int g, int b);
|
|---|
| 636 | /* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha */
|
|---|
| 637 | BGD_DECLARE(int) gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a);
|
|---|
| 638 |
|
|---|
| 639 | /* A simpler way to obtain an opaque truecolor value for drawing on a
|
|---|
| 640 | truecolor image. Not for use with palette images! */
|
|---|
| 641 |
|
|---|
| 642 | #define gdTrueColor(r, g, b) (((r) << 16) + \
|
|---|
| 643 | ((g) << 8) + \
|
|---|
| 644 | (b))
|
|---|
| 645 |
|
|---|
| 646 | /* Returns a truecolor value with an alpha channel component.
|
|---|
| 647 | gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
|
|---|
| 648 | opaque. */
|
|---|
| 649 |
|
|---|
| 650 | #define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
|
|---|
| 651 | ((r) << 16) + \
|
|---|
| 652 | ((g) << 8) + \
|
|---|
| 653 | (b))
|
|---|
| 654 |
|
|---|
| 655 | BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color);
|
|---|
| 656 |
|
|---|
| 657 | /* Converts a truecolor image to a palette-based image,
|
|---|
| 658 | using a high-quality two-pass quantization routine
|
|---|
| 659 | which attempts to preserve alpha channel information
|
|---|
| 660 | as well as R/G/B color information when creating
|
|---|
| 661 | a palette. If ditherFlag is set, the image will be
|
|---|
| 662 | dithered to approximate colors better, at the expense
|
|---|
| 663 | of some obvious "speckling." colorsWanted can be
|
|---|
| 664 | anything up to 256. If the original source image
|
|---|
| 665 | includes photographic information or anything that
|
|---|
| 666 | came out of a JPEG, 256 is strongly recommended.
|
|---|
| 667 |
|
|---|
| 668 | Better yet, don't use these function -- write real
|
|---|
| 669 | truecolor PNGs and JPEGs. The disk space gain of
|
|---|
| 670 | conversion to palette is not great (for small images
|
|---|
| 671 | it can be negative) and the quality loss is ugly.
|
|---|
| 672 |
|
|---|
| 673 | DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
|
|---|
| 674 | returns a new image. gdImageTrueColorToPalette modifies
|
|---|
| 675 | an existing image, and the truecolor pixels are discarded.
|
|---|
| 676 |
|
|---|
| 677 | gdImageTrueColorToPalette() returns TRUE on success, FALSE on failure.
|
|---|
| 678 | */
|
|---|
| 679 |
|
|---|
| 680 | BGD_DECLARE(gdImagePtr) gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag,
|
|---|
| 681 | int colorsWanted);
|
|---|
| 682 |
|
|---|
| 683 | BGD_DECLARE(int) gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag,
|
|---|
| 684 | int colorsWanted);
|
|---|
| 685 |
|
|---|
| 686 | BGD_DECLARE(int) gdImagePaletteToTrueColor(gdImagePtr src);
|
|---|
| 687 |
|
|---|
| 688 | /* An attempt at getting the results of gdImageTrueColorToPalette to
|
|---|
| 689 | * look a bit more like the original (im1 is the original and im2 is
|
|---|
| 690 | * the palette version */
|
|---|
| 691 |
|
|---|
| 692 | BGD_DECLARE(int) gdImageColorMatch(gdImagePtr im1, gdImagePtr im2);
|
|---|
| 693 |
|
|---|
| 694 | /* Selects quantization method used for subsequent gdImageTrueColorToPalette calls.
|
|---|
| 695 | See gdPaletteQuantizationMethod enum (e.g. GD_QUANT_NEUQUANT, GD_QUANT_LIQ).
|
|---|
| 696 | Speed is from 1 (highest quality) to 10 (fastest).
|
|---|
| 697 | Speed 0 selects method-specific default (recommended).
|
|---|
| 698 |
|
|---|
| 699 | Returns FALSE if the given method is invalid or not available.
|
|---|
| 700 | */
|
|---|
| 701 | BGD_DECLARE(int) gdImageTrueColorToPaletteSetMethod (gdImagePtr im, int method, int speed);
|
|---|
| 702 |
|
|---|
| 703 | /*
|
|---|
| 704 | Chooses quality range that subsequent call to gdImageTrueColorToPalette will aim for.
|
|---|
| 705 | Min and max quality is in range 1-100 (1 = ugly, 100 = perfect). Max must be higher than min.
|
|---|
| 706 | If palette cannot represent image with at least min_quality, then image will remain true-color.
|
|---|
| 707 | If palette can represent image with quality better than max_quality, then lower number of colors will be used.
|
|---|
| 708 | This function has effect only when GD_QUANT_LIQ method has been selected and the source image is true-color.
|
|---|
| 709 | */
|
|---|
| 710 | BGD_DECLARE(void) gdImageTrueColorToPaletteSetQuality (gdImagePtr im, int min_quality, int max_quality);
|
|---|
| 711 |
|
|---|
| 712 | /* Specifies a color index (if a palette image) or an
|
|---|
| 713 | RGB color (if a truecolor image) which should be
|
|---|
| 714 | considered 100% transparent. FOR TRUECOLOR IMAGES,
|
|---|
| 715 | THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
|
|---|
| 716 | SAVED. Use gdImageSaveAlpha(im, 0); to
|
|---|
| 717 | turn off the saving of a full alpha channel in
|
|---|
| 718 | a truecolor image. Note that gdImageColorTransparent
|
|---|
| 719 | is usually compatible with older browsers that
|
|---|
| 720 | do not understand full alpha channels well. TBB */
|
|---|
| 721 | BGD_DECLARE(void) gdImageColorTransparent (gdImagePtr im, int color);
|
|---|
| 722 |
|
|---|
| 723 | BGD_DECLARE(void) gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src);
|
|---|
| 724 |
|
|---|
| 725 | typedef int (*gdCallbackImageColor)(gdImagePtr im, int src);
|
|---|
| 726 |
|
|---|
| 727 | BGD_DECLARE(int) gdImageColorReplace(gdImagePtr im, int src, int dst);
|
|---|
| 728 | BGD_DECLARE(int) gdImageColorReplaceThreshold(gdImagePtr im, int src, int dst, float threshold);
|
|---|
| 729 | BGD_DECLARE(int) gdImageColorReplaceArray(gdImagePtr im, int len, int *src, int *dst);
|
|---|
| 730 | BGD_DECLARE(int) gdImageColorReplaceCallback(gdImagePtr im, gdCallbackImageColor callback);
|
|---|
| 731 |
|
|---|
| 732 | BGD_DECLARE(void) gdImageGif (gdImagePtr im, FILE * out);
|
|---|
| 733 | BGD_DECLARE(void) gdImagePng (gdImagePtr im, FILE * out);
|
|---|
| 734 | BGD_DECLARE(void) gdImagePngCtx (gdImagePtr im, gdIOCtx * out);
|
|---|
| 735 | BGD_DECLARE(void) gdImageGifCtx (gdImagePtr im, gdIOCtx * out);
|
|---|
| 736 | BGD_DECLARE(void) gdImageTiff(gdImagePtr im, FILE *outFile);
|
|---|
| 737 | BGD_DECLARE(void *) gdImageTiffPtr(gdImagePtr im, int *size);
|
|---|
| 738 | BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out);
|
|---|
| 739 |
|
|---|
| 740 | BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression);
|
|---|
| 741 | BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression);
|
|---|
| 742 | BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
|
|---|
| 743 |
|
|---|
| 744 | /* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
|
|---|
| 745 | 1 is FASTEST but produces larger files, 9 provides the best
|
|---|
| 746 | compression (smallest files) but takes a long time to compress, and
|
|---|
| 747 | -1 selects the default compiled into the zlib library. */
|
|---|
| 748 | BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level);
|
|---|
| 749 | BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
|
|---|
| 750 |
|
|---|
| 751 | BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out);
|
|---|
| 752 | BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
|
|---|
| 753 |
|
|---|
| 754 | /* Guaranteed to correctly free memory returned by the gdImage*Ptr
|
|---|
| 755 | functions */
|
|---|
| 756 | BGD_DECLARE(void) gdFree (void *m);
|
|---|
| 757 |
|
|---|
| 758 | /* Best to free this memory with gdFree(), not free() */
|
|---|
| 759 | BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg);
|
|---|
| 760 |
|
|---|
| 761 | /* 100 is highest quality (there is always a little loss with JPEG).
|
|---|
| 762 | 0 is lowest. 10 is about the lowest useful setting. */
|
|---|
| 763 | BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality);
|
|---|
| 764 | BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality);
|
|---|
| 765 |
|
|---|
| 766 | /* Best to free this memory with gdFree(), not free() */
|
|---|
| 767 | BGD_DECLARE(void *) gdImageJpegPtr (gdImagePtr im, int *size, int quality);
|
|---|
| 768 |
|
|---|
| 769 | BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization);
|
|---|
| 770 | BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile);
|
|---|
| 771 | BGD_DECLARE(void *) gdImageWebpPtr (gdImagePtr im, int *size);
|
|---|
| 772 | BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quantization);
|
|---|
| 773 | BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization);
|
|---|
| 774 |
|
|---|
| 775 | /* Legal values for Disposal. gdDisposalNone is always used by
|
|---|
| 776 | the built-in optimizer if previm is passed. */
|
|---|
| 777 |
|
|---|
| 778 | enum {
|
|---|
| 779 | gdDisposalUnknown,
|
|---|
| 780 | gdDisposalNone,
|
|---|
| 781 | gdDisposalRestoreBackground,
|
|---|
| 782 | gdDisposalRestorePrevious
|
|---|
| 783 | };
|
|---|
| 784 |
|
|---|
| 785 | BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
|
|---|
| 786 | BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
|
|---|
| 787 | BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile);
|
|---|
| 788 | BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtx *out, int GlobalCM, int Loops);
|
|---|
| 789 | BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
|
|---|
| 790 | BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtx *out);
|
|---|
| 791 | BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops);
|
|---|
| 792 | BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
|
|---|
| 793 | BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
|
|---|
| 794 |
|
|---|
| 795 | /* A custom data sink. For backwards compatibility. Use gdIOCtx
|
|---|
| 796 | instead. The sink function must return -1 on error, otherwise the
|
|---|
| 797 | number of bytes written, which must be equal to len. Context will
|
|---|
| 798 | be passed to your sink function.
|
|---|
| 799 | */
|
|---|
| 800 | typedef struct {
|
|---|
| 801 | int (*sink) (void *context, const char *buffer, int len);
|
|---|
| 802 | void *context;
|
|---|
| 803 | }
|
|---|
| 804 | gdSink, *gdSinkPtr;
|
|---|
| 805 |
|
|---|
| 806 | BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
|
|---|
| 807 |
|
|---|
| 808 | BGD_DECLARE(void) gdImageGd (gdImagePtr im, FILE * out);
|
|---|
| 809 | BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * out, int cs, int fmt);
|
|---|
| 810 |
|
|---|
| 811 | /* Best to free this memory with gdFree(), not free() */
|
|---|
| 812 | BGD_DECLARE(void *) gdImageGifPtr (gdImagePtr im, int *size);
|
|---|
| 813 |
|
|---|
| 814 | /* Best to free this memory with gdFree(), not free() */
|
|---|
| 815 | BGD_DECLARE(void *) gdImagePngPtr (gdImagePtr im, int *size);
|
|---|
| 816 | BGD_DECLARE(void *) gdImagePngPtrEx (gdImagePtr im, int *size, int level);
|
|---|
| 817 |
|
|---|
| 818 | /* Best to free this memory with gdFree(), not free() */
|
|---|
| 819 | BGD_DECLARE(void *) gdImageGdPtr (gdImagePtr im, int *size);
|
|---|
| 820 |
|
|---|
| 821 | /* Best to free this memory with gdFree(), not free() */
|
|---|
| 822 | BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size);
|
|---|
| 823 |
|
|---|
| 824 | /* Style is a bitwise OR ( | operator ) of these.
|
|---|
| 825 | gdArc and gdChord are mutually exclusive;
|
|---|
| 826 | gdChord just connects the starting and ending
|
|---|
| 827 | angles with a straight line, while gdArc produces
|
|---|
| 828 | a rounded edge. gdPie is a synonym for gdArc.
|
|---|
| 829 | gdNoFill indicates that the arc or chord should be
|
|---|
| 830 | outlined, not filled. gdEdged, used together with
|
|---|
| 831 | gdNoFill, indicates that the beginning and ending
|
|---|
| 832 | angles should be connected to the center; this is
|
|---|
| 833 | a good way to outline (rather than fill) a
|
|---|
| 834 | 'pie slice'. */
|
|---|
| 835 | #define gdArc 0
|
|---|
| 836 | #define gdPie gdArc
|
|---|
| 837 | #define gdChord 1
|
|---|
| 838 | #define gdNoFill 2
|
|---|
| 839 | #define gdEdged 4
|
|---|
| 840 |
|
|---|
| 841 | BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s,
|
|---|
| 842 | int e, int color, int style);
|
|---|
| 843 | BGD_DECLARE(void) gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e,
|
|---|
| 844 | int color);
|
|---|
| 845 | BGD_DECLARE(void) gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
|
|---|
| 846 | BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h,
|
|---|
| 847 | int color);
|
|---|
| 848 | BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border,
|
|---|
| 849 | int color);
|
|---|
| 850 | BGD_DECLARE(void) gdImageFill (gdImagePtr im, int x, int y, int color);
|
|---|
| 851 | BGD_DECLARE(void) gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
|---|
| 852 | int srcX, int srcY, int w, int h);
|
|---|
| 853 | BGD_DECLARE(void) gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
|---|
| 854 | int srcX, int srcY, int w, int h, int pct);
|
|---|
| 855 | BGD_DECLARE(void) gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX,
|
|---|
| 856 | int dstY, int srcX, int srcY, int w, int h,
|
|---|
| 857 | int pct);
|
|---|
| 858 |
|
|---|
| 859 | /* Stretches or shrinks to fit, as needed. Does NOT attempt
|
|---|
| 860 | to average the entire set of source pixels that scale down onto the
|
|---|
| 861 | destination pixel. */
|
|---|
| 862 | BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
|---|
| 863 | int srcX, int srcY, int dstW, int dstH, int srcW,
|
|---|
| 864 | int srcH);
|
|---|
| 865 |
|
|---|
| 866 | /* gd 2.0: stretches or shrinks to fit, as needed. When called with a
|
|---|
| 867 | truecolor destination image, this function averages the
|
|---|
| 868 | entire set of source pixels that scale down onto the
|
|---|
| 869 | destination pixel, taking into account what portion of the
|
|---|
| 870 | destination pixel each source pixel represents. This is a
|
|---|
| 871 | floating point operation, but this is not a performance issue
|
|---|
| 872 | on modern hardware, except for some embedded devices. If the
|
|---|
| 873 | destination is a palette image, gdImageCopyResized is
|
|---|
| 874 | substituted automatically. */
|
|---|
| 875 | BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX,
|
|---|
| 876 | int dstY, int srcX, int srcY, int dstW, int dstH,
|
|---|
| 877 | int srcW, int srcH);
|
|---|
| 878 |
|
|---|
| 879 | /* gd 2.0.8: gdImageCopyRotated is added. Source
|
|---|
| 880 | is a rectangle, with its upper left corner at
|
|---|
| 881 | srcX and srcY. Destination is the *center* of
|
|---|
| 882 | the rotated copy. Angle is in degrees, same as
|
|---|
| 883 | gdImageArc. Floating point destination center
|
|---|
| 884 | coordinates allow accurate rotation of
|
|---|
| 885 | objects of odd-numbered width or height. */
|
|---|
| 886 | BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst,
|
|---|
| 887 | gdImagePtr src,
|
|---|
| 888 | double dstX, double dstY,
|
|---|
| 889 | int srcX, int srcY,
|
|---|
| 890 | int srcWidth, int srcHeight, int angle);
|
|---|
| 891 |
|
|---|
| 892 | BGD_DECLARE(gdImagePtr) gdImageClone (gdImagePtr src);
|
|---|
| 893 |
|
|---|
| 894 | BGD_DECLARE(void) gdImageSetBrush (gdImagePtr im, gdImagePtr brush);
|
|---|
| 895 | BGD_DECLARE(void) gdImageSetTile (gdImagePtr im, gdImagePtr tile);
|
|---|
| 896 | BGD_DECLARE(void) gdImageSetAntiAliased (gdImagePtr im, int c);
|
|---|
| 897 | BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend);
|
|---|
| 898 | BGD_DECLARE(void) gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels);
|
|---|
| 899 | /* Line thickness (defaults to 1). Affects lines, ellipses,
|
|---|
| 900 | rectangles, polygons and so forth. */
|
|---|
| 901 | BGD_DECLARE(void) gdImageSetThickness (gdImagePtr im, int thickness);
|
|---|
| 902 | /* On or off (1 or 0) for all three of these. */
|
|---|
| 903 | BGD_DECLARE(void) gdImageInterlace (gdImagePtr im, int interlaceArg);
|
|---|
| 904 | BGD_DECLARE(void) gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg);
|
|---|
| 905 | BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg);
|
|---|
| 906 |
|
|---|
| 907 | BGD_DECLARE(gdImagePtr) gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor);
|
|---|
| 908 |
|
|---|
| 909 | enum gdPixelateMode {
|
|---|
| 910 | GD_PIXELATE_UPPERLEFT,
|
|---|
| 911 | GD_PIXELATE_AVERAGE
|
|---|
| 912 | };
|
|---|
| 913 |
|
|---|
| 914 | BGD_DECLARE(int) gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode);
|
|---|
| 915 |
|
|---|
| 916 | typedef struct {
|
|---|
| 917 | int sub;
|
|---|
| 918 | int plus;
|
|---|
| 919 | unsigned int num_colors;
|
|---|
| 920 | int *colors;
|
|---|
| 921 | unsigned int seed;
|
|---|
| 922 | } gdScatter, *gdScatterPtr;
|
|---|
| 923 |
|
|---|
| 924 | BGD_DECLARE(int) gdImageScatter(gdImagePtr im, int sub, int plus);
|
|---|
| 925 | BGD_DECLARE(int) gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors);
|
|---|
| 926 | BGD_DECLARE(int) gdImageScatterEx(gdImagePtr im, gdScatterPtr s);
|
|---|
| 927 | BGD_DECLARE(int) gdImageSmooth(gdImagePtr im, float weight);
|
|---|
| 928 | BGD_DECLARE(int) gdImageMeanRemoval(gdImagePtr im);
|
|---|
| 929 | BGD_DECLARE(int) gdImageEmboss(gdImagePtr im);
|
|---|
| 930 | BGD_DECLARE(int) gdImageGaussianBlur(gdImagePtr im);
|
|---|
| 931 | BGD_DECLARE(int) gdImageEdgeDetectQuick(gdImagePtr src);
|
|---|
| 932 | BGD_DECLARE(int) gdImageSelectiveBlur( gdImagePtr src);
|
|---|
| 933 | BGD_DECLARE(int) gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, float offset);
|
|---|
| 934 | BGD_DECLARE(int) gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
|
|---|
| 935 | BGD_DECLARE(int) gdImageContrast(gdImagePtr src, double contrast);
|
|---|
| 936 | BGD_DECLARE(int) gdImageBrightness(gdImagePtr src, int brightness);
|
|---|
| 937 | BGD_DECLARE(int) gdImageGrayScale(gdImagePtr src);
|
|---|
| 938 | BGD_DECLARE(int) gdImageNegate(gdImagePtr src);
|
|---|
| 939 |
|
|---|
| 940 | /* Macros to access information about images. */
|
|---|
| 941 |
|
|---|
| 942 | /* Returns nonzero if the image is a truecolor image,
|
|---|
| 943 | zero for a palette image. */
|
|---|
| 944 | #define gdImageTrueColor(im) ((im)->trueColor)
|
|---|
| 945 |
|
|---|
| 946 | #define gdImageSX(im) ((im)->sx)
|
|---|
| 947 | #define gdImageSY(im) ((im)->sy)
|
|---|
| 948 | #define gdImageColorsTotal(im) ((im)->colorsTotal)
|
|---|
| 949 | #define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
|
|---|
| 950 | (im)->red[(c)])
|
|---|
| 951 | #define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
|
|---|
| 952 | (im)->green[(c)])
|
|---|
| 953 | #define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
|
|---|
| 954 | (im)->blue[(c)])
|
|---|
| 955 | #define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
|
|---|
| 956 | (im)->alpha[(c)])
|
|---|
| 957 | #define gdImageGetTransparent(im) ((im)->transparent)
|
|---|
| 958 | #define gdImageGetInterlaced(im) ((im)->interlace)
|
|---|
| 959 |
|
|---|
| 960 | /* These macros provide direct access to pixels in
|
|---|
| 961 | palette-based and truecolor images, respectively.
|
|---|
| 962 | If you use these macros, you must perform your own
|
|---|
| 963 | bounds checking. Use of the macro for the correct type
|
|---|
| 964 | of image is also your responsibility. */
|
|---|
| 965 | #define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
|
|---|
| 966 | #define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
|
|---|
| 967 |
|
|---|
| 968 | #define gdImageResolutionX(im) (im)->res_x
|
|---|
| 969 | #define gdImageResolutionY(im) (im)->res_y
|
|---|
| 970 |
|
|---|
| 971 | /* I/O Support routines. */
|
|---|
| 972 |
|
|---|
| 973 | BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *);
|
|---|
| 974 | /* If data is null, size is ignored and an initial data buffer is
|
|---|
| 975 | allocated automatically. NOTE: this function assumes gd has the right
|
|---|
| 976 | to free or reallocate "data" at will! Also note that gd will free
|
|---|
| 977 | "data" when the IO context is freed. If data is not null, it must point
|
|---|
| 978 | to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
|
|---|
| 979 | If not, see gdNewDynamicCtxEx for an alternative. */
|
|---|
| 980 | BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
|
|---|
| 981 | /* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
|
|---|
| 982 | needed as described above. If freeFlag is zero, gd will never free
|
|---|
| 983 | or reallocate "data", which means that the context should only be used
|
|---|
| 984 | for *reading* an image from a memory buffer, or writing an image to a
|
|---|
| 985 | memory buffer which is already large enough. If the memory buffer is
|
|---|
| 986 | not large enough and an image write is attempted, the write operation
|
|---|
| 987 | will fail. Those wishing to write an image to a buffer in memory have
|
|---|
| 988 | a much simpler alternative in the gdImage[something]Ptr functions. */
|
|---|
| 989 | BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag);
|
|---|
| 990 | BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
|
|---|
| 991 | BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size);
|
|---|
| 992 |
|
|---|
| 993 | #define GD2_CHUNKSIZE 128
|
|---|
| 994 | #define GD2_CHUNKSIZE_MIN 64
|
|---|
| 995 | #define GD2_CHUNKSIZE_MAX 4096
|
|---|
| 996 |
|
|---|
| 997 | #define GD2_VERS 2
|
|---|
| 998 | #define GD2_ID "gd2"
|
|---|
| 999 |
|
|---|
| 1000 | #define GD2_FMT_RAW 1
|
|---|
| 1001 | #define GD2_FMT_COMPRESSED 2
|
|---|
| 1002 |
|
|---|
| 1003 | /* Image comparison definitions */
|
|---|
| 1004 | BGD_DECLARE(int) gdImageCompare (gdImagePtr im1, gdImagePtr im2);
|
|---|
| 1005 |
|
|---|
| 1006 | BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im);
|
|---|
| 1007 | BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im);
|
|---|
| 1008 | BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im);
|
|---|
| 1009 |
|
|---|
| 1010 | #define GD_FLIP_HORINZONTAL 1
|
|---|
| 1011 | #define GD_FLIP_VERTICAL 2
|
|---|
| 1012 | #define GD_FLIP_BOTH 3
|
|---|
| 1013 |
|
|---|
| 1014 | /**
|
|---|
| 1015 | * Group: Crop
|
|---|
| 1016 | *
|
|---|
| 1017 | * Constants: gdCropMode
|
|---|
| 1018 | * GD_CROP_DEFAULT - Default crop mode (4 corners or background)
|
|---|
| 1019 | * GD_CROP_TRANSPARENT - Crop using the transparent color
|
|---|
| 1020 | * GD_CROP_BLACK - Crop black borders
|
|---|
| 1021 | * GD_CROP_WHITE - Crop white borders
|
|---|
| 1022 | * GD_CROP_SIDES - Crop using colors of the 4 corners
|
|---|
| 1023 | *
|
|---|
| 1024 | * See also:
|
|---|
| 1025 | * <gdImageAutoCrop>
|
|---|
| 1026 | **/
|
|---|
| 1027 | enum gdCropMode {
|
|---|
| 1028 | GD_CROP_DEFAULT = 0,
|
|---|
| 1029 | GD_CROP_TRANSPARENT,
|
|---|
| 1030 | GD_CROP_BLACK,
|
|---|
| 1031 | GD_CROP_WHITE,
|
|---|
| 1032 | GD_CROP_SIDES,
|
|---|
| 1033 | GD_CROP_THRESHOLD
|
|---|
| 1034 | };
|
|---|
| 1035 |
|
|---|
| 1036 | BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop);
|
|---|
| 1037 | BGD_DECLARE(gdImagePtr) gdImageCropAuto(gdImagePtr im, const unsigned int mode);
|
|---|
| 1038 | BGD_DECLARE(gdImagePtr) gdImageCropThreshold(gdImagePtr im, const unsigned int color, const float threshold);
|
|---|
| 1039 |
|
|---|
| 1040 | BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id);
|
|---|
| 1041 |
|
|---|
| 1042 | gdImagePtr gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, const unsigned int new_height);
|
|---|
| 1043 | gdImagePtr gdImageScaleBicubic(gdImagePtr src_img, const unsigned int new_width, const unsigned int new_height);
|
|---|
| 1044 | gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height);
|
|---|
| 1045 | gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height);
|
|---|
| 1046 | gdImagePtr gdImageScaleTwoPass(const gdImagePtr pOrigImage, const unsigned int uOrigWidth, const unsigned int uOrigHeight, const unsigned int uNewWidth, const unsigned int uNewHeight);
|
|---|
| 1047 | BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height);
|
|---|
| 1048 |
|
|---|
| 1049 | gdImagePtr gdImageRotate90(gdImagePtr src, int ignoretransparent);
|
|---|
| 1050 | gdImagePtr gdImageRotate180(gdImagePtr src, int ignoretransparent);
|
|---|
| 1051 | gdImagePtr gdImageRotate270(gdImagePtr src, int ignoretransparent);
|
|---|
| 1052 | gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgColor);
|
|---|
| 1053 | gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor);
|
|---|
| 1054 | gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor);
|
|---|
| 1055 | gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor);
|
|---|
| 1056 | BGD_DECLARE(gdImagePtr) gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
|
|---|
| 1057 |
|
|---|
| 1058 | typedef enum {
|
|---|
| 1059 | GD_AFFINE_TRANSLATE = 0,
|
|---|
| 1060 | GD_AFFINE_SCALE,
|
|---|
| 1061 | GD_AFFINE_ROTATE,
|
|---|
| 1062 | GD_AFFINE_SHEAR_HORIZONTAL,
|
|---|
| 1063 | GD_AFFINE_SHEAR_VERTICAL
|
|---|
| 1064 | } gdAffineStandardMatrix;
|
|---|
| 1065 |
|
|---|
| 1066 | BGD_DECLARE(int) gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src, const double affine[6]);
|
|---|
| 1067 | BGD_DECLARE(int) gdAffineInvert (double dst[6], const double src[6]);
|
|---|
| 1068 | BGD_DECLARE(int) gdAffineFlip (double dst_affine[6], const double src_affine[6], const int flip_h, const int flip_v);
|
|---|
| 1069 | BGD_DECLARE(int) gdAffineConcat (double dst[6], const double m1[6], const double m2[6]);
|
|---|
| 1070 |
|
|---|
| 1071 | BGD_DECLARE(int) gdAffineIdentity (double dst[6]);
|
|---|
| 1072 | BGD_DECLARE(int) gdAffineScale (double dst[6], const double scale_x, const double scale_y);
|
|---|
| 1073 | BGD_DECLARE(int) gdAffineRotate (double dst[6], const double angle);
|
|---|
| 1074 | BGD_DECLARE(int) gdAffineShearHorizontal (double dst[6], const double angle);
|
|---|
| 1075 | BGD_DECLARE(int) gdAffineShearVertical(double dst[6], const double angle);
|
|---|
| 1076 | BGD_DECLARE(int) gdAffineTranslate (double dst[6], const double offset_x, const double offset_y);
|
|---|
| 1077 | BGD_DECLARE(double) gdAffineExpansion (const double src[6]);
|
|---|
| 1078 | BGD_DECLARE(int) gdAffineRectilinear (const double src[6]);
|
|---|
| 1079 | BGD_DECLARE(int) gdAffineEqual (const double matrix1[6], const double matrix2[6]);
|
|---|
| 1080 | BGD_DECLARE(int) gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]);
|
|---|
| 1081 | BGD_DECLARE(int) gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]);
|
|---|
| 1082 | /*
|
|---|
| 1083 | gdTransformAffineCopy(gdImagePtr dst, int x0, int y0, int x1, int y1,
|
|---|
| 1084 | const gdImagePtr src, int src_width, int src_height,
|
|---|
| 1085 | const double affine[6]);
|
|---|
| 1086 | */
|
|---|
| 1087 | BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox);
|
|---|
| 1088 |
|
|---|
| 1089 | #define GD_CMP_IMAGE 1 /* Actual image IS different */
|
|---|
| 1090 | #define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */
|
|---|
| 1091 | #define GD_CMP_COLOR 4 /* Image colours differ */
|
|---|
| 1092 | #define GD_CMP_SIZE_X 8 /* Image width differs */
|
|---|
| 1093 | #define GD_CMP_SIZE_Y 16 /* Image heights differ */
|
|---|
| 1094 | #define GD_CMP_TRANSPARENT 32 /* Transparent colour */
|
|---|
| 1095 | #define GD_CMP_BACKGROUND 64 /* Background colour */
|
|---|
| 1096 | #define GD_CMP_INTERLACE 128 /* Interlaced setting */
|
|---|
| 1097 | #define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */
|
|---|
| 1098 |
|
|---|
| 1099 | /* resolution affects ttf font rendering, particularly hinting */
|
|---|
| 1100 | #define GD_RESOLUTION 96 /* pixels per inch */
|
|---|
| 1101 |
|
|---|
| 1102 | #ifdef __cplusplus
|
|---|
| 1103 | }
|
|---|
| 1104 | #endif
|
|---|
| 1105 |
|
|---|
| 1106 | /* newfangled special effects */
|
|---|
| 1107 | #include "gdfx.h"
|
|---|
| 1108 |
|
|---|
| 1109 | #endif /* GD_H */
|
|---|
| 1110 |
|
|---|
| 1111 | #ifdef __cplusplus
|
|---|
| 1112 | }
|
|---|
| 1113 | #endif
|
|---|