43class BGD_EXPORT_DATA_PROT Point {
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)
56 int X()
const {
return _x; }
57 int Y()
const {
return _y; }
59 void X(
int x) { _x = x; }
60 void Y(
int y) { _y = y; }
61 void set(
int x,
int y)
66 int &lhsX() {
return _x; }
67 int &lhsY() {
return _y; }
74typedef Point *PointPtr;
78class BGD_EXPORT_DATA_PROT Size {
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)
91 int W()
const {
return _w; }
92 int H()
const {
return _h; }
94 void W(
int w) { _w = w; }
95 void H(
int h) { _h = h; }
96 void set(
int w,
int h)
101 int &lhsW() {
return _w; }
102 int &lhsH() {
return _h; }
107typedef Size *SizePtr;
112class BGD_EXPORT_DATA_PROT TrueColor {
117 unsigned char blue, green, red, alpha;
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)
124 internal.as_uchar.alpha = a;
125 internal.as_uchar.red = r;
126 internal.as_uchar.green = g;
127 internal.as_uchar.blue = b;
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; }
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)
139 internal.as_uchar.alpha = a;
140 internal.as_uchar.red = r;
141 internal.as_uchar.green = g;
142 internal.as_uchar.blue = b;
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; }
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 {};
168class BGD_EXPORT_DATA_PROT Image {
179 Image(
int sx,
int sy,
bool istruecolor =
false) :
im(0)
182 CreateTrueColor(sx, sy);
191 Image(
const Size &s,
bool istruecolor =
false) :
im(0)
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); }
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); }
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); }
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); }
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); }
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); }
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); }
401 Image(FILE *in, Xbm_tag) :
im(0) { CreateFromXbm(in); }
403 ~Image() { clear(); }
408 GD::Image &operator=(
const GD::Image &src)
416 void Copy(
const GD::Image &src)
418 int w = src.Width(), h = src.Height();
419 if (src.IsTrueColor())
420 CreateTrueColor(w, h);
425 Copy(src, 0, 0, 0, 0, w, h);
429 bool good()
const {
return (
im != 0); }
437 bool Create(
int sx,
int sy)
440 return ((
im = gdImageCreate(sx, sy)) != 0);
448 bool CreateTrueColor(
int sx,
int sy)
451 return ((
im = gdImageCreateTrueColor(sx, sy)) != 0);
458 bool Create(
const Size &s) {
return Create(s.W(), s.H()); }
464 bool CreateTrueColor(
const Size &s) {
return CreateTrueColor(s.W(), s.H()); }
468 bool CreateFrom(FILE *in);
471 bool CreateFrom(std::istream &in);
473 bool CreateFrom(
int size,
void *data);
476 bool CreateFromPng(FILE *in)
481 bool CreateFromPng(gdIOCtxPtr in)
486 bool CreateFromPng(
int size,
void *data)
491 bool CreateFromPng(std::istream &in)
494 istreamIOCtx _in_ctx(in);
499 bool CreateFromGif(FILE *in)
504 bool CreateFromGif(gdIOCtxPtr in)
509 bool CreateFromGif(
int size,
void *data)
514 bool CreateFromGif(std::istream &in)
517 istreamIOCtx _in_ctx(in);
521 bool CreateFromWBMP(FILE *in)
526 bool CreateFromWBMP(gdIOCtxPtr in)
531 bool CreateFromWBMP(
int size,
void *data)
536 bool CreateFromWBMP(std::istream &in)
539 istreamIOCtx _in_ctx(in);
554 bool CreateFromJpeg(FILE *in)
569 bool CreateFromJpeg(gdIOCtxPtr in)
584 bool CreateFromJpeg(
int size,
void *data)
597 bool CreateFromJpeg(std::istream &in)
600 istreamIOCtx _in_ctx(in);
605 bool CreateFromGd(FILE *in)
610 bool CreateFromGd(gdIOCtxPtr in)
615 bool CreateFromGd(
int size,
void *data)
620 bool CreateFromGd(std::istream &in)
623 istreamIOCtx _in_ctx(in);
627 bool CreateFromGd2(FILE *in)
632 bool CreateFromGd2(gdIOCtxPtr in)
637 bool CreateFromGd2(
int size,
void *data)
642 bool CreateFromGd2(std::istream &in)
645 istreamIOCtx _in_ctx(in);
649 bool CreateFromGd2Part(FILE *in,
int srcx,
int srcy,
int w,
int h)
654 bool CreateFromGd2Part(gdIOCtxPtr in,
int srcx,
int srcy,
int w,
int h)
659 bool CreateFromGd2Part(
int size,
void *data,
int srcx,
int srcy,
int w,
int h)
664 bool CreateFromGd2Part(std::istream &in,
int srcx,
int srcy,
int w,
int h)
667 istreamIOCtx _in_ctx(in);
670 bool CreateFromGd2Part(FILE *in,
const Point &src,
const Size &s)
672 return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
674 bool CreateFromGd2Part(gdIOCtxPtr in,
const Point &src,
const Size &s)
676 return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
678 bool CreateFromGd2Part(
int size,
void *data,
const Point &src,
const Size &s)
680 return CreateFromGd2Part(size, data, src.X(), src.Y(), s.W(), s.H());
682 bool CreateFromGd2Part(std::istream &in,
const Point &src,
const Size &s)
684 return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
687 bool CreateFromXbm(FILE *in)
693 bool CreateFromXpm(
char *filename)
696 return ((
im = gdImageCreateFromXpm(filename)) != 0);
698 bool CreateFromXpm(std::string &filename) {
return CreateFromXpm((
char *)(filename.c_str())); }
702 void SetPixel(
const Point &p,
int color) { SetPixel(p.X(), p.Y(), color); }
704 int GetPixel(
const Point &p)
const {
return GetPixel(p.X(), p.Y()); }
706 int GetTrueColorPixel(
const Point &p)
const {
return GetTrueColorPixel(p.X(), p.Y()); }
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
713 c.set(GetTrueColorPixel(p.X(), p.Y()));
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)
721 Line(p1.X(), p1.Y(), p2.X(), p2.Y(), color);
723 void Rectangle(
int x1,
int y1,
int x2,
int y2,
int color)
727 void Rectangle(
const Point &p1,
const Point &p2,
int color)
729 Rectangle(p1.X(), p1.Y(), p2.X(), p2.Y(), color);
731 void Rectangle(
const Point &p,
const Size &s,
int color)
733 Rectangle(p.X(), p.Y(), p.X() + s.W(), p.Y() + s.H(), color);
735 void FilledRectangle(
int x1,
int y1,
int x2,
int y2,
int color)
739 void FilledRectangle(
const Point &p1,
const Point &p2,
int color)
741 FilledRectangle(p1.X(), p1.Y(), p2.X(), p2.Y(), color);
743 void FilledRectangle(
const Point &p,
const Size &s,
int color)
745 FilledRectangle(p.X(), p.Y(), p.X() + s.W(), p.Y() + s.H(), color);
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)
752 SetClip(p.X(), p.Y(), p.X() + s.W(), p.Y() + s.H());
754 void GetClip(
int &x1,
int &y1,
int &x2,
int &y2)
const
758 void GetClip(Point &p1, Point &p2)
const
760 GetClip(p1.lhsX(), p1.lhsY(), p2.lhsX(), p2.lhsY());
762 void GetClip(Point &p, Size &s)
const
765 GetClip(p.lhsX(), p.lhsY(), p2.lhsX(), p2.lhsY());
766 s.set(p2.X() - p.X(), p2.Y() - p.Y());
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()); }
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)
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)
781 CharUp(f, p.X(), p.Y(), c, color);
784 void String(gdFontPtr f,
int x,
int y,
unsigned char *s,
int color)
788 void StringUp(gdFontPtr f,
int x,
int y,
unsigned char *s,
int color)
792 void String(gdFontPtr f,
int x,
int y,
unsigned short *s,
int color)
796 void StringUp(gdFontPtr f,
int x,
int y,
unsigned short *s,
int color)
800 void String(gdFontPtr f,
int x,
int y,
char *s,
int color)
804 void StringUp(gdFontPtr f,
int x,
int y,
char *s,
int color)
808 void String(gdFontPtr f,
int x,
int y,
const std::string &s,
int color)
810 String(f, x, y, (
char *)s.c_str(), color);
812 void StringUp(gdFontPtr f,
int x,
int y,
const std::string &s,
int color)
814 StringUp(f, x, y, (
char *)s.c_str(), color);
817 void String(gdFontPtr f,
const Point &p,
unsigned char *s,
int color)
819 String(f, p.X(), p.Y(), (
unsigned char *)s, color);
821 void StringUp(gdFontPtr f,
const Point &p,
unsigned char *s,
int color)
823 StringUp(f, p.X(), p.Y(), (
unsigned char *)s, color);
825 void String(gdFontPtr f,
const Point &p,
unsigned short *s,
int color)
827 String(f, p.X(), p.Y(), (
unsigned short *)s, color);
829 void StringUp(gdFontPtr f,
const Point &p,
unsigned short *s,
int color)
831 StringUp(f, p.X(), p.Y(), (
unsigned short *)s, color);
833 void String(gdFontPtr f,
const Point &p,
char *s,
int color)
835 String(f, p.X(), p.Y(), (
unsigned char *)s, color);
837 void StringUp(gdFontPtr f,
const Point &p,
char *s,
int color)
839 StringUp(f, p.X(), p.Y(), (
unsigned char *)s, color);
841 void String(gdFontPtr f,
const Point &p,
const std::string &s,
int color)
843 String(f, p, (
char *)s.c_str(), color);
845 void StringUp(gdFontPtr f,
const Point &p,
const std::string &s,
int color)
847 StringUp(f, p, (
char *)s.c_str(), color);
850 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
int x,
int y,
855 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
int x,
int y,
860 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
int x,
int y,
861 const std::string &
string)
863 return StringFT(brect, fg, fontlist, ptsize, angle, x, y, (
char *)
string.c_str());
865 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
int x,
int y,
868 return StringFT(brect, fg, fontlist, ptsize, angle, x, y, (
char *)
string.c_str(), strex);
871 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
const Point &p,
874 return StringFT(brect, fg, fontlist, ptsize, angle, p.X(), p.Y(),
string);
876 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
const Point &p,
879 return StringFT(brect, fg, fontlist, ptsize, angle, p.X(), p.Y(),
string, strex);
881 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
const Point &p,
882 const std::string &
string)
884 return StringFT(brect, fg, fontlist, ptsize, angle, p, (
char *)
string.c_str());
886 char *StringFT(
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
const Point &p,
889 return StringFT(brect, fg, fontlist, ptsize, angle, p, (
char *)
string.c_str(), strex);
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); }
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)
903 return gdImageColorAllocateAlpha(
im, r, g, b, a);
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
909 return gdImageColorClosestAlpha(
im, r, g, b, a);
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
915 return gdImageColorExactAlpha(
im, r, g, b, a);
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)
920 return gdImageColorResolveAlpha(
im, r, g, b, a);
923 void ColorDeallocate(
int color) { gdImageColorDeallocate(
im, color); }
925 void TrueColorToPalette(
int ditherFlag,
int colorsWanted)
930 void ColorTransparent(
int color) { gdImageColorTransparent(
im, color); }
932 void PaletteCopy(gdImagePtr src) { gdImagePaletteCopy(
im, src); }
933 void PaletteCopy(
const GD::Image &src) { PaletteCopy(src.im); }
956 void Gif(std::ostream &out)
const
958 ostreamIOCtx _out_ctx(out);
983 void Png(std::ostream &out)
const
985 ostreamIOCtx _out_ctx(out);
995 void Png(FILE *out,
int level)
const {
gdImagePngEx(
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
1023 ostreamIOCtx _out_ctx(out);
1032 void WBMP(
int fg, FILE *out)
const {
gdImageWBMP(
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
1055 ostreamIOCtx _out_ctx(out);
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
1094 ostreamIOCtx _out_ctx(out);
1095 gdImageJpegCtx(
im, &_out_ctx, quality);
1098 void GifAnimBegin(FILE *out,
int GlobalCM,
int Loops)
const
1102 void GifAnimAdd(FILE *out,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
1103 gdImagePtr previm)
const
1107 void GifAnimAdd(FILE *out,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
1108 const GD::Image &previm)
const
1110 GifAnimAdd(out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
1113 void GifAnimBegin(gdIOCtxPtr out,
int GlobalCM,
int Loops)
const
1117 void GifAnimAdd(gdIOCtxPtr out,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
1118 gdImagePtr previm)
const
1122 void GifAnimAdd(gdIOCtxPtr out,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
1123 const GD::Image &previm)
const
1125 GifAnimAdd(out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
1128 void *GifAnimBegin(
int *size,
int GlobalCM,
int Loops)
const
1132 void *GifAnimAdd(
int *size,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
1133 gdImagePtr previm)
const
1137 void *GifAnimAdd(
int *size,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
1138 const GD::Image &previm)
const
1140 return GifAnimAdd(size, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
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); }
1149 void Ellipse(
int cx,
int cy,
int w,
int h,
int color)
1157 void FilledArc(
int cx,
int cy,
int w,
int h,
int s,
int e,
int color,
int style)
1161 void Arc(
int cx,
int cy,
int w,
int h,
int s,
int e,
int color)
1165 void FilledEllipse(
int cx,
int cy,
int w,
int h,
int color)
1169 void FillToBorder(
int x,
int y,
int border,
int color)
1171 gdImageFillToBorder(
im, x, y, border, color);
1173 void Fill(
int x,
int y,
int color) { gdImageFill(
im, x, y, color); }
1175 void Ellipse(
const Point &c,
const Size &s,
int color)
1177 Ellipse(c.X(), c.Y(), s.W(), s.H(), color);
1179 void FilledArc(
const Point &c,
const Size &si,
int s,
int e,
int color,
int style)
1181 FilledArc(c.X(), c.Y(), si.W(), si.H(), s, e, color, style);
1183 void Arc(
const Point &c,
const Size &si,
int s,
int e,
int color)
1185 Arc(c.X(), c.Y(), si.W(), si.H(), s, e, color);
1187 void FilledEllipse(
const Point &c,
const Size &s,
int color)
1189 FilledEllipse(c.X(), c.Y(), s.W(), s.H(), color);
1191 void FillToBorder(
const Point &p,
int border,
int color)
1193 FillToBorder(p.X(), p.Y(), border, color);
1195 void Fill(
const Point &p,
int color) { Fill(p.X(), p.Y(), color); }
1197 void Copy(
const gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h)
1201 void CopyMerge(
const gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
1206 void CopyMergeGray(
const gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
1212 void CopyResized(
const gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
1213 int dstH,
int srcW,
int srcH)
1217 void CopyResampled(
const gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
1218 int dstH,
int srcW,
int srcH)
1222 void CopyRotated(
const gdImagePtr src,
double dstX,
double dstY,
int srcX,
int srcY,
1223 int srcWidth,
int srcHeight,
int angle)
1228 Image *CopyGaussianBlurred(
int radius,
double sigma)
1233 void Copy(
const gdImagePtr src,
const Point &dstP,
const Point &srcP,
const Size &s)
1235 Copy(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H());
1237 void CopyMerge(
const gdImagePtr src,
const Point &dstP,
const Point &srcP,
const Size &s,
1240 CopyMerge(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1242 void CopyMergeGray(
const gdImagePtr src,
const Point &dstP,
const Point &srcP,
const Size &s,
1245 CopyMergeGray(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1248 void CopyResized(
const gdImagePtr src,
const Point &dstP,
const Point &srcP,
const Size &dstS,
1251 CopyResized(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1254 void CopyResampled(
const gdImagePtr src,
const Point &dstP,
const Point &srcP,
const Size &dstS,
1257 CopyResampled(src, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1260 void CopyRotated(
const gdImagePtr src,
double dstX,
double dstY,
const Point &srcP,
1261 const Size &srcS,
int angle)
1263 CopyRotated(src, dstX, dstY, srcP.X(), srcP.Y(), srcS.W(), srcS.H(), angle);
1266 void Copy(
const GD::Image &src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h)
1268 Copy(src.im, dstX, dstY, srcX, srcY, w, h);
1270 void CopyMerge(
const GD::Image &src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
1273 CopyMerge(src.im, dstX, dstY, srcX, srcY, w, h, pct);
1275 void CopyMergeGray(
const GD::Image &src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
1278 CopyMergeGray(src.im, dstX, dstY, srcX, srcY, w, h, pct);
1281 void CopyResized(
const GD::Image &src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
1282 int dstH,
int srcW,
int srcH)
1284 CopyResized(src.im, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
1286 void CopyResampled(
const GD::Image &src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
1287 int dstH,
int srcW,
int srcH)
1289 CopyResampled(src.im, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
1291 void CopyRotated(
const GD::Image &src,
double dstX,
double dstY,
int srcX,
int srcY,
1292 int srcWidth,
int srcHeight,
int angle)
1294 CopyRotated(src.im, dstX, dstY, srcX, srcY, srcWidth, srcHeight, angle);
1297 void Copy(
const GD::Image &src,
const Point &dstP,
const Point &srcP,
const Size &s)
1299 Copy(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H());
1301 void CopyMerge(
const GD::Image &src,
const Point &dstP,
const Point &srcP,
const Size &s,
1304 CopyMerge(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1306 void CopyMergeGray(
const GD::Image &src,
const Point &dstP,
const Point &srcP,
const Size &s,
1309 CopyMergeGray(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), s.W(), s.H(), pct);
1312 void CopyResized(
const GD::Image &src,
const Point &dstP,
const Point &srcP,
const Size &dstS,
1315 CopyResized(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1318 void CopyResampled(
const GD::Image &src,
const Point &dstP,
const Point &srcP,
const Size &dstS,
1321 CopyResampled(src.im, dstP.X(), dstP.Y(), srcP.X(), srcP.Y(), dstS.W(), dstS.H(), srcS.W(),
1324 void CopyRotated(
const GD::Image &src,
double dstX,
double dstY,
const Point &srcP,
1325 const Size &srcS,
int angle)
1327 CopyRotated(src.im, dstX, dstY, srcP.X(), srcP.Y(), srcS.W(), srcS.H(), angle);
1333 void SetBrush(
const GD::Image &brush) { SetBrush(brush.im); }
1335 void SetTile(
const GD::Image &tile) { SetTile(tile.im); }
1337 void SetAntiAliasedDontBlend(
int c,
int dont_blend)
1341 void SetStyle(
int *style,
int noOfPixels) {
gdImageSetStyle(
im, style, noOfPixels); }
1343 void SetResolution(
int res_x,
int res_y) { gdImageSetResolution(
im, res_x, res_y); }
1349 Image *RotateInterpolated(
const float angle,
int bgcolor)
1355 void AlphaBlending(
bool alphaBlendingArg)
1357 gdImageAlphaBlending(
im, alphaBlendingArg ? 1 : 0);
1359 void SaveAlpha(
bool saveAlphaArg) { gdImageSaveAlpha(
im, saveAlphaArg ? 1 : 0); }
1361 int ColorReplace(
int src,
int dst) {
return gdImageColorReplace(
im, src, dst); }
1362 int ColorReplaceArray(
int len,
int *src,
int *dst)
1364 return gdImageColorReplaceArray(
im, len, src, dst);
1366 int ColorReplaceCallback(gdCallbackImageColor callback)
1368 return gdImageColorReplaceCallback(
im, callback);
1370 int ColorReplaceThreshold(
int src,
int dst,
float threshold)
1372 return gdImageColorReplaceThreshold(
im, src, dst, threshold);
1380 Image *Scale(
int new_width,
int new_height)
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); }
1403 const gdImagePtr GetPtr()
const {
return im; }
1417std::istream &
operator>>(std::istream &in, GD::Image &img);
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
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.
A point in the coordinate space of the image.
Definition gd.h:6614