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 _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
1063 static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col) in gdImageHLine() argument
1065 if (im->thick > 1) { in gdImageHLine()
1066 int thickhalf = im->thick >> 1; in gdImageHLine()
1067 _gdImageFilledHRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col); in gdImageHLine()
1076 gdImageSetPixel(im, x1, y, col); in gdImageHLine()
1082 static void gdImageVLine(gdImagePtr im, int x, int y1, int y2, int col) in gdImageVLine() argument
1084 if (im->thick > 1) { in gdImageVLine()
1085 int thickhalf = im->thick >> 1; in gdImageVLine()
1086 gdImageFilledRectangle(im, x - thickhalf, y1, x + im->thick - thickhalf - 1, y2, col); in gdImageVLine()
1095 gdImageSetPixel(im, x, y1, col); in gdImageVLine()
1102 void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageLine() argument
1107 int thick = im->thick; in gdImageLine()
1115 gdImageAALine(im, x1, y1, x2, y2, im->AA_color); in gdImageLine()
1120 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { in gdImageLine()
1128 gdImageVLine(im, x1, y1, y2, color); in gdImageLine()
1131 gdImageHLine(im, y1, x1, x2, color); in gdImageLine()
1171 gdImageSetPixel(im, x, w, color); in gdImageLine()
1185 gdImageSetPixel (im, x, w, color); in gdImageLine()
1199 gdImageSetPixel (im, x, w, color); in gdImageLine()
1235 gdImageSetPixel (im, w, y, color); in gdImageLine()
1249 gdImageSetPixel (im, w, y, color); in gdImageLine()
1263 gdImageSetPixel (im, w, y, color); in gdImageLine()
1277 inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t) in gdImageSetAAPixelColor() argument
1284 p = gdImageGetPixel(im,x,y); in gdImageSetAAPixelColor()
1292 im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); in gdImageSetAAPixelColor()
1298 void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) in gdImageAALine() argument
1305 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { in gdImageAALine()
1330 gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); in gdImageAALine()
1331 if (y + 1 < im->sy) { in gdImageAALine()
1332 gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF); in gdImageAALine()
1358 gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); in gdImageAALine()
1359 if (x + 1 < im->sx) { in gdImageAALine()
1360 gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF); in gdImageAALine()
1374 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i…
1376 void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageDashedLine() argument
1383 int thick = im->thick; in gdImageDashedLine()
1414 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1424 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1435 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1463 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1473 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1484 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1490 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i… in dashedSet() argument
1505 gdImageSetPixel(im, x, w, color); in dashedSet()
1510 gdImageSetPixel(im, w, y, color); in dashedSet()
1518 void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageChar() argument
1535 gdImageSetPixel(im, px, py, color); in gdImageChar()
1544 void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageCharUp() argument
1561 gdImageSetPixel(im, px, py, color); in gdImageCharUp()
1570 void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageString() argument
1576 gdImageChar(im, f, x, y, s[i], color); in gdImageString()
1581 void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageStringUp() argument
1587 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp()
1594 void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageString16() argument
1600 gdImageChar(im, f, x, y, s[i], color); in gdImageString16()
1605 void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageStringUp16() argument
1611 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp16()
1642 void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) in gdImageArc() argument
1644 gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill); in gdImageArc()
1647 void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int st… in gdImageFilledArc() argument
1685 gdImageLine(im, lx, ly, x, y, color); in gdImageFilledArc()
1716 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1717 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1719 gdImageLine(im, fx, fy, lx, ly, color); in gdImageFilledArc()
1727 gdImageFilledPolygon(im, pts, 3, color); in gdImageFilledArc()
1732 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1733 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1738 gdImageFilledPolygon(im, pts, pti+1, color); in gdImageFilledArc()
1743 void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) in gdImageFillToBorder() argument
1755 if (!im->trueColor) { in gdImageFillToBorder()
1756 if ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) { in gdImageFillToBorder()
1761 restoreAlphaBlending = im->alphaBlendingFlag; in gdImageFillToBorder()
1762 im->alphaBlendingFlag = 0; in gdImageFillToBorder()
1764 if (x >= im->sx) { in gdImageFillToBorder()
1765 x = im->sx - 1; in gdImageFillToBorder()
1769 if (y >= im->sy) { in gdImageFillToBorder()
1770 y = im->sy - 1; in gdImageFillToBorder()
1776 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1779 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1783 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1788 for (i = (x + 1); i < im->sx; i++) { in gdImageFillToBorder()
1789 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1792 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1800 int c = gdImageGetPixel(im, i, y - 1); in gdImageFillToBorder()
1803 gdImageFillToBorder(im, i, y - 1, border, color); in gdImageFillToBorder()
1813 if (y < ((im->sy) - 1)) { in gdImageFillToBorder()
1816 int c = gdImageGetPixel(im, i, y + 1); in gdImageFillToBorder()
1820 gdImageFillToBorder(im, i, y + 1, border, color); in gdImageFillToBorder()
1828 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1845 #define FILL_MAX ((int)(im->sy*im->sx)/4)
1853 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
1855 void gdImageFill(gdImagePtr im, int x, int y, int nc) in gdImageFill() argument
1868 if (!im->trueColor && nc > (im->colorsTotal -1)) { in gdImageFill()
1872 alphablending_bak = im->alphaBlendingFlag; in gdImageFill()
1873 im->alphaBlendingFlag = 0; in gdImageFill()
1876 _gdImageFillTiled(im,x,y,nc); in gdImageFill()
1877 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1881 wx2=im->sx;wy2=im->sy; in gdImageFill()
1882 oc = gdImageGetPixel(im, x, y); in gdImageFill()
1884 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1891 if (im->sx < 4) { in gdImageFill()
1895 c = gdImageGetPixel(im, ix, iy); in gdImageFill()
1899 gdImageSetPixel(im, ix, iy, nc); in gdImageFill()
1900 } while(ix++ < (im->sx -1)); in gdImageFill()
1902 } while(iy++ < (im->sy -1)); in gdImageFill()
1906 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in gdImageFill()
1916 for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) { in gdImageFill()
1917 gdImageSetPixel(im,x, y, nc); in gdImageFill()
1930 for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) { in gdImageFill()
1931 gdImageSetPixel(im, x, y, nc); in gdImageFill()
1938 skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); in gdImageFill()
1947 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1950 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) in _gdImageFillTiled() argument
1960 if (!im->tile) { in _gdImageFillTiled()
1964 wx2=im->sx;wy2=im->sy; in _gdImageFillTiled()
1966 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1968 pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); in _gdImageFillTiled()
1969 for (i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
1970 pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); in _gdImageFillTiled()
1973 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in _gdImageFillTiled()
1976 oc = gdImageGetPixel(im, x, y); in _gdImageFillTiled()
1984 for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { in _gdImageFillTiled()
1985 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
1987 gdImageSetPixel(im,x, y, nc); in _gdImageFillTiled()
2000 for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) { in _gdImageFillTiled()
2001 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2003 gdImageSetPixel(im, x, y, nc); in _gdImageFillTiled()
2010 skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); in _gdImageFillTiled()
2015 for(i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2025 void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageRectangle() argument
2028 int thick = im->thick; in gdImageRectangle()
2032 gdImageSetPixel(im, x1, y1, color); in gdImageRectangle()
2063 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2071 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2079 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2087 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2094 gdImageLine(im, x1, y1, x2, y2, color); in gdImageRectangle()
2098 gdImageLine(im, x1h, y1h, x2h, y1h, color); in gdImageRectangle()
2099 gdImageLine(im, x1h, y2h, x2h, y2h, color); in gdImageRectangle()
2100 gdImageLine(im, x1v, y1v, x1v, y2v, color); in gdImageRectangle()
2101 gdImageLine(im, x2v, y1v, x2v, y2v, color); in gdImageRectangle()
2106 static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledHRectangle() argument
2111 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledHRectangle()
2131 if (x2 >= gdImageSX(im)) { in _gdImageFilledHRectangle()
2132 x2 = gdImageSX(im) - 1; in _gdImageFilledHRectangle()
2139 if (y2 >= gdImageSY(im)) { in _gdImageFilledHRectangle()
2140 y2 = gdImageSY(im) - 1; in _gdImageFilledHRectangle()
2145 gdImageSetPixel (im, x, y, color); in _gdImageFilledHRectangle()
2150 static void _gdImageFilledVRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledVRectangle() argument
2155 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledVRectangle()
2175 if (x2 >= gdImageSX(im)) { in _gdImageFilledVRectangle()
2176 x2 = gdImageSX(im) - 1; in _gdImageFilledVRectangle()
2183 if (y2 >= gdImageSY(im)) { in _gdImageFilledVRectangle()
2184 y2 = gdImageSY(im) - 1; in _gdImageFilledVRectangle()
2189 gdImageSetPixel (im, x, y, color); in _gdImageFilledVRectangle()
2194 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageFilledRectangle() argument
2196 _gdImageFilledVRectangle(im, x1, y1, x2, y2, color); in gdImageFilledRectangle()
2586 void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImagePolygon() argument
2590 typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color); in gdImagePolygon()
2601 im->AA_polygon = 1; in gdImagePolygon()
2604 if ( im->antialias) { in gdImagePolygon()
2611 draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c); in gdImagePolygon()
2614 draw_line(im, lx, ly, p->x, p->y, c); in gdImagePolygon()
2620 im->AA_polygon = 0; in gdImagePolygon()
2621 gdImageAABlend(im); in gdImagePolygon()
2635 void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageFilledPolygon() argument
2655 fill_color = im->AA_color; in gdImageFilledPolygon()
2660 if (!im->polyAllocated) { in gdImageFilledPolygon()
2661 im->polyInts = (int *) gdMalloc(sizeof(int) * n); in gdImageFilledPolygon()
2662 im->polyAllocated = n; in gdImageFilledPolygon()
2664 if (im->polyAllocated < n) { in gdImageFilledPolygon()
2665 while (im->polyAllocated < n) { in gdImageFilledPolygon()
2666 im->polyAllocated *= 2; in gdImageFilledPolygon()
2668 if (overflow2(sizeof(int), im->polyAllocated)) { in gdImageFilledPolygon()
2671 im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); in gdImageFilledPolygon()
2693 gdImageLine(im, x1, miny, x2, miny, c); in gdImageFilledPolygon()
2701 if (maxy >= gdImageSY(im)) { in gdImageFilledPolygon()
2702 maxy = gdImageSY(im) - 1; in gdImageFilledPolygon()
2737 im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; in gdImageFilledPolygon()
2739 im->polyInts[ints++] = x2; in gdImageFilledPolygon()
2742 qsort(im->polyInts, ints, sizeof(int), gdCompareInt); in gdImageFilledPolygon()
2745 gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); in gdImageFilledPolygon()
2751 gdImagePolygon(im, p, n, c); in gdImageFilledPolygon()
2760 void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels) in gdImageSetStyle() argument
2762 if (im->style) { in gdImageSetStyle()
2763 gdFree(im->style); in gdImageSetStyle()
2765 im->style = (int *) gdMalloc(sizeof(int) * noOfPixels); in gdImageSetStyle()
2766 memcpy(im->style, style, sizeof(int) * noOfPixels); in gdImageSetStyle()
2767 im->styleLength = noOfPixels; in gdImageSetStyle()
2768 im->stylePos = 0; in gdImageSetStyle()
2771 void gdImageSetThickness (gdImagePtr im, int thickness) in gdImageSetThickness() argument
2773 im->thick = thickness; in gdImageSetThickness()
2776 void gdImageSetBrush (gdImagePtr im, gdImagePtr brush) in gdImageSetBrush() argument
2779 im->brush = brush; in gdImageSetBrush()
2780 if (!im->trueColor && !im->brush->trueColor) { in gdImageSetBrush()
2783 …index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(bru… in gdImageSetBrush()
2784 im->brushColorMap[i] = index; in gdImageSetBrush()
2789 void gdImageSetTile (gdImagePtr im, gdImagePtr tile) in gdImageSetTile() argument
2792 im->tile = tile; in gdImageSetTile()
2793 if (!im->trueColor && !im->tile->trueColor) { in gdImageSetTile()
2796 …index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile,… in gdImageSetTile()
2797 im->tileColorMap[i] = index; in gdImageSetTile()
2802 void gdImageSetAntiAliased (gdImagePtr im, int c) in gdImageSetAntiAliased() argument
2804 im->AA = 1; in gdImageSetAntiAliased()
2805 im->AA_color = c; in gdImageSetAntiAliased()
2806 im->AA_dont_blend = -1; in gdImageSetAntiAliased()
2809 void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend) in gdImageSetAntiAliasedDontBlend() argument
2811 im->AA = 1; in gdImageSetAntiAliasedDontBlend()
2812 im->AA_color = c; in gdImageSetAntiAliasedDontBlend()
2813 im->AA_dont_blend = dont_blend; in gdImageSetAntiAliasedDontBlend()
2817 void gdImageInterlace (gdImagePtr im, int interlaceArg) in gdImageInterlace() argument
2819 im->interlace = interlaceArg; in gdImageInterlace()
2962 void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) in gdImageAlphaBlending() argument
2964 im->alphaBlendingFlag = alphaBlendingArg; in gdImageAlphaBlending()
2967 void gdImageAntialias (gdImagePtr im, int antialias) in gdImageAntialias() argument
2969 if (im->trueColor){ in gdImageAntialias()
2970 im->antialias = antialias; in gdImageAntialias()
2974 void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) in gdImageSaveAlpha() argument
2976 im->saveAlphaFlag = saveAlphaArg; in gdImageSaveAlpha()
3012 void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) in gdImageSetClip() argument
3017 if (x1 >= im->sx) { in gdImageSetClip()
3018 x1 = im->sx - 1; in gdImageSetClip()
3023 if (x2 >= im->sx) { in gdImageSetClip()
3024 x2 = im->sx - 1; in gdImageSetClip()
3029 if (y1 >= im->sy) { in gdImageSetClip()
3030 y1 = im->sy - 1; in gdImageSetClip()
3035 if (y2 >= im->sy) { in gdImageSetClip()
3036 y2 = im->sy - 1; in gdImageSetClip()
3038 im->cx1 = x1; in gdImageSetClip()
3039 im->cy1 = y1; in gdImageSetClip()
3040 im->cx2 = x2; in gdImageSetClip()
3041 im->cy2 = y2; in gdImageSetClip()
3044 void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) in gdImageGetClip() argument
3046 *x1P = im->cx1; in gdImageGetClip()
3047 *y1P = im->cy1; in gdImageGetClip()
3048 *x2P = im->cx2; in gdImageGetClip()
3049 *y2P = im->cy2; in gdImageGetClip()