Lines Matching refs:im
94 static void gdImageBrushApply(gdImagePtr im, int x, int y);
95 static void gdImageTileApply(gdImagePtr im, int x, int y);
96 static void gdImageAntiAliasedApply(gdImagePtr im, int x, int y);
99 int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y);
124 gdImagePtr im; in gdImageCreate() local
138 im = (gdImage *) gdCalloc(1, sizeof(gdImage)); in gdImageCreate()
141 im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
142 im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
143 im->polyInts = 0; in gdImageCreate()
144 im->polyAllocated = 0; in gdImageCreate()
145 im->brush = 0; in gdImageCreate()
146 im->tile = 0; in gdImageCreate()
147 im->style = 0; in gdImageCreate()
150 im->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
151 im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
153 im->sx = sx; in gdImageCreate()
154 im->sy = sy; in gdImageCreate()
155 im->colorsTotal = 0; in gdImageCreate()
156 im->transparent = (-1); in gdImageCreate()
157 im->interlace = 0; in gdImageCreate()
158 im->thick = 1; in gdImageCreate()
159 im->AA = 0; in gdImageCreate()
160 im->AA_polygon = 0; in gdImageCreate()
162 im->open[i] = 1; in gdImageCreate()
163 im->red[i] = 0; in gdImageCreate()
164 im->green[i] = 0; in gdImageCreate()
165 im->blue[i] = 0; in gdImageCreate()
167 im->trueColor = 0; in gdImageCreate()
168 im->tpixels = 0; in gdImageCreate()
169 im->cx1 = 0; in gdImageCreate()
170 im->cy1 = 0; in gdImageCreate()
171 im->cx2 = im->sx - 1; in gdImageCreate()
172 im->cy2 = im->sy - 1; in gdImageCreate()
173 im->interpolation = NULL; in gdImageCreate()
174 im->interpolation_id = GD_BILINEAR_FIXED; in gdImageCreate()
175 return im; in gdImageCreate()
181 gdImagePtr im; in gdImageCreateTrueColor() local
195 im = (gdImage *) gdMalloc(sizeof(gdImage)); in gdImageCreateTrueColor()
196 memset(im, 0, sizeof(gdImage)); in gdImageCreateTrueColor()
197 im->tpixels = (int **) gdMalloc(sizeof(int *) * sy); in gdImageCreateTrueColor()
198 im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreateTrueColor()
199 im->polyInts = 0; in gdImageCreateTrueColor()
200 im->polyAllocated = 0; in gdImageCreateTrueColor()
201 im->brush = 0; in gdImageCreateTrueColor()
202 im->tile = 0; in gdImageCreateTrueColor()
203 im->style = 0; in gdImageCreateTrueColor()
205 im->tpixels[i] = (int *) gdCalloc(sx, sizeof(int)); in gdImageCreateTrueColor()
206 im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreateTrueColor()
208 im->sx = sx; in gdImageCreateTrueColor()
209 im->sy = sy; in gdImageCreateTrueColor()
210 im->transparent = (-1); in gdImageCreateTrueColor()
211 im->interlace = 0; in gdImageCreateTrueColor()
212 im->trueColor = 1; in gdImageCreateTrueColor()
219 im->saveAlphaFlag = 0; in gdImageCreateTrueColor()
220 im->alphaBlendingFlag = 1; in gdImageCreateTrueColor()
221 im->thick = 1; in gdImageCreateTrueColor()
222 im->AA = 0; in gdImageCreateTrueColor()
223 im->AA_polygon = 0; in gdImageCreateTrueColor()
224 im->cx1 = 0; in gdImageCreateTrueColor()
225 im->cy1 = 0; in gdImageCreateTrueColor()
226 im->cx2 = im->sx - 1; in gdImageCreateTrueColor()
227 im->cy2 = im->sy - 1; in gdImageCreateTrueColor()
228 im->interpolation = NULL; in gdImageCreateTrueColor()
229 im->interpolation_id = GD_BILINEAR_FIXED; in gdImageCreateTrueColor()
230 return im; in gdImageCreateTrueColor()
233 void gdImageDestroy (gdImagePtr im) in gdImageDestroy() argument
236 if (im->pixels) { in gdImageDestroy()
237 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
238 gdFree(im->pixels[i]); in gdImageDestroy()
240 gdFree(im->pixels); in gdImageDestroy()
242 if (im->tpixels) { in gdImageDestroy()
243 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
244 gdFree(im->tpixels[i]); in gdImageDestroy()
246 gdFree(im->tpixels); in gdImageDestroy()
248 if (im->AA_opacity) { in gdImageDestroy()
249 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
250 gdFree(im->AA_opacity[i]); in gdImageDestroy()
252 gdFree(im->AA_opacity); in gdImageDestroy()
254 if (im->polyInts) { in gdImageDestroy()
255 gdFree(im->polyInts); in gdImageDestroy()
257 if (im->style) { in gdImageDestroy()
258 gdFree(im->style); in gdImageDestroy()
260 gdFree(im); in gdImageDestroy()
263 int gdImageColorClosest (gdImagePtr im, int r, int g, int b) in gdImageColorClosest() argument
265 return gdImageColorClosestAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorClosest()
268 int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorClosestAlpha() argument
276 if (im->trueColor) { in gdImageColorClosestAlpha()
279 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestAlpha()
281 if (im->open[i]) { in gdImageColorClosestAlpha()
284 rd = im->red[i] - r; in gdImageColorClosestAlpha()
285 gd = im->green[i] - g; in gdImageColorClosestAlpha()
286 bd = im->blue[i] - b; in gdImageColorClosestAlpha()
288 ad = im->alpha[i] - a; in gdImageColorClosestAlpha()
434 int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) in gdImageColorClosestHWB() argument
441 if (im->trueColor) { in gdImageColorClosestHWB()
444 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestHWB()
446 if (im->open[i]) { in gdImageColorClosestHWB()
449 dist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b); in gdImageColorClosestHWB()
459 int gdImageColorExact (gdImagePtr im, int r, int g, int b) in gdImageColorExact() argument
461 return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorExact()
464 int gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorExactAlpha() argument
467 if (im->trueColor) { in gdImageColorExactAlpha()
470 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorExactAlpha()
471 if (im->open[i]) { in gdImageColorExactAlpha()
474 if ((im->red[i] == r) && (im->green[i] == g) && (im->blue[i] == b) && (im->alpha[i] == a)) { in gdImageColorExactAlpha()
481 int gdImageColorAllocate (gdImagePtr im, int r, int g, int b) in gdImageColorAllocate() argument
483 return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorAllocate()
486 int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorAllocateAlpha() argument
490 if (im->trueColor) { in gdImageColorAllocateAlpha()
493 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorAllocateAlpha()
494 if (im->open[i]) { in gdImageColorAllocateAlpha()
500 ct = im->colorsTotal; in gdImageColorAllocateAlpha()
504 im->colorsTotal++; in gdImageColorAllocateAlpha()
506 im->red[ct] = r; in gdImageColorAllocateAlpha()
507 im->green[ct] = g; in gdImageColorAllocateAlpha()
508 im->blue[ct] = b; in gdImageColorAllocateAlpha()
509 im->alpha[ct] = a; in gdImageColorAllocateAlpha()
510 im->open[ct] = 0; in gdImageColorAllocateAlpha()
526 int gdImageColorResolve (gdImagePtr im, int r, int g, int b) in gdImageColorResolve() argument
528 return gdImageColorResolveAlpha(im, r, g, b, gdAlphaOpaque); in gdImageColorResolve()
531 int gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorResolveAlpha() argument
538 if (im->trueColor) in gdImageColorResolveAlpha()
543 for (c = 0; c < im->colorsTotal; c++) in gdImageColorResolveAlpha()
545 if (im->open[c]) in gdImageColorResolveAlpha()
550 if (c == im->transparent) in gdImageColorResolveAlpha()
556 rd = (long) (im->red[c] - r); in gdImageColorResolveAlpha()
557 gd = (long) (im->green[c] - g); in gdImageColorResolveAlpha()
558 bd = (long) (im->blue[c] - b); in gdImageColorResolveAlpha()
559 ad = (long) (im->alpha[c] - a); in gdImageColorResolveAlpha()
574 op = im->colorsTotal; in gdImageColorResolveAlpha()
579 im->colorsTotal++; in gdImageColorResolveAlpha()
581 im->red[op] = r; in gdImageColorResolveAlpha()
582 im->green[op] = g; in gdImageColorResolveAlpha()
583 im->blue[op] = b; in gdImageColorResolveAlpha()
584 im->alpha[op] = a; in gdImageColorResolveAlpha()
585 im->open[op] = 0; in gdImageColorResolveAlpha()
589 void gdImageColorDeallocate (gdImagePtr im, int color) in gdImageColorDeallocate() argument
591 if (im->trueColor) { in gdImageColorDeallocate()
595 im->open[color] = 1; in gdImageColorDeallocate()
598 void gdImageColorTransparent (gdImagePtr im, int color) in gdImageColorTransparent() argument
603 if (!im->trueColor) { in gdImageColorTransparent()
604 if((color >= im->colorsTotal)) { in gdImageColorTransparent()
608 if (im->transparent != -1) { in gdImageColorTransparent()
609 im->alpha[im->transparent] = gdAlphaOpaque; in gdImageColorTransparent()
611 im->alpha[color] = gdAlphaTransparent; in gdImageColorTransparent()
613 im->transparent = color; in gdImageColorTransparent()
725 void gdImageSetPixel (gdImagePtr im, int x, int y, int color) in gdImageSetPixel() argument
730 if (!im->style) { in gdImageSetPixel()
734 p = im->style[im->stylePos++]; in gdImageSetPixel()
737 gdImageSetPixel(im, x, y, p); in gdImageSetPixel()
739 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
742 if (!im->style) { in gdImageSetPixel()
746 p = im->style[im->stylePos++]; in gdImageSetPixel()
748 gdImageSetPixel(im, x, y, gdBrushed); in gdImageSetPixel()
750 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
753 gdImageBrushApply(im, x, y); in gdImageSetPixel()
756 gdImageTileApply(im, x, y); in gdImageSetPixel()
759 gdImageAntiAliasedApply(im, x, y); in gdImageSetPixel()
762 if (gdImageBoundsSafe(im, x, y)) { in gdImageSetPixel()
763 if (im->trueColor) { in gdImageSetPixel()
764 switch (im->alphaBlendingFlag) { in gdImageSetPixel()
767 im->tpixels[y][x] = color; in gdImageSetPixel()
770 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
773 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
776 im->tpixels[y][x] = gdLayerOverlay(im->tpixels[y][x], color); in gdImageSetPixel()
780 im->pixels[y][x] = color; in gdImageSetPixel()
787 int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) in gdImageGetTrueColorPixel() argument
789 int p = gdImageGetPixel(im, x, y); in gdImageGetTrueColorPixel()
791 if (!im->trueColor) { in gdImageGetTrueColorPixel()
792 …return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTra… in gdImageGetTrueColorPixel()
798 static void gdImageBrushApply (gdImagePtr im, int x, int y) in gdImageBrushApply() argument
805 if (!im->brush) { in gdImageBrushApply()
809 hy = gdImageSY(im->brush) / 2; in gdImageBrushApply()
811 y2 = y1 + gdImageSY(im->brush); in gdImageBrushApply()
812 hx = gdImageSX(im->brush) / 2; in gdImageBrushApply()
814 x2 = x1 + gdImageSX(im->brush); in gdImageBrushApply()
817 if (im->trueColor) { in gdImageBrushApply()
818 if (im->brush->trueColor) { in gdImageBrushApply()
823 p = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
825 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
826 gdImageSetPixel(im, lx, ly, p); in gdImageBrushApply()
838 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
839 tc = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
841 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
842 gdImageSetPixel(im, lx, ly, tc); in gdImageBrushApply()
854 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
856 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
858 if (im->brush->trueColor) { in gdImageBrushApply()
859 gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), in gdImageBrushApply()
864 gdImageSetPixel(im, lx, ly, im->brushColorMap[p]); in gdImageBrushApply()
874 static void gdImageTileApply (gdImagePtr im, int x, int y) in gdImageTileApply() argument
876 gdImagePtr tile = im->tile; in gdImageTileApply()
884 if (im->trueColor) { in gdImageTileApply()
890 gdImageSetPixel(im, x, y, p); in gdImageTileApply()
898 gdImageSetPixel(im, x, y, gdImageColorResolveAlpha(im, in gdImageTileApply()
904 gdImageSetPixel(im, x, y, im->tileColorMap[p]); in gdImageTileApply()
911 static int gdImageTileGet (gdImagePtr im, int x, int y) in gdImageTileGet() argument
915 if (!im->tile) { in gdImageTileGet()
918 srcx = x % gdImageSX(im->tile); in gdImageTileGet()
919 srcy = y % gdImageSY(im->tile); in gdImageTileGet()
920 p = gdImageGetPixel(im->tile, srcx, srcy); in gdImageTileGet()
922 if (im->trueColor) { in gdImageTileGet()
923 if (im->tile->trueColor) { in gdImageTileGet()
926 …olor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p… in gdImageTileGet()
929 if (im->tile->trueColor) { in gdImageTileGet()
930 …tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueCol… in gdImageTileGet()
933 …= gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im… in gdImageTileGet()
940 static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py) in gdImageAntiAliasedApply() argument
953 int Ax_Cx = im->AAL_x1 - px; in gdImageAntiAliasedApply()
954 int Ay_Cy = im->AAL_y1 - py; in gdImageAntiAliasedApply()
956 int Bx_Cx = im->AAL_x2 - px; in gdImageAntiAliasedApply()
957 int By_Cy = im->AAL_y2 - py; in gdImageAntiAliasedApply()
964 if (!gdImageBoundsSafe(im, px, py)) { in gdImageAntiAliasedApply()
972 if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) && ((im->AAL_LAB_2 + LBC_2) >= LAC_2)) { in gdImageAntiAliasedApply()
976 p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) - (Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB); in gdImageAntiAliasedApply()
985 if ((p_dist >= 0) && (p_dist <= (float) (im->thick))) { in gdImageAntiAliasedApply()
994 if (!im->AA_polygon || (im->AA_opacity[py][px] < opacity)) { in gdImageAntiAliasedApply()
995 im->AA_opacity[py][px] = opacity; in gdImageAntiAliasedApply()
1002 int gdImageGetPixel (gdImagePtr im, int x, int y) in gdImageGetPixel() argument
1004 if (gdImageBoundsSafe(im, x, y)) { in gdImageGetPixel()
1005 if (im->trueColor) { in gdImageGetPixel()
1006 return im->tpixels[y][x]; in gdImageGetPixel()
1008 return im->pixels[y][x]; in gdImageGetPixel()
1015 void gdImageAABlend (gdImagePtr im) in gdImageAABlend() argument
1018 int color = im->AA_color, color_red, color_green, color_blue; in gdImageAABlend()
1023 color_red = gdImageRed(im, color); in gdImageAABlend()
1024 color_green = gdImageGreen(im, color); in gdImageAABlend()
1025 color_blue = gdImageBlue(im, color); in gdImageAABlend()
1028 for (py = 0; py < im->sy; py++) { in gdImageAABlend()
1029 for (px = 0; px < im->sx; px++) { in gdImageAABlend()
1030 if (im->AA_opacity[py][px] != 0) { in gdImageAABlend()
1031 old_color = gdImageGetPixel(im, px, py); in gdImageAABlend()
1033 …if ((old_color != color) && ((old_color != im->AA_dont_blend) || (im->AA_opacity[py][px] == 255)))… in gdImageAABlend()
1035 p_alpha = (float) (im->AA_opacity[py][px]) / 255.0; in gdImageAABlend()
1041 old_red = gdImageRed(im, old_color); in gdImageAABlend()
1042 old_green = gdImageGreen(im, old_color); in gdImageAABlend()
1043 old_blue = gdImageBlue(im, old_color); in gdImageAABlend()
1048 p_color = gdImageColorResolve(im, p_red, p_green, p_blue); in gdImageAABlend()
1050 gdImageSetPixel(im, px, py, p_color); in gdImageAABlend()
1055 memset(im->AA_opacity[py], 0, im->sx); in gdImageAABlend()
1059 static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
1061 static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col) in gdImageHLine() argument
1063 if (im->thick > 1) { in gdImageHLine()
1064 int thickhalf = im->thick >> 1; in gdImageHLine()
1065 _gdImageFilledHRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col); in gdImageHLine()
1074 gdImageSetPixel(im, x1, y, col); in gdImageHLine()
1080 static void gdImageVLine(gdImagePtr im, int x, int y1, int y2, int col) in gdImageVLine() argument
1082 if (im->thick > 1) { in gdImageVLine()
1083 int thickhalf = im->thick >> 1; in gdImageVLine()
1084 gdImageFilledRectangle(im, x - thickhalf, y1, x + im->thick - thickhalf - 1, y2, col); in gdImageVLine()
1093 gdImageSetPixel(im, x, y1, col); in gdImageVLine()
1100 void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageLine() argument
1105 int thick = im->thick; in gdImageLine()
1113 gdImageAALine(im, x1, y1, x2, y2, im->AA_color); in gdImageLine()
1118 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { in gdImageLine()
1126 gdImageVLine(im, x1, y1, y2, color); in gdImageLine()
1129 gdImageHLine(im, y1, x1, x2, color); in gdImageLine()
1169 gdImageSetPixel(im, x, w, color); in gdImageLine()
1183 gdImageSetPixel (im, x, w, color); in gdImageLine()
1197 gdImageSetPixel (im, x, w, color); in gdImageLine()
1233 gdImageSetPixel (im, w, y, color); in gdImageLine()
1247 gdImageSetPixel (im, w, y, color); in gdImageLine()
1261 gdImageSetPixel (im, w, y, color); in gdImageLine()
1275 inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t) in gdImageSetAAPixelColor() argument
1282 p = gdImageGetPixel(im,x,y); in gdImageSetAAPixelColor()
1290 im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); in gdImageSetAAPixelColor()
1296 void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) in gdImageAALine() argument
1303 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { in gdImageAALine()
1328 gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); in gdImageAALine()
1329 if (y + 1 < im->sy) { in gdImageAALine()
1330 gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF); in gdImageAALine()
1356 gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); in gdImageAALine()
1357 if (x + 1 < im->sx) { in gdImageAALine()
1358 gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF); in gdImageAALine()
1372 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i…
1374 void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageDashedLine() argument
1381 int thick = im->thick; in gdImageDashedLine()
1412 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1422 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1433 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1461 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1471 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1482 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1488 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i… in dashedSet() argument
1503 gdImageSetPixel(im, x, w, color); in dashedSet()
1508 gdImageSetPixel(im, w, y, color); in dashedSet()
1516 void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageChar() argument
1533 gdImageSetPixel(im, px, py, color); in gdImageChar()
1542 void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageCharUp() argument
1559 gdImageSetPixel(im, px, py, color); in gdImageCharUp()
1568 void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageString() argument
1574 gdImageChar(im, f, x, y, s[i], color); in gdImageString()
1579 void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageStringUp() argument
1585 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp()
1592 void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageString16() argument
1598 gdImageChar(im, f, x, y, s[i], color); in gdImageString16()
1603 void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageStringUp16() argument
1609 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp16()
1640 void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) in gdImageArc() argument
1642 gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill); in gdImageArc()
1645 void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int st… in gdImageFilledArc() argument
1683 gdImageLine(im, lx, ly, x, y, color); in gdImageFilledArc()
1714 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1715 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1717 gdImageLine(im, fx, fy, lx, ly, color); in gdImageFilledArc()
1725 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1730 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1731 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1736 gdImageFilledPolygon(im, pts, pti+1, color); in gdImageFilledArc()
1741 void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) in gdImageFillToBorder() argument
1753 if (!im->trueColor) { in gdImageFillToBorder()
1754 if ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) { in gdImageFillToBorder()
1759 restoreAlphaBlending = im->alphaBlendingFlag; in gdImageFillToBorder()
1760 im->alphaBlendingFlag = 0; in gdImageFillToBorder()
1762 if (x >= im->sx) { in gdImageFillToBorder()
1763 x = im->sx - 1; in gdImageFillToBorder()
1767 if (y >= im->sy) { in gdImageFillToBorder()
1768 y = im->sy - 1; in gdImageFillToBorder()
1774 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1777 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1781 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1786 for (i = (x + 1); i < im->sx; i++) { in gdImageFillToBorder()
1787 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1790 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1798 int c = gdImageGetPixel(im, i, y - 1); in gdImageFillToBorder()
1801 gdImageFillToBorder(im, i, y - 1, border, color); in gdImageFillToBorder()
1811 if (y < ((im->sy) - 1)) { in gdImageFillToBorder()
1814 int c = gdImageGetPixel(im, i, y + 1); in gdImageFillToBorder()
1818 gdImageFillToBorder(im, i, y + 1, border, color); in gdImageFillToBorder()
1826 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1843 #define FILL_MAX ((int)(im->sy*im->sx)/4)
1851 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
1853 void gdImageFill(gdImagePtr im, int x, int y, int nc) in gdImageFill() argument
1866 if (!im->trueColor && nc > (im->colorsTotal -1)) { in gdImageFill()
1870 alphablending_bak = im->alphaBlendingFlag; in gdImageFill()
1871 im->alphaBlendingFlag = 0; in gdImageFill()
1874 _gdImageFillTiled(im,x,y,nc); in gdImageFill()
1875 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1879 wx2=im->sx;wy2=im->sy; in gdImageFill()
1880 oc = gdImageGetPixel(im, x, y); in gdImageFill()
1882 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1889 if (im->sx < 4) { in gdImageFill()
1893 c = gdImageGetPixel(im, ix, iy); in gdImageFill()
1897 gdImageSetPixel(im, ix, iy, nc); in gdImageFill()
1898 } while(ix++ < (im->sx -1)); in gdImageFill()
1900 } while(iy++ < (im->sy -1)); in gdImageFill()
1904 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in gdImageFill()
1914 for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) { in gdImageFill()
1915 gdImageSetPixel(im,x, y, nc); in gdImageFill()
1928 for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) { in gdImageFill()
1929 gdImageSetPixel(im, x, y, nc); in gdImageFill()
1936 skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); in gdImageFill()
1945 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1948 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) in _gdImageFillTiled() argument
1958 if (!im->tile) { in _gdImageFillTiled()
1962 wx2=im->sx;wy2=im->sy; in _gdImageFillTiled()
1964 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1966 pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); in _gdImageFillTiled()
1967 for (i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
1968 pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); in _gdImageFillTiled()
1971 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in _gdImageFillTiled()
1974 oc = gdImageGetPixel(im, x, y); in _gdImageFillTiled()
1982 for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { in _gdImageFillTiled()
1983 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1985 gdImageSetPixel(im,x, y, nc); in _gdImageFillTiled()
1998 for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) { in _gdImageFillTiled()
1999 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2001 gdImageSetPixel(im, x, y, nc); in _gdImageFillTiled()
2008 skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); in _gdImageFillTiled()
2013 for(i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2023 void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageRectangle() argument
2026 int thick = im->thick; in gdImageRectangle()
2030 gdImageSetPixel(im, x1, y1, color); in gdImageRectangle()
2061 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2069 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2077 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2085 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2092 gdImageLine(im, x1, y1, x2, y2, color); in gdImageRectangle()
2096 gdImageLine(im, x1h, y1h, x2h, y1h, color); in gdImageRectangle()
2097 gdImageLine(im, x1h, y2h, x2h, y2h, color); in gdImageRectangle()
2098 gdImageLine(im, x1v, y1v, x1v, y2v, color); in gdImageRectangle()
2099 gdImageLine(im, x2v, y1v, x2v, y2v, color); in gdImageRectangle()
2104 static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledHRectangle() argument
2109 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledHRectangle()
2129 if (x2 >= gdImageSX(im)) { in _gdImageFilledHRectangle()
2130 x2 = gdImageSX(im) - 1; in _gdImageFilledHRectangle()
2137 if (y2 >= gdImageSY(im)) { in _gdImageFilledHRectangle()
2138 y2 = gdImageSY(im) - 1; in _gdImageFilledHRectangle()
2143 gdImageSetPixel (im, x, y, color); in _gdImageFilledHRectangle()
2148 static void _gdImageFilledVRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledVRectangle() argument
2153 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledVRectangle()
2173 if (x2 >= gdImageSX(im)) { in _gdImageFilledVRectangle()
2174 x2 = gdImageSX(im) - 1; in _gdImageFilledVRectangle()
2181 if (y2 >= gdImageSY(im)) { in _gdImageFilledVRectangle()
2182 y2 = gdImageSY(im) - 1; in _gdImageFilledVRectangle()
2187 gdImageSetPixel (im, x, y, color); in _gdImageFilledVRectangle()
2192 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageFilledRectangle() argument
2194 _gdImageFilledVRectangle(im, x1, y1, x2, y2, color); in gdImageFilledRectangle()
2584 void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImagePolygon() argument
2588 typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color); in gdImagePolygon()
2599 im->AA_polygon = 1; in gdImagePolygon()
2602 if ( im->antialias) { in gdImagePolygon()
2609 draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c); in gdImagePolygon()
2612 draw_line(im, lx, ly, p->x, p->y, c); in gdImagePolygon()
2618 im->AA_polygon = 0; in gdImagePolygon()
2619 gdImageAABlend(im); in gdImagePolygon()
2633 void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageFilledPolygon() argument
2653 fill_color = im->AA_color; in gdImageFilledPolygon()
2658 if (!im->polyAllocated) { in gdImageFilledPolygon()
2659 im->polyInts = (int *) gdMalloc(sizeof(int) * n); in gdImageFilledPolygon()
2660 im->polyAllocated = n; in gdImageFilledPolygon()
2662 if (im->polyAllocated < n) { in gdImageFilledPolygon()
2663 while (im->polyAllocated < n) { in gdImageFilledPolygon()
2664 im->polyAllocated *= 2; in gdImageFilledPolygon()
2666 if (overflow2(sizeof(int), im->polyAllocated)) { in gdImageFilledPolygon()
2669 im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); in gdImageFilledPolygon()
2691 gdImageLine(im, x1, miny, x2, miny, c); in gdImageFilledPolygon()
2699 if (maxy >= gdImageSY(im)) { in gdImageFilledPolygon()
2700 maxy = gdImageSY(im) - 1; in gdImageFilledPolygon()
2735 im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; in gdImageFilledPolygon()
2737 im->polyInts[ints++] = x2; in gdImageFilledPolygon()
2740 qsort(im->polyInts, ints, sizeof(int), gdCompareInt); in gdImageFilledPolygon()
2743 gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); in gdImageFilledPolygon()
2749 gdImagePolygon(im, p, n, c); in gdImageFilledPolygon()
2758 void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels) in gdImageSetStyle() argument
2760 if (im->style) { in gdImageSetStyle()
2761 gdFree(im->style); in gdImageSetStyle()
2763 im->style = (int *) gdMalloc(sizeof(int) * noOfPixels); in gdImageSetStyle()
2764 memcpy(im->style, style, sizeof(int) * noOfPixels); in gdImageSetStyle()
2765 im->styleLength = noOfPixels; in gdImageSetStyle()
2766 im->stylePos = 0; in gdImageSetStyle()
2769 void gdImageSetThickness (gdImagePtr im, int thickness) in gdImageSetThickness() argument
2771 im->thick = thickness; in gdImageSetThickness()
2774 void gdImageSetBrush (gdImagePtr im, gdImagePtr brush) in gdImageSetBrush() argument
2777 im->brush = brush; in gdImageSetBrush()
2778 if (!im->trueColor && !im->brush->trueColor) { in gdImageSetBrush()
2781 …index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(bru… in gdImageSetBrush()
2782 im->brushColorMap[i] = index; in gdImageSetBrush()
2787 void gdImageSetTile (gdImagePtr im, gdImagePtr tile) in gdImageSetTile() argument
2790 im->tile = tile; in gdImageSetTile()
2791 if (!im->trueColor && !im->tile->trueColor) { in gdImageSetTile()
2794 …index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile,… in gdImageSetTile()
2795 im->tileColorMap[i] = index; in gdImageSetTile()
2800 void gdImageSetAntiAliased (gdImagePtr im, int c) in gdImageSetAntiAliased() argument
2802 im->AA = 1; in gdImageSetAntiAliased()
2803 im->AA_color = c; in gdImageSetAntiAliased()
2804 im->AA_dont_blend = -1; in gdImageSetAntiAliased()
2807 void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend) in gdImageSetAntiAliasedDontBlend() argument
2809 im->AA = 1; in gdImageSetAntiAliasedDontBlend()
2810 im->AA_color = c; in gdImageSetAntiAliasedDontBlend()
2811 im->AA_dont_blend = dont_blend; in gdImageSetAntiAliasedDontBlend()
2815 void gdImageInterlace (gdImagePtr im, int interlaceArg) in gdImageInterlace() argument
2817 im->interlace = interlaceArg; in gdImageInterlace()
2960 void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) in gdImageAlphaBlending() argument
2962 im->alphaBlendingFlag = alphaBlendingArg; in gdImageAlphaBlending()
2965 void gdImageAntialias (gdImagePtr im, int antialias) in gdImageAntialias() argument
2967 if (im->trueColor){ in gdImageAntialias()
2968 im->antialias = antialias; in gdImageAntialias()
2972 void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) in gdImageSaveAlpha() argument
2974 im->saveAlphaFlag = saveAlphaArg; in gdImageSaveAlpha()
3010 void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) in gdImageSetClip() argument
3015 if (x1 >= im->sx) { in gdImageSetClip()
3016 x1 = im->sx - 1; in gdImageSetClip()
3021 if (x2 >= im->sx) { in gdImageSetClip()
3022 x2 = im->sx - 1; in gdImageSetClip()
3027 if (y1 >= im->sy) { in gdImageSetClip()
3028 y1 = im->sy - 1; in gdImageSetClip()
3033 if (y2 >= im->sy) { in gdImageSetClip()
3034 y2 = im->sy - 1; in gdImageSetClip()
3036 im->cx1 = x1; in gdImageSetClip()
3037 im->cy1 = y1; in gdImageSetClip()
3038 im->cx2 = x2; in gdImageSetClip()
3039 im->cy2 = y2; in gdImageSetClip()
3042 void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) in gdImageGetClip() argument
3044 *x1P = im->cx1; in gdImageGetClip()
3045 *y1P = im->cy1; in gdImageGetClip()
3046 *x2P = im->cx2; in gdImageGetClip()
3047 *y2P = im->cy2; in gdImageGetClip()