LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
Vector 2D

Data Structures

struct  gdPathMatrixStruct
 Affine transformation matrix. More...
 
struct  gdRectFStruct
 Floating-point rectangle. More...
 
struct  gdTextError
 Optional detailed error information for 2D text APIs. More...
 
struct  gdTextExtents
 
struct  gdTextOptions
 

Typedefs

typedef struct gdContextStruct gdContext
 Opaque 2D drawing context.
 
typedef gdContextgdContextPtr
 Opaque 2D drawing context pointer.
 
typedef struct gdPathStruct gdPath
 Opaque text shaping options.
 
typedef gdPathgdPathPtr
 Opaque vector path pointer.
 
typedef struct gdPaintStruct gdPaint
 Opaque paint source.
 
typedef gdPaintgdPaintPtr
 Opaque paint source pointer.
 
typedef struct gdPathPatternStruct gdPathPattern
 Opaque image pattern.
 
typedef gdPathPatterngdPathPatternPtr
 Opaque image pattern pointer.
 
typedef struct gdFontFaceStruct gdFontFace
 Opaque font face.
 
typedef gdFontFacegdFontFacePtr
 Opaque font face pointer.
 
typedef struct gdPathMatrixStruct gdPathMatrix
 Affine transformation matrix.
 
typedef gdPathMatrixgdPathMatrixPtr
 Affine transformation matrix pointer.
 
typedef struct gdRectFStruct gdRectF
 Floating-point rectangle.
 
typedef gdRectFgdRectFPtr
 Floating-point rectangle pointer.
 

Enumerations

enum  gdExtendMode
 
enum  gdLineCap { gdLineCapButt , gdLineCapRound , gdLineCapSquare }
 
enum  gdLineJoin { gdLineJoinMiter , gdLineJoinRound , gdLineJoinBevel }
 
enum  gdFillRule { gdFillRuleNonZero , gdFillRuleEvenOdd }
 
enum  gdPatternFilter { GD_PATTERN_FILTER_FAST , GD_PATTERN_FILTER_GOOD , GD_PATTERN_FILTER_BEST }
 
enum  gdCompositeOperator {
  GD_OP_CLEAR , GD_OP_SOURCE , GD_OP_OVER , GD_OP_IN ,
  GD_OP_OUT , GD_OP_ATOP , GD_OP_DEST , GD_OP_DEST_OVER ,
  GD_OP_DEST_IN , GD_OP_DEST_OUT , GD_OP_DEST_ATOP , GD_OP_XOR ,
  GD_OP_ADD , GD_OP_SATURATE , GD_OP_MULTIPLY , GD_OP_SCREEN ,
  GD_OP_OVERLAY , GD_OP_DARKEN , GD_OP_LIGHTEN , GD_OP_COLOR_DODGE ,
  GD_OP_COLOR_BURN , GD_OP_HARD_LIGHT , GD_OP_SOFT_LIGHT , GD_OP_DIFFERENCE ,
  GD_OP_EXCLUSION , GD_OP_HSL_HUE , GD_OP_HSL_SATURATION , GD_OP_HSL_COLOR ,
  GD_OP_HSL_LUMINOSITY , GD_OP_COUNT
}
 
enum  gdTextStatus {
  GD_TEXT_OK = 0 , GD_TEXT_E_INVALID_ARGUMENT , GD_TEXT_E_UNAVAILABLE , GD_TEXT_E_FONT ,
  GD_TEXT_E_LAYOUT , GD_TEXT_E_MEMORY
}
 
enum  gdTextShaping { GD_TEXT_SHAPING_NONE = 0 , GD_TEXT_SHAPING_RAQM = 1 }
 

Functions

int gdImageComposite (gdImagePtr dst, const gdImagePtr src, int dst_x, int dst_y, gdCompositeOperator op, double opacity, gdRectPtr src_region, gdRectPtr clip)
 Composite a source image into a truecolor destination image.
 
void gdTextOptionsInit (gdTextOptions *options)
 Initialize text options to defaults.
 
gdContextPtr gdContextCreateForImage (gdImagePtr image)
 Create a 2D drawing context for a truecolor image.
 
void gdContextFlushImage (gdContextPtr context)
 Copy the context's drawing surface back into its image.
 
int gdContextReloadImage (gdContextPtr context)
 Reload the context drawing surface from its backing image.
 
gdImagePtr gdContextGetImage (gdContextPtr context)
 Get the image associated with a context.
 
void gdContextDestroy (gdContextPtr context)
 Destroy a context and flush drawing changes to the backing image.
 
void gdContextDestroyNoFlush (gdContextPtr context)
 Destroy a context without flushing drawing changes to the backing image.
 
int gdContextSave (gdContextPtr context)
 Save the current graphics state.
 
int gdContextRestore (gdContextPtr context)
 Restore the most recently saved graphics state.
 
int gdContextClip (gdContextPtr context)
 Intersect the current clip with the current path and clear the path.
 
int gdContextClipPreserve (gdContextPtr context)
 Intersect the current clip with the current path without clearing the path.
 
void gdContextNewPath (gdContextPtr context)
 Clear the current path.
 
void gdContextAppendPath (gdContextPtr context, gdPathPtr path)
 Append a path to the context's current path.
 
void gdContextSetSourceRgba (gdContextPtr context, double r, double g, double b, double a)
 Set the current source paint to a solid RGBA color.
 
void gdContextSetSourceRgb (gdContextPtr context, double r, double g, double b)
 Set the current source paint to an opaque RGB color.
 
void gdContextSetSourceImage (gdContextPtr context, gdImagePtr image, double x, double y)
 Set the current source paint to an image pattern.
 
void gdContextSetSource (gdContextPtr context, gdPaintPtr source)
 Set the current source paint.
 
void gdContextSetOperator (gdContextPtr context, gdCompositeOperator op)
 Set the compositing operator used for subsequent drawing.
 
void gdContextSetOpacity (gdContextPtr context, double opacity)
 Set a global opacity multiplier for subsequent drawing.
 
void gdContextSetPatternFilter (gdContextPtr context, gdPatternFilter filter)
 Set the default image-pattern filter for patterns created by context source helpers such as gdContextSetSourceImage.
 
gdPatternFilter gdContextGetPatternFilter (gdContextPtr context)
 Get the current default image-pattern filter from a context.
 
void gdContextSetFontFace (gdContextPtr context, gdFontFacePtr face)
 Set the current font face for text operations.
 
void gdContextSetFontSize (gdContextPtr context, double size)
 Set the current font size for text operations.
 
gdTextStatus gdContextTextPath (gdContextPtr context, const char *utf8, double x, double y, const gdTextOptions *options, gdTextError *err)
 Convert UTF-8 text to path contours and append them to the current path.
 
gdTextStatus gdContextShowText (gdContextPtr context, const char *utf8, double x, double y, const gdTextOptions *options, gdTextError *err)
 Draw UTF-8 text using the current source paint.
 
