Lines Matching refs:im

136 static void gdImageBrushApply(gdImagePtr im, int x, int y);
137 static void gdImageTileApply(gdImagePtr im, int x, int y);
139 int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y);
144 gdImagePtr im; in gdImageCreate() local
156 im = (gdImage *) gdCalloc(1, sizeof(gdImage)); in gdImageCreate()
159 im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); in gdImageCreate()
160 im->polyInts = 0; in gdImageCreate()
161 im->polyAllocated = 0; in gdImageCreate()
162 im->brush = 0; in gdImageCreate()
163 im->tile = 0; in gdImageCreate()
164 im->style = 0; in gdImageCreate()
167 im->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char)); in gdImageCreate()
169 im->sx = sx; in gdImageCreate()
170 im->sy = sy; in gdImageCreate()
171 im->colorsTotal = 0; in gdImageCreate()
172 im->transparent = (-1); in gdImageCreate()
173 im->interlace = 0; in gdImageCreate()
174 im->thick = 1; in gdImageCreate()
175 im->AA = 0; in gdImageCreate()
177 im->open[i] = 1; in gdImageCreate()
178 im->red[i] = 0; in gdImageCreate()
179 im->green[i] = 0; in gdImageCreate()
180 im->blue[i] = 0; in gdImageCreate()
182 im->trueColor = 0; in gdImageCreate()
183 im->tpixels = 0; in gdImageCreate()
184 im->cx1 = 0; in gdImageCreate()
185 im->cy1 = 0; in gdImageCreate()
186 im->cx2 = im->sx - 1; in gdImageCreate()
187 im->cy2 = im->sy - 1; in gdImageCreate()
188 im->res_x = GD_RESOLUTION; in gdImageCreate()
189 im->res_y = GD_RESOLUTION; in gdImageCreate()
190 im->interpolation = NULL; in gdImageCreate()
191 im->interpolation_id = GD_BILINEAR_FIXED; in gdImageCreate()
192 return im; in gdImageCreate()
198 gdImagePtr im; in gdImageCreateTrueColor() local
210 im = (gdImage *) gdMalloc(sizeof(gdImage)); in gdImageCreateTrueColor()
211 memset(im, 0, sizeof(gdImage)); in gdImageCreateTrueColor()
212 im->tpixels = (int **) gdMalloc(sizeof(int *) * sy); in gdImageCreateTrueColor()
213 im->polyInts = 0; in gdImageCreateTrueColor()
214 im->polyAllocated = 0; in gdImageCreateTrueColor()
215 im->brush = 0; in gdImageCreateTrueColor()
216 im->tile = 0; in gdImageCreateTrueColor()
217 im->style = 0; in gdImageCreateTrueColor()
219 im->tpixels[i] = (int *) gdCalloc(sx, sizeof(int)); in gdImageCreateTrueColor()
221 im->sx = sx; in gdImageCreateTrueColor()
222 im->sy = sy; in gdImageCreateTrueColor()
223 im->transparent = (-1); in gdImageCreateTrueColor()
224 im->interlace = 0; in gdImageCreateTrueColor()
225 im->trueColor = 1; in gdImageCreateTrueColor()
232 im->saveAlphaFlag = 0; in gdImageCreateTrueColor()
233 im->alphaBlendingFlag = 1; in gdImageCreateTrueColor()
234 im->thick = 1; in gdImageCreateTrueColor()
235 im->AA = 0; in gdImageCreateTrueColor()
236 im->cx1 = 0; in gdImageCreateTrueColor()
237 im->cy1 = 0; in gdImageCreateTrueColor()
238 im->cx2 = im->sx - 1; in gdImageCreateTrueColor()
239 im->cy2 = im->sy - 1; in gdImageCreateTrueColor()
240 im->res_x = GD_RESOLUTION; in gdImageCreateTrueColor()
241 im->res_y = GD_RESOLUTION; in gdImageCreateTrueColor()
242 im->interpolation = NULL; in gdImageCreateTrueColor()
243 im->interpolation_id = GD_BILINEAR_FIXED; in gdImageCreateTrueColor()
244 return im; in gdImageCreateTrueColor()
247 void gdImageDestroy (gdImagePtr im) in gdImageDestroy() argument
250 if (im->pixels) { in gdImageDestroy()
251 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
252 gdFree(im->pixels[i]); in gdImageDestroy()
254 gdFree(im->pixels); in gdImageDestroy()
256 if (im->tpixels) { in gdImageDestroy()
257 for (i = 0; i < im->sy; i++) { in gdImageDestroy()
258 gdFree(im->tpixels[i]); in gdImageDestroy()
260 gdFree(im->tpixels); in gdImageDestroy()
262 if (im->polyInts) { in gdImageDestroy()
263 gdFree(im->polyInts); in gdImageDestroy()
265 if (im->style) { in gdImageDestroy()
266 gdFree(im->style); in gdImageDestroy()
268 gdFree(im); in gdImageDestroy()
271 int gdImageColorClosest (gdImagePtr im, int r, int g, int b) in gdImageColorClosest() argument
273 return gdImageColorClosestAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorClosest()
276 int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorClosestAlpha() argument
284 if (im->trueColor) { in gdImageColorClosestAlpha()
287 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestAlpha()
289 if (im->open[i]) { in gdImageColorClosestAlpha()
292 rd = im->red[i] - r; in gdImageColorClosestAlpha()
293 gd = im->green[i] - g; in gdImageColorClosestAlpha()
294 bd = im->blue[i] - b; in gdImageColorClosestAlpha()
296 ad = im->alpha[i] - a; in gdImageColorClosestAlpha()
442 int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) in gdImageColorClosestHWB() argument
449 if (im->trueColor) { in gdImageColorClosestHWB()
452 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorClosestHWB()
454 if (im->open[i]) { in gdImageColorClosestHWB()
457 dist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b); in gdImageColorClosestHWB()
467 int gdImageColorExact (gdImagePtr im, int r, int g, int b) in gdImageColorExact() argument
469 return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorExact()
472 int gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorExactAlpha() argument
475 if (im->trueColor) { in gdImageColorExactAlpha()
478 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorExactAlpha()
479 if (im->open[i]) { in gdImageColorExactAlpha()
482 if ((im->red[i] == r) && (im->green[i] == g) && (im->blue[i] == b) && (im->alpha[i] == a)) { in gdImageColorExactAlpha()
489 int gdImageColorAllocate (gdImagePtr im, int r, int g, int b) in gdImageColorAllocate() argument
491 return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque); in gdImageColorAllocate()
494 int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorAllocateAlpha() argument
498 if (im->trueColor) { in gdImageColorAllocateAlpha()
501 for (i = 0; i < im->colorsTotal; i++) { in gdImageColorAllocateAlpha()
502 if (im->open[i]) { in gdImageColorAllocateAlpha()
508 ct = im->colorsTotal; in gdImageColorAllocateAlpha()
512 im->colorsTotal++; in gdImageColorAllocateAlpha()
514 im->red[ct] = r; in gdImageColorAllocateAlpha()
515 im->green[ct] = g; in gdImageColorAllocateAlpha()
516 im->blue[ct] = b; in gdImageColorAllocateAlpha()
517 im->alpha[ct] = a; in gdImageColorAllocateAlpha()
518 im->open[ct] = 0; in gdImageColorAllocateAlpha()
534 int gdImageColorResolve (gdImagePtr im, int r, int g, int b) in gdImageColorResolve() argument
536 return gdImageColorResolveAlpha(im, r, g, b, gdAlphaOpaque); in gdImageColorResolve()
539 int gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a) in gdImageColorResolveAlpha() argument
546 if (im->trueColor) in gdImageColorResolveAlpha()
551 for (c = 0; c < im->colorsTotal; c++) in gdImageColorResolveAlpha()
553 if (im->open[c]) in gdImageColorResolveAlpha()
558 if (c == im->transparent) in gdImageColorResolveAlpha()
564 rd = (long) (im->red[c] - r); in gdImageColorResolveAlpha()
565 gd = (long) (im->green[c] - g); in gdImageColorResolveAlpha()
566 bd = (long) (im->blue[c] - b); in gdImageColorResolveAlpha()
567 ad = (long) (im->alpha[c] - a); in gdImageColorResolveAlpha()
582 op = im->colorsTotal; in gdImageColorResolveAlpha()
587 im->colorsTotal++; in gdImageColorResolveAlpha()
589 im->red[op] = r; in gdImageColorResolveAlpha()
590 im->green[op] = g; in gdImageColorResolveAlpha()
591 im->blue[op] = b; in gdImageColorResolveAlpha()
592 im->alpha[op] = a; in gdImageColorResolveAlpha()
593 im->open[op] = 0; in gdImageColorResolveAlpha()
597 void gdImageColorDeallocate (gdImagePtr im, int color) in gdImageColorDeallocate() argument
599 if (im->trueColor) { in gdImageColorDeallocate()
603 im->open[color] = 1; in gdImageColorDeallocate()
606 void gdImageColorTransparent (gdImagePtr im, int color) in gdImageColorTransparent() argument
611 if (!im->trueColor) { in gdImageColorTransparent()
612 if((color >= im->colorsTotal)) { in gdImageColorTransparent()
616 if (im->transparent != -1) { in gdImageColorTransparent()
617 im->alpha[im->transparent] = gdAlphaOpaque; in gdImageColorTransparent()
619 im->alpha[color] = gdAlphaTransparent; in gdImageColorTransparent()
621 im->transparent = color; in gdImageColorTransparent()
733 void gdImageSetPixel (gdImagePtr im, int x, int y, int color) in gdImageSetPixel() argument
738 if (!im->style) { in gdImageSetPixel()
742 p = im->style[im->stylePos++]; in gdImageSetPixel()
745 gdImageSetPixel(im, x, y, p); in gdImageSetPixel()
747 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
750 if (!im->style) { in gdImageSetPixel()
754 p = im->style[im->stylePos++]; in gdImageSetPixel()
756 gdImageSetPixel(im, x, y, gdBrushed); in gdImageSetPixel()
758 im->stylePos = im->stylePos % im->styleLength; in gdImageSetPixel()
761 gdImageBrushApply(im, x, y); in gdImageSetPixel()
764 gdImageTileApply(im, x, y); in gdImageSetPixel()
769 gdImageSetPixel(im, x, y, im->AA_color); in gdImageSetPixel()
772 if (gdImageBoundsSafe(im, x, y)) { in gdImageSetPixel()
773 if (im->trueColor) { in gdImageSetPixel()
774 switch (im->alphaBlendingFlag) { in gdImageSetPixel()
777 im->tpixels[y][x] = color; in gdImageSetPixel()
781 im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color); in gdImageSetPixel()
784 im->tpixels[y][x] = gdLayerOverlay(im->tpixels[y][x], color); in gdImageSetPixel()
787 im->tpixels[y][x] = gdLayerMultiply(im->tpixels[y][x], color); in gdImageSetPixel()
791 im->pixels[y][x] = color; in gdImageSetPixel()
798 int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) in gdImageGetTrueColorPixel() argument
800 int p = gdImageGetPixel(im, x, y); in gdImageGetTrueColorPixel()
802 if (!im->trueColor) { in gdImageGetTrueColorPixel()
803 …return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTra… in gdImageGetTrueColorPixel()
809 static void gdImageBrushApply (gdImagePtr im, int x, int y) in gdImageBrushApply() argument
816 if (!im->brush) { in gdImageBrushApply()
820 hy = gdImageSY(im->brush) / 2; in gdImageBrushApply()
822 y2 = y1 + gdImageSY(im->brush); in gdImageBrushApply()
823 hx = gdImageSX(im->brush) / 2; in gdImageBrushApply()
825 x2 = x1 + gdImageSX(im->brush); in gdImageBrushApply()
828 if (im->trueColor) { in gdImageBrushApply()
829 if (im->brush->trueColor) { in gdImageBrushApply()
834 p = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
836 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
837 gdImageSetPixel(im, lx, ly, p); in gdImageBrushApply()
849 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
850 tc = gdImageGetTrueColorPixel(im->brush, srcx, srcy); in gdImageBrushApply()
852 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
853 gdImageSetPixel(im, lx, ly, tc); in gdImageBrushApply()
865 p = gdImageGetPixel(im->brush, srcx, srcy); in gdImageBrushApply()
867 if (p != gdImageGetTransparent(im->brush)) { in gdImageBrushApply()
869 if (im->brush->trueColor) { in gdImageBrushApply()
870 gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), in gdImageBrushApply()
875 gdImageSetPixel(im, lx, ly, im->brushColorMap[p]); in gdImageBrushApply()
885 static void gdImageTileApply (gdImagePtr im, int x, int y) in gdImageTileApply() argument
887 gdImagePtr tile = im->tile; in gdImageTileApply()
895 if (im->trueColor) { in gdImageTileApply()
901 gdImageSetPixel(im, x, y, p); in gdImageTileApply()
909 gdImageSetPixel(im, x, y, gdImageColorResolveAlpha(im, in gdImageTileApply()
915 gdImageSetPixel(im, x, y, im->tileColorMap[p]); in gdImageTileApply()
922 static int gdImageTileGet (gdImagePtr im, int x, int y) in gdImageTileGet() argument
926 if (!im->tile) { in gdImageTileGet()
929 srcx = x % gdImageSX(im->tile); in gdImageTileGet()
930 srcy = y % gdImageSY(im->tile); in gdImageTileGet()
931 p = gdImageGetPixel(im->tile, srcx, srcy); in gdImageTileGet()
933 if (im->trueColor) { in gdImageTileGet()
934 if (im->tile->trueColor) { in gdImageTileGet()
937 …olor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p… in gdImageTileGet()
940 if (im->tile->trueColor) { in gdImageTileGet()
941 …tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueCol… in gdImageTileGet()
944 …= gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im in gdImageTileGet()
951 int gdImageGetPixel (gdImagePtr im, int x, int y) in gdImageGetPixel() argument
953 if (gdImageBoundsSafe(im, x, y)) { in gdImageGetPixel()
954 if (im->trueColor) { in gdImageGetPixel()
955 return im->tpixels[y][x]; in gdImageGetPixel()
957 return im->pixels[y][x]; in gdImageGetPixel()
964 void gdImageAABlend (gdImagePtr im) in gdImageAABlend() argument
966 (void)im; in gdImageAABlend()
969 static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
1055 static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col) in gdImageHLine() argument
1057 if (im->thick > 1) { in gdImageHLine()
1058 int thickhalf = im->thick >> 1; in gdImageHLine()
1059 _gdImageFilledHRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col); in gdImageHLine()
1068 gdImageSetPixel(im, x1, y, col); in gdImageHLine()
1074 static void gdImageVLine(gdImagePtr im, int x, int y1, int y2, int col) in gdImageVLine() argument
1076 if (im->thick > 1) { in gdImageVLine()
1077 int thickhalf = im->thick >> 1; in gdImageVLine()
1078 gdImageFilledRectangle(im, x - thickhalf, y1, x + im->thick - thickhalf - 1, y2, col); in gdImageVLine()
1087 gdImageSetPixel(im, x, y1, col); in gdImageVLine()
1094 void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageLine() argument
1099 int thick = im->thick; in gdImageLine()
1107 gdImageAALine(im, x1, y1, x2, y2, im->AA_color); in gdImageLine()
1112 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { in gdImageLine()
1120 gdImageVLine(im, x1, y1, y2, color); in gdImageLine()
1123 gdImageHLine(im, y1, x1, x2, color); in gdImageLine()
1163 gdImageSetPixel(im, x, w, color); in gdImageLine()
1177 gdImageSetPixel (im, x, w, color); in gdImageLine()
1191 gdImageSetPixel (im, x, w, color); in gdImageLine()
1227 gdImageSetPixel (im, w, y, color); in gdImageLine()
1241 gdImageSetPixel (im, w, y, color); in gdImageLine()
1255 gdImageSetPixel (im, w, y, color); in gdImageLine()
1269 inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t) in gdImageSetAAPixelColor() argument
1276 p = gdImageGetPixel(im,x,y); in gdImageSetAAPixelColor()
1284 im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); in gdImageSetAAPixelColor()
1290 void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) in gdImageAALine() argument
1296 if (!im->trueColor) { in gdImageAALine()
1298 gdImageLine(im, x1, y1, x2, y2, col); in gdImageAALine()
1303 if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { in gdImageAALine()
1328 gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); in gdImageAALine()
1329 if (y + 1 < im->sy) { in gdImageAALine()
1330 gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF); in gdImageAALine()
1356 gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); in gdImageAALine()
1357 if (x + 1 < im->sx) { in gdImageAALine()
1358 gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF); in gdImageAALine()
1372 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i…
1374 void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageDashedLine() argument
1381 int thick = im->thick; in gdImageDashedLine()
1411 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1421 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1432 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1460 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1470 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1481 dashedSet(im, x, y, color, &on, &dashStep, wid, vert); in gdImageDashedLine()
1487 static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, i… in dashedSet() argument
1502 gdImageSetPixel(im, x, w, color); in dashedSet()
1507 gdImageSetPixel(im, w, y, color); in dashedSet()
1515 void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageChar() argument
1534 gdImageSetPixel(im, px, py, color); in gdImageChar()
1543 void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) in gdImageCharUp() argument
1562 gdImageSetPixel(im, px, py, color); in gdImageCharUp()
1571 void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageString() argument
1577 gdImageChar(im, f, x, y, s[i], color); in gdImageString()
1582 void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) in gdImageStringUp() argument
1588 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp()
1595 void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageString16() argument
1601 gdImageChar(im, f, x, y, s[i], color); in gdImageString16()
1606 void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) in gdImageStringUp16() argument
1612 gdImageCharUp(im, f, x, y, s[i], color); in gdImageStringUp16()
1643 void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) in gdImageArc() argument
1645 gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill); in gdImageArc()
1648 void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int st… in gdImageFilledArc() argument
1686 gdImageLine(im, lx, ly, x, y, color); in gdImageFilledArc()
1717 gdImageLine(im, cx, cy, lx, ly, color); in gdImageFilledArc()
1718 gdImageLine(im, cx, cy, fx, fy, color); in gdImageFilledArc()
1720 gdImageLine(im, fx, fy, lx, ly, color); in gdImageFilledArc()
1728 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()
1757 gdImageFilledPolygon(im, pts, pti+1, color); in gdImageFilledArc()
1769 void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c) in gdImageEllipse() argument
1776 gdImageSetPixel(im,mx+a, my, c); in gdImageEllipse()
1777 gdImageSetPixel(im,mx-a, my, c); in gdImageEllipse()
1801 gdImageSetPixel(im,mx1, my1, c); in gdImageEllipse()
1802 gdImageSetPixel(im,mx1, my2, c); in gdImageEllipse()
1803 gdImageSetPixel(im,mx2, my1, c); in gdImageEllipse()
1804 gdImageSetPixel(im,mx2, my2, c); in gdImageEllipse()
1808 void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) in gdImageFilledEllipse() argument
1819 gdImageSetPixel(im, x, my, c); in gdImageFilledEllipse()
1848 gdImageSetPixel(im,i,my1,c); in gdImageFilledEllipse()
1849 gdImageSetPixel(im,i,my2,c); in gdImageFilledEllipse()
1856 void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) in gdImageFillToBorder() argument
1868 if (!im->trueColor) { in gdImageFillToBorder()
1869 if ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) { in gdImageFillToBorder()
1874 restoreAlphaBlending = im->alphaBlendingFlag; in gdImageFillToBorder()
1875 im->alphaBlendingFlag = 0; in gdImageFillToBorder()
1877 if (x >= im->sx) { in gdImageFillToBorder()
1878 x = im->sx - 1; in gdImageFillToBorder()
1882 if (y >= im->sy) { in gdImageFillToBorder()
1883 y = im->sy - 1; in gdImageFillToBorder()
1889 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1892 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1896 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1901 for (i = (x + 1); i < im->sx; i++) { in gdImageFillToBorder()
1902 if (gdImageGetPixel(im, i, y) == border) { in gdImageFillToBorder()
1905 gdImageSetPixel(im, i, y, color); in gdImageFillToBorder()
1913 int c = gdImageGetPixel(im, i, y - 1); in gdImageFillToBorder()
1916 gdImageFillToBorder(im, i, y - 1, border, color); in gdImageFillToBorder()
1926 if (y < ((im->sy) - 1)) { in gdImageFillToBorder()
1929 int c = gdImageGetPixel(im, i, y + 1); in gdImageFillToBorder()
1933 gdImageFillToBorder(im, i, y + 1, border, color); in gdImageFillToBorder()
1941 im->alphaBlendingFlag = restoreAlphaBlending; in gdImageFillToBorder()
1958 #define FILL_MAX ((int)(im->sy*im->sx)/4)
1966 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
1968 void gdImageFill(gdImagePtr im, int x, int y, int nc) in gdImageFill() argument
1981 if (!im->trueColor && nc > (im->colorsTotal -1)) { in gdImageFill()
1985 alphablending_bak = im->alphaBlendingFlag; in gdImageFill()
1986 im->alphaBlendingFlag = 0; in gdImageFill()
1989 _gdImageFillTiled(im,x,y,nc); in gdImageFill()
1990 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
1994 wx2=im->sx;wy2=im->sy; in gdImageFill()
1995 oc = gdImageGetPixel(im, x, y); in gdImageFill()
1997 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
2004 if (im->sx < 4) { in gdImageFill()
2008 c = gdImageGetPixel(im, ix, iy); in gdImageFill()
2012 gdImageSetPixel(im, ix, iy, nc); in gdImageFill()
2013 } while(ix++ < (im->sx -1)); in gdImageFill()
2015 } while(iy++ < (im->sy -1)); in gdImageFill()
2019 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in gdImageFill()
2029 for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) { in gdImageFill()
2030 gdImageSetPixel(im,x, y, nc); in gdImageFill()
2043 for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) { in gdImageFill()
2044 gdImageSetPixel(im, x, y, nc); in gdImageFill()
2052 for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++); in gdImageFill()
2061 im->alphaBlendingFlag = alphablending_bak; in gdImageFill()
2064 static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) in _gdImageFillTiled() argument
2074 if (!im->tile) { in _gdImageFillTiled()
2078 wx2=im->sx;wy2=im->sy; in _gdImageFillTiled()
2080 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2082 pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); in _gdImageFillTiled()
2083 for (i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2084 pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); in _gdImageFillTiled()
2087 stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); in _gdImageFillTiled()
2090 oc = gdImageGetPixel(im, x, y); in _gdImageFillTiled()
2098 for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { in _gdImageFillTiled()
2099 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2101 gdImageSetPixel(im,x, y, nc); in _gdImageFillTiled()
2114 for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) { in _gdImageFillTiled()
2115 nc = gdImageTileGet(im,x,y); in _gdImageFillTiled()
2117 gdImageSetPixel(im, x, y, nc); in _gdImageFillTiled()
2125 for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); in _gdImageFillTiled()
2130 for(i = 0; i < im->sy + 1; i++) { in _gdImageFillTiled()
2140 void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageRectangle() argument
2142 int thick = im->thick; in gdImageRectangle()
2146 gdImageSetPixel(im, x1, y1, color); in gdImageRectangle()
2176 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2184 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2192 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2200 gdImageSetPixel(im, cx, cy, color); in gdImageRectangle()
2207 gdImageLine(im, x1, y1, x2, y2, color); in gdImageRectangle()
2209 gdImageLine(im, x1, y1, x2, y1, color); in gdImageRectangle()
2210 gdImageLine(im, x1, y2, x2, y2, color); in gdImageRectangle()
2211 gdImageLine(im, x1, y1 + 1, x1, y2 - 1, color); in gdImageRectangle()
2212 gdImageLine(im, x2, y1 + 1, x2, y2 - 1, color); in gdImageRectangle()
2217 static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledHRectangle() argument
2222 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledHRectangle()
2242 if (x2 >= gdImageSX(im)) { in _gdImageFilledHRectangle()
2243 x2 = gdImageSX(im) - 1; in _gdImageFilledHRectangle()
2250 if (y2 >= gdImageSY(im)) { in _gdImageFilledHRectangle()
2251 y2 = gdImageSY(im) - 1; in _gdImageFilledHRectangle()
2256 gdImageSetPixel (im, x, y, color); in _gdImageFilledHRectangle()
2261 static void _gdImageFilledVRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in _gdImageFilledVRectangle() argument
2266 gdImageSetPixel(im, x1, y1, color); in _gdImageFilledVRectangle()
2286 if (x2 >= gdImageSX(im)) { in _gdImageFilledVRectangle()
2287 x2 = gdImageSX(im) - 1; in _gdImageFilledVRectangle()
2294 if (y2 >= gdImageSY(im)) { in _gdImageFilledVRectangle()
2295 y2 = gdImageSY(im) - 1; in _gdImageFilledVRectangle()
2300 gdImageSetPixel (im, x, y, color); in _gdImageFilledVRectangle()
2305 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) in gdImageFilledRectangle() argument
2307 _gdImageFilledVRectangle(im, x1, y1, x2, y2, color); in gdImageFilledRectangle()
2688 void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImagePolygon() argument
2695 gdImageLine (im, p->x, p->y, p[n - 1].x, p[n - 1].y, c); in gdImagePolygon()
2696 gdImageOpenPolygon (im, p, n, c); in gdImagePolygon()
2699 void gdImageOpenPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageOpenPolygon() argument
2712 gdImageLine(im, lx, ly, p->x, p->y, c); in gdImageOpenPolygon()
2728 void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) in gdImageFilledPolygon() argument
2748 fill_color = im->AA_color; in gdImageFilledPolygon()
2753 if (!im->polyAllocated) { in gdImageFilledPolygon()
2754 im->polyInts = (int *) gdMalloc(sizeof(int) * n); in gdImageFilledPolygon()
2755 im->polyAllocated = n; in gdImageFilledPolygon()
2757 if (im->polyAllocated < n) { in gdImageFilledPolygon()
2758 while (im->polyAllocated < n) { in gdImageFilledPolygon()
2759 im->polyAllocated *= 2; in gdImageFilledPolygon()
2761 if (overflow2(sizeof(int), im->polyAllocated)) { in gdImageFilledPolygon()
2764 im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); in gdImageFilledPolygon()
2786 gdImageLine(im, x1, miny, x2, miny, c); in gdImageFilledPolygon()
2794 if (maxy >= gdImageSY(im)) { in gdImageFilledPolygon()
2795 maxy = gdImageSY(im) - 1; in gdImageFilledPolygon()
2830 im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; in gdImageFilledPolygon()
2832 im->polyInts[ints++] = x2; in gdImageFilledPolygon()
2835 qsort(im->polyInts, ints, sizeof(int), gdCompareInt); in gdImageFilledPolygon()
2838 gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); in gdImageFilledPolygon()
2844 gdImagePolygon(im, p, n, c); in gdImageFilledPolygon()
2853 void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels) in gdImageSetStyle() argument
2855 if (im->style) { in gdImageSetStyle()
2856 gdFree(im->style); in gdImageSetStyle()
2861 im->style = (int *) gdMalloc(sizeof(int) * noOfPixels); in gdImageSetStyle()
2862 memcpy(im->style, style, sizeof(int) * noOfPixels); in gdImageSetStyle()
2863 im->styleLength = noOfPixels; in gdImageSetStyle()
2864 im->stylePos = 0; in gdImageSetStyle()
2867 void gdImageSetThickness (gdImagePtr im, int thickness) in gdImageSetThickness() argument
2869 im->thick = thickness; in gdImageSetThickness()
2872 void gdImageSetBrush (gdImagePtr im, gdImagePtr brush) in gdImageSetBrush() argument
2875 im->brush = brush; in gdImageSetBrush()
2876 if (!im->trueColor && !im->brush->trueColor) { in gdImageSetBrush()
2879 …index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(bru… in gdImageSetBrush()
2880 im->brushColorMap[i] = index; in gdImageSetBrush()
2885 void gdImageSetTile (gdImagePtr im, gdImagePtr tile) in gdImageSetTile() argument
2888 im->tile = tile; in gdImageSetTile()
2889 if (!im->trueColor && !im->tile->trueColor) { in gdImageSetTile()
2892 …index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile,… in gdImageSetTile()
2893 im->tileColorMap[i] = index; in gdImageSetTile()
2898 void gdImageSetAntiAliased (gdImagePtr im, int c) in gdImageSetAntiAliased() argument
2900 im->AA = 1; in gdImageSetAntiAliased()
2901 im->AA_color = c; in gdImageSetAntiAliased()
2902 im->AA_dont_blend = -1; in gdImageSetAntiAliased()
2905 void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend) in gdImageSetAntiAliasedDontBlend() argument
2907 im->AA = 1; in gdImageSetAntiAliasedDontBlend()
2908 im->AA_color = c; in gdImageSetAntiAliasedDontBlend()
2909 im->AA_dont_blend = dont_blend; in gdImageSetAntiAliasedDontBlend()
2913 void gdImageInterlace (gdImagePtr im, int interlaceArg) in gdImageInterlace() argument
2915 im->interlace = interlaceArg; in gdImageInterlace()
3035 void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) in gdImageAlphaBlending() argument
3037 im->alphaBlendingFlag = alphaBlendingArg; in gdImageAlphaBlending()
3040 void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) in gdImageSaveAlpha() argument
3042 im->saveAlphaFlag = saveAlphaArg; in gdImageSaveAlpha()
3100 void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) in gdImageSetClip() argument
3105 if (x1 >= im->sx) { in gdImageSetClip()
3106 x1 = im->sx - 1; in gdImageSetClip()
3111 if (x2 >= im->sx) { in gdImageSetClip()
3112 x2 = im->sx - 1; in gdImageSetClip()
3117 if (y1 >= im->sy) { in gdImageSetClip()
3118 y1 = im->sy - 1; in gdImageSetClip()
3123 if (y2 >= im->sy) { in gdImageSetClip()
3124 y2 = im->sy - 1; in gdImageSetClip()
3126 im->cx1 = x1; in gdImageSetClip()
3127 im->cy1 = y1; in gdImageSetClip()
3128 im->cx2 = x2; in gdImageSetClip()
3129 im->cy2 = y2; in gdImageSetClip()
3132 void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) in gdImageGetClip() argument
3134 *x1P = im->cx1; in gdImageGetClip()
3135 *y1P = im->cy1; in gdImageGetClip()
3136 *x2P = im->cx2; in gdImageGetClip()
3137 *y2P = im->cy2; in gdImageGetClip()
3140 void gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y) in gdImageSetResolution() argument
3142 if (res_x > 0) im->res_x = res_x; in gdImageSetResolution()
3143 if (res_y > 0) im->res_y = res_y; in gdImageSetResolution()