diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 44a90773ee12d..eb1d09b217392 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -795,17 +795,6 @@ void gdImageSetPixel (gdImagePtr im, int x, int y, int color) } } -int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) -{ - int p = gdImageGetPixel(im, x, y); - - if (!im->trueColor) { - return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTransparent : im->alpha[p]); - } else { - return p; - } -} - static void gdImageBrushApply (gdImagePtr im, int x, int y) { int lx, ly; @@ -919,35 +908,6 @@ static void gdImageTileApply (gdImagePtr im, int x, int y) } -static int gdImageTileGet (gdImagePtr im, int x, int y) -{ - int srcx, srcy; - int tileColor,p; - if (!im->tile) { - return -1; - } - srcx = x % gdImageSX(im->tile); - srcy = y % gdImageSY(im->tile); - p = gdImageGetPixel(im->tile, srcx, srcy); - - if (im->trueColor) { - if (im->tile->trueColor) { - tileColor = p; - } else { - tileColor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p)); - } - } else { - if (im->tile->trueColor) { - tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p)); - } else { - tileColor = p; - tileColor = gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p)); - } - } - return tileColor; -} - - int gdImageGetPixel (gdImagePtr im, int x, int y) { if (gdImageBoundsSafe(im, x, y)) { @@ -961,97 +921,24 @@ int gdImageGetPixel (gdImagePtr im, int x, int y) } } -void gdImageAABlend (gdImagePtr im) +int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) { - (void)im; -} - -static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color); - -gdImagePtr gdImageClone (gdImagePtr src) { - gdImagePtr dst; - register int i, x; - - if (src->trueColor) { - dst = gdImageCreateTrueColor(src->sx , src->sy); - } else { - dst = gdImageCreate(src->sx , src->sy); - } - - if (dst == NULL) { - return NULL; - } + int p = gdImageGetPixel(im, x, y); - if (src->trueColor == 0) { - dst->colorsTotal = src->colorsTotal; - for (i = 0; i < gdMaxColors; i++) { - dst->red[i] = src->red[i]; - dst->green[i] = src->green[i]; - dst->blue[i] = src->blue[i]; - dst->alpha[i] = src->alpha[i]; - dst->open[i] = src->open[i]; - } - for (i = 0; i < src->sy; i++) { - for (x = 0; x < src->sx; x++) { - dst->pixels[i][x] = src->pixels[i][x]; - } - } + if (!im->trueColor) { + return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTransparent : im->alpha[p]); } else { - for (i = 0; i < src->sy; i++) { - for (x = 0; x < src->sx; x++) { - dst->tpixels[i][x] = src->tpixels[i][x]; - } - } - } - - dst->interlace = src->interlace; - - dst->alphaBlendingFlag = src->alphaBlendingFlag; - dst->saveAlphaFlag = src->saveAlphaFlag; - dst->AA = src->AA; - dst->AA_color = src->AA_color; - dst->AA_dont_blend = src->AA_dont_blend; - - dst->cx1 = src->cx1; - dst->cy1 = src->cy1; - dst->cx2 = src->cx2; - dst->cy2 = src->cy2; - - dst->res_x = src->res_x; - dst->res_y = src->res_y; - - dst->interpolation_id = src->interpolation_id; - dst->interpolation = src->interpolation; - - if (src->brush) { - dst->brush = gdImageClone(src->brush); - } - - if (src->tile) { - dst->tile = gdImageClone(src->tile); - } - - if (src->style) { - gdImageSetStyle(dst, src->style, src->styleLength); - dst->stylePos = src->stylePos; - } - - for (i = 0; i < gdMaxColors; i++) { - dst->brushColorMap[i] = src->brushColorMap[i]; - dst->tileColorMap[i] = src->tileColorMap[i]; - } - - if (src->polyAllocated > 0 && overflow2(sizeof(int), src->polyAllocated) == 0) { - dst->polyInts = gdMalloc (sizeof (int) * src->polyAllocated); - dst->polyAllocated = src->polyAllocated; - for (i = 0; i < src->polyAllocated; i++) { - dst->polyInts[i] = src->polyInts[i]; - } + return p; } +} - return dst; +void gdImageAABlend (gdImagePtr im) +{ + (void)im; } +static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color); + static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col) { if (im->thick > 1) { @@ -1260,115 +1147,6 @@ TBB: but watch out for /0! */ } -/* - * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org) - * */ -#define BLEND_COLOR(a, nc, c, cc) \ -nc = (cc) + (((((c) - (cc)) * (a)) + ((((c) - (cc)) * (a)) >> 8) + 0x80) >> 8); - -inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t) -{ - int dr,dg,db,p,r,g,b; - dr = gdTrueColorGetRed(color); - dg = gdTrueColorGetGreen(color); - db = gdTrueColorGetBlue(color); - - p = gdImageGetPixel(im,x,y); - r = gdTrueColorGetRed(p); - g = gdTrueColorGetGreen(p); - b = gdTrueColorGetBlue(p); - - BLEND_COLOR(t, dr, r, dr); - BLEND_COLOR(t, dg, g, dg); - BLEND_COLOR(t, db, b, db); - im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); -} - -/* - * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org) - **/ -void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) -{ - /* keep them as 32bits */ - long x, y, inc, frac; - long dx, dy,tmp; - - if (!im->trueColor) { - /* TBB: don't crash when the image is of the wrong type */ - gdImageLine(im, x1, y1, x2, y2, col); - return; - } - - /* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */ - if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { - return; - } - - dx = x2 - x1; - dy = y2 - y1; - - if (dx == 0 && dy == 0) { - return; - } - if (abs((int)dx) > abs((int)dy)) { - if (dx < 0) { - tmp = x1; - x1 = x2; - x2 = tmp; - tmp = y1; - y1 = y2; - y2 = tmp; - dx = x2 - x1; - dy = y2 - y1; - } - y = y1; - inc = (dy * 65536) / dx; - frac = 0; - for (x = x1; x <= x2; x++) { - gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); - if (y + 1 < im->sy) { - gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF); - } - frac += inc; - if (frac >= 65536) { - frac -= 65536; - y++; - } else if (frac < 0) { - frac += 65536; - y--; - } - } - } else { - if (dy < 0) { - tmp = x1; - x1 = x2; - x2 = tmp; - tmp = y1; - y1 = y2; - y2 = tmp; - dx = x2 - x1; - dy = y2 - y1; - } - x = x1; - inc = (dx * 65536) / dy; - frac = 0; - for (y = y1; y <= y2; y++) { - gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); - if (x + 1 < im->sx) { - gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF); - } - frac += inc; - if (frac >= 65536) { - frac -= 65536; - x++; - } else if (frac < 0) { - frac += 65536; - x--; - } - } - } -} - static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, int vert); void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) @@ -1951,6 +1729,35 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) * code I added a 2nd private function. */ +static int gdImageTileGet (gdImagePtr im, int x, int y) +{ + int srcx, srcy; + int tileColor,p; + if (!im->tile) { + return -1; + } + srcx = x % gdImageSX(im->tile); + srcy = y % gdImageSY(im->tile); + p = gdImageGetPixel(im->tile, srcx, srcy); + + if (im->trueColor) { + if (im->tile->trueColor) { + tileColor = p; + } else { + tileColor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p)); + } + } else { + if (im->tile->trueColor) { + tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p)); + } else { + tileColor = p; + tileColor = gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p)); + } + } + return tileColor; +} + + /* horizontal segment of scan line y */ struct seg {int y, xl, xr, dy;}; @@ -2307,6 +2114,90 @@ void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int _gdImageFilledVRectangle(im, x1, y1, x2, y2, color); } +gdImagePtr gdImageClone (gdImagePtr src) { + gdImagePtr dst; + register int i, x; + + if (src->trueColor) { + dst = gdImageCreateTrueColor(src->sx , src->sy); + } else { + dst = gdImageCreate(src->sx , src->sy); + } + + if (dst == NULL) { + return NULL; + } + + if (src->trueColor == 0) { + dst->colorsTotal = src->colorsTotal; + for (i = 0; i < gdMaxColors; i++) { + dst->red[i] = src->red[i]; + dst->green[i] = src->green[i]; + dst->blue[i] = src->blue[i]; + dst->alpha[i] = src->alpha[i]; + dst->open[i] = src->open[i]; + } + for (i = 0; i < src->sy; i++) { + for (x = 0; x < src->sx; x++) { + dst->pixels[i][x] = src->pixels[i][x]; + } + } + } else { + for (i = 0; i < src->sy; i++) { + for (x = 0; x < src->sx; x++) { + dst->tpixels[i][x] = src->tpixels[i][x]; + } + } + } + + dst->interlace = src->interlace; + + dst->alphaBlendingFlag = src->alphaBlendingFlag; + dst->saveAlphaFlag = src->saveAlphaFlag; + dst->AA = src->AA; + dst->AA_color = src->AA_color; + dst->AA_dont_blend = src->AA_dont_blend; + + dst->cx1 = src->cx1; + dst->cy1 = src->cy1; + dst->cx2 = src->cx2; + dst->cy2 = src->cy2; + + dst->res_x = src->res_x; + dst->res_y = src->res_y; + + dst->interpolation_id = src->interpolation_id; + dst->interpolation = src->interpolation; + + if (src->brush) { + dst->brush = gdImageClone(src->brush); + } + + if (src->tile) { + dst->tile = gdImageClone(src->tile); + } + + if (src->style) { + gdImageSetStyle(dst, src->style, src->styleLength); + dst->stylePos = src->stylePos; + } + + for (i = 0; i < gdMaxColors; i++) { + dst->brushColorMap[i] = src->brushColorMap[i]; + dst->tileColorMap[i] = src->tileColorMap[i]; + } + + if (src->polyAllocated > 0 && overflow2(sizeof(int), src->polyAllocated) == 0) { + dst->polyInts = gdMalloc (sizeof (int) * src->polyAllocated); + dst->polyAllocated = src->polyAllocated; + for (i = 0; i < src->polyAllocated; i++) { + dst->polyInts[i] = src->polyInts[i]; + } + } + + return dst; +} + void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h) { int c; @@ -3032,16 +2923,6 @@ int gdAlphaBlend (int dst, int src) { } -void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) -{ - im->alphaBlendingFlag = alphaBlendingArg; -} - -void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) -{ - im->saveAlphaFlag = saveAlphaArg; -} - int gdLayerOverlay (int dst, int src) { int a1, a2; @@ -3097,6 +2978,16 @@ int gdLayerMultiply (int dst, int src) ); } +void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) +{ + im->alphaBlendingFlag = alphaBlendingArg; +} + +void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg) +{ + im->saveAlphaFlag = saveAlphaArg; +} + void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) { if (x1 < 0) { @@ -3143,6 +3034,115 @@ void gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigne if (res_y > 0) im->res_y = res_y; } +/* + * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org) + * */ +#define BLEND_COLOR(a, nc, c, cc) \ +nc = (cc) + (((((c) - (cc)) * (a)) + ((((c) - (cc)) * (a)) >> 8) + 0x80) >> 8); + +inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t) +{ + int dr,dg,db,p,r,g,b; + dr = gdTrueColorGetRed(color); + dg = gdTrueColorGetGreen(color); + db = gdTrueColorGetBlue(color); + + p = gdImageGetPixel(im,x,y); + r = gdTrueColorGetRed(p); + g = gdTrueColorGetGreen(p); + b = gdTrueColorGetBlue(p); + + BLEND_COLOR(t, dr, r, dr); + BLEND_COLOR(t, dg, g, dg); + BLEND_COLOR(t, db, b, db); + im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); +} + +/* + * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org) + **/ +void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) +{ + /* keep them as 32bits */ + long x, y, inc, frac; + long dx, dy,tmp; + + if (!im->trueColor) { + /* TBB: don't crash when the image is of the wrong type */ + gdImageLine(im, x1, y1, x2, y2, col); + return; + } + + /* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */ + if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) { + return; + } + + dx = x2 - x1; + dy = y2 - y1; + + if (dx == 0 && dy == 0) { + return; + } + if (abs((int)dx) > abs((int)dy)) { + if (dx < 0) { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + dx = x2 - x1; + dy = y2 - y1; + } + y = y1; + inc = (dy * 65536) / dx; + frac = 0; + for (x = x1; x <= x2; x++) { + gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); + if (y + 1 < im->sy) { + gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF); + } + frac += inc; + if (frac >= 65536) { + frac -= 65536; + y++; + } else if (frac < 0) { + frac += 65536; + y--; + } + } + } else { + if (dy < 0) { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + dx = x2 - x1; + dy = y2 - y1; + } + x = x1; + inc = (dx * 65536) / dy; + frac = 0; + for (y = y1; y <= y2; y++) { + gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF); + if (x + 1 < im->sx) { + gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF); + } + frac += inc; + if (frac >= 65536) { + frac -= 65536; + x++; + } else if (frac < 0) { + frac += 65536; + x--; + } + } + } +} + /* convert a palette image to true color */ int gdImagePaletteToTrueColor(gdImagePtr src) { diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index 82ba933cac689..26a1ad24e06cc 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -292,30 +292,6 @@ typedef void(*gdErrorMethod)(int, const char *, va_list); void gdSetErrorMethod(gdErrorMethod); void gdClearErrorMethod(void); -/** - * Group: Types - * - * typedef: gdRect - * Defines a rectilinear region. - * - * x - left position - * y - right position - * width - Rectangle width - * height - Rectangle height - * - * typedef: gdRectPtr - * Pointer to a - * - * See also: - * - **/ -typedef struct -{ - int x, y; - int width, height; -} -gdRect, *gdRectPtr; - /* For backwards compatibility only. Use gdImageSetStyle() for MUCH more flexible line drawing. Also see gdImageSetBrush(). */ @@ -352,6 +328,9 @@ gdImagePtr gdImageCreateTrueColor(int sx, int sy); JPEG is always truecolor. */ gdImagePtr gdImageCreateFromPng(FILE *fd); gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in); + +gdImagePtr gdImageCreateFromGif(FILE *fd); +gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in); gdImagePtr gdImageCreateFromWBMP(FILE *inFile); gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile); gdImagePtr gdImageCreateFromJpeg(FILE *infile); @@ -361,8 +340,8 @@ gdImagePtr gdImageCreateFromJpegCtxEx(gdIOCtx *infile, int ignore_warning); gdImagePtr gdImageCreateFromJpegPtr (int size, void *data); gdImagePtr gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning); gdImagePtr gdImageCreateFromWebp(FILE *fd); -gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr in); gdImagePtr gdImageCreateFromWebpPtr (int size, void *data); +gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr in); gdImagePtr gdImageCreateFromAvif(FILE *infile); gdImagePtr gdImageCreateFromAvifPtr(int size, void *data); @@ -391,6 +370,7 @@ typedef struct { } gdSource, *gdSourcePtr; gdImagePtr gdImageCreateFromPngSource(gdSourcePtr in); +gdImagePtr gdImageCreateFromGifSource(gdSourcePtr in); gdImagePtr gdImageCreateFromGd(FILE *in); gdImagePtr gdImageCreateFromGdCtx(gdIOCtxPtr in); @@ -417,8 +397,8 @@ void gdImageDestroy(gdImagePtr im); void gdImageSetPixel(gdImagePtr im, int x, int y, int color); -int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y); int gdImageGetPixel(gdImagePtr im, int x, int y); +int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y); void gdImageAABlend(gdImagePtr im); @@ -436,6 +416,8 @@ void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int c void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2); void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P); void gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y); +/* 2.0.12: this now checks the clipping rectangle */ +#define gdImageBoundsSafe(im, x, y) (!((((y) < (im)->cy1) || ((y) > (im)->cy2)) || (((x) < (im)->cx1) || ((x) > (im)->cx2)))) void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color); void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color); void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color); @@ -504,6 +486,30 @@ typedef struct { int x, y; } gdPoint, *gdPointPtr; +/** + * Group: Types + * + * typedef: gdRect + * Defines a rectilinear region. + * + * x - left position + * y - right position + * width - Rectangle width + * height - Rectangle height + * + * typedef: gdRectPtr + * Pointer to a + * + * See also: + * + **/ +typedef struct +{ + int x, y; + int width, height; +} +gdRect, *gdRectPtr; + void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c); void gdImageOpenPolygon(gdImagePtr im, gdPointPtr p, int n, int c); void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c); @@ -587,9 +593,9 @@ int gdImageColorMatch(gdImagePtr im1, gdImagePtr im2); void gdImageColorTransparent(gdImagePtr im, int color); void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src); +void gdImageGif(gdImagePtr im, FILE *out); void gdImagePng(gdImagePtr im, FILE *out); void gdImagePngCtx(gdImagePtr im, gdIOCtx *out); -void gdImageGif(gdImagePtr im, FILE *out); void gdImageGifCtx(gdImagePtr im, gdIOCtx *out); void * gdImageBmpPtr(gdImagePtr im, int *size, int compression); @@ -619,6 +625,9 @@ void *gdImageWBMPPtr(gdImagePtr im, int *size, int fg); void gdImageJpeg(gdImagePtr im, FILE *out, int quality); void gdImageJpegCtx(gdImagePtr im, gdIOCtx *out, int quality); +/* Best to free this memory with gdFree(), not free() */ +void *gdImageJpegPtr(gdImagePtr im, int *size, int quality); + /** * Group: WebP * @@ -634,13 +643,6 @@ void gdImageJpegCtx(gdImagePtr im, gdIOCtx *out, int quality); void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quality); -/* Best to free this memory with gdFree(), not free() */ -void *gdImageJpegPtr(gdImagePtr im, int *size, int quality); - -gdImagePtr gdImageCreateFromGif(FILE *fd); -gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in); -gdImagePtr gdImageCreateFromGifSource(gdSourcePtr in); - void gdImageAvif(gdImagePtr im, FILE *outfile); void gdImageAvifEx(gdImagePtr im, FILE *outfile, int quality, int speed); void *gdImageAvifPtr(gdImagePtr im, int *size); @@ -672,8 +674,6 @@ void *gdImagePngPtrEx(gdImagePtr im, int *size, int level, int basefilter); /* Best to free this memory with gdFree(), not free() */ void* gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size); -void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c); - /* Style is a bitwise OR ( | operator ) of these. gdArc and gdChord are mutually exclusive; gdChord just connects the starting and ending @@ -693,6 +693,7 @@ void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c); void gdImageFilledArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style); void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color); +void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c); void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color); void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color); void gdImageFill(gdImagePtr im, int x, int y, int color); @@ -749,9 +750,33 @@ typedef struct { unsigned int seed; } gdScatter, *gdScatterPtr; +/* filters section */ int gdImageScatter(gdImagePtr im, int sub, int plus); int gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors); int gdImageScatterEx(gdImagePtr im, gdScatterPtr s); +int gdImageSmooth(gdImagePtr im, float weight); +int gdImageMeanRemoval(gdImagePtr im); +int gdImageEmboss(gdImagePtr im); +int gdImageGaussianBlur(gdImagePtr im); +int gdImageEdgeDetectQuick(gdImagePtr src); +int gdImageSelectiveBlur( gdImagePtr src); +/* Image convolution by a 3x3 custom matrix */ +int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset); +/* Simply adds or subtracts respectively red, green or blue to a pixel */ +int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha); +/* Set the contrast level for the image */ +int gdImageContrast(gdImagePtr src, double contrast); +/* Set the brightness level for the image src */ +int gdImageBrightness(gdImagePtr src, int brightness); +/* Convert the image src to a grayscale image */ +int gdImageGrayScale(gdImagePtr src); +/* + * Negate the imag src, white becomes black, + * The red, green, and blue intensities of an image are negated. + * White becomes black, yellow becomes blue, etc. + */ +int gdImageNegate(gdImagePtr src); + /* Macros to access information about images. */ @@ -802,41 +827,6 @@ void* gdDPExtractData(struct gdIOCtx* ctx, int *size); #define GD2_FMT_COMPRESSED 2 -/* filters section - * - * Negate the imag src, white becomes black, - * The red, green, and blue intensities of an image are negated. - * White becomes black, yellow becomes blue, etc. - */ -int gdImageNegate(gdImagePtr src); - -/* Convert the image src to a grayscale image */ -int gdImageGrayScale(gdImagePtr src); - -/* Set the brightness level for the image src */ -int gdImageBrightness(gdImagePtr src, int brightness); - -/* Set the contrast level for the image */ -int gdImageContrast(gdImagePtr src, double contrast); - -/* Simply adds or subtracts respectively red, green or blue to a pixel */ -int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha); - -/* Image convolution by a 3x3 custom matrix */ -int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset); - -int gdImageEdgeDetectQuick(gdImagePtr src); - -int gdImageGaussianBlur(gdImagePtr im); - -int gdImageSelectiveBlur( gdImagePtr src); - -int gdImageEmboss(gdImagePtr im); - -int gdImageMeanRemoval(gdImagePtr im); - -int gdImageSmooth(gdImagePtr im, float weight); - /* Image comparison definitions */ int gdImageCompare(gdImagePtr im1, gdImagePtr im2); @@ -930,7 +920,4 @@ int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPt } #endif -/* 2.0.12: this now checks the clipping rectangle */ -#define gdImageBoundsSafe(im, x, y) (!((((y) < (im)->cy1) || ((y) > (im)->cy2)) || (((x) < (im)->cx1) || ((x) > (im)->cx2)))) - #endif /* GD_H */