gdfx.c

Summary
gdfx.c
Functions
gdImageStringFTCircleDraw text curved along the top and bottom of a circular area of an image.
gdImageSquareToCircleApply polar coordinate transformation to an image.
gdImageSharpenSharpen an image.

Functions

gdImageStringFTCircle

char* gdImageStringFTCircle (gdImagePtr im,
int cx,
int cy,
double radius,
double textRadius,
double fillPortion,
char *font,
double points,
char *top,
char *bottom,
int fgcolor)

Draw text curved along the top and bottom of a circular area of an image.

Parameters

imThe image to draw onto.
cxThe x-coordinate of the center of the circular area.
cyThe y-coordinate of the center of the circular area.
radiusThe radius of the circular area.
textRadiusThe height of each character; if textRadius is 1/2 of radius, characters extend halfway from the edge to the center.
fillPortionThe percentage of the 180 degrees of the circular area assigned to each section of text, that is actually occupied by text.  The value has to be in range 0.0 to 1.0, with useful values from about 0.4 to 0.9; 0.9 looks better than 1.0 which is rather crowded.
fontThe fontlist that is passed to gdImageStringFT.
pointsThe point size, which functions as a hint.  Although the size of the text is determined by radius, textRadius and fillPortion, a point size that ‘hints’ appropriately should be passed.  If it’s known that the text will be large, a large point size such as 24.0 should be passed to get the best results.
topThe text to draw clockwise at the top of the circular area.
bottomThe text to draw counterclockwise at the bottom of the circular area.
fgcolorThe font color.

Returns

NULL on success, or an error string on failure.

gdImageSquareToCircle

gdImagePtr gdImageSquareToCircle (gdImagePtr im,
int radius)

Apply polar coordinate transformation to an image.

The X axis of the original will be remapped to theta (angle) and the Y axis of the original will be remapped to rho (distance from center).

Parameters

imThe image, which must be square, i.e. width == height.
radiusThe radius of the new image, i.e. width == height == radius * 2.

Returns

The transformed image, or NULL on failure.

gdImageSharpen

void gdImageSharpen (gdImagePtr im,
int pct)

Sharpen an image.

Uses a simple 3x3 convolution kernel and makes use of separability.  It’s faster, but less flexible, than full-blown unsharp masking.  Silently does nothing to non-truecolor images and for pct<0, as it’s not a useful blurring function.

Parameters

pctThe sharpening percentage, which can be greater than 100.

Author

Paul Troughton (paul<dot>troughton<at>ieee<dot>org)

char* gdImageStringFTCircle (gdImagePtr im,
int cx,
int cy,
double radius,
double textRadius,
double fillPortion,
char *font,
double points,
char *top,
char *bottom,
int fgcolor)
Draw text curved along the top and bottom of a circular area of an image.
gdImagePtr gdImageSquareToCircle (gdImagePtr im,
int radius)
Apply polar coordinate transformation to an image.
void gdImageSharpen (gdImagePtr im,
int pct)
Sharpen an image.
char * gdImageStringFT (gdImage *im,
int *brect,
int fg,
char *fontlist,
double ptsize,
double angle,
int x,
int y,
char *string)
Render an UTF-8 string onto a gd image.
Close