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);
126 gdImagePtr im; in gdImageCreate() local
136 im = (gdImage *) gdCalloc(1, sizeof(gdImage)); in gdImageCreate()
139 im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
140 im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
141 im->polyInts = 0; in gdImageCreate()
142 im->polyAllocated = 0; in gdImageCreate()
143 im->brush = 0; in gdImageCreate()
144 im->tile = 0; in gdImageCreate()
145 im->style = 0; in gdImageCreate()
148 im->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
149 im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
151 im->sx = sx; in gdImageCreate()
152 im->sy = sy; in gdImageCreate()
153 im->colorsTotal = 0; in gdImageCreate()
154 im->transparent = (-1); in gdImageCreate()
155 im->interlace = 0; in gdImageCreate()
156 im->thick = 1; in gdImageCreate()
157 im->AA = 0; in gdImageCreate()
158 im->AA_polygon = 0; in gdImageCreate()
160 im->open[i] = 1; in gdImageCreate()
161 im->red[i] = 0; in gdImageCreate()
162 im->green[i] = 0; in gdImageCreate()
163 im->blue[i] = 0; in gdImageCreate()
165 im->trueColor = 0; in gdImageCreate()
166 im->tpixels = 0; in gdImageCreate()
167 im->cx1 = 0; in gdImageCreate()
168 im->cy1 = 0; in gdImageCreate()
169 im->cx2 = im->sx - 1; in gdImageCreate()
170 im->cy2 = im->sy - 1; in gdImageCreate()
171 return im; in gdImageCreate()
177 gdImagePtr im; in gdImageCreateTrueColor() local
191 im = (gdImage *) gdMalloc(sizeof(gdImage)); in gdImageCreateTrueColor()
192 memset(im, 0, sizeof(gdImage)); in gdImageCreateTrueColor()
193 im->tpixels = (int **) gdMalloc(sizeof(int *) * sy); in gdImageCreateTrueColor()
194 im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreateTrueColor()
195 im->polyInts = 0; in gdImageCreateTrueColor()
196 im->polyAllocated = 0; in gdImageCreateTrueColor()
197 im->brush = 0; in gdImageCreateTrueColor()
198 im->tile = 0; in gdImageCreateTrueColor()
199 im->style = 0; in gdImageCreateTrueColor()
201 im->tpixels[i] = (int *) gdCalloc(sx, sizeof(int)); in gdImageCreateTrueColor()
202 im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreateTrueColor()
204 im->sx = sx; in gdImageCreateTrueColor()
205 im->sy = sy; in gdImageCreateTrueColor()
206 im->transparent = (-1); in gdImageCreateTrueColor()
207 im->interlace = 0; in gdImageCreateTrueColor()
208 im->trueColor = 1; in gdImageCreateTrueColor()
215 im->saveAlphaFlag = 0; in gdImageCreateTrueColor()
216 im->alphaBlendingFlag = 1; in gdImageCreateTrueColor()
217 im->thick = 1; in gdImageCreateTrueColor()
218 im->AA = 0; in gdImageCreateTrueColor()
219 im->AA_polygon = 0; in gdImageCreateTrueColor()
220 im->cx1 = 0; in gdImageCreateTrueColor()
221 im->cy1 = 0; in gdImageCreateTrueColor()
222 im->cx2 = im->sx - 1; in gdImageCreateTrueColor()
223 im->cy2 = im->sy - 1; in gdImageCreateTrueColor()
224 return im; in gdImageCreateTrueColor()
227 void gdImageDestroy (gdImagePtr im) in gdImageDestroy() argument
230 if (im->pixels) { in gdImageDestroy()
231 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
232 gdFree(im->pixels[i]); in gdImageDestroy()
234 gdFree(im->pixels); in gdImageDestroy()
236 if (im->tpixels) { in gdImageDestroy()
237 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
238 gdFree(im->tpixels[i]); in gdImageDestroy()
240 gdFree(im->tpixels); in gdImageDestroy()
242 if (im->AA_opacity) { in gdImageDestroy()
243 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
244 gdFree(im->AA_opacity[i]); in gdImageDestroy()
246 gdFree(im->AA_opacity); in gdImageDestroy()
248 if (im->polyInts) { in gdImageDestroy()
249 gdFree(im->polyInts); in gdImageDestroy()
251 if (im->style) { in gdImageDestroy()
252 gdFree(im->style); in gdImageDestroy()
254 gdFree(im); in gdImageDestroy()
257 int gdImageColorClosest (gdImagePtr im, int r, int g, int b) in gdImageColorClosest() argument
259 return gdImageColorClosestAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorClosest()
262 int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorClosestAlpha() argument
270 if (im->trueColor) { in gdImageColorClosestAlpha()
273 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestAlpha()
275 if (im->open[i]) { in gdImageColorClosestAlpha()
278 rd = im->red[i] - r; in gdImageColorClosestAlpha()
279 gd = im->green[i] - g; in gdImageColorClosestAlpha()
280 bd = im->blue[i] - b; in gdImageColorClosestAlpha()
282 ad = im->alpha[i] - a; in gdImageColorClosestAlpha()
428 int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) in gdImageColorClosestHWB() argument
435 if (im->trueColor) { in gdImageColorClosestHWB()
438 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestHWB()
440 if (im->open[i]) { in gdImageColorClosestHWB()
443 dist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b); in gdImageColorClosestHWB()
453 int gdImageColorExact (gdImagePtr im, int r, int g, int b) in gdImageColorExact() argument
455 return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorExact()
458 int gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorExactAlpha() argument
461 if (im->trueColor) { in gdImageColorExactAlpha()
464 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorExactAlpha()
465 if (im->open[i]) { in gdImageColorExactAlpha()
468 if ((im->red[i] == r) && (im->green[i] == g) && (im->blue[i] == b) && (im->alpha[i] == a)) { in gdImageColorExactAlpha()
475 int gdImageColorAllocate (gdImagePtr im, int r, int g, int b) in gdImageColorAllocate() argument
477 return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorAllocate()
480 int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorAllocateAlpha() argument
484 if (im->trueColor) { in gdImageColorAllocateAlpha()
487 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorAllocateAlpha()
488 if (im->open[i]) { in gdImageColorAllocateAlpha()
494 ct = im->colorsTotal; in gdImageColorAllocateAlpha()
498 im->colorsTotal++; in gdImageColorAllocateAlpha()
500 im->red[ct] = r; in gdImageColorAllocateAlpha()
501 im->green[ct] = g; in gdImageColorAllocateAlpha()
502 im->blue[ct] = b; in gdImageColorAllocateAlpha()
503 im->alpha[ct] = a; in gdImageColorAllocateAlpha()
504 im->open[ct] = 0; in gdImageColorAllocateAlpha()
520 int gdImageColorResolve (gdImagePtr im, int r, int g, int b) in gdImageColorResolve() argument
522 return gdImageColorResolveAlpha(im, r, g, b, gdAlphaOpaque); in gdImageColorResolve()
525 int gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorResolveAlpha() argument
532 if (im->trueColor) in gdImageColorResolveAlpha()
537 for (c = 0; c < im->colorsTotal; c++) in gdImageColorResolveAlpha()
539 if (im->open[c]) in gdImageColorResolveAlpha()
544 if (c == im->transparent) in gdImageColorResolveAlpha()
550 rd = (long) (im->red[c] - r); in gdImageColorResolveAlpha()
551 gd = (long) (im->green[c] - g); in gdImageColorResolveAlpha()
552 bd = (long) (im->blue[c] - b); in gdImageColorResolveAlpha()
553 ad = (long) (im->alpha[c] - a); in gdImageColorResolveAlpha()
568 op = im->colorsTotal; in gdImageColorResolveAlpha()
573 im->colorsTotal++; in gdImageColorResolveAlpha()
575 im->red[op] = r; in gdImageColorResolveAlpha()
576 im->green[op] = g; in gdImageColorResolveAlpha()
577 im->blue[op] = b; in gdImageColorResolveAlpha()
578 im->alpha[op] = a; in gdImageColorResolveAlpha()
579 im->open[op] = 0; in gdImageColorResolveAlpha()
583 void gdImageColorDeallocate (gdImagePtr im, int color) in gdImageColorDeallocate() argument
585 if (im->trueColor) { in gdImageColorDeallocate()
589 im->open[color] = 1; in gdImageColorDeallocate()
592 void gdImageColorTransparent (gdImagePtr im, int color) in gdImageColorTransparent() argument
594 if (!im->trueColor) { in gdImageColorTransparent()
595 if (im->transparent != -1) { in gdImageColorTransparent()
596 im->alpha[im->transparent] = gdAlphaOpaque; in gdImageColorTransparent()
598 if (color > -1 && color < im->colorsTotal && color < gdMaxColors) { in gdImageColorTransparent()
599 im->alpha[color] = gdAlphaTransparent; in gdImageColorTransparent()
604 im->transparent = color; in gdImageColorTransparent()
716 void gdImageSetPixel (gdImagePtr im, int x, int y, int color) in gdImageSetPixel() argument
721 if (!im->style) { in gdImageSetPixel()
725 p = im->style[im->stylePos++]; in gdImageSetPixel()
728 gdImageSetPixel(im, x, y, p); in gdImageSetPixel()
730 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
733 if (!im->style) { in gdImageSetPixel()
737 p = im->style[im->stylePos++]; in gdImageSetPixel()
739 gdImageSetPixel(im, x, y, gdBrushed); in gdImageSetPixel()
741 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
744 gdImageBrushApply(im, x, y); in gdImageSetPixel()
747 gdImageTileApply(im, x, y); in gdImageSetPixel()
750 gdImageAntiAliasedApply(im, x, y); in gdImageSetPixel()
753 if (gdImageBoundsSafe(im, x, y)) { in gdImageSetPixel()
754 if (im->trueColor) { in gdImageSetPixel()
755 switch (im->alphaBlendingFlag) { in gdImageSetPixel()
758 im->tpixels[y][x] = color; in gdImageSetPixel()
761 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
764 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
767 im->tpixels[y][x] = gdLayerOverlay(im->tpixels[y][x], color); in gdImageSetPixel()
771 im->pixels[y][x] = color; in gdImageSetPixel()
778 int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) in gdImageGetTrueColorPixel() argument
780 int p = gdImageGetPixel(im, x, y); in gdImageGetTrueColorPixel()
782 if (!im->trueColor) { in gdImageGetTrueColorPixel()
783 …return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTra… in gdImageGetTrueColorPixel()
789 static void gdImageBrushApply (gdImagePtr im, int x, int y) in gdImageBrushApply() argument
796 if (!im->brush) { in gdImageBrushApply()
800 hy = gdImageSY(im->brush) / 2; in gdImageBrushApply()
802 y2 = y1 + gdImageSY(im->brush); in gdImageBrushApply()
803 hx = gdImageSX(im->brush) / 2; in gdImageBrushApply()
805 x2 = x1 + gdImageSX(im->brush); in gdImageBrushApply()
808 if (im->trueColor) { in gdImageBrushApply()
809 if (im->brush->trueColor) { in gdImageBrushApply()
814 p = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
816 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
817 gdImageSetPixel(im, lx, ly, p); in gdImageBrushApply()
829 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
830 tc = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
832 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
833 gdImageSetPixel(im, lx, ly, tc); in gdImageBrushApply()
845 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
847 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
849 if (im->brush->trueColor) { in gdImageBrushApply()
850 gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), in gdImageBrushApply()
855 gdImageSetPixel(im, lx, ly, im->brushColorMap[p]); in gdImageBrushApply()
865 static void gdImageTileApply (gdImagePtr im, int x, int y) in gdImageTileApply() argument
867 gdImagePtr tile = im->tile; in gdImageTileApply()
875 if (im->trueColor) { in gdImageTileApply()
881 gdImageSetPixel(im, x, y, p); in gdImageTileApply()
889 gdImageSetPixel(im, x, y, gdImageColorResolveAlpha(im, in gdImageTileApply()
895 gdImageSetPixel(im, x, y, im->tileColorMap[p]); in gdImageTileApply()
902 static int gdImageTileGet (gdImagePtr im, int x, int y) in gdImageTileGet() argument
906 if (!im->tile) { in gdImageTileGet()
909 srcx = x % gdImageSX(im->tile); in gdImageTileGet()
910 srcy = y % gdImageSY(im->tile); in gdImageTileGet()
911 p = gdImageGetPixel(im->tile, srcx, srcy); in gdImageTileGet()
913 if (im->trueColor) { in gdImageTileGet()
914 if (im->tile->trueColor) { in gdImageTileGet()
917 …olor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p… in gdImageTileGet()
920 if (im->tile->trueColor) { in gdImageTileGet()
921 …tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueCol… in gdImageTileGet()
924 …= gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im in gdImageTileGet()
931 static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py) in gdImageAntiAliasedApply() argument
944 int Ax_Cx = im->AAL_x1 - px; in gdImageAntiAliasedApply()
945 int Ay_Cy = im->AAL_y1 - py; in gdImageAntiAliasedApply()
947 int Bx_Cx = im->AAL_x2 - px; in gdImageAntiAliasedApply()
948 int By_Cy = im->AAL_y2 - py; in gdImageAntiAliasedApply()
955 if (!gdImageBoundsSafe(im, px, py)) { in gdImageAntiAliasedApply()
963 if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) && ((im->AAL_LAB_2 + LBC_2) >= LAC_2)) { in gdImageAntiAliasedApply()
967 p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) - (Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB); in gdImageAntiAliasedApply()
976 if ((p_dist >= 0) && (p_dist <= (float) (im->thick))) { in gdImageAntiAliasedApply()
985 if (!im->AA_polygon || (im->AA_opacity[py][px] < opacity)) { in gdImageAntiAliasedApply()
986 im->AA_opacity[py][px] = opacity; in gdImageAntiAliasedApply()
993 int gdImageGetPixel (gdImagePtr im, int x, int y) in gdImageGetPixel() argument
995 if (gdImageBoundsSafe(im, x, y)) { in gdImageGetPixel()
996 if (im->trueColor) { in gdImageGetPixel()
997 return im->tpixels[y][x]; in gdImageGetPixel()
999 return im->pixels[y][x]; in gdImageGetPixel()
1006 void gdImageAABlend (gdImagePtr im) in gdImageAABlend() argument
1009 int color = im->AA_color, color_red, color_green, color_blue; in gdImageAABlend()
1014 color_red = gdImageRed(im, color); in gdImageAABlend()
1015 color_green = gdImageGreen(im, color); in gdImageAABlend()
1016 color_blue = gdImageBlue(im, color); in gdImageAABlend()
1019 for (py = 0; py < im->sy; py++) { in gdImageAABlend()
1020 for (px = 0; px < im->sx; px++) { in gdImageAABlend()
1021 if (im->AA_opacity[py][px] != 0) { in gdImageAABlend()
1022 old_color = gdImageGetPixel(im, px, py); in gdImageAABlend()
1024 …if ((old_color != color) && ((old_color != im->AA_dont_blend) || (im->AA_opacity[py][px] == 255)))… in gdImageAABlend()
1026 p_alpha = (float) (im->AA_opacity[py][px]) / 255.0; in gdImageAABlend()
1032 old_red = gdImageRed(im, old_color); in gdImageAABlend()
1033 old_green = gdImageGreen(im, old_color); in gdImageAABlend()
1034 old_blue = gdImageBlue(im, old_color); in gdImageAABlend()
1039 p_color = gdImageColorResolve(im, p_red, p_green, p_blue); in gdImageAABlend()
1041 gdImageSetPixel(im, px, py, p_color); in gdImageAABlend()
1046 memset(im->AA_opacity[py], 0, im->sx); in gdImageAABlend()
1050 static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col) in gdImageHLine() argument
1052 if (im->thick > 1) { in gdImageHLine()
1053 int thickhalf = im->thick >> 1; in gdImageHLine()
1054 gdImageFilledRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col); in gdImageHLine()
1063 gdImageSetPixel(im, x1, y, col); in gdImageHLine()
1069 static void gdImageVLine(gdImagePtr im, int x, int y1, int y2, int col) in gdImageVLine() argument
1071 if (im->thick > 1) { in gdImageVLine()
1072 int thickhalf = im->thick >> 1; in gdImageVLine()
1073 gdImageFilledRectangle(im, x - thickhalf, y1, x + im->thick - thickhalf - 1, y2, col); in gdImageVLine()
1082 gdImageSetPixel(im, x, y1, col); in gdImageVLine()
1089 void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageLine() argument
1094 int thick = im->thick; in gdImageLine()
1102 gdImageAALine(im, x1, y1, x2, y2, im->AA_color); in gdImageLine()
1107 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) { in gdImageLine()
1115 gdImageVLine(im, x1, y1, y2, color); in gdImageLine()
1118 gdImageHLine(im, y1, x1, x2, color); in gdImageLine()
1158 gdImageSetPixel(im, x, w, color); in gdImageLine()
1172 gdImageSetPixel (im, x, w, color); in gdImageLine()
1186 gdImageSetPixel (im, x, w, color); in gdImageLine()
1222 gdImageSetPixel (im, w, y, color); in gdImageLine()
1236 gdImageSetPixel (im, w, y, color); in gdImageLine()
1250 gdImageSetPixel (im, w, y, color); in gdImageLine()
1264 inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t) in gdImageSetAAPixelColor() argument
1271 p = gdImageGetPixel(im,x,y); in gdImageSetAAPixelColor()
1279 im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); in gdImageSetAAPixelColor()
1285 void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) in gdImageAALine() argument
1304 if (y1 >= im->sy && y2 >= im->sy) { in gdImageAALine()
1307 if (y1 >= im->sy) { in gdImageAALine()
1308 x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1); in gdImageAALine()
1309 y1 = im->sy - 1; in gdImageAALine()
1311 if (y2 >= im->sy) { in gdImageAALine()
1312 x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1); in gdImageAALine()
1313 y2 = im->sy - 1; in gdImageAALine()
1329 if (x1 >= im->sx && x2 >= im->sx) { in gdImageAALine()
1332 if (x1 >= im->sx) { in gdImageAALine()
1333 y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1); in gdImageAALine()
1334 x1 = im->sx - 1; in gdImageAALine()
1336 if (x2 >= im->sx) { in gdImageAALine()
1337 y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1); in gdImageAALine()
1338 x2 = im->sx - 1; in gdImageAALine()
1362 gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF); in gdImageAALine()
1363 if ((y >> 16) + 1 < im->sy) { in gdImageAALine()
1364 gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF); in gdImageAALine()
1384 gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF); in gdImageAALine()
1385 if ((x >> 16) + 1 < im->sx) { in gdImageAALine()
1386 gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF); in gdImageAALine()
1394 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i…
1396 void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageDashedLine() argument
1403 int thick = im->thick; in gdImageDashedLine()
1434 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1444 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1455 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1483 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1493 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1504 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1510 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i… in dashedSet() argument
1525 gdImageSetPixel(im, x, w, color); in dashedSet()
1530 gdImageSetPixel(im, w, y, color); in dashedSet()
1538 void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageChar() argument
1555 gdImageSetPixel(im, px, py, color); in gdImageChar()
1564 void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageCharUp() argument
1581 gdImageSetPixel(im, px, py, color); in gdImageCharUp()
1590 void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageString() argument
1596 gdImageChar(im, f, x, y, s[i], color); in gdImageString()
1601 void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageStringUp() argument
1607 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp()
1614 void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageString16() argument
1620 gdImageChar(im, f, x, y, s[i], color); in gdImageString16()
1625 void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageStringUp16() argument
1631 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp16()
1664 void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) in gdImageArc() argument
1667 gdImageEllipse(im, cx, cy, w, h, color); in gdImageArc()
1669 gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill); in gdImageArc()
1673 void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int st… in gdImageFilledArc() argument
1711 gdImageLine(im, lx, ly, x, y, color); in gdImageFilledArc()
1720 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1733 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1734 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1736 gdImageLine(im, fx, fy, lx, ly, color); in gdImageFilledArc()
1744 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1749 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1750 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1756 void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) in gdImageFillToBorder() argument
1768 restoreAlphaBlending = im->alphaBlendingFlag; in gdImageFillToBorder()
1769 im->alphaBlendingFlag = 0; in gdImageFillToBorder()
1771 if (x >= im->sx) { in gdImageFillToBorder()
1772 x = im->sx - 1; in gdImageFillToBorder()
1774 if (y >= im->sy) { in gdImageFillToBorder()
1775 y = im->sy - 1; in gdImageFillToBorder()
1779 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1782 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1786 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1791 for (i = (x + 1); i < im->sx; i++) { in gdImageFillToBorder()
1792 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1795 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1803 int c = gdImageGetPixel(im, i, y - 1); in gdImageFillToBorder()
1806 gdImageFillToBorder(im, i, y - 1, border, color); in gdImageFillToBorder()
1816 if (y < ((im->sy) - 1)) { in gdImageFillToBorder()
1819 int c = gdImageGetPixel(im, i, y + 1); in gdImageFillToBorder()
1823 gdImageFillToBorder(im, i, y + 1, border, color); in gdImageFillToBorder()
1831 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1848 #define FILL_MAX ((int)(im->sy*im->sx)/4)
1856 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
1858 void gdImageFill(gdImagePtr im, int x, int y, int nc) in gdImageFill() argument
1871 if (!im->trueColor && nc > (im->colorsTotal -1)) { in gdImageFill()
1875 alphablending_bak = im->alphaBlendingFlag; in gdImageFill()
1876 im->alphaBlendingFlag = 0; in gdImageFill()
1879 _gdImageFillTiled(im,x,y,nc); in gdImageFill()
1880 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1884 wx2=im->sx;wy2=im->sy; in gdImageFill()
1885 oc = gdImageGetPixel(im, x, y); in gdImageFill()
1887 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1894 if (im->sx < 4) { in gdImageFill()
1898 c = gdImageGetPixel(im, ix, iy); in gdImageFill()
1902 gdImageSetPixel(im, ix, iy, nc); in gdImageFill()
1903 } while(ix++ < (im->sx -1)); in gdImageFill()
1905 } while(iy++ < (im->sy -1)); in gdImageFill()
1909 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in gdImageFill()
1919 for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) { in gdImageFill()
1920 gdImageSetPixel(im,x, y, nc); in gdImageFill()
1933 for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) { in gdImageFill()
1934 gdImageSetPixel(im, x, y, nc); in gdImageFill()
1941 skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); in gdImageFill()
1950 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1953 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) in _gdImageFillTiled() argument
1964 if (!im->tile) { in _gdImageFillTiled()
1968 wx2=im->sx;wy2=im->sy; in _gdImageFillTiled()
1971 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1973 pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); in _gdImageFillTiled()
1974 for (i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
1975 pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); in _gdImageFillTiled()
1978 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in _gdImageFillTiled()
1981 oc = gdImageGetPixel(im, x, y); in _gdImageFillTiled()
1989 for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { in _gdImageFillTiled()
1990 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1992 gdImageSetPixel(im,x, y, nc); in _gdImageFillTiled()
2005 for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) { in _gdImageFillTiled()
2006 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2008 gdImageSetPixel(im, x, y, nc); in _gdImageFillTiled()
2015 skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); in _gdImageFillTiled()
2020 for(i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2030 void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageRectangle() argument
2033 int thick = im->thick; in gdImageRectangle()
2038 gdImageSetPixel(im, x1, y1, color); in gdImageRectangle()
2067 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2075 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2083 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2091 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2099 gdImageLine(im, x1h, y1h, x2h, y1h, color); in gdImageRectangle()
2100 gdImageLine(im, x1h, y2h, x2h, y2h, color); in gdImageRectangle()
2101 gdImageLine(im, x1v, y1v, x1v, y2v, color); in gdImageRectangle()
2102 gdImageLine(im, x2v, y1v, x2v, y2v, color); in gdImageRectangle()
2106 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageFilledRectangle() argument
2112 gdImageSetPixel(im, x1, y1, color); in gdImageFilledRectangle()
2132 if (x2 >= gdImageSX(im)) { in gdImageFilledRectangle()
2133 x2 = gdImageSX(im) - 1; in gdImageFilledRectangle()
2140 if (y2 >= gdImageSY(im)) { in gdImageFilledRectangle()
2141 y2 = gdImageSY(im) - 1; in gdImageFilledRectangle()
2146 gdImageSetPixel (im, x, y, color); in gdImageFilledRectangle()
2559 void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImagePolygon() argument
2563 typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color); in gdImagePolygon()
2574 im->AA_polygon = 1; in gdImagePolygon()
2577 if ( im->antialias) { in gdImagePolygon()
2584 draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c); in gdImagePolygon()
2587 draw_line(im, lx, ly, p->x, p->y, c); in gdImagePolygon()
2593 im->AA_polygon = 0; in gdImagePolygon()
2594 gdImageAABlend(im); in gdImagePolygon()
2608 void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageFilledPolygon() argument
2628 fill_color = im->AA_color; in gdImageFilledPolygon()
2633 if (!im->polyAllocated) { in gdImageFilledPolygon()
2634 im->polyInts = (int *) gdMalloc(sizeof(int) * n); in gdImageFilledPolygon()
2635 im->polyAllocated = n; in gdImageFilledPolygon()
2637 if (im->polyAllocated < n) { in gdImageFilledPolygon()
2638 while (im->polyAllocated < n) { in gdImageFilledPolygon()
2639 im->polyAllocated *= 2; in gdImageFilledPolygon()
2641 if (overflow2(sizeof(int), im->polyAllocated)) { in gdImageFilledPolygon()
2644 im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); in gdImageFilledPolygon()
2661 if (maxy >= gdImageSY(im)) { in gdImageFilledPolygon()
2662 maxy = gdImageSY(im) - 1; in gdImageFilledPolygon()
2697 im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; in gdImageFilledPolygon()
2699 im->polyInts[ints++] = x2; in gdImageFilledPolygon()
2702 qsort(im->polyInts, ints, sizeof(int), gdCompareInt); in gdImageFilledPolygon()
2705 gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); in gdImageFilledPolygon()
2711 gdImagePolygon(im, p, n, c); in gdImageFilledPolygon()
2720 void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels) in gdImageSetStyle() argument
2722 if (im->style) { in gdImageSetStyle()
2723 gdFree(im->style); in gdImageSetStyle()
2725 im->style = (int *) gdMalloc(sizeof(int) * noOfPixels); in gdImageSetStyle()
2726 memcpy(im->style, style, sizeof(int) * noOfPixels); in gdImageSetStyle()
2727 im->styleLength = noOfPixels; in gdImageSetStyle()
2728 im->stylePos = 0; in gdImageSetStyle()
2731 void gdImageSetThickness (gdImagePtr im, int thickness) in gdImageSetThickness() argument
2733 im->thick = thickness; in gdImageSetThickness()
2736 void gdImageSetBrush (gdImagePtr im, gdImagePtr brush) in gdImageSetBrush() argument
2739 im->brush = brush; in gdImageSetBrush()
2740 if (!im->trueColor && !im->brush->trueColor) { in gdImageSetBrush()
2743 …index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(bru… in gdImageSetBrush()
2744 im->brushColorMap[i] = index; in gdImageSetBrush()
2749 void gdImageSetTile (gdImagePtr im, gdImagePtr tile) in gdImageSetTile() argument
2752 im->tile = tile; in gdImageSetTile()
2753 if (!im->trueColor && !im->tile->trueColor) { in gdImageSetTile()
2756 …index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile,… in gdImageSetTile()
2757 im->tileColorMap[i] = index; in gdImageSetTile()
2762 void gdImageSetAntiAliased (gdImagePtr im, int c) in gdImageSetAntiAliased() argument
2764 im->AA = 1; in gdImageSetAntiAliased()
2765 im->AA_color = c; in gdImageSetAntiAliased()
2766 im->AA_dont_blend = -1; in gdImageSetAntiAliased()
2769 void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend) in gdImageSetAntiAliasedDontBlend() argument
2771 im->AA = 1; in gdImageSetAntiAliasedDontBlend()
2772 im->AA_color = c; in gdImageSetAntiAliasedDontBlend()
2773 im->AA_dont_blend = dont_blend; in gdImageSetAntiAliasedDontBlend()
2777 void gdImageInterlace (gdImagePtr im, int interlaceArg) in gdImageInterlace() argument
2779 im->interlace = interlaceArg; in gdImageInterlace()
2922 void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) in gdImageAlphaBlending() argument
2924 im->alphaBlendingFlag = alphaBlendingArg; in gdImageAlphaBlending()
2927 void gdImageAntialias (gdImagePtr im, int antialias) in gdImageAntialias() argument
2929 if (im->trueColor){ in gdImageAntialias()
2930 im->antialias = antialias; in gdImageAntialias()
2934 void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) in gdImageSaveAlpha() argument
2936 im->saveAlphaFlag = saveAlphaArg; in gdImageSaveAlpha()
2972 void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) in gdImageSetClip() argument
2977 if (x1 >= im->sx) { in gdImageSetClip()
2978 x1 = im->sx - 1; in gdImageSetClip()
2983 if (x2 >= im->sx) { in gdImageSetClip()
2984 x2 = im->sx - 1; in gdImageSetClip()
2989 if (y1 >= im->sy) { in gdImageSetClip()
2990 y1 = im->sy - 1; in gdImageSetClip()
2995 if (y2 >= im->sy) { in gdImageSetClip()
2996 y2 = im->sy - 1; in gdImageSetClip()
2998 im->cx1 = x1; in gdImageSetClip()
2999 im->cy1 = y1; in gdImageSetClip()
3000 im->cx2 = x2; in gdImageSetClip()
3001 im->cy2 = y2; in gdImageSetClip()
3004 void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) in gdImageGetClip() argument
3006 *x1P = im->cx1; in gdImageGetClip()
3007 *y1P = im->cy1; in gdImageGetClip()
3008 *x2P = im->cx2; in gdImageGetClip()
3009 *y2P = im->cy2; in gdImageGetClip()