1 #ifndef GD_H
2 #define GD_H 1
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11
12 #include "php_compat.h"
13
14 #define GD_MAJOR_VERSION 2
15 #define GD_MINOR_VERSION 0
16 #define GD_RELEASE_VERSION 35
17 #define GD_EXTRA_VERSION ""
18 #define GD_VERSION_STRING "2.0.35"
19
20 #ifdef NETWARE
21
22 #define DEFAULT_FONTPATH "sys:/java/nwgfx/lib/x11/fonts/ttf;."
23 #define PATHSEPARATOR ";"
24 #elif defined(WIN32)
25
26 #define DEFAULT_FONTPATH "c:\\winnt\\fonts;c:\\windows\\fonts;."
27 #define PATHSEPARATOR ";"
28 #else
29
30 #define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:."
31 #define PATHSEPARATOR ":"
32 #endif
33
34
35
36
37
38
39
40
41
42
43
44
45
46 #include <stdio.h>
47 #include "gd_io.h"
48
49 void php_gd_error_ex(int type, const char *format, ...);
50
51 void php_gd_error(const char *format, ...);
52
53
54
55
56
57
58 #define gdMaxColors 256
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 #define gdAlphaMax 127
82 #define gdAlphaOpaque 0
83 #define gdAlphaTransparent 127
84 #define gdRedMax 255
85 #define gdGreenMax 255
86 #define gdBlueMax 255
87 #define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
88 #define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
89 #define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
90 #define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
91 #define gdEffectReplace 0
92 #define gdEffectAlphaBlend 1
93 #define gdEffectNormal 2
94 #define gdEffectOverlay 3
95
96 #define GD_TRUE 1
97 #define GD_FALSE 0
98
99 #define GD_EPSILON 1e-6
100
101
102
103
104
105
106 int gdAlphaBlend(int dest, int src);
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138 typedef enum {
139 GD_DEFAULT = 0,
140 GD_BELL,
141 GD_BESSEL,
142 GD_BILINEAR_FIXED,
143 GD_BICUBIC,
144 GD_BICUBIC_FIXED,
145 GD_BLACKMAN,
146 GD_BOX,
147 GD_BSPLINE,
148 GD_CATMULLROM,
149 GD_GAUSSIAN,
150 GD_GENERALIZED_CUBIC,
151 GD_HERMITE,
152 GD_HAMMING,
153 GD_HANNING,
154 GD_MITCHELL,
155 GD_NEAREST_NEIGHBOUR,
156 GD_POWER,
157 GD_QUADRATIC,
158 GD_SINC,
159 GD_TRIANGLE,
160 GD_WEIGHTED4,
161 GD_METHOD_COUNT = 21
162 } gdInterpolationMethod;
163
164
165
166
167 typedef double (* interpolation_method )(double);
168
169 typedef struct gdImageStruct {
170
171 unsigned char ** pixels;
172 int sx;
173 int sy;
174
175
176
177 int colorsTotal;
178 int red[gdMaxColors];
179 int green[gdMaxColors];
180 int blue[gdMaxColors];
181 int open[gdMaxColors];
182
183
184
185
186
187
188
189
190
191
192 int transparent;
193 int *polyInts;
194 int polyAllocated;
195 struct gdImageStruct *brush;
196 struct gdImageStruct *tile;
197 int brushColorMap[gdMaxColors];
198 int tileColorMap[gdMaxColors];
199 int styleLength;
200 int stylePos;
201 int *style;
202 int interlace;
203
204 int thick;
205
206
207
208
209
210
211
212
213 int alpha[gdMaxColors];
214
215
216 int trueColor;
217 int ** tpixels;
218
219
220
221
222
223
224 int alphaBlendingFlag;
225
226 int antialias;
227
228
229
230 int saveAlphaFlag;
231
232
233
234 int AA;
235 int AA_color;
236 int AA_dont_blend;
237 unsigned char **AA_opacity;
238 int AA_polygon;
239
240
241
242 int AAL_x1;
243 int AAL_y1;
244 int AAL_x2;
245 int AAL_y2;
246 int AAL_Bx_Ax;
247 int AAL_By_Ay;
248 int AAL_LAB_2;
249 float AAL_LAB;
250
251
252 int cx1;
253 int cy1;
254 int cx2;
255 int cy2;
256 gdInterpolationMethod interpolation_id;
257 interpolation_method interpolation;
258 } gdImage;
259
260 typedef gdImage * gdImagePtr;
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279 typedef struct
280 {
281 double x, y;
282 }
283 gdPointF, *gdPointFPtr;
284
285 typedef struct {
286
287 int nchars;
288
289 int offset;
290
291 int w;
292 int h;
293
294
295
296 char *data;
297 } gdFont;
298
299
300 typedef gdFont *gdFontPtr;
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320 typedef struct
321 {
322 int x, y;
323 int width, height;
324 }
325 gdRect, *gdRectPtr;
326
327
328
329
330 #define gdDashSize 4
331
332
333
334 #define gdStyled (-2)
335 #define gdBrushed (-3)
336 #define gdStyledBrushed (-4)
337 #define gdTiled (-5)
338
339
340
341 #define gdTransparent (-6)
342
343 #define gdAntiAliased (-7)
344
345
346
347
348 gdImagePtr gdImageCreate(int sx, int sy);
349
350
351 #define gdImageCreatePalette gdImageCreate
352
353
354 gdImagePtr gdImageCreateTrueColor(int sx, int sy);
355
356
357
358
359
360
361 gdImagePtr gdImageCreateFromPng(FILE *fd);
362 gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
363 gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
364 gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
365 gdImagePtr gdImageCreateFromJpeg(FILE *infile);
366 gdImagePtr gdImageCreateFromJpegEx(FILE *infile, int ignore_warning);
367 gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
368 gdImagePtr gdImageCreateFromJpegCtxEx(gdIOCtx *infile, int ignore_warning);
369 gdImagePtr gdImageCreateFromJpegPtr (int size, void *data);
370 gdImagePtr gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning);
371 gdImagePtr gdImageCreateFromWebp(FILE *fd);
372 gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr in);
373 gdImagePtr gdImageCreateFromWebpPtr (int size, void *data);
374
375 int gdJpegGetVersionInt();
376 const char * gdPngGetVersionString();
377
378 int gdJpegGetVersionInt();
379 const char * gdJpegGetVersionString();
380
381
382
383
384
385
386 typedef struct {
387 int (*source) (void *context, char *buffer, int len);
388 void *context;
389 } gdSource, *gdSourcePtr;
390
391 gdImagePtr gdImageCreateFromPngSource(gdSourcePtr in);
392
393 gdImagePtr gdImageCreateFromGd(FILE *in);
394 gdImagePtr gdImageCreateFromGdCtx(gdIOCtxPtr in);
395
396 gdImagePtr gdImageCreateFromGd2(FILE *in);
397 gdImagePtr gdImageCreateFromGd2Ctx(gdIOCtxPtr in);
398
399 gdImagePtr gdImageCreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h);
400 gdImagePtr gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, int h);
401
402 gdImagePtr gdImageCreateFromXbm(FILE *fd);
403 void gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
404
405 gdImagePtr gdImageCreateFromXpm (char *filename);
406
407 void gdImageDestroy(gdImagePtr im);
408
409
410
411
412
413
414
415
416 void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
417
418 int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y);
419 int gdImageGetPixel(gdImagePtr im, int x, int y);
420
421 void gdImageAABlend(gdImagePtr im);
422
423 void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
424 void gdImageAALine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
425
426
427
428 void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
429
430
431 void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
432
433 void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
434 void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
435 void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
436 void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
437 void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
438 void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
439 void gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
440 void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
441 void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
442
443
444
445
446
447
448 void gdFontCacheMutexSetup();
449 void gdFontCacheMutexShutdown();
450
451
452
453
454
455
456
457 int gdFontCacheSetup(void);
458
459
460 void gdFontCacheShutdown(void);
461
462
463 char *gdImageStringTTF(gdImage *im, int *brect, int fg, char *fontlist,
464 double ptsize, double angle, int x, int y, char *string);
465
466
467 char *gdImageStringFT(gdImage *im, int *brect, int fg, char *fontlist,
468 double ptsize, double angle, int x, int y, char *string);
469
470 typedef struct {
471 double linespacing;
472 int flags;
473 int charmap;
474
475
476
477 int hdpi;
478 int vdpi;
479 }
480 gdFTStringExtra, *gdFTStringExtraPtr;
481
482 #define gdFTEX_LINESPACE 1
483 #define gdFTEX_CHARMAP 2
484 #define gdFTEX_RESOLUTION 4
485
486
487 #define gdFTEX_Unicode 0
488 #define gdFTEX_Shift_JIS 1
489 #define gdFTEX_Big5 2
490 #define gdFTEX_MacRoman 3
491
492
493 char *
494 gdImageStringFTEx(gdImage * im, int *brect, int fg, char * fontlist,
495 double ptsize, double angle, int x, int y, char * string,
496 gdFTStringExtraPtr strex);
497
498
499
500 typedef struct {
501 int x, y;
502 } gdPoint, *gdPointPtr;
503
504 void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
505 void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
506
507
508
509 int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
510
511 int gdImageColorAllocateAlpha(gdImagePtr im, int r, int g, int b, int a);
512
513 int gdImageColorClosest(gdImagePtr im, int r, int g, int b);
514
515
516
517
518 int gdImageColorClosestAlpha(gdImagePtr im, int r, int g, int b, int a);
519
520 int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
521
522 int gdImageColorExact(gdImagePtr im, int r, int g, int b);
523
524 int gdImageColorExactAlpha(gdImagePtr im, int r, int g, int b, int a);
525
526 int gdImageColorResolve(gdImagePtr im, int r, int g, int b);
527
528 int gdImageColorResolveAlpha(gdImagePtr im, int r, int g, int b, int a);
529
530
531
532
533 #define gdTrueColor(r, g, b) (((r) << 16) + \
534 ((g) << 8) + \
535 (b))
536
537
538
539
540
541 #define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
542 ((r) << 16) + \
543 ((g) << 8) + \
544 (b))
545
546 void gdImageColorDeallocate(gdImagePtr im, int color);
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564 gdImagePtr gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag, int colorsWanted);
565
566 void gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted);
567 int gdImagePaletteToTrueColor(gdImagePtr src);
568
569
570
571
572 int gdImageColorMatch(gdImagePtr im1, gdImagePtr im2);
573
574
575
576
577
578
579
580
581
582
583 void gdImageColorTransparent(gdImagePtr im, int color);
584
585 void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src);
586 void gdImagePng(gdImagePtr im, FILE *out);
587 void gdImagePngCtx(gdImagePtr im, gdIOCtx *out);
588 void gdImageGif(gdImagePtr im, FILE *out);
589 void gdImageGifCtx(gdImagePtr im, gdIOCtx *out);
590
591
592
593
594
595 void gdImagePngEx(gdImagePtr im, FILE * out, int level, int basefilter);
596 void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level, int basefilter);
597
598 void gdImageWBMP(gdImagePtr image, int fg, FILE *out);
599 void gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out);
600
601
602
603 void gdFree(void *m);
604
605
606 void *gdImageWBMPPtr(gdImagePtr im, int *size, int fg);
607
608
609
610 void gdImageJpeg(gdImagePtr im, FILE *out, int quality);
611 void gdImageJpegCtx(gdImagePtr im, gdIOCtx *out, int quality);
612
613 void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization);
614
615
616 void *gdImageJpegPtr(gdImagePtr im, int *size, int quality);
617
618 gdImagePtr gdImageCreateFromGif(FILE *fd);
619 gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in);
620 gdImagePtr gdImageCreateFromGifSource(gdSourcePtr in);
621
622
623
624
625
626
627 typedef struct {
628 int (*sink) (void *context, const char *buffer, int len);
629 void *context;
630 } gdSink, *gdSinkPtr;
631
632 void gdImagePngToSink(gdImagePtr im, gdSinkPtr out);
633
634 void gdImageGd(gdImagePtr im, FILE *out);
635 void gdImageGd2(gdImagePtr im, FILE *out, int cs, int fmt);
636
637
638 void* gdImagePngPtr(gdImagePtr im, int *size);
639
640
641 void* gdImageGdPtr(gdImagePtr im, int *size);
642 void *gdImagePngPtrEx(gdImagePtr im, int *size, int level, int basefilter);
643
644
645 void* gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size);
646
647 void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c);
648
649
650
651
652
653
654
655
656
657
658
659
660 #define gdArc 0
661 #define gdPie gdArc
662 #define gdChord 1
663 #define gdNoFill 2
664 #define gdEdged 4
665
666 void gdImageFilledArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style);
667 void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color);
668 void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
669 void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
670 void gdImageFill(gdImagePtr im, int x, int y, int color);
671 void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
672 void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
673 int srcX, int srcY, int w, int h, int pct);
674 void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
675 int srcX, int srcY, int w, int h, int pct);
676
677
678
679
680 void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
681
682
683
684
685
686
687
688
689
690
691 void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
692
693 gdImagePtr gdImageRotate90(gdImagePtr src, int ignoretransparent);
694 gdImagePtr gdImageRotate180(gdImagePtr src, int ignoretransparent);
695 gdImagePtr gdImageRotate270(gdImagePtr src, int ignoretransparent);
696 gdImagePtr gdImageRotate45(gdImagePtr src, double dAngle, int clrBack, int ignoretransparent);
697 gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack, int ignoretransparent);
698 gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
699
700 void gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
701 void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
702 void gdImageSetAntiAliased(gdImagePtr im, int c);
703 void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend);
704 void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
705
706
707 void gdImageSetThickness(gdImagePtr im, int thickness);
708
709 void gdImageInterlace(gdImagePtr im, int interlaceArg);
710 void gdImageAlphaBlending(gdImagePtr im, int alphaBlendingArg);
711 void gdImageAntialias(gdImagePtr im, int antialias);
712 void gdImageSaveAlpha(gdImagePtr im, int saveAlphaArg);
713
714 enum gdPixelateMode {
715 GD_PIXELATE_UPPERLEFT,
716 GD_PIXELATE_AVERAGE
717 };
718
719 int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode);
720
721
722
723
724
725
726 #define gdImageTrueColor(im) ((im)->trueColor)
727
728 #define gdImageSX(im) ((im)->sx)
729 #define gdImageSY(im) ((im)->sy)
730 #define gdImageColorsTotal(im) ((im)->colorsTotal)
731 #define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
732 (im)->red[(c)])
733 #define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
734 (im)->green[(c)])
735 #define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
736 (im)->blue[(c)])
737 #define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
738 (im)->alpha[(c)])
739 #define gdImageGetTransparent(im) ((im)->transparent)
740 #define gdImageGetInterlaced(im) ((im)->interlace)
741
742
743
744
745
746
747 #define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
748 #define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
749
750
751
752 gdIOCtx* gdNewFileCtx(FILE*);
753 gdIOCtx* gdNewDynamicCtx(int, void*);
754 gdIOCtx *gdNewDynamicCtxEx(int size, void *data, int freeFlag);
755 gdIOCtx* gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
756 void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
757
758 #define GD2_CHUNKSIZE 128
759 #define GD2_CHUNKSIZE_MIN 64
760 #define GD2_CHUNKSIZE_MAX 4096
761
762 #define GD2_VERS 2
763 #define GD2_ID "gd2"
764 #define GD2_FMT_RAW 1
765 #define GD2_FMT_COMPRESSED 2
766
767
768
769
770
771
772
773
774 int gdImageNegate(gdImagePtr src);
775
776
777 int gdImageGrayScale(gdImagePtr src);
778
779
780 int gdImageBrightness(gdImagePtr src, int brightness);
781
782
783 int gdImageContrast(gdImagePtr src, double contrast);
784
785
786 int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
787
788
789 int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset);
790
791 int gdImageEdgeDetectQuick(gdImagePtr src);
792
793 int gdImageGaussianBlur(gdImagePtr im);
794
795 int gdImageSelectiveBlur( gdImagePtr src);
796
797 int gdImageEmboss(gdImagePtr im);
798
799 int gdImageMeanRemoval(gdImagePtr im);
800
801 int gdImageSmooth(gdImagePtr im, float weight);
802
803
804 int gdImageCompare(gdImagePtr im1, gdImagePtr im2);
805
806 void gdImageFlipHorizontal(gdImagePtr im);
807 void gdImageFlipVertical(gdImagePtr im);
808 void gdImageFlipBoth(gdImagePtr im);
809
810 #define GD_FLIP_HORINZONTAL 1
811 #define GD_FLIP_VERTICAL 2
812 #define GD_FLIP_BOTH 3
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827 enum gdCropMode {
828 GD_CROP_DEFAULT = 0,
829 GD_CROP_TRANSPARENT,
830 GD_CROP_BLACK,
831 GD_CROP_WHITE,
832 GD_CROP_SIDES,
833 GD_CROP_THRESHOLD
834 };
835
836 gdImagePtr gdImageCrop(gdImagePtr src, const gdRectPtr crop);
837 gdImagePtr gdImageCropAuto(gdImagePtr im, const unsigned int mode);
838 gdImagePtr gdImageCropThreshold(gdImagePtr im, const unsigned int color, const float threshold);
839
840 int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id);
841
842 gdImagePtr gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, const unsigned int new_height);
843 gdImagePtr gdImageScaleBicubic(gdImagePtr src_img, const unsigned int new_width, const unsigned int new_height);
844 gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height);
845 gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height);
846 gdImagePtr gdImageScaleTwoPass(const gdImagePtr pOrigImage, const unsigned int uOrigWidth, const unsigned int uOrigHeight, const unsigned int uNewWidth, const unsigned int uNewHeight);
847 gdImagePtr gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height);
848
849 gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgColor);
850 gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor);
851 gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor);
852 gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor);
853 gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
854
855 typedef enum {
856 GD_AFFINE_TRANSLATE = 0,
857 GD_AFFINE_SCALE,
858 GD_AFFINE_ROTATE,
859 GD_AFFINE_SHEAR_HORIZONTAL,
860 GD_AFFINE_SHEAR_VERTICAL,
861 } gdAffineStandardMatrix;
862
863 int gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src, const double affine[6]);
864 int gdAffineInvert (double dst[6], const double src[6]);
865 int gdAffineFlip (double dst_affine[6], const double src_affine[6], const int flip_h, const int flip_v);
866 int gdAffineConcat (double dst[6], const double m1[6], const double m2[6]);
867
868 int gdAffineIdentity (double dst[6]);
869 int gdAffineScale (double dst[6], const double scale_x, const double scale_y);
870 int gdAffineRotate (double dst[6], const double angle);
871 int gdAffineShearHorizontal (double dst[6], const double angle);
872 int gdAffineShearVertical(double dst[6], const double angle);
873 int gdAffineTranslate (double dst[6], const double offset_x, const double offset_y);
874 double gdAffineExpansion (const double src[6]);
875 int gdAffineRectilinear (const double src[6]);
876 int gdAffineEqual (const double matrix1[6], const double matrix2[6]);
877 int gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]);
878 int gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]);
879
880
881
882
883
884 int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox);
885
886
887 #define GD_CMP_IMAGE 1
888 #define GD_CMP_NUM_COLORS 2
889 #define GD_CMP_COLOR 4
890 #define GD_CMP_SIZE_X 8
891 #define GD_CMP_SIZE_Y 16
892 #define GD_CMP_TRANSPARENT 32
893 #define GD_CMP_BACKGROUND 64
894 #define GD_CMP_INTERLACE 128
895 #define GD_CMP_TRUECOLOR 256
896
897
898 #define GD_RESOLUTION 96
899
900 #ifdef __cplusplus
901 }
902 #endif
903
904
905 #define gdImageBoundsSafe(im, x, y) (!((((y) < (im)->cy1) || ((y) > (im)->cy2)) || (((x) < (im)->cx1) || ((x) > (im)->cx2))))
906
907 #endif