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
140 im = (gdImage *) gdCalloc(1, sizeof(gdImage)); in gdImageCreate()
143 im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
144 im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
145 im->polyInts = 0; in gdImageCreate()
146 im->polyAllocated = 0; in gdImageCreate()
147 im->brush = 0; in gdImageCreate()
148 im->tile = 0; in gdImageCreate()
149 im->style = 0; in gdImageCreate()
152 im->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
153 im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
155 im->sx = sx; in gdImageCreate()
156 im->sy = sy; in gdImageCreate()
157 im->colorsTotal = 0; in gdImageCreate()
158 im->transparent = (-1); in gdImageCreate()
159 im->interlace = 0; in gdImageCreate()
160 im->thick = 1; in gdImageCreate()
161 im->AA = 0; in gdImageCreate()
162 im->AA_polygon = 0; in gdImageCreate()
164 im->open[i] = 1; in gdImageCreate()
165 im->red[i] = 0; in gdImageCreate()
166 im->green[i] = 0; in gdImageCreate()
167 im->blue[i] = 0; in gdImageCreate()
169 im->trueColor = 0; in gdImageCreate()
170 im->tpixels = 0; in gdImageCreate()
171 im->cx1 = 0; in gdImageCreate()
172 im->cy1 = 0; in gdImageCreate()
173 im->cx2 = im->sx - 1; in gdImageCreate()
174 im->cy2 = im->sy - 1; in gdImageCreate()
175 im->interpolation = NULL; in gdImageCreate()
176 im->interpolation_id = GD_BILINEAR_FIXED; in gdImageCreate()
177 return im; in gdImageCreate()
183 gdImagePtr im; in gdImageCreateTrueColor() local
197 im = (gdImage *) gdMalloc(sizeof(gdImage)); in gdImageCreateTrueColor()
198 memset(im, 0, sizeof(gdImage)); in gdImageCreateTrueColor()
199 im->tpixels = (int **) gdMalloc(sizeof(int *) * sy); in gdImageCreateTrueColor()
200 im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreateTrueColor()
201 im->polyInts = 0; in gdImageCreateTrueColor()
202 im->polyAllocated = 0; in gdImageCreateTrueColor()
203 im->brush = 0; in gdImageCreateTrueColor()
204 im->tile = 0; in gdImageCreateTrueColor()
205 im->style = 0; in gdImageCreateTrueColor()
207 im->tpixels[i] = (int *) gdCalloc(sx, sizeof(int)); in gdImageCreateTrueColor()
208 im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreateTrueColor()
210 im->sx = sx; in gdImageCreateTrueColor()
211 im->sy = sy; in gdImageCreateTrueColor()
212 im->transparent = (-1); in gdImageCreateTrueColor()
213 im->interlace = 0; in gdImageCreateTrueColor()
214 im->trueColor = 1; in gdImageCreateTrueColor()
221 im->saveAlphaFlag = 0; in gdImageCreateTrueColor()
222 im->alphaBlendingFlag = 1; in gdImageCreateTrueColor()
223 im->thick = 1; in gdImageCreateTrueColor()
224 im->AA = 0; in gdImageCreateTrueColor()
225 im->AA_polygon = 0; in gdImageCreateTrueColor()
226 im->cx1 = 0; in gdImageCreateTrueColor()
227 im->cy1 = 0; in gdImageCreateTrueColor()
228 im->cx2 = im->sx - 1; in gdImageCreateTrueColor()
229 im->cy2 = im->sy - 1; in gdImageCreateTrueColor()
230 im->interpolation = NULL; in gdImageCreateTrueColor()
231 im->interpolation_id = GD_BILINEAR_FIXED; in gdImageCreateTrueColor()
232 return im; in gdImageCreateTrueColor()
235 void gdImageDestroy (gdImagePtr im) in gdImageDestroy() argument
238 if (im->pixels) { in gdImageDestroy()
239 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
240 gdFree(im->pixels[i]); in gdImageDestroy()
242 gdFree(im->pixels); in gdImageDestroy()
244 if (im->tpixels) { in gdImageDestroy()
245 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
246 gdFree(im->tpixels[i]); in gdImageDestroy()
248 gdFree(im->tpixels); in gdImageDestroy()
250 if (im->AA_opacity) { in gdImageDestroy()
251 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
252 gdFree(im->AA_opacity[i]); in gdImageDestroy()
254 gdFree(im->AA_opacity); in gdImageDestroy()
256 if (im->polyInts) { in gdImageDestroy()
257 gdFree(im->polyInts); in gdImageDestroy()
259 if (im->style) { in gdImageDestroy()
260 gdFree(im->style); in gdImageDestroy()
262 gdFree(im); in gdImageDestroy()
265 int gdImageColorClosest (gdImagePtr im, int r, int g, int b) in gdImageColorClosest() argument
267 return gdImageColorClosestAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorClosest()
270 int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorClosestAlpha() argument
278 if (im->trueColor) { in gdImageColorClosestAlpha()
281 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestAlpha()
283 if (im->open[i]) { in gdImageColorClosestAlpha()
286 rd = im->red[i] - r; in gdImageColorClosestAlpha()
287 gd = im->green[i] - g; in gdImageColorClosestAlpha()
288 bd = im->blue[i] - b; in gdImageColorClosestAlpha()
290 ad = im->alpha[i] - a; in gdImageColorClosestAlpha()
436 int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) in gdImageColorClosestHWB() argument
443 if (im->trueColor) { in gdImageColorClosestHWB()
446 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestHWB()
448 if (im->open[i]) { in gdImageColorClosestHWB()
451 dist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b); in gdImageColorClosestHWB()
461 int gdImageColorExact (gdImagePtr im, int r, int g, int b) in gdImageColorExact() argument
463 return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorExact()
466 int gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorExactAlpha() argument
469 if (im->trueColor) { in gdImageColorExactAlpha()
472 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorExactAlpha()
473 if (im->open[i]) { in gdImageColorExactAlpha()
476 if ((im->red[i] == r) && (im->green[i] == g) && (im->blue[i] == b) && (im->alpha[i] == a)) { in gdImageColorExactAlpha()
483 int gdImageColorAllocate (gdImagePtr im, int r, int g, int b) in gdImageColorAllocate() argument
485 return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorAllocate()
488 int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorAllocateAlpha() argument
492 if (im->trueColor) { in gdImageColorAllocateAlpha()
495 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorAllocateAlpha()
496 if (im->open[i]) { in gdImageColorAllocateAlpha()
502 ct = im->colorsTotal; in gdImageColorAllocateAlpha()
506 im->colorsTotal++; in gdImageColorAllocateAlpha()
508 im->red[ct] = r; in gdImageColorAllocateAlpha()
509 im->green[ct] = g; in gdImageColorAllocateAlpha()
510 im->blue[ct] = b; in gdImageColorAllocateAlpha()
511 im->alpha[ct] = a; in gdImageColorAllocateAlpha()
512 im->open[ct] = 0; in gdImageColorAllocateAlpha()
528 int gdImageColorResolve (gdImagePtr im, int r, int g, int b) in gdImageColorResolve() argument
530 return gdImageColorResolveAlpha(im, r, g, b, gdAlphaOpaque); in gdImageColorResolve()
533 int gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorResolveAlpha() argument
540 if (im->trueColor) in gdImageColorResolveAlpha()
545 for (c = 0; c < im->colorsTotal; c++) in gdImageColorResolveAlpha()
547 if (im->open[c]) in gdImageColorResolveAlpha()
552 if (c == im->transparent) in gdImageColorResolveAlpha()
558 rd = (long) (im->red[c] - r); in gdImageColorResolveAlpha()
559 gd = (long) (im->green[c] - g); in gdImageColorResolveAlpha()
560 bd = (long) (im->blue[c] - b); in gdImageColorResolveAlpha()
561 ad = (long) (im->alpha[c] - a); in gdImageColorResolveAlpha()
576 op = im->colorsTotal; in gdImageColorResolveAlpha()
581 im->colorsTotal++; in gdImageColorResolveAlpha()
583 im->red[op] = r; in gdImageColorResolveAlpha()
584 im->green[op] = g; in gdImageColorResolveAlpha()
585 im->blue[op] = b; in gdImageColorResolveAlpha()
586 im->alpha[op] = a; in gdImageColorResolveAlpha()
587 im->open[op] = 0; in gdImageColorResolveAlpha()
591 void gdImageColorDeallocate (gdImagePtr im, int color) in gdImageColorDeallocate() argument
593 if (im->trueColor) { in gdImageColorDeallocate()
597 im->open[color] = 1; in gdImageColorDeallocate()
600 void gdImageColorTransparent (gdImagePtr im, int color) in gdImageColorTransparent() argument
605 if (!im->trueColor) { in gdImageColorTransparent()
606 if((color >= im->colorsTotal)) { in gdImageColorTransparent()
610 if (im->transparent != -1) { in gdImageColorTransparent()
611 im->alpha[im->transparent] = gdAlphaOpaque; in gdImageColorTransparent()
613 im->alpha[color] = gdAlphaTransparent; in gdImageColorTransparent()
615 im->transparent = color; in gdImageColorTransparent()
727 void gdImageSetPixel (gdImagePtr im, int x, int y, int color) in gdImageSetPixel() argument
732 if (!im->style) { in gdImageSetPixel()
736 p = im->style[im->stylePos++]; in gdImageSetPixel()
739 gdImageSetPixel(im, x, y, p); in gdImageSetPixel()
741 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
744 if (!im->style) { in gdImageSetPixel()
748 p = im->style[im->stylePos++]; in gdImageSetPixel()
750 gdImageSetPixel(im, x, y, gdBrushed); in gdImageSetPixel()
752 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
755 gdImageBrushApply(im, x, y); in gdImageSetPixel()
758 gdImageTileApply(im, x, y); in gdImageSetPixel()
761 gdImageAntiAliasedApply(im, x, y); in gdImageSetPixel()
764 if (gdImageBoundsSafe(im, x, y)) { in gdImageSetPixel()
765 if (im->trueColor) { in gdImageSetPixel()
766 switch (im->alphaBlendingFlag) { in gdImageSetPixel()
769 im->tpixels[y][x] = color; in gdImageSetPixel()
772 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
775 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
778 im->tpixels[y][x] = gdLayerOverlay(im->tpixels[y][x], color); in gdImageSetPixel()
782 im->pixels[y][x] = color; in gdImageSetPixel()
789 int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) in gdImageGetTrueColorPixel() argument
791 int p = gdImageGetPixel(im, x, y); in gdImageGetTrueColorPixel()
793 if (!im->trueColor) { in gdImageGetTrueColorPixel()
794 …return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTra… in gdImageGetTrueColorPixel()
800 static void gdImageBrushApply (gdImagePtr im, int x, int y) in gdImageBrushApply() argument
807 if (!im->brush) { in gdImageBrushApply()
811 hy = gdImageSY(im->brush) / 2; in gdImageBrushApply()
813 y2 = y1 + gdImageSY(im->brush); in gdImageBrushApply()
814 hx = gdImageSX(im->brush) / 2; in gdImageBrushApply()
816 x2 = x1 + gdImageSX(im->brush); in gdImageBrushApply()
819 if (im->trueColor) { in gdImageBrushApply()
820 if (im->brush->trueColor) { in gdImageBrushApply()
825 p = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
827 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
828 gdImageSetPixel(im, lx, ly, p); in gdImageBrushApply()
840 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
841 tc = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
843 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
844 gdImageSetPixel(im, lx, ly, tc); in gdImageBrushApply()
856 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
858 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
860 if (im->brush->trueColor) { in gdImageBrushApply()
861 gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), in gdImageBrushApply()
866 gdImageSetPixel(im, lx, ly, im->brushColorMap[p]); in gdImageBrushApply()
876 static void gdImageTileApply (gdImagePtr im, int x, int y) in gdImageTileApply() argument
878 gdImagePtr tile = im->tile; in gdImageTileApply()
886 if (im->trueColor) { in gdImageTileApply()
892 gdImageSetPixel(im, x, y, p); in gdImageTileApply()
900 gdImageSetPixel(im, x, y, gdImageColorResolveAlpha(im, in gdImageTileApply()
906 gdImageSetPixel(im, x, y, im->tileColorMap[p]); in gdImageTileApply()
913 static int gdImageTileGet (gdImagePtr im, int x, int y) in gdImageTileGet() argument
917 if (!im->tile) { in gdImageTileGet()
920 srcx = x % gdImageSX(im->tile); in gdImageTileGet()
921 srcy = y % gdImageSY(im->tile); in gdImageTileGet()
922 p = gdImageGetPixel(im->tile, srcx, srcy); in gdImageTileGet()
924 if (im->trueColor) { in gdImageTileGet()
925 if (im->tile->trueColor) { in gdImageTileGet()
928 …olor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p… in gdImageTileGet()
931 if (im->tile->trueColor) { in gdImageTileGet()
932 …tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueCol… in gdImageTileGet()
935 …= gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im in gdImageTileGet()
942 static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py) in gdImageAntiAliasedApply() argument
955 int Ax_Cx = im->AAL_x1 - px; in gdImageAntiAliasedApply()
956 int Ay_Cy = im->AAL_y1 - py; in gdImageAntiAliasedApply()
958 int Bx_Cx = im->AAL_x2 - px; in gdImageAntiAliasedApply()
959 int By_Cy = im->AAL_y2 - py; in gdImageAntiAliasedApply()
966 if (!gdImageBoundsSafe(im, px, py)) { in gdImageAntiAliasedApply()
974 if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) && ((im->AAL_LAB_2 + LBC_2) >= LAC_2)) { in gdImageAntiAliasedApply()
978 p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) - (Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB); in gdImageAntiAliasedApply()
987 if ((p_dist >= 0) && (p_dist <= (float) (im->thick))) { in gdImageAntiAliasedApply()
996 if (!im->AA_polygon || (im->AA_opacity[py][px] < opacity)) { in gdImageAntiAliasedApply()
997 im->AA_opacity[py][px] = opacity; in gdImageAntiAliasedApply()
1004 int gdImageGetPixel (gdImagePtr im, int x, int y) in gdImageGetPixel() argument
1006 if (gdImageBoundsSafe(im, x, y)) { in gdImageGetPixel()
1007 if (im->trueColor) { in gdImageGetPixel()
1008 return im->tpixels[y][x]; in gdImageGetPixel()
1010 return im->pixels[y][x]; in gdImageGetPixel()
1017 void gdImageAABlend (gdImagePtr im) in gdImageAABlend() argument
1020 int color = im->AA_color, color_red, color_green, color_blue; in gdImageAABlend()
1025 color_red = gdImageRed(im, color); in gdImageAABlend()
1026 color_green = gdImageGreen(im, color); in gdImageAABlend()
1027 color_blue = gdImageBlue(im, color); in gdImageAABlend()
1030 for (py = 0; py < im->sy; py++) { in gdImageAABlend()
1031 for (px = 0; px < im->sx; px++) { in gdImageAABlend()
1032 if (im->AA_opacity[py][px] != 0) { in gdImageAABlend()
1033 old_color = gdImageGetPixel(im, px, py); in gdImageAABlend()
1035 …if ((old_color != color) && ((old_color != im->AA_dont_blend) || (im->AA_opacity[py][px] == 255)))… in gdImageAABlend()
1037 p_alpha = (float) (im->AA_opacity[py][px]) / 255.0; in gdImageAABlend()
1043 old_red = gdImageRed(im, old_color); in gdImageAABlend()
1044 old_green = gdImageGreen(im, old_color); in gdImageAABlend()
1045 old_blue = gdImageBlue(im, old_color); in gdImageAABlend()
1050 p_color = gdImageColorResolve(im, p_red, p_green, p_blue); in gdImageAABlend()
1052 gdImageSetPixel(im, px, py, p_color); in gdImageAABlend()
1057 memset(im->AA_opacity[py], 0, im->sx); in gdImageAABlend()
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 gdImageFilledRectangle(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)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) { 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
1315 if (y1 >= im->sy && y2 >= im->sy) { in gdImageAALine()
1318 if (y1 >= im->sy) { in gdImageAALine()
1319 x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1); in gdImageAALine()
1320 y1 = im->sy - 1; in gdImageAALine()
1322 if (y2 >= im->sy) { in gdImageAALine()
1323 x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1); in gdImageAALine()
1324 y2 = im->sy - 1; in gdImageAALine()
1340 if (x1 >= im->sx && x2 >= im->sx) { in gdImageAALine()
1343 if (x1 >= im->sx) { in gdImageAALine()
1344 y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1); in gdImageAALine()
1345 x1 = im->sx - 1; in gdImageAALine()
1347 if (x2 >= im->sx) { in gdImageAALine()
1348 y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1); in gdImageAALine()
1349 x2 = im->sx - 1; in gdImageAALine()
1373 gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF); in gdImageAALine()
1374 if ((y >> 16) + 1 < im->sy) { in gdImageAALine()
1375 gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF); in gdImageAALine()
1395 gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF); in gdImageAALine()
1396 if ((x >> 16) + 1 < im->sx) { in gdImageAALine()
1397 gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF); in gdImageAALine()
1405 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i…
1407 void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageDashedLine() argument
1414 int thick = im->thick; in gdImageDashedLine()
1445 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1455 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1466 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1494 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1504 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1515 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1521 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i… in dashedSet() argument
1536 gdImageSetPixel(im, x, w, color); in dashedSet()
1541 gdImageSetPixel(im, w, y, color); in dashedSet()
1549 void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageChar() argument
1566 gdImageSetPixel(im, px, py, color); in gdImageChar()
1575 void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageCharUp() argument
1592 gdImageSetPixel(im, px, py, color); in gdImageCharUp()
1601 void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageString() argument
1607 gdImageChar(im, f, x, y, s[i], color); in gdImageString()
1612 void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageStringUp() argument
1618 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp()
1625 void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageString16() argument
1631 gdImageChar(im, f, x, y, s[i], color); in gdImageString16()
1636 void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageStringUp16() argument
1642 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp16()
1675 void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) in gdImageArc() argument
1678 gdImageEllipse(im, cx, cy, w, h, color); in gdImageArc()
1680 gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill); in gdImageArc()
1684 void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int st… in gdImageFilledArc() argument
1722 gdImageLine(im, lx, ly, x, y, color); in gdImageFilledArc()
1731 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1744 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1745 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1747 gdImageLine(im, fx, fy, lx, ly, color); in gdImageFilledArc()
1755 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1760 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1761 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1767 void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) in gdImageFillToBorder() argument
1779 restoreAlphaBlending = im->alphaBlendingFlag; in gdImageFillToBorder()
1780 im->alphaBlendingFlag = 0; in gdImageFillToBorder()
1782 if (x >= im->sx) { in gdImageFillToBorder()
1783 x = im->sx - 1; in gdImageFillToBorder()
1787 if (y >= im->sy) { in gdImageFillToBorder()
1788 y = im->sy - 1; in gdImageFillToBorder()
1794 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1797 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1801 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1806 for (i = (x + 1); i < im->sx; i++) { in gdImageFillToBorder()
1807 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1810 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1818 int c = gdImageGetPixel(im, i, y - 1); in gdImageFillToBorder()
1821 gdImageFillToBorder(im, i, y - 1, border, color); in gdImageFillToBorder()
1831 if (y < ((im->sy) - 1)) { in gdImageFillToBorder()
1834 int c = gdImageGetPixel(im, i, y + 1); in gdImageFillToBorder()
1838 gdImageFillToBorder(im, i, y + 1, border, color); in gdImageFillToBorder()
1846 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1863 #define FILL_MAX ((int)(im->sy*im->sx)/4)
1871 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
1873 void gdImageFill(gdImagePtr im, int x, int y, int nc) in gdImageFill() argument
1886 if (!im->trueColor && nc > (im->colorsTotal -1)) { in gdImageFill()
1890 alphablending_bak = im->alphaBlendingFlag; in gdImageFill()
1891 im->alphaBlendingFlag = 0; in gdImageFill()
1894 _gdImageFillTiled(im,x,y,nc); in gdImageFill()
1895 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1899 wx2=im->sx;wy2=im->sy; in gdImageFill()
1900 oc = gdImageGetPixel(im, x, y); in gdImageFill()
1902 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1909 if (im->sx < 4) { in gdImageFill()
1913 c = gdImageGetPixel(im, ix, iy); in gdImageFill()
1917 gdImageSetPixel(im, ix, iy, nc); in gdImageFill()
1918 } while(ix++ < (im->sx -1)); in gdImageFill()
1920 } while(iy++ < (im->sy -1)); in gdImageFill()
1924 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in gdImageFill()
1934 for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) { in gdImageFill()
1935 gdImageSetPixel(im,x, y, nc); in gdImageFill()
1948 for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) { in gdImageFill()
1949 gdImageSetPixel(im, x, y, nc); in gdImageFill()
1956 skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); in gdImageFill()
1965 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1968 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) in _gdImageFillTiled() argument
1978 if (!im->tile) { in _gdImageFillTiled()
1982 wx2=im->sx;wy2=im->sy; in _gdImageFillTiled()
1984 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1986 pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); in _gdImageFillTiled()
1987 for (i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
1988 pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); in _gdImageFillTiled()
1991 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in _gdImageFillTiled()
1994 oc = gdImageGetPixel(im, x, y); in _gdImageFillTiled()
2002 for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { in _gdImageFillTiled()
2003 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2005 gdImageSetPixel(im,x, y, nc); in _gdImageFillTiled()
2018 for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) { in _gdImageFillTiled()
2019 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2021 gdImageSetPixel(im, x, y, nc); in _gdImageFillTiled()
2028 skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); in _gdImageFillTiled()
2033 for(i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2043 void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageRectangle() argument
2046 int thick = im->thick; in gdImageRectangle()
2050 gdImageSetPixel(im, x1, y1, color); in gdImageRectangle()
2079 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2087 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2095 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2103 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2111 gdImageLine(im, x1h, y1h, x2h, y1h, color); in gdImageRectangle()
2112 gdImageLine(im, x1h, y2h, x2h, y2h, color); in gdImageRectangle()
2113 gdImageLine(im, x1v, y1v, x1v, y2v, color); in gdImageRectangle()
2114 gdImageLine(im, x2v, y1v, x2v, y2v, color); in gdImageRectangle()
2118 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageFilledRectangle() argument
2124 gdImageSetPixel(im, x1, y1, color); in gdImageFilledRectangle()
2144 if (x2 >= gdImageSX(im)) { in gdImageFilledRectangle()
2145 x2 = gdImageSX(im) - 1; in gdImageFilledRectangle()
2152 if (y2 >= gdImageSY(im)) { in gdImageFilledRectangle()
2153 y2 = gdImageSY(im) - 1; in gdImageFilledRectangle()
2158 gdImageSetPixel (im, x, y, color); in gdImageFilledRectangle()
2568 void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImagePolygon() argument
2572 typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color); in gdImagePolygon()
2583 im->AA_polygon = 1; in gdImagePolygon()
2586 if ( im->antialias) { in gdImagePolygon()
2593 draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c); in gdImagePolygon()
2596 draw_line(im, lx, ly, p->x, p->y, c); in gdImagePolygon()
2602 im->AA_polygon = 0; in gdImagePolygon()
2603 gdImageAABlend(im); in gdImagePolygon()
2617 void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageFilledPolygon() argument
2637 fill_color = im->AA_color; in gdImageFilledPolygon()
2642 if (!im->polyAllocated) { in gdImageFilledPolygon()
2643 im->polyInts = (int *) gdMalloc(sizeof(int) * n); in gdImageFilledPolygon()
2644 im->polyAllocated = n; in gdImageFilledPolygon()
2646 if (im->polyAllocated < n) { in gdImageFilledPolygon()
2647 while (im->polyAllocated < n) { in gdImageFilledPolygon()
2648 im->polyAllocated *= 2; in gdImageFilledPolygon()
2650 if (overflow2(sizeof(int), im->polyAllocated)) { in gdImageFilledPolygon()
2653 im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); in gdImageFilledPolygon()
2670 if (maxy >= gdImageSY(im)) { in gdImageFilledPolygon()
2671 maxy = gdImageSY(im) - 1; in gdImageFilledPolygon()
2706 im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; in gdImageFilledPolygon()
2708 im->polyInts[ints++] = x2; in gdImageFilledPolygon()
2711 qsort(im->polyInts, ints, sizeof(int), gdCompareInt); in gdImageFilledPolygon()
2714 gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); in gdImageFilledPolygon()
2720 gdImagePolygon(im, p, n, c); in gdImageFilledPolygon()
2729 void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels) in gdImageSetStyle() argument
2731 if (im->style) { in gdImageSetStyle()
2732 gdFree(im->style); in gdImageSetStyle()
2734 im->style = (int *) gdMalloc(sizeof(int) * noOfPixels); in gdImageSetStyle()
2735 memcpy(im->style, style, sizeof(int) * noOfPixels); in gdImageSetStyle()
2736 im->styleLength = noOfPixels; in gdImageSetStyle()
2737 im->stylePos = 0; in gdImageSetStyle()
2740 void gdImageSetThickness (gdImagePtr im, int thickness) in gdImageSetThickness() argument
2742 im->thick = thickness; in gdImageSetThickness()
2745 void gdImageSetBrush (gdImagePtr im, gdImagePtr brush) in gdImageSetBrush() argument
2748 im->brush = brush; in gdImageSetBrush()
2749 if (!im->trueColor && !im->brush->trueColor) { in gdImageSetBrush()
2752 …index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(bru… in gdImageSetBrush()
2753 im->brushColorMap[i] = index; in gdImageSetBrush()
2758 void gdImageSetTile (gdImagePtr im, gdImagePtr tile) in gdImageSetTile() argument
2761 im->tile = tile; in gdImageSetTile()
2762 if (!im->trueColor && !im->tile->trueColor) { in gdImageSetTile()
2765 …index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile,… in gdImageSetTile()
2766 im->tileColorMap[i] = index; in gdImageSetTile()
2771 void gdImageSetAntiAliased (gdImagePtr im, int c) in gdImageSetAntiAliased() argument
2773 im->AA = 1; in gdImageSetAntiAliased()
2774 im->AA_color = c; in gdImageSetAntiAliased()
2775 im->AA_dont_blend = -1; in gdImageSetAntiAliased()
2778 void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend) in gdImageSetAntiAliasedDontBlend() argument
2780 im->AA = 1; in gdImageSetAntiAliasedDontBlend()
2781 im->AA_color = c; in gdImageSetAntiAliasedDontBlend()
2782 im->AA_dont_blend = dont_blend; in gdImageSetAntiAliasedDontBlend()
2786 void gdImageInterlace (gdImagePtr im, int interlaceArg) in gdImageInterlace() argument
2788 im->interlace = interlaceArg; in gdImageInterlace()
2931 void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) in gdImageAlphaBlending() argument
2933 im->alphaBlendingFlag = alphaBlendingArg; in gdImageAlphaBlending()
2936 void gdImageAntialias (gdImagePtr im, int antialias) in gdImageAntialias() argument
2938 if (im->trueColor){ in gdImageAntialias()
2939 im->antialias = antialias; in gdImageAntialias()
2943 void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) in gdImageSaveAlpha() argument
2945 im->saveAlphaFlag = saveAlphaArg; in gdImageSaveAlpha()
2981 void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) in gdImageSetClip() argument
2986 if (x1 >= im->sx) { in gdImageSetClip()
2987 x1 = im->sx - 1; in gdImageSetClip()
2992 if (x2 >= im->sx) { in gdImageSetClip()
2993 x2 = im->sx - 1; in gdImageSetClip()
2998 if (y1 >= im->sy) { in gdImageSetClip()
2999 y1 = im->sy - 1; in gdImageSetClip()
3004 if (y2 >= im->sy) { in gdImageSetClip()
3005 y2 = im->sy - 1; in gdImageSetClip()
3007 im->cx1 = x1; in gdImageSetClip()
3008 im->cy1 = y1; in gdImageSetClip()
3009 im->cx2 = x2; in gdImageSetClip()
3010 im->cy2 = y2; in gdImageSetClip()
3013 void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) in gdImageGetClip() argument
3015 *x1P = im->cx1; in gdImageGetClip()
3016 *y1P = im->cy1; in gdImageGetClip()
3017 *x2P = im->cx2; in gdImageGetClip()
3018 *y2P = im->cy2; in gdImageGetClip()