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()
1411 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1421 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1432 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1460 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1470 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1481 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1487 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i… in dashedSet() argument
1502 gdImageSetPixel(im, x, w, color); in dashedSet()
1507 gdImageSetPixel(im, w, y, color); in dashedSet()
1515 void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageChar() argument
1532 gdImageSetPixel(im, px, py, color); in gdImageChar()
1541 void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageCharUp() argument
1558 gdImageSetPixel(im, px, py, color); in gdImageCharUp()
1567 void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageString() argument
1573 gdImageChar(im, f, x, y, s[i], color); in gdImageString()
1578 void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageStringUp() argument
1584 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp()
1591 void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageString16() argument
1597 gdImageChar(im, f, x, y, s[i], color); in gdImageString16()
1602 void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageStringUp16() argument
1608 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp16()
1639 void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) in gdImageArc() argument
1641 gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill); in gdImageArc()
1644 void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int st… in gdImageFilledArc() argument
1682 gdImageLine(im, lx, ly, x, y, color); in gdImageFilledArc()
1713 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1714 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1716 gdImageLine(im, fx, fy, lx, ly, color); in gdImageFilledArc()
1724 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1729 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1730 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1735 gdImageFilledPolygon(im, pts, pti+1, color); in gdImageFilledArc()
1740 void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) in gdImageFillToBorder() argument
1752 if (!im->trueColor) { in gdImageFillToBorder()
1753 if ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) { in gdImageFillToBorder()
1758 restoreAlphaBlending = im->alphaBlendingFlag; in gdImageFillToBorder()
1759 im->alphaBlendingFlag = 0; in gdImageFillToBorder()
1761 if (x >= im->sx) { in gdImageFillToBorder()
1762 x = im->sx - 1; in gdImageFillToBorder()
1766 if (y >= im->sy) { in gdImageFillToBorder()
1767 y = im->sy - 1; in gdImageFillToBorder()
1773 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1776 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1780 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1785 for (i = (x + 1); i < im->sx; i++) { in gdImageFillToBorder()
1786 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1789 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1797 int c = gdImageGetPixel(im, i, y - 1); in gdImageFillToBorder()
1800 gdImageFillToBorder(im, i, y - 1, border, color); in gdImageFillToBorder()
1810 if (y < ((im->sy) - 1)) { in gdImageFillToBorder()
1813 int c = gdImageGetPixel(im, i, y + 1); in gdImageFillToBorder()
1817 gdImageFillToBorder(im, i, y + 1, border, color); in gdImageFillToBorder()
1825 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1842 #define FILL_MAX ((int)(im->sy*im->sx)/4)
1850 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
1852 void gdImageFill(gdImagePtr im, int x, int y, int nc) in gdImageFill() argument
1865 if (!im->trueColor && nc > (im->colorsTotal -1)) { in gdImageFill()
1869 alphablending_bak = im->alphaBlendingFlag; in gdImageFill()
1870 im->alphaBlendingFlag = 0; in gdImageFill()
1873 _gdImageFillTiled(im,x,y,nc); in gdImageFill()
1874 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1878 wx2=im->sx;wy2=im->sy; in gdImageFill()
1879 oc = gdImageGetPixel(im, x, y); in gdImageFill()
1881 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1888 if (im->sx < 4) { in gdImageFill()
1892 c = gdImageGetPixel(im, ix, iy); in gdImageFill()
1896 gdImageSetPixel(im, ix, iy, nc); in gdImageFill()
1897 } while(ix++ < (im->sx -1)); in gdImageFill()
1899 } while(iy++ < (im->sy -1)); in gdImageFill()
1903 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in gdImageFill()
1913 for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) { in gdImageFill()
1914 gdImageSetPixel(im,x, y, nc); in gdImageFill()
1927 for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) { in gdImageFill()
1928 gdImageSetPixel(im, x, y, nc); in gdImageFill()
1935 skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); in gdImageFill()
1944 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1947 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) in _gdImageFillTiled() argument
1957 if (!im->tile) { in _gdImageFillTiled()
1961 wx2=im->sx;wy2=im->sy; in _gdImageFillTiled()
1963 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1965 pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); in _gdImageFillTiled()
1966 for (i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
1967 pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); in _gdImageFillTiled()
1970 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in _gdImageFillTiled()
1973 oc = gdImageGetPixel(im, x, y); in _gdImageFillTiled()
1981 for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { in _gdImageFillTiled()
1982 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1984 gdImageSetPixel(im,x, y, nc); in _gdImageFillTiled()
1997 for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) { in _gdImageFillTiled()
1998 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2000 gdImageSetPixel(im, x, y, nc); in _gdImageFillTiled()
2007 skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); in _gdImageFillTiled()
2012 for(i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2022 void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageRectangle() argument
2025 int thick = im->thick; in gdImageRectangle()
2029 gdImageSetPixel(im, x1, y1, color); in gdImageRectangle()
2060 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2068 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2076 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2084 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2091 gdImageLine(im, x1, y1, x2, y2, color); in gdImageRectangle()
2095 gdImageLine(im, x1h, y1h, x2h, y1h, color); in gdImageRectangle()
2096 gdImageLine(im, x1h, y2h, x2h, y2h, color); in gdImageRectangle()
2097 gdImageLine(im, x1v, y1v, x1v, y2v, color); in gdImageRectangle()
2098 gdImageLine(im, x2v, y1v, x2v, y2v, color); in gdImageRectangle()
2103 static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledHRectangle() argument
2108 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledHRectangle()
2128 if (x2 >= gdImageSX(im)) { in _gdImageFilledHRectangle()
2129 x2 = gdImageSX(im) - 1; in _gdImageFilledHRectangle()
2136 if (y2 >= gdImageSY(im)) { in _gdImageFilledHRectangle()
2137 y2 = gdImageSY(im) - 1; in _gdImageFilledHRectangle()
2142 gdImageSetPixel (im, x, y, color); in _gdImageFilledHRectangle()
2147 static void _gdImageFilledVRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledVRectangle() argument
2152 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledVRectangle()
2172 if (x2 >= gdImageSX(im)) { in _gdImageFilledVRectangle()
2173 x2 = gdImageSX(im) - 1; in _gdImageFilledVRectangle()
2180 if (y2 >= gdImageSY(im)) { in _gdImageFilledVRectangle()
2181 y2 = gdImageSY(im) - 1; in _gdImageFilledVRectangle()
2186 gdImageSetPixel (im, x, y, color); in _gdImageFilledVRectangle()
2191 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageFilledRectangle() argument
2193 _gdImageFilledVRectangle(im, x1, y1, x2, y2, color); in gdImageFilledRectangle()
2583 void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImagePolygon() argument
2587 typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color); in gdImagePolygon()
2598 im->AA_polygon = 1; in gdImagePolygon()
2601 if ( im->antialias) { in gdImagePolygon()
2608 draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c); in gdImagePolygon()
2611 draw_line(im, lx, ly, p->x, p->y, c); in gdImagePolygon()
2617 im->AA_polygon = 0; in gdImagePolygon()
2618 gdImageAABlend(im); in gdImagePolygon()
2632 void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageFilledPolygon() argument
2652 fill_color = im->AA_color; in gdImageFilledPolygon()
2657 if (!im->polyAllocated) { in gdImageFilledPolygon()
2658 im->polyInts = (int *) gdMalloc(sizeof(int) * n); in gdImageFilledPolygon()
2659 im->polyAllocated = n; in gdImageFilledPolygon()
2661 if (im->polyAllocated < n) { in gdImageFilledPolygon()
2662 while (im->polyAllocated < n) { in gdImageFilledPolygon()
2663 im->polyAllocated *= 2; in gdImageFilledPolygon()
2665 if (overflow2(sizeof(int), im->polyAllocated)) { in gdImageFilledPolygon()
2668 im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); in gdImageFilledPolygon()
2690 gdImageLine(im, x1, miny, x2, miny, c); in gdImageFilledPolygon()
2698 if (maxy >= gdImageSY(im)) { in gdImageFilledPolygon()
2699 maxy = gdImageSY(im) - 1; in gdImageFilledPolygon()
2734 im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; in gdImageFilledPolygon()
2736 im->polyInts[ints++] = x2; in gdImageFilledPolygon()
2739 qsort(im->polyInts, ints, sizeof(int), gdCompareInt); in gdImageFilledPolygon()
2742 gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); in gdImageFilledPolygon()
2748 gdImagePolygon(im, p, n, c); in gdImageFilledPolygon()
2757 void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels) in gdImageSetStyle() argument
2759 if (im->style) { in gdImageSetStyle()
2760 gdFree(im->style); in gdImageSetStyle()
2762 im->style = (int *) gdMalloc(sizeof(int) * noOfPixels); in gdImageSetStyle()
2763 memcpy(im->style, style, sizeof(int) * noOfPixels); in gdImageSetStyle()
2764 im->styleLength = noOfPixels; in gdImageSetStyle()
2765 im->stylePos = 0; in gdImageSetStyle()
2768 void gdImageSetThickness (gdImagePtr im, int thickness) in gdImageSetThickness() argument
2770 im->thick = thickness; in gdImageSetThickness()
2773 void gdImageSetBrush (gdImagePtr im, gdImagePtr brush) in gdImageSetBrush() argument
2776 im->brush = brush; in gdImageSetBrush()
2777 if (!im->trueColor && !im->brush->trueColor) { in gdImageSetBrush()
2780 …index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(bru… in gdImageSetBrush()
2781 im->brushColorMap[i] = index; in gdImageSetBrush()
2786 void gdImageSetTile (gdImagePtr im, gdImagePtr tile) in gdImageSetTile() argument
2789 im->tile = tile; in gdImageSetTile()
2790 if (!im->trueColor && !im->tile->trueColor) { in gdImageSetTile()
2793 …index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile,… in gdImageSetTile()
2794 im->tileColorMap[i] = index; in gdImageSetTile()
2799 void gdImageSetAntiAliased (gdImagePtr im, int c) in gdImageSetAntiAliased() argument
2801 im->AA = 1; in gdImageSetAntiAliased()
2802 im->AA_color = c; in gdImageSetAntiAliased()
2803 im->AA_dont_blend = -1; in gdImageSetAntiAliased()
2806 void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend) in gdImageSetAntiAliasedDontBlend() argument
2808 im->AA = 1; in gdImageSetAntiAliasedDontBlend()
2809 im->AA_color = c; in gdImageSetAntiAliasedDontBlend()
2810 im->AA_dont_blend = dont_blend; in gdImageSetAntiAliasedDontBlend()
2814 void gdImageInterlace (gdImagePtr im, int interlaceArg) in gdImageInterlace() argument
2816 im->interlace = interlaceArg; in gdImageInterlace()
2959 void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) in gdImageAlphaBlending() argument
2961 im->alphaBlendingFlag = alphaBlendingArg; in gdImageAlphaBlending()
2964 void gdImageAntialias (gdImagePtr im, int antialias) in gdImageAntialias() argument
2966 if (im->trueColor){ in gdImageAntialias()
2967 im->antialias = antialias; in gdImageAntialias()
2971 void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) in gdImageSaveAlpha() argument
2973 im->saveAlphaFlag = saveAlphaArg; in gdImageSaveAlpha()
3009 void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) in gdImageSetClip() argument
3014 if (x1 >= im->sx) { in gdImageSetClip()
3015 x1 = im->sx - 1; in gdImageSetClip()
3020 if (x2 >= im->sx) { in gdImageSetClip()
3021 x2 = im->sx - 1; in gdImageSetClip()
3026 if (y1 >= im->sy) { in gdImageSetClip()
3027 y1 = im->sy - 1; in gdImageSetClip()
3032 if (y2 >= im->sy) { in gdImageSetClip()
3033 y2 = im->sy - 1; in gdImageSetClip()
3035 im->cx1 = x1; in gdImageSetClip()
3036 im->cy1 = y1; in gdImageSetClip()
3037 im->cx2 = x2; in gdImageSetClip()
3038 im->cy2 = y2; in gdImageSetClip()
3041 void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) in gdImageGetClip() argument
3043 *x1P = im->cx1; in gdImageGetClip()
3044 *y1P = im->cy1; in gdImageGetClip()
3045 *x2P = im->cx2; in gdImageGetClip()
3046 *y2P = im->cy2; in gdImageGetClip()