gdTextStatus gdContextTextExtents (gdContextPtr context, const char *utf8, const gdTextOptions *options, gdTextExtents *extents, gdTextError *err)
 Measure UTF-8 text using the current font face and font size.
 
void gdContextMoveTo (gdContextPtr context, double x, double y)
 Move the current point in the context path.
 
void gdContextRelMoveTo (gdContextPtr context, double dx, double dy)
 Move the current point by an offset in the context path.
 
void gdContextLineTo (gdContextPtr context, double x, double y)
 Add a line to the context path.
 
void gdContextRelLineTo (gdContextPtr context, double dx, double dy)
 Add a relative line to the context path.
 
void gdContextCurveTo (gdContextPtr context, double x1, double y1, double x2, double y2, double x3, double y3)
 Add a cubic Bezier curve to the context path.
 
void gdContextRelCurveTo (gdContextPtr context, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
 Add a relative cubic Bezier curve to the context path.
 
void gdContextQuadTo (gdContextPtr context, double x1, double y1, double x2, double y2)
 Add a quadratic Bezier curve to the context path.
 
void gdContextRelQuadTo (gdContextPtr context, double dx1, double dy1, double dx2, double dy2)
 Add a relative quadratic Bezier curve to the context path.
 
void gdContextArc (gdContextPtr context, double cx, double cy, double radius, double a0, double a1)
 Add a positive-direction circular arc to the context path.
 
void gdContextNegativeArc (gdContextPtr context, double cx, double cy, double radius, double a0, double a1)
 Add a negative-direction circular arc to the context path.
 
void gdContextRectangle (gdContextPtr context, double x, double y, double width, double height)
 Add a rectangle to the context path.
 
void gdContextClosePath (gdContextPtr context)
 Close the current contour in the context path.
 
void gdContextScale (gdContextPtr context, double x, double y)
 Apply scaling to the current transformation matrix.
 
void gdContextTranslate (gdContextPtr context, double x, double y)
 Apply translation to the current transformation matrix.
 
void gdContextRotate (gdContextPtr context, double radians)
 Apply rotation to the current transformation matrix.
 
void gdContextTransform (gdContextPtr context, const gdPathMatrixPtr matrix)
 Apply an affine transformation to the current transformation matrix.
 
void gdContextSetLineWidth (gdContextPtr context, double width)
 Set the stroke line width.
 
void gdContextSetLineCap (gdContextPtr context, gdLineCap cap)
 Set the stroke line cap style.
 
void gdContextSetLineJoin (gdContextPtr context, gdLineJoin join)
 Set the stroke line join style.
 
void gdContextSetDash (gdContextPtr context, double offset, const double *data, int size)
 Set the stroke dash pattern.
 
void gdContextSetFillRule (gdContextPtr context, gdFillRule rule)
 Set the fill rule used by subsequent fill and clip operations.
 
void gdContextStroke (gdContextPtr context)
 Stroke the current path and then clear it.
 
void gdContextStrokePreserve (gdContextPtr context)
 Stroke the current path without clearing it.
 
void gdContextFill (gdContextPtr context)
 Fill the current path and then clear it.
 
void gdContextFillPreserve (gdContextPtr context)
 Fill the current path without clearing it.
 
void gdContextPaint (gdContextPtr context)
 Paint the current source over the entire current clip.
 
gdFontFacePtr gdFontFaceCreateFromFile (const char *path, int face_index, gdTextError *err)
 Load a font face from a file.
 
gdFontFacePtr gdFontFaceCreateFromData (const unsigned char *data, size_t size, int face_index, gdTextError *err)
 Load a font face from memory.
 
gdFontFacePtr gdFontFaceAddRef (gdFontFacePtr face)
 Add a reference to a font face.
 
void gdFontFaceDestroy (gdFontFacePtr face)
 Release a font face reference. Passing NULL has no effect.
 
gdPaintPtr gdPaintCreateFromPattern (gdPathPatternPtr pattern)
 Create a paint object from an image pattern.
 
gdPaintPtr gdPaintCreateLinear (double x0, double y0, double x1, double y1)
 Create a linear gradient paint.
 
gdPaintPtr gdPaintCreateRadial (double x0, double y0, double r0, double x1, double y1, double r1)
 Create a radial gradient paint between two circles.
 
int gdPaintAddColorStopRgb (gdPaintPtr paint, double offset, double r, double g, double b)
 Add an opaque color stop to a gradient paint.
 
int gdPaintAddColorStopRgba (gdPaintPtr paint, double offset, double r, double g, double b, double a)
 Add a color stop with opacity to a gradient paint.
 
int gdPaintSetExtend (gdPaintPtr paint, gdExtendMode extend)
 Set the extend mode for a gradient or pattern paint.
 
int gdPaintSetMatrix (gdPaintPtr paint, const gdPathMatrixPtr matrix)
 Set the paint's pattern or gradient transform.
 
void gdPaintDestroy (gdPaintPtr paint)
 Release a paint object. Passing NULL has no effect.
 
gdPathPatternPtr gdPathPatternCreateForImage (gdImagePtr image)
 Create an image pattern from a gd image.
 
void gdPathPatternDestroy (gdPathPatternPtr pattern)
 Release a pattern object. Passing NULL has no effect.
 
void gdPathPatternSetExtend (gdPathPatternPtr pattern, gdExtendMode extend)
 Set how an image pattern is sampled outside its image bounds.
 
void gdPathPatternSetMatrix (gdPathPatternPtr pattern, gdPathMatrixPtr matrix)
 Set the pattern-to-user-space transform for an image pattern.
 
void gdPathPatternSetOpacity (gdPathPatternPtr pattern, double opacity)
 Set the opacity multiplier for an image pattern.
 
void gdPathPatternSetFilter (gdPathPatternPtr pattern, gdPatternFilter filter)
 Set the sampling quality for an image pattern.
 
gdPatternFilter gdPathPatternGetFilter (gdPathPatternPtr pattern)
 Get the sampling quality for an image pattern.
 
void gdPathMatrixInit (gdPathMatrixPtr matrix, double m00, double m10, double m01, double m11, double m02, double m12)
 Initialize an affine transformation matrix from its six coefficients.
 
void gdPathMatrixInitIdentity (gdPathMatrixPtr matrix)
 Initialize a matrix to the identity transformation.
 
void gdPathMatrixInitTranslate (gdPathMatrixPtr matrix, double x, double y)
 Initialize a translation matrix.
 
void gdPathMatrixInitScale (gdPathMatrixPtr matrix, double x, double y)
 Initialize a scaling matrix.
 
void gdPathMatrixInitShear (gdPathMatrixPtr matrix, double x, double y)
 Initialize a shear matrix. The shear factors are the tangents of the supplied angles.
 
void gdPathMatrixInitRotate (gdPathMatrixPtr matrix, double radians)
 Initialize a rotation matrix about the origin.
 
void gdPathMatrixInitRotateTranslate (gdPathMatrixPtr matrix, double radians, double x, double y)
 Initialize a rotation matrix about a specified point. The point (x, y) remains unchanged by the resulting transformation.
 
void gdPathMatrixTranslate (gdPathMatrixPtr matrix, double x, double y)
 Apply a translation before the transformation already in a matrix.
 
void gdPathMatrixScale (gdPathMatrixPtr matrix, double x, double y)
 Apply scaling before the transformation already in a matrix.
 
void gdPathMatrixShear (gdPathMatrixPtr matrix, double x, double y)
 Apply a shear before the transformation already in a matrix.
 
void gdPathMatrixRotate (gdPathMatrixPtr matrix, double radians)
 Apply a rotation about the origin before the transformation already in a matrix.
 
void gdPathMatrixRotateTranslate (gdPathMatrixPtr matrix, double radians, double x, double y)
 Apply a rotation about a specified point before the transformation already in a matrix.
 
void gdPathMatrixMultiply (gdPathMatrixPtr matrix, const gdPathMatrixPtr a, const gdPathMatrixPtr b)
 Compose two affine transformations. The result maps through a first and then through b. matrix may alias a or b.
 
int gdPathMatrixInvert (gdPathMatrixPtr matrix)
 Invert an affine transformation in place. A singular matrix is left unchanged.
 
void gdPathMatrixMap (const gdPathMatrixPtr matrix, double x, double y, double *result_x, double *result_y)
 Transform a pair of coordinates.
 
void gdPathMatrixMapPoint (const gdPathMatrixPtr matrix, const gdPointFPtr src, gdPointFPtr dst)
 Transform a point. src and dst may point to the same object.
 
void gdPathMatrixMapRect (const gdPathMatrixPtr matrix, const gdRectFPtr src, gdRectFPtr dst)
 Transform all four corners of a rectangle and calculate their axis-aligned bounding box. src and dst may point to the same object.
 
gdPathPtr gdPathCreate (void)
 Create an empty path.
 
gdPathPtr gdPathDuplicate (const gdPathPtr path)
 Create an independent copy of a path.
 
void gdPathDestroy (gdPathPtr path)
 Release a path. Passing NULL has no effect.
 
void gdPathAppendPath (gdPathPtr path, const gdPathPtr source)
 Append all contours from one path to another.
 
void gdPathTransform (gdPathPtr path, const gdPathMatrixPtr matrix)
 Transform every point in a path in place.
 
void gdPathMoveTo (gdPathPtr path, double x, double y)
 Start a new contour at an absolute position.
 
void gdPathRelMoveTo (gdPathPtr path, double dx, double dy)
 Start a new contour at an offset from the current point. For an empty path, the offset is relative to (0, 0).
 
void gdPathLineTo (gdPathPtr path, double x, double y)
 Add a straight line to an absolute position.
 
void gdPathRelLineTo (gdPathPtr path, double dx, double dy)
 Add a straight line using an offset from the current point.
 
void gdPathQuadTo (gdPathPtr path, double x1, double y1, double x2, double y2)
 Add a quadratic Bezier curve.
 
void gdPathRelQuadTo (gdPathPtr path, double dx1, double dy1, double dx2, double dy2)
 Add a quadratic Bezier curve using offsets from the current point.
 
void gdPathCurveTo (gdPathPtr path, double x1, double y1, double x2, double y2, double x3, double y3)
 Add a cubic Bezier curve.
 
void gdPathRelCurveTo (gdPathPtr path, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
 Add a cubic Bezier curve using offsets from the current point.
 
void gdPathArc (gdPathPtr path, double cx, double cy, double radius, double angle1, double angle2)
 Add a circular arc in the positive-angle direction. Angles are in radians. A line is added from the current point to the beginning of the arc when necessary.
 
void gdPathNegativeArc (gdPathPtr path, double cx, double cy, double radius, double angle1, double angle2)
 Add a circular arc in the negative-angle direction. Angles are in radians. A line is added from the current point to the beginning of the arc when necessary.
 
void gdPathArcTo (gdPathPtr path, double x1, double y1, double x2, double y2, double radius)
 Connect the current point to (x1, y1) and (x2, y2) with a circular arc tangent to both line segments. Degenerate geometry or a non-positive radius adds a line to (x1, y1).
 
void gdPathRectangle (gdPathPtr path, double x, double y, double width, double height)
 Add a closed rectangular contour.
 
void gdPathClose (gdPathPtr path)
 Close the current contour with a line to its starting point. An empty path or an already closed contour is unchanged.
 

Detailed Description

Experimental 2D vector drawing API for libgd.

Typedef Documentation

◆ gdContext

typedef struct gdContextStruct gdContext

Opaque 2D drawing context.

Opaque drawing context for the 2D API. A context owns the current path and a stack of graphics state, and draws into an ARGB surface backed by a truecolor gdImage.

See also:

◆ gdContextPtr

Opaque 2D drawing context pointer.

Pointer to an opaque drawing context for the 2D API.

See also:

◆ gdFontFace

typedef struct gdFontFaceStruct gdFontFace

Opaque font face.

Opaque font face used by text APIs.

See also:

◆ gdFontFacePtr

Opaque font face pointer.

Pointer to an opaque font face used by text APIs.

See also:

◆ gdPaint

typedef struct gdPaintStruct gdPaint

Opaque paint source.

Opaque paint source. A paint may be a solid color, image pattern, or gradient.

See also:

◆ gdPaintPtr

typedef gdPaint* gdPaintPtr

Opaque paint source pointer.

Pointer to an opaque paint source. A paint may be a solid color, image pattern, or gradient.

See also:

◆ gdPath

typedef struct gdPathStruct gdPath

Opaque text shaping options.

Opaque vector path made of contours, lines, curves, arcs, and rectangles.

See also:

◆ gdPathMatrix

Affine transformation matrix.

Affine transformation matrix used by paths, contexts, paints, and patterns.

Points are mapped as: (x * m00 + y * m01 + m02, x * m10 + y * m11 + m12).

See also:

◆ gdPathPattern

typedef struct gdPathPatternStruct gdPathPattern

Opaque image pattern.

Opaque image pattern used as a paint source.

See also:

◆ gdPathPatternPtr

Opaque image pattern pointer.

Pointer to an opaque image pattern used as a paint source.

See also:

◆ gdPathPtr

typedef gdPath* gdPathPtr

Opaque vector path pointer.

Pointer to an opaque vector path made of contours, lines, curves, arcs, and rectangles.

See also:

◆ gdRectF

typedef struct gdRectFStruct gdRectF

Floating-point rectangle.

Floating-point rectangle.

Members: x - Left coordinate. y - Top coordinate. w - Width. h - Height.

◆ gdRectFPtr

typedef gdRectF* gdRectFPtr

Floating-point rectangle pointer.

Pointer to a floating-point rectangle.

Enumeration Type Documentation

◆ gdCompositeOperator

Constants: gdCompositeOperator

Porter-Duff and blend operators used when painting source pixels over the destination. See also:

Enumerator
GD_OP_CLEAR 

Clear the destination.

GD_OP_SOURCE 

Replace with the source.

GD_OP_OVER 

Draw source over destination.

GD_OP_IN 

Keep source only where destination exists.

GD_OP_OUT 

Keep source only where destination is transparent.

GD_OP_ATOP 

Source atop destination.

GD_OP_DEST 

Keep destination unchanged.

GD_OP_DEST_OVER 

Draw destination over source.

GD_OP_DEST_IN 

Keep destination only where source exists.

GD_OP_DEST_OUT 

Keep destination only where source is transparent.

GD_OP_DEST_ATOP 

Destination atop source.

GD_OP_XOR 

Source and destination outside their overlap.

GD_OP_ADD 

Add source and destination.

GD_OP_SATURATE 

Saturating source-over operation.

GD_OP_MULTIPLY 

Multiply blend mode.

GD_OP_SCREEN 

Screen blend mode.

GD_OP_OVERLAY 

Overlay blend mode.

GD_OP_DARKEN 

Darken blend mode.

GD_OP_LIGHTEN 

Lighten blend mode.

GD_OP_COLOR_DODGE 

Color dodge blend mode.

GD_OP_COLOR_BURN 

Color burn blend mode.

GD_OP_HARD_LIGHT 

Hard light blend mode.

GD_OP_SOFT_LIGHT 

Soft light blend mode.

GD_OP_DIFFERENCE 

Difference blend mode.

GD_OP_EXCLUSION 

Exclusion blend mode.

GD_OP_HSL_HUE 

HSL hue blend mode.

GD_OP_HSL_SATURATION 

HSL saturation blend mode.

GD_OP_HSL_COLOR 

HSL color blend mode.

GD_OP_HSL_LUMINOSITY 

HSL luminosity blend mode.

◆ gdExtendMode

Constants: gdExtendMode

Describes how paints are sampled outside their natural bounds.

See also:

◆ gdFillRule

enum gdFillRule

Constants: gdFillRule

Rule used to decide which parts of a path are inside the fill.

See also:

Enumerator
gdFillRuleNonZero 

Non-zero winding rule.

gdFillRuleEvenOdd 

Even-odd rule.

◆ gdLineCap

enum gdLineCap

Constants: gdLineCap

Stroke endpoint style.

See also:

Enumerator
gdLineCapButt 

End the stroke at the endpoint.

gdLineCapRound 

Add a round cap.

gdLineCapSquare 

Add a square cap.

◆ gdLineJoin

enum gdLineJoin

Constants: gdLineJoin

Stroke corner style.

See also:

Enumerator
gdLineJoinMiter 

Join segments with a miter when possible.

gdLineJoinRound 

Join segments with a round corner.

gdLineJoinBevel 

Join segments with a bevel.

◆ gdPatternFilter

Constants: gdPatternFilter

Selects the image sampling quality used when an image pattern is transformed while filling or painting through the 2D API.

The constants describe the requested quality level, not a fixed low-level kernel. The exact sampler used for GOOD or BEST may change between releases to improve output while keeping the public API stable.

See also
gdContextSetPatternFilter gdPathPatternSetFilter
Enumerator
GD_PATTERN_FILTER_FAST 

Fastest sampling. Uses nearest-neighbour sampling.

GD_PATTERN_FILTER_GOOD 

Balanced quality. Uses bilinear sampling and mipmapped sampling for minification.

GD_PATTERN_FILTER_BEST 

Highest quality. Uses Mitchell bicubic sampling where appropriate and trilinear mipmapped sampling for minification.

◆ gdTextShaping

Constants: gdTextShaping

Text shaping mode.

See also:

Enumerator
GD_TEXT_SHAPING_NONE 

Basic glyph loading without complex shaping.

GD_TEXT_SHAPING_RAQM 

Use libraqm shaping when available.

◆ gdTextStatus

Constants: gdTextStatus

Status values returned by 2D text functions.

See also
gdTextError
Enumerator
GD_TEXT_OK 

The operation succeeded.

GD_TEXT_E_INVALID_ARGUMENT 

An argument was invalid.

GD_TEXT_E_UNAVAILABLE 

Required text support is unavailable.

GD_TEXT_E_FONT 

A font provider error occurred.

GD_TEXT_E_LAYOUT 

Text layout or shaping failed.

GD_TEXT_E_MEMORY 

Memory allocation failed.

Function Documentation

◆ gdContextAppendPath()

void gdContextAppendPath ( gdContextPtr  context,
gdPathPtr  path 
)

Append a path to the context's current path.

Parameters
contextThe drawing context.
pathThe path to append.

◆ gdContextClip()

int gdContextClip ( gdContextPtr  context)

Intersect the current clip with the current path and clear the path.

Returns
Non-zero on success, zero on allocation failure.

See also:

◆ gdContextClipPreserve()

int gdContextClipPreserve ( gdContextPtr  context)

Intersect the current clip with the current path without clearing the path.

Returns
Non-zero on success, zero on allocation failure.
See also
gdContextClip

◆ gdContextCreateForImage()

gdContextPtr gdContextCreateForImage ( gdImagePtr  image)

Create a 2D drawing context for a truecolor image.

The context keeps an internal premultiplied ARGB surface. Existing image pixels are loaded into the context when it is created. Use gdContextFlushImage or gdContextDestroy to write drawing results back to the image.

Parameters
imageA truecolor image.
Returns
gdContextPtr a new drawing context , or NULL if image is NULL, not truecolor, or allocation fails.

See also:

◆ gdContextDestroy()

void gdContextDestroy ( gdContextPtr  context)

Destroy a context and flush drawing changes to the backing image.

Passing NULL has no effect.

Parameters
contextThe context to destroy.
See also
gdContextDestroyNoFlush

◆ gdContextDestroyNoFlush()

void gdContextDestroyNoFlush ( gdContextPtr  context)

Destroy a context without flushing drawing changes to the backing image.

Passing NULL has no effect.

Parameters
contextThe context to destroy.
See also
gdContextDestroy

◆ gdContextFill()

void gdContextFill ( gdContextPtr  context)

Fill the current path and then clear it.

See also
gdContextFillPreserve

◆ gdContextFlushImage()

void gdContextFlushImage ( gdContextPtr  context)

Copy the context's drawing surface back into its image.

Parameters
contextThe drawing context.
See also
gdContextCreateForImage gdContextReloadImage

◆ gdContextGetImage()

gdImagePtr gdContextGetImage ( gdContextPtr  context)

Get the image associated with a context.

Parameters
contextThe drawing context.
Returns
The backing image, or NULL if context is NULL or has no backing image.

◆ gdContextGetPatternFilter()

gdPatternFilter gdContextGetPatternFilter ( gdContextPtr  context)

Get the current default image-pattern filter from a context.

Parameters
contextThe drawing context.
Returns
The current pattern filter. If context is NULL, GD_PATTERN_FILTER_GOOD is returned.
See also
gdContextSetPatternFilter

◆ gdContextReloadImage()

int gdContextReloadImage ( gdContextPtr  context)

Reload the context drawing surface from its backing image.

This discards unflushed drawing changes in the context.

Parameters
contextThe drawing context.
Returns
Non-zero on success, zero on failure.
See also
gdContextFlushImage

◆ gdContextRestore()

int gdContextRestore ( gdContextPtr  context)

Restore the most recently saved graphics state.

Parameters
contextThe drawing context.
Returns
Non-zero on success, zero if there is no saved state or context is NULL.
See also
gdContextSave

◆ gdContextRotate()

void gdContextRotate ( gdContextPtr  context,
double  radians 
)

Apply rotation to the current transformation matrix.

Parameters
contextThe drawing context.
radiansRotation angle in radians.

◆ gdContextSave()

int gdContextSave ( gdContextPtr  context)

Save the current graphics state.

The saved state includes source, operator, opacity, transform, clip, stroke settings, fill rule, font settings, and pattern filter.

Parameters
contextThe drawing context.
Returns
Non-zero on success, zero on failure.
See also
gdContextRestore

◆ gdContextSetDash()

void gdContextSetDash ( gdContextPtr  context,
double  offset,
const double *  data,
int  size 
)

Set the stroke dash pattern.

Parameters
contextThe drawing context.
offsetDash phase offset.
dataDash segment lengths.
sizeNumber of dash segment lengths.

◆ gdContextSetFontFace()

void gdContextSetFontFace ( gdContextPtr  context,
gdFontFacePtr  face 
)

Set the current font face for text operations.

The context keeps its own reference to the font face. Passing NULL clears the current font face.

Parameters
contextThe drawing context.
faceThe font face to use, or NULL.
See also
gdFontFaceCreateFromFile gdContextShowText

◆ gdContextSetFontSize()

void gdContextSetFontSize ( gdContextPtr  context,
double  size 
)

Set the current font size for text operations.

Parameters
contextThe drawing context.
sizeFont size in user-space units. Non-positive or non-finite values are ignored.

◆ gdContextSetOpacity()

void gdContextSetOpacity ( gdContextPtr  context,
double  opacity 
)

Set a global opacity multiplier for subsequent drawing.

Parameters
contextThe drawing context.
opacityOpacity value. Values are clamped to the range 0.0 to 1.0.

◆ gdContextSetOperator()

void gdContextSetOperator ( gdContextPtr  context,
gdCompositeOperator  op 
)

Set the compositing operator used for subsequent drawing.

Parameters
contextThe drawing context.
opThe compositing operator.
See also
gdCompositeOperator

◆ gdContextSetPatternFilter()

void gdContextSetPatternFilter ( gdContextPtr  context,
gdPatternFilter  filter 
)

Set the default image-pattern filter for patterns created by context source helpers such as gdContextSetSourceImage.

This value is part of the graphics state and is saved and restored by gdContextSave and gdContextRestore. It does not modify patterns that have already been created; use gdPathPatternSetFilter for explicit pattern objects.

Parameters
contextThe drawing context.
filterThe requested pattern sampling quality.
See also
gdPatternFilter gdContextGetPatternFilter gdPathPatternSetFilter

◆ gdContextSetSource()

void gdContextSetSource ( gdContextPtr  context,
gdPaintPtr  source 
)

Set the current source paint.

The context keeps its own reference to the paint. The caller may destroy its reference after this call.

Parameters
contextThe drawing context.
sourceThe paint to use for subsequent drawing.

◆ gdContextSetSourceImage()

void gdContextSetSourceImage ( gdContextPtr  context,
gdImagePtr  image,
double  x,
double  y 
)

Set the current source paint to an image pattern.

The image is snapshotted when this function is called, so later changes to the source image do not affect the pattern. The source image is positioned by translating the pattern by (x, y). The pattern inherits the context's current pattern filter; use gdContextSetPatternFilter before this call to choose FAST, GOOD, or BEST sampling for transformed image fills.

Parameters
contextThe drawing context.
imageThe image to use as the source pattern.
xThe pattern x offset in user space.
yThe pattern y offset in user space.

See also:

◆ gdContextSetSourceRgb()

void gdContextSetSourceRgb ( gdContextPtr  context,
double  r,
double  g,
double  b 
)

Set the current source paint to an opaque RGB color.

Color components use the range 0.0 to 1.0.

Parameters
contextThe drawing context.
rRed component.
gGreen component.
bBlue component.

◆ gdContextSetSourceRgba()

void gdContextSetSourceRgba ( gdContextPtr  context,
double  r,
double  g,
double  b,
double  a 
)

Set the current source paint to a solid RGBA color.

Color components use the range 0.0 to 1.0.

Parameters
contextThe drawing context.
rRed component.
gGreen component.
bBlue component.
aAlpha component.

◆ gdContextShowText()

gdTextStatus gdContextShowText ( gdContextPtr  context,
const char *  utf8,
double  x,
double  y,
const gdTextOptions options,
gdTextError err 
)

Draw UTF-8 text using the current source paint.

This appends the text path, fills it, and clears the current path as part of gdContextFill.

Parameters
contextThe drawing context.
utf8UTF-8 text.
xText origin x coordinate.
yText origin y coordinate.
optionsOptional text options, or NULL for defaults.
errOptional error output.
Returns
GD_TEXT_OK on success, or another gdTextStatus value on failure.

◆ gdContextStroke()

void gdContextStroke ( gdContextPtr  context)

Stroke the current path and then clear it.

See also
gdContextStrokePreserve

◆ gdContextTextExtents()

gdTextStatus gdContextTextExtents ( gdContextPtr  context,
const char *  utf8,
const gdTextOptions options,
gdTextExtents extents,
gdTextError err 
)

Measure UTF-8 text using the current font face and font size.

Parameters
contextThe drawing context.
utf8UTF-8 text.
optionsOptional text options, or NULL for defaults.
extentsWhere to store text metrics.
errOptional error output.
Returns
GD_TEXT_OK on success, or another gdTextStatus value on failure.

◆ gdContextTextPath()

gdTextStatus gdContextTextPath ( gdContextPtr  context,
const char *  utf8,
double  x,
double  y,
const gdTextOptions options,
gdTextError err 
)

Convert UTF-8 text to path contours and append them to the current path.

Text is positioned with its origin at (x, y). The current font face and font size are taken from the context.

Parameters
contextThe drawing context.
utf8UTF-8 text.
xText origin x coordinate.
yText origin y coordinate.
optionsOptional text options, or NULL for defaults.
errOptional error output.
Returns
GD_TEXT_OK on success, or another gdTextStatus value on failure.
See also
gdContextShowText gdContextTextExtents

◆ gdContextTransform()

void gdContextTransform ( gdContextPtr  context,
const gdPathMatrixPtr  matrix 
)

Apply an affine transformation to the current transformation matrix.

Parameters
contextThe drawing context.
matrixThe transform to apply.

◆ gdFontFaceAddRef()

gdFontFacePtr gdFontFaceAddRef ( gdFontFacePtr  face)

Add a reference to a font face.

Parameters
faceThe font face to add a reference to.
Returns
The same font face, or NULL if face is NULL.

◆ gdFontFaceCreateFromData()

gdFontFacePtr gdFontFaceCreateFromData ( const unsigned char *  data,
size_t  size,
int  face_index,
gdTextError err 
)

Load a font face from memory.

The caller must keep the data buffer alive for the lifetime of the font face.

Parameters
dataFont data.
sizeFont data size in bytes.
face_indexFace index within the font data.
errOptional error output.
Returns
A new font face, or NULL on failure.

◆ gdFontFaceCreateFromFile()

gdFontFacePtr gdFontFaceCreateFromFile ( const char *  path,
int  face_index,
gdTextError err 
)

Load a font face from a file.

Parameters
pathFont file path.
face_indexFace index within the font file.
errOptional error output.
Returns
A new font face, or NULL on failure.

◆ gdImageComposite()

int gdImageComposite ( gdImagePtr  dst,
const gdImagePtr  src,
int  dst_x,
int  dst_y,
gdCompositeOperator  op,
double  opacity,
gdRectPtr  src_region,
gdRectPtr  clip 
)

Composite a source image into a truecolor destination image.

Parameters
dstDestination image.
srcSource image.
dst_xDestination x offset.
dst_yDestination y offset.
opComposite operator.
opacityGlobal source opacity, from 0.0 to 1.0.
src_regionOptional source rectangle.
clipOptional destination clip rectangle.
Returns
GD_TRUE on success, or GD_FALSE for invalid arguments.

◆ gdPaintAddColorStopRgb()

int gdPaintAddColorStopRgb ( gdPaintPtr  paint,
double  offset,
double  r,
double  g,
double  b 
)

Add an opaque color stop to a gradient paint.

Parameters
paint- A linear or radial gradient paint.
offset- Stop offset in the range 0.0 to 1.0.
r- Red component in the range 0.0 to 1.0.
g- Green component in the range 0.0 to 1.0.
b- Blue component in the range 0.0 to 1.0.
Returns
Non-zero on success, zero on invalid input or allocation failure.

See also:

◆ gdPaintAddColorStopRgba()

int gdPaintAddColorStopRgba ( gdPaintPtr  paint,
double  offset,
double  r,
double  g,
double  b,
double  a 
)

Add a color stop with opacity to a gradient paint.

Add a color stop with opacity to a gradient paint.

Multiple stops may have the same offset. Stops are kept in insertion order for equal offsets.

Parameters
paint- A linear or radial gradient paint.
offset- Stop offset in the range 0.0 to 1.0.
r- Red component in the range 0.0 to 1.0.
g- Green component in the range 0.0 to 1.0.
b- Blue component in the range 0.0 to 1.0.
a- Alpha component in the range 0.0 to 1.0.
Returns
Non-zero on success, zero on invalid input or allocation failure.
See also
gdPaintAddColorStopRgb

◆ gdPaintCreateFromPattern()

gdPaintPtr gdPaintCreateFromPattern ( gdPathPatternPtr  pattern)

Create a paint object from an image pattern.

Create a paint object from an image pattern.

The paint holds a reference to the pattern. The caller may destroy its own pattern reference after creating the paint.

Parameters
patternThe pattern to use as a paint source.
Returns
A new paint object, or NULL on allocation failure.
See also
gdPathPatternCreateForImage gdPathPatternSetFilter gdContextSetSource

◆ gdPaintCreateLinear()

gdPaintPtr gdPaintCreateLinear ( double  x0,
double  y0,
double  x1,
double  y1 
)

Create a linear gradient paint.

The gradient parameter runs from (x0, y0) to (x1, y1). Add color stops with gdPaintAddColorStopRgb or gdPaintAddColorStopRgba.

Parameters
x0Start point x coordinate.
y0Start point y coordinate.
x1End point x coordinate.
y1End point y coordinate.
Returns
A new paint object, or NULL on invalid input or allocation failure.

◆ gdPaintCreateRadial()

gdPaintPtr gdPaintCreateRadial ( double  x0,
double  y0,
double  r0,
double  x1,
double  y1,
double  r1 
)

Create a radial gradient paint between two circles.

Create a radial gradient paint between two circles.

Add color stops with gdPaintAddColorStopRgb or gdPaintAddColorStopRgba.

Parameters
x0First circle center x coordinate.
y0First circle center y coordinate.
r0First circle radius. Must be non-negative.
x1Second circle center x coordinate.
y1Second circle center y coordinate.
r1Second circle radius. Must be non-negative.
Returns
A new paint object, or NULL on invalid input or allocation failure.

◆ gdPaintSetExtend()

int gdPaintSetExtend ( gdPaintPtr  paint,
gdExtendMode  extend 
)

Set the extend mode for a gradient or pattern paint.

Parameters
paint- The paint to update.
extend- The extend mode.
Returns
Non-zero on success, zero if the paint type or extend mode is invalid.

See also:

◆ gdPaintSetMatrix()

int gdPaintSetMatrix ( gdPaintPtr  paint,
const gdPathMatrixPtr  matrix 
)

Set the paint's pattern or gradient transform.

The matrix must be finite and invertible.

Parameters
paint- The paint to update.
matrix- The paint matrix.
Returns
Non-zero on success, zero on invalid input.

◆ gdPathAppendPath()

void gdPathAppendPath ( gdPathPtr  path,
const gdPathPtr  source 
)

Append all contours from one path to another.

Parameters
path- The destination path.
source- The path to append.

◆ gdPathArc()

void gdPathArc ( gdPathPtr  path,
double  cx,
double  cy,
double  radius,
double  angle1,
double  angle2 
)

Add a circular arc in the positive-angle direction. Angles are in radians. A line is added from the current point to the beginning of the arc when necessary.

Parameters
path- The path to modify.
cx- The center's horizontal coordinate.
cy- The center's vertical coordinate.
radius- The arc radius.
angle1- The starting angle in radians.
angle2- The ending angle in radians.

◆ gdPathArcTo()

void gdPathArcTo ( gdPathPtr  path,
double  x1,
double  y1,
double  x2,
double  y2,
double  radius 
)

Connect the current point to (x1, y1) and (x2, y2) with a circular arc tangent to both line segments. Degenerate geometry or a non-positive radius adds a line to (x1, y1).

Parameters
path- The path to modify.
x1- The corner's horizontal coordinate.
y1- The corner's vertical coordinate.
x2- The second tangent line's horizontal endpoint.
y2- The second tangent line's vertical endpoint.
radius- The arc radius.

◆ gdPathClose()

void gdPathClose ( gdPathPtr  path)

Close the current contour with a line to its starting point. An empty path or an already closed contour is unchanged.

Parameters
path- The path to modify.

◆ gdPathCreate()

gdPathPtr gdPathCreate ( void  )

Create an empty path.

Returns
A new path, or NULL if allocation fails. Destroy it with gdPathDestroy.

◆ gdPathCurveTo()

void gdPathCurveTo ( gdPathPtr  path,
double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

Add a cubic Bezier curve.

Parameters
path- The path to modify.
x1- The first control point's horizontal coordinate.
y1- The first control point's vertical coordinate.
x2- The second control point's horizontal coordinate.
y2- The second control point's vertical coordinate.
x3- The endpoint's horizontal coordinate.
y3- The endpoint's vertical coordinate.

◆ gdPathDestroy()

void gdPathDestroy ( gdPathPtr  path)

Release a path. Passing NULL has no effect.

Parameters
path- The path to release.

◆ gdPathDuplicate()

gdPathPtr gdPathDuplicate ( const gdPathPtr  path)

Create an independent copy of a path.

Parameters
path- The path to copy. Must not be NULL.
Returns
A new path, or NULL if path is NULL or allocation fails. Destroy the copy with gdPathDestroy.

◆ gdPathLineTo()

void gdPathLineTo ( gdPathPtr  path,
double  x,
double  y 
)

Add a straight line to an absolute position.

Parameters
path- The path to modify.
x- The endpoint's horizontal coordinate.
y- The endpoint's vertical coordinate.

◆ gdPathMatrixInit()

void gdPathMatrixInit ( gdPathMatrixPtr  matrix,
double  m00,
double  m10,
double  m01,
double  m11,
double  m02,
double  m12 
)

Initialize an affine transformation matrix from its six coefficients.

A point is mapped to (x * m00 + y * m01 + m02, x * m10 + y * m11 + m12).

Parameters
matrix- The matrix to initialize.
m00- The horizontal x coefficient.
m10- The vertical x coefficient.
m01- The horizontal y coefficient.
m11- The vertical y coefficient.
m02- The horizontal translation.
m12- The vertical translation.
See also
gdPathMatrixInitIdentity gdPathMatrixMap

◆ gdPathMatrixInitIdentity()

void gdPathMatrixInitIdentity ( gdPathMatrixPtr  matrix)

Initialize a matrix to the identity transformation.

Parameters
matrix- The matrix to initialize.

◆ gdPathMatrixInitRotate()

void gdPathMatrixInitRotate ( gdPathMatrixPtr  matrix,
double  radians 
)

Initialize a rotation matrix about the origin.

Parameters
matrix- The matrix to initialize.
radians- The rotation angle, in radians.

◆ gdPathMatrixInitRotateTranslate()

void gdPathMatrixInitRotateTranslate ( gdPathMatrixPtr  matrix,
double  radians,
double  x,
double  y 
)

Initialize a rotation matrix about a specified point. The point (x, y) remains unchanged by the resulting transformation.

Parameters
matrix- The matrix to initialize.
radians- The rotation angle, in radians.
x- The horizontal coordinate of the rotation center.
y- The vertical coordinate of the rotation center.

◆ gdPathMatrixInitScale()

void gdPathMatrixInitScale ( gdPathMatrixPtr  matrix,
double  x,
double  y 
)

Initialize a scaling matrix.

Parameters
matrix- The matrix to initialize.
x- The horizontal scale factor.
y- The vertical scale factor.

◆ gdPathMatrixInitShear()

void gdPathMatrixInitShear ( gdPathMatrixPtr  matrix,
double  x,
double  y 
)

Initialize a shear matrix. The shear factors are the tangents of the supplied angles.

Parameters
matrix- The matrix to initialize.
x- The horizontal shear angle, in radians.
y- The vertical shear angle, in radians.

◆ gdPathMatrixInitTranslate()

void gdPathMatrixInitTranslate ( gdPathMatrixPtr  matrix,
double  x,
double  y 
)

Initialize a translation matrix.

Parameters
matrix- The matrix to initialize.
x- The horizontal translation.
y- The vertical translation.

◆ gdPathMatrixInvert()

int gdPathMatrixInvert ( gdPathMatrixPtr  matrix)

Invert an affine transformation in place. A singular matrix is left unchanged.

Parameters
matrix- The matrix to invert.
Returns
Non-zero on success, or zero if the matrix is singular.

◆ gdPathMatrixMap()

void gdPathMatrixMap ( const gdPathMatrixPtr  matrix,
double  x,
double  y,
double *  result_x,
double *  result_y 
)

Transform a pair of coordinates.

Parameters
matrix- The transformation matrix.
x- The source horizontal coordinate.
y- The source vertical coordinate.
result_x- Where to store the transformed horizontal coordinate.
result_y- Where to store the transformed vertical coordinate.

◆ gdPathMatrixMapPoint()

void gdPathMatrixMapPoint ( const gdPathMatrixPtr  matrix,
const gdPointFPtr  src,
gdPointFPtr  dst 
)

Transform a point. src and dst may point to the same object.

Transform a point. src and dst may point to the same object.

Parameters
matrix- The transformation matrix.
src- The source point.
dst- Where to store the transformed point.

◆ gdPathMatrixMapRect()

void gdPathMatrixMapRect ( const gdPathMatrixPtr  matrix,
const gdRectFPtr  src,
gdRectFPtr  dst 
)

Transform all four corners of a rectangle and calculate their axis-aligned bounding box. src and dst may point to the same object.

Parameters
matrix- The transformation matrix.
src- The source rectangle.
dst- Where to store the transformed bounding rectangle.

◆ gdPathMatrixMultiply()

void gdPathMatrixMultiply ( gdPathMatrixPtr  matrix,
const gdPathMatrixPtr  a,
const gdPathMatrixPtr  b 
)

Compose two affine transformations. The result maps through a first and then through b. matrix may alias a or b.

Parameters
matrix- The destination matrix.
a- The transformation applied first.
b- The transformation applied second.

◆ gdPathMatrixRotate()

void gdPathMatrixRotate ( gdPathMatrixPtr  matrix,
double  radians 
)

Apply a rotation about the origin before the transformation already in a matrix.

Parameters
matrix- The matrix to modify.
radians- The rotation angle, in radians.

◆ gdPathMatrixRotateTranslate()

void gdPathMatrixRotateTranslate ( gdPathMatrixPtr  matrix,
double  radians,
double  x,
double  y 
)

Apply a rotation about a specified point before the transformation already in a matrix.

Parameters
matrix- The matrix to modify.
radians- The rotation angle, in radians.
x- The horizontal coordinate of the rotation center.
y- The vertical coordinate of the rotation center.

◆ gdPathMatrixScale()

void gdPathMatrixScale ( gdPathMatrixPtr  matrix,
double  x,
double  y 
)

Apply scaling before the transformation already in a matrix.

Parameters
matrix- The matrix to modify.
x- The horizontal scale factor.
y- The vertical scale factor.

◆ gdPathMatrixShear()

void gdPathMatrixShear ( gdPathMatrixPtr  matrix,
double  x,
double  y 
)

Apply a shear before the transformation already in a matrix.

Parameters
matrix- The matrix to modify.
x- The horizontal shear angle, in radians.
y- The vertical shear angle, in radians.

◆ gdPathMatrixTranslate()

void gdPathMatrixTranslate ( gdPathMatrixPtr  matrix,
double  x,
double  y 
)

Apply a translation before the transformation already in a matrix.

Parameters
matrix- The matrix to modify.
x- The horizontal translation.
y- The vertical translation.

◆ gdPathMoveTo()

void gdPathMoveTo ( gdPathPtr  path,
double  x,
double  y 
)

Start a new contour at an absolute position.

Parameters
path- The path to modify.
x- The horizontal coordinate.
y- The vertical coordinate.

◆ gdPathNegativeArc()

void gdPathNegativeArc ( gdPathPtr  path,
double  cx,
double  cy,
double  radius,
double  angle1,
double  angle2 
)

Add a circular arc in the negative-angle direction. Angles are in radians. A line is added from the current point to the beginning of the arc when necessary.

Parameters
path- The path to modify.
cx- The center's horizontal coordinate.
cy- The center's vertical coordinate.
radius- The arc radius.
angle1- The starting angle in radians.
angle2- The ending angle in radians.

◆ gdPathPatternCreateForImage()

gdPathPatternPtr gdPathPatternCreateForImage ( gdImagePtr  image)

Create an image pattern from a gd image.

The image contents are copied into an internal surface when the pattern is created. The new pattern uses GD_EXTEND_NONE, identity matrix, full opacity, and GD_PATTERN_FILTER_GOOD by default.

Parameters
image- The image to snapshot into a pattern.
Returns
A new pattern, or NULL on failure.

See also:

◆ gdPathPatternGetFilter()

gdPatternFilter gdPathPatternGetFilter ( gdPathPatternPtr  pattern)

Get the sampling quality for an image pattern.

Get the sampling quality for an image pattern.

Parameters
pattern- The pattern to query.
Returns
The pattern filter. If pattern is NULL, GD_PATTERN_FILTER_GOOD is returned.
See also
gdPathPatternSetFilter

◆ gdPathPatternSetExtend()

void gdPathPatternSetExtend ( gdPathPatternPtr  pattern,
gdExtendMode  extend 
)

Set how an image pattern is sampled outside its image bounds.

Set how an image pattern is sampled outside its image bounds.

Parameters
pattern- The pattern to update.
extend- The extend mode.
See also
gdExtendMode

◆ gdPathPatternSetFilter()

void gdPathPatternSetFilter ( gdPathPatternPtr  pattern,
gdPatternFilter  filter 
)

Set the sampling quality for an image pattern.

Set the sampling quality for an image pattern.

The filter is used when the pattern image is transformed during painting. FAST requests nearest-neighbour sampling, GOOD requests balanced quality, and BEST requests the highest practical software quality. The exact kernel used for GOOD or BEST is intentionally an implementation detail.

Parameters
pattern- The pattern to update.
filter- The requested pattern sampling quality.
See also
gdPatternFilter gdPathPatternGetFilter gdContextSetPatternFilter

◆ gdPathPatternSetMatrix()

void gdPathPatternSetMatrix ( gdPathPatternPtr  pattern,
gdPathMatrixPtr  matrix 
)

Set the pattern-to-user-space transform for an image pattern.

Set the pattern-to-user-space transform for an image pattern.

The matrix controls how the pattern image is positioned, scaled, rotated, or sheared before it is used as a fill source.

Parameters
pattern- The pattern to update.
matrix- The pattern matrix.
See also
gdPathMatrix gdContextSetSourceImage

◆ gdPathPatternSetOpacity()

void gdPathPatternSetOpacity ( gdPathPatternPtr  pattern,
double  opacity 
)

Set the opacity multiplier for an image pattern.

Set the opacity multiplier for an image pattern.

Parameters
pattern- The pattern to update.
opacity- The opacity value. Values are clamped to the range 0.0 to 1.0.

◆ gdPathQuadTo()

void gdPathQuadTo ( gdPathPtr  path,
double  x1,
double  y1,
double  x2,
double  y2 
)

Add a quadratic Bezier curve.

Parameters
path- The path to modify.
x1- The control point's horizontal coordinate.
y1- The control point's vertical coordinate.
x2- The endpoint's horizontal coordinate.
y2- The endpoint's vertical coordinate.

◆ gdPathRectangle()

void gdPathRectangle ( gdPathPtr  path,
double  x,
double  y,
double  width,
double  height 
)

Add a closed rectangular contour.

Parameters
path- The path to modify.
x- The rectangle's left coordinate.
y- The rectangle's top coordinate.
width- The rectangle width.
height- The rectangle height.

◆ gdPathRelCurveTo()

void gdPathRelCurveTo ( gdPathPtr  path,
double  dx1,
double  dy1,
double  dx2,
double  dy2,
double  dx3,
double  dy3 
)

Add a cubic Bezier curve using offsets from the current point.

Parameters
path- The path to modify.
dx1- The first control point's horizontal offset.
dy1- The first control point's vertical offset.
dx2- The second control point's horizontal offset.
dy2- The second control point's vertical offset.
dx3- The endpoint's horizontal offset.
dy3- The endpoint's vertical offset.

◆ gdPathRelLineTo()

void gdPathRelLineTo ( gdPathPtr  path,
double  dx,
double  dy 
)

Add a straight line using an offset from the current point.

Parameters
path- The path to modify.
dx- The horizontal offset.
dy- The vertical offset.

◆ gdPathRelMoveTo()

void gdPathRelMoveTo ( gdPathPtr  path,
double  dx,
double  dy 
)

Start a new contour at an offset from the current point. For an empty path, the offset is relative to (0, 0).

Parameters
path- The path to modify.
dx- The horizontal offset.
dy- The vertical offset.

◆ gdPathRelQuadTo()

void gdPathRelQuadTo ( gdPathPtr  path,
double  dx1,
double  dy1,
double  dx2,
double  dy2 
)

Add a quadratic Bezier curve using offsets from the current point.

Add a quadratic Bezier curve using offsets from the current point.

Parameters
path- The path to modify.
dx1- The control point's horizontal offset.
dy1- The control point's vertical offset.
dx2- The endpoint's horizontal offset.
dy2- The endpoint's vertical offset.

◆ gdPathTransform()

void gdPathTransform ( gdPathPtr  path,
const gdPathMatrixPtr  matrix 
)

Transform every point in a path in place.

Parameters
path- The path to transform.
matrix- The transformation matrix.

◆ gdTextOptionsInit()

void gdTextOptionsInit ( gdTextOptions options)

Initialize text options to defaults.

Defaults are basic shaping, line spacing of 1.0, and zeroed reserved fields.

Parameters
optionsThe options structure to initialize.