LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
gdpp.h
Go to the documentation of this file.
1/* *****************************************************************************
2** Initial file written and documented by:
3** Kevin Shepherd <kshepherd@php.net> December 2007
4** of Scarlet Line http://www.scarletline.com/
5** with contributions from Torben Nielsen.
6*******************************************************************************/
22#ifndef _gdpp_h
23#define _gdpp_h
24#ifdef __cplusplus
25#include "gd_intern.h"
26#include "gd_io_stream.h"
27#include <string>
28
30
39namespace GD {
43class BGD_EXPORT_DATA_PROT Point {
44 public:
45 // Constructors
46 Point(int x, int y) : _x(x), _y(y) {}
47 Point(const Point &p) : _x(p._x), _y(p._y) {}
48 Point() : _x(0), _y(0) {}
49 Point &operator=(const Point &p)
50 {
51 _x = p._x;
52 _y = p._y;
53 return (*this);
54 }
55 // Accessors
56 int X() const { return _x; }
57 int Y() const { return _y; }
58 // Updaters
59 void X(int x) { _x = x; }
60 void Y(int y) { _y = y; }
61 void set(int x, int y)
62 {
63 _x = x;
64 _y = y;
65 }
66 int &lhsX() { return _x; }
67 int &lhsY() { return _y; }
68
69 gdPointPtr as_gdPointPtr() { return (gdPointPtr)this; }
70
71 protected:
72 int _x, _y;
73};
74typedef Point *PointPtr;
78class BGD_EXPORT_DATA_PROT Size {
79 public:
80 // Constructors
81 Size(int w, int h) : _w(w), _h(h) {}
82 Size(const Size &p) : _w(p._w), _h(p._h) {}
83 Size() : _w(0), _h(0) {}
84 Size &operator=(const Size &p)
85 {
86 _w = p._w;
87 _h = p._h;
88 return (*this);
89 }
90 // Accessors
91 int W() const { return _w; }
92 int H() const { return _h; }
93 // Updaters
94 void W(int w) { _w = w; }
95 void H(int h) { _h = h; }
96 void set(int w, int h)
97 {
98 _w = w;
99 _h = h;
100 }
101 int &lhsW() { return _w; }
102 int &lhsH() { return _h; }
103
104 protected:
105 int _w, _h;
106};
107typedef Size *SizePtr;
108
112class BGD_EXPORT_DATA_PROT TrueColor {
113 public:
114 union as_types {
115 int as_int;
116 struct uchars {
117 unsigned char blue, green, red, alpha;
118 } as_uchar;
119 };
120 TrueColor() { internal.as_int = 0; }
121 TrueColor(int c) { internal.as_int = c; }
122 TrueColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0)
123 {
124 internal.as_uchar.alpha = a;
125 internal.as_uchar.red = r;
126 internal.as_uchar.green = g;
127 internal.as_uchar.blue = b;
128 }
129 // Accessors
130 int Int() const { return internal.as_int; }
131 unsigned char Red() const { return internal.as_uchar.red; }
132 unsigned char Green() const { return internal.as_uchar.green; }
133 unsigned char Blue() const { return internal.as_uchar.blue; }
134 unsigned char Alpha() const { return internal.as_uchar.alpha; }
135 // Updaters
136 void set(int c) { internal.as_int = c; }
137 void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0)
138 {
139 internal.as_uchar.alpha = a;
140 internal.as_uchar.red = r;
141 internal.as_uchar.green = g;
142 internal.as_uchar.blue = b;
143 }
144 void Red(unsigned char c) { internal.as_uchar.red = c; }
145 void Green(unsigned char c) { internal.as_uchar.green = c; }
146 void Blue(unsigned char c) { internal.as_uchar.blue = c; }
147 void Alpha(unsigned char c) { internal.as_uchar.alpha = c; }
148
149 protected:
150 as_types internal;
151};
152/* The following tags are simply empty structures which are used
153 to tell the compiler which constructor we want when we know
154 the image file format.
155*/
156struct BGD_EXPORT_DATA_PROT Png_tag {};
157struct BGD_EXPORT_DATA_PROT Gif_tag {};
158struct BGD_EXPORT_DATA_PROT WBMP_tag {};
159struct BGD_EXPORT_DATA_PROT Jpeg_tag {};
160struct BGD_EXPORT_DATA_PROT Gd_tag {};
161struct BGD_EXPORT_DATA_PROT Gd2_tag {};
162struct BGD_EXPORT_DATA_PROT Xbm_tag {};
163
168class BGD_EXPORT_DATA_PROT Image {
169 public:
172 Image() : im(0) {}
179 Image(int sx, int sy, bool istruecolor = false) : im(0)
180 {
181 if (istruecolor)
182 CreateTrueColor(sx, sy);
183 else
184 Create(sx, sy);
185 }
191 Image(const Size &s, bool istruecolor = false) : im(0)
192 {
193 if (istruecolor)
194 CreateTrueColor(s);
195 else
196 Create(s);
197 }
202 Image(gdImagePtr i) : im(i) {}
207 Image(const GD::Image &i) : im(0) { Copy(i); }
212 Image(std::istream &in) : im(0) { CreateFrom(in); }
218 Image(FILE *in) : im(0) { CreateFrom(in); }
224 Image(int size, void *data) : im(0) { CreateFrom(size, data); }
225
231 Image(std::istream &in, Png_tag) : im(0) { CreateFromPng(in); }
238 Image(FILE *in, Png_tag) : im(0) { CreateFromPng(in); }
245 Image(gdIOCtxPtr in, Png_tag) : im(0) { CreateFromPng(in); }
252 Image(int size, void *data, Png_tag) : im(0) { CreateFromPng(size, data); }
253
259 Image(std::istream &in, Gif_tag) : im(0) { CreateFromGif(in); }
266 Image(FILE *in, Gif_tag) : im(0) { CreateFromGif(in); }
273 Image(gdIOCtxPtr in, Gif_tag) : im(0) { CreateFromGif(in); }
280 Image(int size, void *data, Gif_tag) : im(0) { CreateFromGif(size, data); }
281
288 Image(std::istream &in, WBMP_tag) : im(0) { CreateFromWBMP(in); }
295 Image(FILE *in, WBMP_tag) : im(0) { CreateFromWBMP(in); }
302 Image(gdIOCtxPtr in, WBMP_tag) : im(0) { CreateFromWBMP(in); }
309 Image(int size, void *data, WBMP_tag) : im(0) { CreateFromWBMP(size, data); }
310
316 Image(std::istream &in, Jpeg_tag) : im(0) { CreateFromJpeg(in); }
323 Image(FILE *in, Jpeg_tag) : im(0) { CreateFromJpeg(in); }
330 Image(gdIOCtxPtr in, Jpeg_tag) : im(0) { CreateFromJpeg(in); }
337 Image(int size, void *data, Jpeg_tag) : im(0) { CreateFromJpeg(size, data); }
338
344 Image(std::istream &in, Gd_tag) : im(0) { CreateFromGd(in); }
351 Image(FILE *in, Gd_tag) : im(0) { CreateFromGd(in); }
358 Image(gdIOCtxPtr in, Gd_tag) : im(0) { CreateFromGd(in); }
365 Image(int size, void *data, Gd_tag) : im(0) { CreateFromGd(size, data); }
366
372 Image(std::istream &in, Gd2_tag) : im(0) { CreateFromGd2(in); }
379 Image(FILE *in, Gd2_tag) : im(0) { CreateFromGd2(in); }
386 Image(gdIOCtxPtr in, Gd2_tag) : im(0) { CreateFromGd2(in); }
393 Image(int size, void *data, Gd2_tag) : im(0) { CreateFromGd2(size, data); }
394
401 Image(FILE *in, Xbm_tag) : im(0) { CreateFromXbm(in); }
402
403 ~Image() { clear(); }
404
408 GD::Image &operator=(const GD::Image &src)
409 {
410 Copy(src);
411 return (*this);
412 }
416 void Copy(const GD::Image &src)
417 {
418 int w = src.Width(), h = src.Height();
419 if (src.IsTrueColor())
420 CreateTrueColor(w, h);
421 else {
422 Create(w, h);
423 PaletteCopy(src);
424 }
425 Copy(src, 0, 0, 0, 0, w, h);
426 }
429 bool good() const { return (im != 0); }
430 // Creation:
437 bool Create(int sx, int sy)
438 {
439 clear();
440 return ((im = gdImageCreate(sx, sy)) != 0);
441 }
448 bool CreateTrueColor(int sx, int sy)
449 {
450 clear();
451 return ((im = gdImageCreateTrueColor(sx, sy)) != 0);
452 }
458 bool Create(const Size &s) { return Create(s.W(), s.H()); }
464 bool CreateTrueColor(const Size &s) { return CreateTrueColor(s.W(), s.H()); }
465 // Create, determining the image format from the data
468 bool CreateFrom(FILE *in);
471 bool CreateFrom(std::istream &in);
473 bool CreateFrom(int size, void *data);
474
475 // Png
476 bool CreateFromPng(FILE *in)
477 {
478 clear();
479 return ((im = gdImageCreateFromPng(in)) != 0);
480 }
481 bool CreateFromPng(gdIOCtxPtr in)
482 {
483 clear();
484 return ((im = gdImageCreateFromPngCtx(in)) != 0);
485 }
486 bool CreateFromPng(int size, void *data)
487 {
488 clear();
489 return ((im = gdImageCreateFromPngPtr(size, data)) != 0);
490 }
491 bool CreateFromPng(std::istream &in)
492 {
493 clear();
494 istreamIOCtx _in_ctx(in);
495 return ((im = gdImageCreateFromPngCtx(&_in_ctx)) != 0);
496 }
497
498 // Gif
499 bool CreateFromGif(FILE *in)
500 {
501 clear();
502 return ((im = gdImageCreateFromGif(in)) != 0);
503 }
504 bool CreateFromGif(gdIOCtxPtr in)
505 {
506 clear();
507 return ((im = gdImageCreateFromGifCtx(in)) != 0);
508 }
509 bool CreateFromGif(int size, void *data)
510 {
511 clear();
512 return ((im = gdImageCreateFromGifPtr(size, data)) != 0);
513 }
514 bool CreateFromGif(std::istream &in)
515 {
516 clear();
517 istreamIOCtx _in_ctx(in);
518 return ((im = gdImageCreateFromGifCtx(&_in_ctx)) != 0);
519 }
520 // WBMP
521 bool CreateFromWBMP(FILE *in)
522 {
523 clear();
524 return ((im = gdImageCreateFromWBMP(in)) != 0);
525 }
526 bool CreateFromWBMP(gdIOCtxPtr in)
527 {
528 clear();
529 return ((im = gdImageCreateFromWBMPCtx(in)) != 0);
530 }
531 bool CreateFromWBMP(int size, void *data)
532 {
533 clear();
534 return ((im = gdImageCreateFromWBMPPtr(size, data)) != 0);
535 }
536 bool CreateFromWBMP(std::istream &in)
537 {
538 clear();
539 istreamIOCtx _in_ctx(in);
540 return ((im = gdImageCreateFromWBMPCtx(&_in_ctx)) != 0);
541 }
542
543 // Jpeg
554 bool CreateFromJpeg(FILE *in)
555 {
556 clear();
557 return ((im = gdImageCreateFromJpeg(in)) != 0);
558 }
569 bool CreateFromJpeg(gdIOCtxPtr in)
570 {
571 clear();
572 return ((im = gdImageCreateFromJpegCtx(in)) != 0);
573 }
584 bool CreateFromJpeg(int size, void *data)
585 {
586 clear();
587 return ((im = gdImageCreateFromJpegPtr(size, data)) != 0);
588 }
597 bool CreateFromJpeg(std::istream &in)
598 {
599 clear();
600 istreamIOCtx _in_ctx(in);
601 return ((im = gdImageCreateFromJpegCtx(&_in_ctx)) != 0);
602 }
603
604 // Gd
605 bool CreateFromGd(FILE *in)
606 {
607 clear();
608 return ((im = gdImageCreateFromGd(in)) != 0);
609 }
610 bool CreateFromGd(gdIOCtxPtr in)
611 {
612 clear();
613 return ((im = gdImageCreateFromGdCtx(in)) != 0);
614 }
615 bool CreateFromGd(int size, void *data)
616 {
617 clear();
618 return ((im = gdImageCreateFromGdPtr(size, data)) != 0);
619 }
620 bool CreateFromGd(std::istream &in)
621 {
622 clear();
623 istreamIOCtx _in_ctx(in);
624 return ((im = gdImageCreateFromGdCtx(&_in_ctx)) != 0);
625 }
626 // Gd2
627 bool CreateFromGd2(FILE *in)
628 {
629 clear();
630 return ((im = gdImageCreateFromGd2(in)) != 0);
631 }
632 bool CreateFromGd2(gdIOCtxPtr in)
633 {
634 clear();
635 return ((im = gdImageCreateFromGd2Ctx(in)) != 0);
636 }
637 bool CreateFromGd2(int size, void *data)
638 {
639 clear();
640 return ((im = gdImageCreateFromGd2Ptr(size, data)) != 0);
641 }
642 bool CreateFromGd2(std::istream &in)
643 {
644 clear();
645 istreamIOCtx _in_ctx(in);
646 return ((im = gdImageCreateFromGd2Ctx(&_in_ctx)) != 0);
647 }
648 // Gd2 Part
649 bool CreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h)
650 {
651 clear();
652 return ((im = gdImageCreateFromGd2Part(in, srcx, srcy, w, h)) != 0);
653 }
654 bool CreateFromGd2Part(gdIOCtxPtr in, int srcx, int srcy, int w, int h)
655 {
656 clear();
657 return ((im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h)) != 0);
658 }
659 bool CreateFromGd2Part(int size, void *data, int srcx, int srcy, int w, int h)
660 {
661 clear();
662 return ((im = gdImageCreateFromGd2PartPtr(size, data, srcx, srcy, w, h)) != 0);
663 }
664 bool CreateFromGd2Part(std::istream &in, int srcx, int srcy, int w, int h)
665 {
666 clear();
667 istreamIOCtx _in_ctx(in);
668 return ((im = gdImageCreateFromGd2PartCtx(&_in_ctx, srcx, srcy, w, h)) != 0);
669 }
670 bool CreateFromGd2Part(FILE *in, const Point &src, const Size &s)
671 {
672 return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
673 }
674 bool CreateFromGd2Part(gdIOCtxPtr in, const Point &src, const Size &s)
675 {
676 return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
677 }
678 bool CreateFromGd2Part(int size, void *data, const Point &src, const Size &s)
679 {
680 return CreateFromGd2Part(size, data, src.X(), src.Y(), s.W(), s.H());
681 }
682 bool CreateFromGd2Part(std::istream &in, const Point &src, const Size &s)
683 {
684 return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
685 }
686 // Xbm
687 bool CreateFromXbm(FILE *in)
688 {
689 clear();
690 return ((im = gdImageCreateFromXbm(in)) != 0);
691 }
692 // Xpm
693 bool CreateFromXpm(char *filename)
694 {
695 clear();
696 return ((im = gdImageCreateFromXpm(filename)) != 0);
697 }
698 bool CreateFromXpm(std::string &filename) { return CreateFromXpm((char *)(filename.c_str())); }
699
700 // Accessors, Updaters & Methods:
701 void SetPixel(int x, int y, int color) { gdImageSetPixel(im, x, y, color); }
702 void SetPixel(const Point &p, int color) { SetPixel(p.X(), p.Y(), color); }
703 int GetPixel(int x, int y) const { return gdImageGetPixel(im, x, y); }
704 int GetPixel(const Point &p) const { return GetPixel(p.X(), p.Y()); }
705 int GetTrueColorPixel(int x, int y) const { return gdImageGetTrueColorPixel(im, x, y); }
706 int GetTrueColorPixel(const Point &p) const { return GetTrueColorPixel(p.X(), p.Y()); }
707
708 void SetPixel(int x, int y, TrueColor c) { SetPixel(x, y, c.Int()); }
709 void SetPixel(const Point &p, TrueColor c) { SetPixel(p.X(), p.Y(), c.Int()); }
710 void GetTrueColorPixel(TrueColor &c, int x, int y) const { c.set(GetTrueColorPixel(x, y)); }
711 void GetTrueColorPixel(TrueColor &c, const Point &p) const
712 {
713 c.set(GetTrueColorPixel(p.X(), p.Y()));
714 }
715
716 void AABlend() { gdImageAABlend(im); }
717
718 void Line(int x1, int y1, int x2, int y2, int color) { gdImageLine(im, x1, y1, x2, y2, color); }
719 void Line(const Point &p1, const Point &p2, int color)
720 {
721 Line(p1.X(), p1.Y(), p2.X(), p2.Y(), color);
722 }
723 void Rectangle(int x1, int y1, int x2, int y2, int color)
724 {
725 gdImageRectangle(im, x1, y1, x2, y2, color);
726 }
727 void Rectangle(const Point &p1, const Point &p2, int color)
728 {
729 Rectangle(p1.X(), p1.Y(), p2.X(), p2.Y(), color);
730 }
731 void Rectangle(const Point &p, const Size &s, int color)
732 {
733 Rectangle(p.X(), p.Y(), p.X() + s.W(), p.Y() + s.H(), color);
734 }
735 void FilledRectangle(int x1, int y1, int x2, int y2, int color)
736 {
737 gdImageFilledRectangle(im, x1, y1, x2, y2, color);
738 }
739 void FilledRectangle(const Point &p1, const Point &p2, int color)
740 {
741 FilledRectangle(p1.X(), p1.Y(), p2.X(), p2.Y(), color);
742 }
743 void FilledRectangle(const Point &p, const Size &s, int color)
744 {
745 FilledRectangle(p.X(), p.Y(), p.X() + s.W(), p.Y() + s.H(), color);
746 }
747
748 void SetClip(int x1, int y1, int x2, int y2) { gdImageSetClip(im, x1, y1, x2, y2); }
749 void SetClip(const Point &p1, const Point &p2) { SetClip(p1.X(), p1.Y(), p2.X(), p2.Y()); }
750 void SetClip(const Point &p, const Size &s)
751 {
752 SetClip(p.X(), p.Y(), p.X() + s.W(), p.Y() + s.H());
753 }
754 void GetClip(int &x1, int &y1, int &x2, int &y2) const
755 {
756 gdImageGetClip(im, &x1, &y1, &x2, &y2);
757 }
758 void GetClip(Point &p1, Point &p2) const
759 {
760 GetClip(p1.lhsX(), p1.lhsY(), p2.lhsX(), p2.lhsY());
761 }
762 void GetClip(Point &p, Size &s) const
763 {
764 Point p2;
765 GetClip(p.lhsX(), p.lhsY(), p2.lhsX(), p2.lhsY());
766 s.set(p2.X() - p.X(), p2.Y() - p.Y());
767 }
768
769 bool BoundsSafe(int x, int y) const { return (gdImageBoundsSafeMacro(im, x, y) ? true : false); }
770 bool BoundsSafe(const Point &p) const { return BoundsSafe(p.X(), p.Y()); }
771
772 void Char(gdFontPtr f, int x, int y, int c, int color) { gdImageChar(im, f, x, y, c, color); }
773 void CharUp(gdFontPtr f, int x, int y, int c, int color)
774 {
775 gdImageCharUp(im, f, x, y, c, color);
776 }
777
778 void Char(gdFontPtr f, const Point &p, int c, int color) { Char(f, p.X(), p.Y(), c, color); }
779 void CharUp(gdFontPtr f, const Point &p, int c, int color)
780 {
781 CharUp(f, p.X(), p.Y(), c, color);
782 }
783
784 void String(gdFontPtr f, int x, int y, unsigned char *s, int color)
785 {
786 gdImageString(im, f, x, y, (unsigned char *)s, color);
787 }
788 void StringUp(gdFontPtr f, int x, int y, unsigned char *s, int color)
789 {
790 gdImageStringUp(im, f, x, y, (unsigned char *)s, color);
791 }
792 void String(gdFontPtr f, int x, int y, unsigned short *s, int color)
793 {
794 gdImageString16(im, f, x, y, (unsigned short *)s, color);
795 }
796 void StringUp(gdFontPtr f, int x, int y, unsigned short *s, int color)
797 {
798 gdImageStringUp16(im, f, x, y, (unsigned short *)s, color);
799 }
800 void String(gdFontPtr f, int x, int y, char *s, int color)
801 {
802 gdImageString(im, f, x, y, (unsigned char *)s, color);
803 }
804 void StringUp(gdFontPtr f, int x, int y, char *s, int color)
805 {
806 gdImageStringUp(im, f, x, y, (unsigned char *)s, color);
807 }
808 void String(gdFontPtr f, int x, int y, const std::string &s, int color)
809 {
810 String(f, x, y, (char *)s.c_str(), color);
811 }
812 void StringUp(gdFontPtr f, int x, int y, const std::string &s, int color)
813 {
814 StringUp(f, x, y, (char *)s.c_str(), color);
815 }
816
817 void String(gdFontPtr f, const Point &p, unsigned char *s, int color)
818 {
819 String(f, p.X(), p.Y(), (unsigned char *)s, color);
820 }
821 void StringUp(gdFontPtr f, const Point &p, unsigned char *s, int color)
822 {
823 StringUp(f, p.X(), p.Y(), (unsigned char *)s, color);
824 }
825 void String(gdFontPtr f, const Point &p, unsigned short *s, int color)
826 {
827 String(f, p.X(), p.Y(), (unsigned short *)s, color);
828 }
829 void StringUp(gdFontPtr f, const Point &p, unsigned short *s, int color)
830 {
831 StringUp(f, p.X(), p.Y(), (unsigned short *)s, color);
832 }
833 void String(gdFontPtr f, const Point &p, char *s, int color)
834 {
835 String(f, p.X(), p.Y(), (unsigned char *)s, color);
836 }
837 void StringUp(gdFontPtr f, const Point &p, char *s, int color)
838 {
839 StringUp(f, p.X(), p.Y(), (unsigned char *)s, color);
840 }
841 void String(gdFontPtr f, const Point &p, const std::string &s, int color)
842 {
843 String(f, p, (char *)s.c_str(), color);
844 }
845 void StringUp(gdFontPtr f, const Point &p, const std::string &s, int color)
846 {
847 StringUp(f, p, (char *)s.c_str(), color);
848 }
849
850 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y,
851 char *string)
852 {
853 return gdImageStringFT(im, brect, fg, fontlist, ptsize, angle, x, y, string);
854 }
855 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y,
856 char *string, gdFTStringExtraPtr strex)
857 {
858 return gdImageStringFTEx(im, brect, fg, fontlist, ptsize, angle, x, y, string, strex);
859 }
860 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y,
861 const std::string &string)
862 {
863 return StringFT(brect, fg, fontlist, ptsize, angle, x, y, (char *)string.c_str());
864 }
865 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y,
866 const std::string &string, gdFTStringExtraPtr strex)
867 {
868 return StringFT(brect, fg, fontlist, ptsize, angle, x, y, (char *)string.c_str(), strex);
869 }
870
871 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, const Point &p,
872 char *string)
873 {
874 return StringFT(brect, fg, fontlist, ptsize, angle, p.X(), p.Y(), string);
875 }
876 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, const Point &p,
877 char *string, gdFTStringExtraPtr strex)
878 {
879 return StringFT(brect, fg, fontlist, ptsize, angle, p.X(), p.Y(), string, strex);
880 }
881 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, const Point &p,
882 const std::string &string)
883 {
884 return StringFT(brect, fg, fontlist, ptsize, angle, p, (char *)string.c_str());
885 }
886 char *StringFT(int *brect, int fg, char *fontlist, double ptsize, double angle, const Point &p,
887 const std::string &string, gdFTStringExtraPtr strex)
888 {
889 return StringFT(brect, fg, fontlist, ptsize, angle, p, (char *)string.c_str(), strex);
890 }
891
892 void Polygon(gdPointPtr p, int n, int c) { gdImagePolygon(im, p, n, c); }
893 void OpenPolygon(gdPointPtr p, int n, int c) { gdImageOpenPolygon(im, p, n, c); }
894 void FilledPolygon(gdPointPtr p, int n, int c) { gdImageFilledPolygon(im, p, n, c); }
895
896 void Polygon(PointPtr p, int n, int c) { Polygon(p->as_gdPointPtr(), n, c); }
897 void OpenPolygon(PointPtr p, int n, int c) { OpenPolygon(p->as_gdPointPtr(), n, c); }
898 void FilledPolygon(PointPtr p, int n, int c) { FilledPolygon(p->as_gdPointPtr(), n, c); }
899
900 int ColorAllocate(int r, int g, int b) { return gdImageColorAllocate(im, r, g, b); }
901 int ColorAllocate(int r, int g, int b, int a)
902 {
903 return gdImageColorAllocateAlpha(im, r, g, b, a);
904 }
905
906 int ColorClosest(int r, int g, int b) const { return gdImageColorClosest(im, r, g, b); }
907 int ColorClosest(int r, int g, int b, int a) const
908 {
909 return gdImageColorClosestAlpha(im, r, g, b, a);
910 }
911 int ColorClosestHWB(int r, int g, int b) const { return gdImageColorClosestHWB(im, r, g, b); }
912 int ColorExact(int r, int g, int b) const { return gdImageColorExact(im, r, g, b); }
913 int ColorExact(int r, int g, int b, int a) const
914 {
915 return gdImageColorExactAlpha(im, r, g, b, a);
916 }
917 int ColorResolve(int r, int g, int b) { return gdImageColorResolve(im, r, g, b); }
918 int ColorResolve(int r, int g, int b, int a)
919 {
920 return gdImageColorResolveAlpha(im, r, g, b, a);
921 }
922
923 void ColorDeallocate(int color) { gdImageColorDeallocate(im, color); }
924
925 void TrueColorToPalette(int ditherFlag, int colorsWanted)
926 {
927 gdImageTrueColorToPalette(im, ditherFlag, colorsWanted);
928 }
929
930 void ColorTransparent(int color) { gdImageColorTransparent(im, color); }
931
932 void PaletteCopy(gdImagePtr src) { gdImagePaletteCopy(im, src); }
933 void PaletteCopy(const GD::Image &src) { PaletteCopy(src.im); }
934
939 void Gif(FILE *out) const { gdImageGif(im, out); }
944 void Gif(gdIOCtxPtr out) const { gdImageGifCtx(im, out); }
951 void *Gif(int *size) const { return gdImageGifPtr(im, size); }
956 void Gif(std::ostream &out) const
957 {
958 ostreamIOCtx _out_ctx(out);
959 gdImageGifCtx(im, &_out_ctx);
960 }
961
966 void Png(FILE *out) const { gdImagePng(im, out); }
971 void Png(gdIOCtxPtr out) const { gdImagePngCtx(im, out); }
978 void *Png(int *size) const { return gdImagePngPtr(im, size); }
983 void Png(std::ostream &out) const
984 {
985 ostreamIOCtx _out_ctx(out);
986 gdImagePngCtx(im, &_out_ctx);
987 }
995 void Png(FILE *out, int level) const { gdImagePngEx(im, out, level); }
1003 void Png(gdIOCtxPtr out, int level) const { gdImagePngCtxEx(im, out, level); }
1013 void *Png(int *size, int level) const { return gdImagePngPtrEx(im, size, level); }
1021 void Png(std::ostream &out, int level) const
1022 {
1023 ostreamIOCtx _out_ctx(out);
1024 gdImagePngCtxEx(im, &_out_ctx, level);
1025 }
1026
1032 void WBMP(int fg, FILE *out) const { gdImageWBMP(im, fg, out); }
1038 void WBMP(int fg, gdIOCtxPtr out) const { gdImageWBMPCtx(im, fg, out); }
1047 void *WBMP(int *size, int fg) const { return gdImageWBMPPtr(im, size, fg); }
1053 void WBMP(int fg, std::ostream &out) const
1054 {
1055 ostreamIOCtx _out_ctx(out);
1056 gdImageWBMPCtx(im, fg, &_out_ctx);
1057 }
1058
1066 void Jpeg(FILE *out, int quality = -1) const { gdImageJpeg(im, out, quality); }
1074 void Jpeg(gdIOCtxPtr out, int quality = -1) const { gdImageJpegCtx(im, out, quality); }
1084 void *Jpeg(int *size, int quality = -1) const { return gdImageJpegPtr(im, size, quality); }
1092 void Jpeg(std::ostream &out, int quality = -1) const
1093 {
1094 ostreamIOCtx _out_ctx(out);
1095 gdImageJpegCtx(im, &_out_ctx, quality);
1096 }
1097
1098 void GifAnimBegin(FILE *out, int GlobalCM, int Loops) const
1099 {
1100 gdImageGifAnimBegin(im, out, GlobalCM, Loops);
1101 }
1102 void GifAnimAdd(FILE *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal,
1103 gdImagePtr previm) const
1104 {
1105 gdImageGifAnimAdd(im, out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm);
1106 }
1107 void GifAnimAdd(FILE *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal,
1108 const GD::Image &previm) const
1109 {
1110 GifAnimAdd(out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
1111 }
1112 inline static void GifAnimEnd(FILE *out) { gdImageGifAnimEnd(out); }
1113 void GifAnimBegin(gdIOCtxPtr out, int GlobalCM, int Loops) const
1114 {
1115 gdImageGifAnimBeginCtx(im, out, GlobalCM, Loops);
1116 }
1117 void GifAnimAdd(gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal,
1118 gdImagePtr previm) const
1119 {
1120 gdImageGifAnimAddCtx(im, out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm);
1121 }
1122 void GifAnimAdd(gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal,
1123 const GD::Image &previm) const
1124 {
1125 GifAnimAdd(out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
1126 }
1127 inline static void GifAnimEnd(gdIOCtxPtr out) { gdImageGifAnimEndCtx(out); }
1128 void *GifAnimBegin(int *size, int GlobalCM, int Loops) const
1129 {
1130 return gdImageGifAnimBeginPtr(im, size, GlobalCM, Loops);
1131 }
1132 void *GifAnimAdd(int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal,
1133 gdImagePtr previm) const
1134 {
1135 return gdImageGifAnimAddPtr(im, size, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm);
1136 }
1137 void *GifAnimAdd(int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal,
1138 const GD::Image &previm) const
1139 {
1140 return GifAnimAdd(size, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
1141 }
1142 inline static void *GifAnimEnd(int *size) { return gdImageGifAnimEndPtr(size); }
1143
1144 void Gd(FILE *out) const { gdImageGd(im, out); }
1145 void *Gd(int *size) const { return gdImageGdPtr(im, size); }
1146 void Gd2(FILE *out, int cs, int fmt) const { gdImageGd2(im, out, cs, fmt); }
1147 void *Gd2(int cs, int fmt, int *size) const { return gdImageGd2Ptr(im, cs, fmt, size); }
1148
1149 void Ellipse(int cx, int cy, int w, int h, int color)
1150 {
1151 gdImageEllipse(im, cx, cy, w, h, color);
1152 }
1157 void FilledArc(int cx, int cy, int w, int h, int s, int e, int color, int style)
1158 {
1159 gdImageFilledArc(im, cx, cy, w, h, s, e, color, style);
1160 }
1161 void Arc(int cx, int cy, int w, int h, int s, int e, int color)
1162 {
1163 gdImageArc(im, cx, cy, w, h, s, e, color);
1164 }
1165 void FilledEllipse(int cx, int cy, int w, int h, int color)
1166 {
1167 gdImageFilledEllipse(im, cx, cy, w, h, color);
1168 }
1169 void FillToBorder(int x, int y, int border, int color)
1170 {
1171 gdImageFillToBorder(im, x, y, border, color);
1172 }
1173 void Fill(int x, int y, int color) { gdImageFill(im, x, y, color); }
1174
1175 void Ellipse(const Point &c, const Size &s, int color)
1176 {
1177 Ellipse(c.X(), c.Y(), s.W(), s.H(), color);
1178 }
1179 void FilledArc(const Point &c, const Size &si, int s, int e, int color, int style)
1180 {
1181 FilledArc(c.X(), c.Y(), si.W(), si.H(), s, e, color, style);
1182 }
1183 void Arc(const Point &c, const Size &si, int s, int e, int color)
1184 {
1185 Arc(c.X(), c.Y(), si.W(), si.H(), s, e, color);
1186 }
1187 void FilledEllipse(const Point &c, const Size &s, int color)
1188 {
1189 FilledEllipse(c.X(), c.Y(), s.W(), s.H(), color);
1190 }
1191 void FillToBorder(const Point &p, int border, int color)
1192 {
1193 FillToBorder(p.X(), p.Y(), border, color);
1194 }
1195 void Fill(const Point &p, int color) { Fill(p.X(), p.Y(), color); }
1196
1197 void Copy(const gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h)
1198 {
1199 gdImageCopy(im, src, dstX, dstY, srcX, srcY, w, h);
1200 }
1201 void CopyMerge(const gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h,
1202 int pct)
1203 {
1204 gdImageCopyMerge(im, src, dstX, dstY, srcX, srcY, w, h, pct);
1205 }
1206 void CopyMergeGray(const gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h,
1207 int pct)
1208 {
1209 gdImageCopyMergeGray(im, src, dstX, dstY, srcX, srcY, w, h, pct);
1210 }
1211
1212 void CopyResized(const gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW,
1213 int dstH, int srcW, int srcH)
1214 {
1215 gdImageCopyResized(im, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
1216 }
1217 void CopyResampled(const gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW,
1218 int dstH, int srcW, int srcH)
1219 {
1220 gdImageCopyResampled(im, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
1221 }
1222 void CopyRotated(const gdImagePtr src, double dstX, double dstY, int srcX, int srcY,
1223 int srcWidth, int srcHeight, int angle)
1224 {
1225 gdImageCopyRotated(im, src, dstX, dstY, srcX, srcY, srcWidth, srcHeight, angle);
1226 }
1227
1228 Image *CopyGaussianBlurred(int radius, double sigma)
1229 {
1230 return new Image(gdImageCopyGaussianBlurred(im, radius, sigma));
1231 }
1232
1233 void Copy(const gdImagePtr src, const Point &dstP, const Point &srcP, const Size &s)
1234 {
1235 Copy(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H());
1236 }
1237 void CopyMerge(const gdImagePtr src, const Point &dstP, const Point &srcP, const Size &s,
1238 int pct)
1239 {
1240 CopyMerge(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1241 }
1242 void CopyMergeGray(const gdImagePtr src, const Point &dstP, const Point &srcP, const Size &s,
1243 int pct)
1244 {
1245 CopyMergeGray(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1246 }
1247
1248 void CopyResized(const gdImagePtr src, const Point &dstP, const Point &srcP, const Size &dstS,
1249 const Size &srcS)
1250 {
1251 CopyResized(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1252 srcS.H());
1253 }
1254 void CopyResampled(const gdImagePtr src, const Point &dstP, const Point &srcP, const Size &dstS,
1255 const Size &srcS)
1256 {
1257 CopyResampled(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1258 srcS.H());
1259 }
1260 void CopyRotated(const gdImagePtr src, double dstX, double dstY, const Point &srcP,
1261 const Size &srcS, int angle)
1262 {
1263 CopyRotated(src, dstX, dstY, srcP.X(), srcP.Y(), srcS.W(), srcS.H(), angle);
1264 }
1265
1266 void Copy(const GD::Image &src, int dstX, int dstY, int srcX, int srcY, int w, int h)
1267 {
1268 Copy(src.im, dstX, dstY, srcX, srcY, w, h);
1269 }
1270 void CopyMerge(const GD::Image &src, int dstX, int dstY, int srcX, int srcY, int w, int h,
1271 int pct)
1272 {
1273 CopyMerge(src.im, dstX, dstY, srcX, srcY, w, h, pct);
1274 }
1275 void CopyMergeGray(const GD::Image &src, int dstX, int dstY, int srcX, int srcY, int w, int h,
1276 int pct)
1277 {
1278 CopyMergeGray(src.im, dstX, dstY, srcX, srcY, w, h, pct);
1279 }
1280
1281 void CopyResized(const GD::Image &src, int dstX, int dstY, int srcX, int srcY, int dstW,
1282 int dstH, int srcW, int srcH)
1283 {
1284 CopyResized(src.im, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
1285 }
1286 void CopyResampled(const GD::Image &src, int dstX, int dstY, int srcX, int srcY, int dstW,
1287 int dstH, int srcW, int srcH)
1288 {
1289 CopyResampled(src.im, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
1290 }
1291 void CopyRotated(const GD::Image &src, double dstX, double dstY, int srcX, int srcY,
1292 int srcWidth, int srcHeight, int angle)
1293 {
1294 CopyRotated(src.im, dstX, dstY, srcX, srcY, srcWidth, srcHeight, angle);
1295 }
1296
1297 void Copy(const GD::Image &src, const Point &dstP, const Point &srcP, const Size &s)
1298 {
1299 Copy(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H());
1300 }
1301 void CopyMerge(const GD::Image &src, const Point &dstP, const Point &srcP, const Size &s,
1302 int pct)
1303 {
1304 CopyMerge(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1305 }
1306 void CopyMergeGray(const GD::Image &src, const Point &dstP, const Point &srcP, const Size &s,
1307 int pct)
1308 {
1309 CopyMergeGray(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1310 }
1311
1312 void CopyResized(const GD::Image &src, const Point &dstP, const Point &srcP, const Size &dstS,
1313 const Size &srcS)
1314 {
1315 CopyResized(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1316 srcS.H());
1317 }
1318 void CopyResampled(const GD::Image &src, const Point &dstP, const Point &srcP, const Size &dstS,
1319 const Size &srcS)
1320 {
1321 CopyResampled(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1322 srcS.H());
1323 }
1324 void CopyRotated(const GD::Image &src, double dstX, double dstY, const Point &srcP,
1325 const Size &srcS, int angle)
1326 {
1327 CopyRotated(src.im, dstX, dstY, srcP.X(), srcP.Y(), srcS.W(), srcS.H(), angle);
1328 }
1329
1330 Image *Clone() { return new Image(gdImageClone(im)); }
1331
1332 void SetBrush(gdImagePtr brush) { gdImageSetBrush(im, brush); }
1333 void SetBrush(const GD::Image &brush) { SetBrush(brush.im); }
1334 void SetTile(gdImagePtr tile) { gdImageSetTile(im, tile); }
1335 void SetTile(const GD::Image &tile) { SetTile(tile.im); }
1336 void SetAntiAliased(int c) { gdImageSetAntiAliased(im, c); }
1337 void SetAntiAliasedDontBlend(int c, int dont_blend)
1338 {
1339 gdImageSetAntiAliasedDontBlend(im, c, dont_blend);
1340 }
1341 void SetStyle(int *style, int noOfPixels) { gdImageSetStyle(im, style, noOfPixels); }
1342 void SetThickness(int thickness) { gdImageSetThickness(im, thickness); }
1343 void SetResolution(int res_x, int res_y) { gdImageSetResolution(im, res_x, res_y); }
1344 void SetInterpolationMethod(gdInterpolationMethod interpolation_method)
1345 {
1346 gdImageSetInterpolationMethod(im, interpolation_method);
1347 }
1348
1349 Image *RotateInterpolated(const float angle, int bgcolor)
1350 {
1351 return new Image(gdImageRotateInterpolated(im, angle, bgcolor));
1352 }
1353
1354 void Interlace(bool interlaceArg) { gdImageInterlace(im, interlaceArg ? 1 : 0); }
1355 void AlphaBlending(bool alphaBlendingArg)
1356 {
1357 gdImageAlphaBlending(im, alphaBlendingArg ? 1 : 0);
1358 }
1359 void SaveAlpha(bool saveAlphaArg) { gdImageSaveAlpha(im, saveAlphaArg ? 1 : 0); }
1360
1361 int ColorReplace(int src, int dst) { return gdImageColorReplace(im, src, dst); }
1362 int ColorReplaceArray(int len, int *src, int *dst)
1363 {
1364 return gdImageColorReplaceArray(im, len, src, dst);
1365 }
1366 int ColorReplaceCallback(gdCallbackImageColor callback)
1367 {
1368 return gdImageColorReplaceCallback(im, callback);
1369 }
1370 int ColorReplaceThreshold(int src, int dst, float threshold)
1371 {
1372 return gdImageColorReplaceThreshold(im, src, dst, threshold);
1373 }
1374
1375 bool Pixelate(int block_size, gdPixelateMode mode)
1376 {
1377 return gdImagePixelate(im, block_size, mode) == 0 ? false : true;
1378 }
1379
1380 Image *Scale(int new_width, int new_height)
1381 {
1382 return new Image(gdImageScale(im, new_width, new_height));
1383 }
1384
1385 bool IsTrueColor() const { return (gdImageTrueColor(im) ? true : false); }
1386 int SX() const { return gdImageSX(im); }
1387 int SY() const { return gdImageSY(im); }
1388 int Width() const { return SX(); }
1389 int Height() const { return SY(); }
1390 int ResX() const { return gdImageResolutionX(im); }
1391 int ResY() const { return gdImageResolutionY(im); }
1392 void GetSize(Size &s) const { s.set(SX(), SY()); }
1393 int ColorsTotal() const { return gdImageColorsTotal(im); }
1394 int Red(int color) const { return gdImageRed(im, color); }
1395 int Green(int color) const { return gdImageGreen(im, color); }
1396 int Blue(int color) const { return gdImageBlue(im, color); }
1397 int Alpha(int color) const { return gdImageAlpha(im, color); }
1398 int GetTransparent() const { return gdImageGetTransparent(im); }
1399 int GetInterlaced() const { return gdImageGetInterlaced(im); }
1400 int PalettePixel(int x, int y) const { return gdImagePalettePixel(im, x, y); }
1401 int TrueColorPixel(int x, int y) const { return gdImageTrueColorPixel(im, x, y); }
1402
1403 const gdImagePtr GetPtr() const { return im; }
1404
1405 protected:
1407 void clear()
1408 {
1409 if (im)
1410 gdImageDestroy(im);
1411 im = 0;
1412 }
1413 gdImagePtr im;
1414};
1415} // namespace GD
1417std::istream &operator>>(std::istream &in, GD::Image &img);
1418
1419#endif /* __cplusplus */
1420#endif /* _gdpp_h */
C++ standard library iostream specializations of gdIOCtx.
std::istream & operator>>(std::istream &in, GD::Image &img)
Definition gdpp.cxx:258
int gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted)
Converts a truecolor image to a palette image.
Definition gd_topal.c:1382
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
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
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
void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
Draws a single character.
Definition gd.c:1538
gdPixelateMode
gdImagePixelate options
Definition gd.h:7243
int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode)
Pixelates an image.
Definition gd_filter.c:137
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 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
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 mx, int my, int w, int h, int c)
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 mx, int my, int w, int h, int c)
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
void gdImageAABlend(gdImagePtr im)
Definition gd.c:1173
int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id)
Set the interpolation method stored on an image.
Definition gd_interpolation.c:2711
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
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
gdInterpolationMethod
gdInterpolationMethod
Definition gd.h:315
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
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
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
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
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
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
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
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
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
void gdImageGif(gdImagePtr im, FILE *out)
Write an image as GIF data to a stdio file.
Definition gd_gif_out.c:126
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
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
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
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
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtxPtr infile)
Create an image from JPEG data read through a gdIOCtx.
void gdImageJpeg(gdImagePtr im, FILE *out, int quality)
Write an image as JPEG data to a stdio file.
Definition gd_jpeg.c:1730
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.
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.
void gdImagePng(gdImagePtr im, FILE *out)
Write an image as PNG data to a stdio file.
Definition gd_png.c:1691
void gdImagePngCtxEx(gdImagePtr im, gdIOCtxPtr out, int level)
Write an image as PNG data to a gdIOCtx with a compression level.
gdImagePtr gdImageCreateFromPngPtr(int size, void *data)
Create an image from a PNG memory buffer.
Definition gd_png.c:1670
gdImagePtr gdImageCreateFromPng(FILE *fd)
Create an image from a PNG stdio file.
Definition gd_png.c:1663
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
gdImagePtr gdImageCreateFromXbm(FILE *in)
Create an image from XBM data in a stdio stream.
Definition gd_xbm.c:23
Write an image as JPEG data to a gdIOCtx.
Structure for passing additional parameters to FreeType 2 string rendering functions.
Definition gd.h:6417
A point in the coordinate space of the image.
Definition gd.h:6614