|
LibGd 2.4.0-dev
GD Graphics library
|
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 gdContext * | gdContextPtr |
| Opaque 2D drawing context pointer. | |
| typedef struct gdPathStruct | gdPath |
| Opaque text shaping options. | |
| typedef gdPath * | gdPathPtr |
| Opaque vector path pointer. | |
| typedef struct gdPaintStruct | gdPaint |
| Opaque paint source. | |
| typedef gdPaint * | gdPaintPtr |
| Opaque paint source pointer. | |
| typedef struct gdPathPatternStruct | gdPathPattern |
| Opaque image pattern. | |
| typedef gdPathPattern * | gdPathPatternPtr |
| Opaque image pattern pointer. | |
| typedef struct gdFontFaceStruct | gdFontFace |
| Opaque font face. | |
| typedef gdFontFace * | gdFontFacePtr |
| Opaque font face pointer. | |
| typedef struct gdPathMatrixStruct | gdPathMatrix |
| Affine transformation matrix. | |
| typedef gdPathMatrix * | gdPathMatrixPtr |
| Affine transformation matrix pointer. | |
| typedef struct gdRectFStruct | gdRectF |
| Floating-point rectangle. | |
| typedef gdRectF * | gdRectFPtr |
| Floating-point rectangle pointer. | |
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. | |
Experimental 2D vector drawing API for libgd.
| 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:
| typedef gdContext* gdContextPtr |
Opaque 2D drawing context pointer.
Pointer to an opaque drawing context for the 2D API.
See also:
| typedef struct gdFontFaceStruct gdFontFace |
Opaque font face.
Opaque font face used by text APIs.
See also:
| typedef gdFontFace* gdFontFacePtr |
Opaque font face pointer.
Pointer to an opaque font face used by text APIs.
See also:
| typedef struct gdPaintStruct gdPaint |
Opaque paint source.
Opaque paint source. A paint may be a solid color, image pattern, or gradient.
See also:
| 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:
| typedef struct gdPathStruct gdPath |
Opaque text shaping options.
Opaque vector path made of contours, lines, curves, arcs, and rectangles.
See also:
| typedef struct gdPathMatrixStruct 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:
| typedef struct gdPathPatternStruct gdPathPattern |
Opaque image pattern.
Opaque image pattern used as a paint source.
See also:
| typedef gdPathPattern* gdPathPatternPtr |
Opaque image pattern pointer.
Pointer to an opaque image pattern used as a paint source.
See also:
| typedef gdPath* gdPathPtr |
Opaque vector path pointer.
Pointer to an opaque vector path made of contours, lines, curves, arcs, and rectangles.
See also:
| typedef struct gdRectFStruct gdRectF |
Floating-point rectangle.
Floating-point rectangle.
Members: x - Left coordinate. y - Top coordinate. w - Width. h - Height.
| typedef gdRectF* gdRectFPtr |
| enum gdCompositeOperator |
Constants: gdCompositeOperator
Porter-Duff and blend operators used when painting source pixels over the destination. See also:
| enum gdExtendMode |
Constants: gdExtendMode
Describes how paints are sampled outside their natural bounds.
See also:
| 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. |
| 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. |
| 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. |
| enum 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.
| enum 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. |
| enum gdTextStatus |
Constants: gdTextStatus
Status values returned by 2D text functions.
| void gdContextAppendPath | ( | gdContextPtr | context, |
| gdPathPtr | path | ||
| ) |
Append a path to the context's current path.
| context | The drawing context. |
| path | The path to append. |
| int gdContextClip | ( | gdContextPtr | context | ) |
Intersect the current clip with the current path and clear the path.
See also:
| int gdContextClipPreserve | ( | gdContextPtr | context | ) |
Intersect the current clip with the current path without clearing the path.
| 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.
| image | A truecolor image. |
See also:
| void gdContextDestroy | ( | gdContextPtr | context | ) |
Destroy a context and flush drawing changes to the backing image.
Passing NULL has no effect.
| context | The context to destroy. |
| void gdContextDestroyNoFlush | ( | gdContextPtr | context | ) |
Destroy a context without flushing drawing changes to the backing image.
Passing NULL has no effect.
| context | The context to destroy. |
| void gdContextFill | ( | gdContextPtr | context | ) |
Fill the current path and then clear it.
| void gdContextFlushImage | ( | gdContextPtr | context | ) |
Copy the context's drawing surface back into its image.
| context | The drawing context. |
| gdImagePtr gdContextGetImage | ( | gdContextPtr | context | ) |
Get the image associated with a context.
| context | The drawing context. |
| gdPatternFilter gdContextGetPatternFilter | ( | gdContextPtr | context | ) |
Get the current default image-pattern filter from a context.
| context | The drawing context. |
| int gdContextReloadImage | ( | gdContextPtr | context | ) |
Reload the context drawing surface from its backing image.
This discards unflushed drawing changes in the context.
| context | The drawing context. |
| int gdContextRestore | ( | gdContextPtr | context | ) |
Restore the most recently saved graphics state.
| context | The drawing context. |
| void gdContextRotate | ( | gdContextPtr | context, |
| double | radians | ||
| ) |
Apply rotation to the current transformation matrix.
| context | The drawing context. |
| radians | Rotation angle in radians. |
| 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.
| context | The drawing context. |
| void gdContextSetDash | ( | gdContextPtr | context, |
| double | offset, | ||
| const double * | data, | ||
| int | size | ||
| ) |
Set the stroke dash pattern.
| context | The drawing context. |
| offset | Dash phase offset. |
| data | Dash segment lengths. |
| size | Number of dash segment lengths. |
| 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.
| context | The drawing context. |
| face | The font face to use, or NULL. |
| void gdContextSetFontSize | ( | gdContextPtr | context, |
| double | size | ||
| ) |
Set the current font size for text operations.
| context | The drawing context. |
| size | Font size in user-space units. Non-positive or non-finite values are ignored. |
| void gdContextSetOpacity | ( | gdContextPtr | context, |
| double | opacity | ||
| ) |
Set a global opacity multiplier for subsequent drawing.
| context | The drawing context. |
| opacity | Opacity value. Values are clamped to the range 0.0 to 1.0. |
| void gdContextSetOperator | ( | gdContextPtr | context, |
| gdCompositeOperator | op | ||
| ) |
Set the compositing operator used for subsequent drawing.
| context | The drawing context. |
| op | The compositing operator. |
| 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.
| context | The drawing context. |
| filter | The requested pattern sampling quality. |
| 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.
| context | The drawing context. |
| source | The paint to use for subsequent drawing. |
| 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.
| context | The drawing context. |
| image | The image to use as the source pattern. |
| x | The pattern x offset in user space. |
| y | The pattern y offset in user space. |
See also:
| 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.
| context | The drawing context. |
| r | Red component. |
| g | Green component. |
| b | Blue component. |
| 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.
| context | The drawing context. |
| r | Red component. |
| g | Green component. |
| b | Blue component. |
| a | Alpha component. |
| 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.
| context | The drawing context. |
| utf8 | UTF-8 text. |
| x | Text origin x coordinate. |
| y | Text origin y coordinate. |
| options | Optional text options, or NULL for defaults. |
| err | Optional error output. |
| void gdContextStroke | ( | gdContextPtr | context | ) |
Stroke the current path and then clear it.
| 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.
| context | The drawing context. |
| utf8 | UTF-8 text. |
| options | Optional text options, or NULL for defaults. |
| extents | Where to store text metrics. |
| err | Optional error output. |
| 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.
| context | The drawing context. |
| utf8 | UTF-8 text. |
| x | Text origin x coordinate. |
| y | Text origin y coordinate. |
| options | Optional text options, or NULL for defaults. |
| err | Optional error output. |
| void gdContextTransform | ( | gdContextPtr | context, |
| const gdPathMatrixPtr | matrix | ||
| ) |
Apply an affine transformation to the current transformation matrix.
| context | The drawing context. |
| matrix | The transform to apply. |
| gdFontFacePtr gdFontFaceAddRef | ( | gdFontFacePtr | face | ) |
Add a reference to a font face.
| face | The font face to add a reference to. |
| 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.
| data | Font data. |
| size | Font data size in bytes. |
| face_index | Face index within the font data. |
| err | Optional error output. |
| gdFontFacePtr gdFontFaceCreateFromFile | ( | const char * | path, |
| int | face_index, | ||
| gdTextError * | err | ||
| ) |
Load a font face from a file.
| path | Font file path. |
| face_index | Face index within the font file. |
| err | Optional error output. |
| 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.
| dst | Destination image. |
| src | Source image. |
| dst_x | Destination x offset. |
| dst_y | Destination y offset. |
| op | Composite operator. |
| opacity | Global source opacity, from 0.0 to 1.0. |
| src_region | Optional source rectangle. |
| clip | Optional destination clip rectangle. |
| int gdPaintAddColorStopRgb | ( | gdPaintPtr | paint, |
| double | offset, | ||
| double | r, | ||
| double | g, | ||
| double | b | ||
| ) |
Add an opaque color stop to a gradient paint.
| 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. |
See also:
| 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.
| 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. |
| 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.
| pattern | The pattern to use as a paint source. |
| 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.
| x0 | Start point x coordinate. |
| y0 | Start point y coordinate. |
| x1 | End point x coordinate. |
| y1 | End point y coordinate. |
| 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.
| x0 | First circle center x coordinate. |
| y0 | First circle center y coordinate. |
| r0 | First circle radius. Must be non-negative. |
| x1 | Second circle center x coordinate. |
| y1 | Second circle center y coordinate. |
| r1 | Second circle radius. Must be non-negative. |
| int gdPaintSetExtend | ( | gdPaintPtr | paint, |
| gdExtendMode | extend | ||
| ) |
Set the extend mode for a gradient or pattern paint.
| paint | - The paint to update. |
| extend | - The extend mode. |
See also:
| int gdPaintSetMatrix | ( | gdPaintPtr | paint, |
| const gdPathMatrixPtr | matrix | ||
| ) |
Set the paint's pattern or gradient transform.
The matrix must be finite and invertible.
| paint | - The paint to update. |
| matrix | - The paint matrix. |
| void gdPathAppendPath | ( | gdPathPtr | path, |
| const gdPathPtr | source | ||
| ) |
Append all contours from one path to another.
| path | - The destination path. |
| source | - The path to append. |
| 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.
| 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. |
| 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).
| 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. |
| 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.
| path | - The path to modify. |
| gdPathPtr gdPathCreate | ( | void | ) |
Create an empty path.
| void gdPathCurveTo | ( | gdPathPtr | path, |
| double | x1, | ||
| double | y1, | ||
| double | x2, | ||
| double | y2, | ||
| double | x3, | ||
| double | y3 | ||
| ) |
Add a cubic Bezier curve.
| 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. |
| void gdPathDestroy | ( | gdPathPtr | path | ) |
Release a path. Passing NULL has no effect.
| path | - The path to release. |
| gdPathPtr gdPathDuplicate | ( | const gdPathPtr | path | ) |
Create an independent copy of a path.
| path | - The path to copy. Must not be NULL. |
| void gdPathLineTo | ( | gdPathPtr | path, |
| double | x, | ||
| double | y | ||
| ) |
Add a straight line to an absolute position.
| path | - The path to modify. |
| x | - The endpoint's horizontal coordinate. |
| y | - The endpoint's vertical coordinate. |
| 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).
| 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. |
| void gdPathMatrixInitIdentity | ( | gdPathMatrixPtr | matrix | ) |
Initialize a matrix to the identity transformation.
| matrix | - The matrix to initialize. |
| void gdPathMatrixInitRotate | ( | gdPathMatrixPtr | matrix, |
| double | radians | ||
| ) |
Initialize a rotation matrix about the origin.
| matrix | - The matrix to initialize. |
| radians | - The rotation angle, in radians. |
| 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.
| 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. |
| void gdPathMatrixInitScale | ( | gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y | ||
| ) |
Initialize a scaling matrix.
| matrix | - The matrix to initialize. |
| x | - The horizontal scale factor. |
| y | - The vertical scale factor. |
| void gdPathMatrixInitShear | ( | gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y | ||
| ) |
Initialize a shear matrix. The shear factors are the tangents of the supplied angles.
| matrix | - The matrix to initialize. |
| x | - The horizontal shear angle, in radians. |
| y | - The vertical shear angle, in radians. |
| void gdPathMatrixInitTranslate | ( | gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y | ||
| ) |
Initialize a translation matrix.
| matrix | - The matrix to initialize. |
| x | - The horizontal translation. |
| y | - The vertical translation. |
| int gdPathMatrixInvert | ( | gdPathMatrixPtr | matrix | ) |
Invert an affine transformation in place. A singular matrix is left unchanged.
| matrix | - The matrix to invert. |
| void gdPathMatrixMap | ( | const gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y, | ||
| double * | result_x, | ||
| double * | result_y | ||
| ) |
Transform a pair of coordinates.
| 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. |
| 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.
| matrix | - The transformation matrix. |
| src | - The source point. |
| dst | - Where to store the transformed point. |
| 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.
| matrix | - The transformation matrix. |
| src | - The source rectangle. |
| dst | - Where to store the transformed bounding rectangle. |
| 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.
| matrix | - The destination matrix. |
| a | - The transformation applied first. |
| b | - The transformation applied second. |
| void gdPathMatrixRotate | ( | gdPathMatrixPtr | matrix, |
| double | radians | ||
| ) |
Apply a rotation about the origin before the transformation already in a matrix.
| matrix | - The matrix to modify. |
| radians | - The rotation angle, in radians. |
| void gdPathMatrixRotateTranslate | ( | gdPathMatrixPtr | matrix, |
| double | radians, | ||
| double | x, | ||
| double | y | ||
| ) |
Apply a rotation about a specified point before the transformation already in a matrix.
| 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. |
| void gdPathMatrixScale | ( | gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y | ||
| ) |
Apply scaling before the transformation already in a matrix.
| matrix | - The matrix to modify. |
| x | - The horizontal scale factor. |
| y | - The vertical scale factor. |
| void gdPathMatrixShear | ( | gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y | ||
| ) |
Apply a shear before the transformation already in a matrix.
| matrix | - The matrix to modify. |
| x | - The horizontal shear angle, in radians. |
| y | - The vertical shear angle, in radians. |
| void gdPathMatrixTranslate | ( | gdPathMatrixPtr | matrix, |
| double | x, | ||
| double | y | ||
| ) |
Apply a translation before the transformation already in a matrix.
| matrix | - The matrix to modify. |
| x | - The horizontal translation. |
| y | - The vertical translation. |
| void gdPathMoveTo | ( | gdPathPtr | path, |
| double | x, | ||
| double | y | ||
| ) |
Start a new contour at an absolute position.
| path | - The path to modify. |
| x | - The horizontal coordinate. |
| y | - The vertical coordinate. |
| 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.
| 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. |
| 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.
| image | - The image to snapshot into a pattern. |
See also:
| gdPatternFilter gdPathPatternGetFilter | ( | gdPathPatternPtr | pattern | ) |
Get the sampling quality for an image pattern.
Get the sampling quality for an image pattern.
| pattern | - The pattern to query. |
| 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.
| pattern | - The pattern to update. |
| extend | - The extend mode. |
| 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.
| pattern | - The pattern to update. |
| filter | - The requested pattern sampling quality. |
| 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.
| pattern | - The pattern to update. |
| matrix | - The pattern matrix. |
| void gdPathPatternSetOpacity | ( | gdPathPatternPtr | pattern, |
| double | opacity | ||
| ) |
Set the opacity multiplier for an image pattern.
Set the opacity multiplier for an image pattern.
| pattern | - The pattern to update. |
| opacity | - The opacity value. Values are clamped to the range 0.0 to 1.0. |
| void gdPathQuadTo | ( | gdPathPtr | path, |
| double | x1, | ||
| double | y1, | ||
| double | x2, | ||
| double | y2 | ||
| ) |
Add a quadratic Bezier curve.
| 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. |
| void gdPathRectangle | ( | gdPathPtr | path, |
| double | x, | ||
| double | y, | ||
| double | width, | ||
| double | height | ||
| ) |
Add a closed rectangular contour.
| 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. |
| 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.
| 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. |
| void gdPathRelLineTo | ( | gdPathPtr | path, |
| double | dx, | ||
| double | dy | ||
| ) |
Add a straight line using an offset from the current point.
| path | - The path to modify. |
| dx | - The horizontal offset. |
| dy | - The vertical offset. |
| 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).
| path | - The path to modify. |
| dx | - The horizontal offset. |
| dy | - The vertical offset. |
| 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.
| 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. |
| void gdPathTransform | ( | gdPathPtr | path, |
| const gdPathMatrixPtr | matrix | ||
| ) |
Transform every point in a path in place.
| path | - The path to transform. |
| matrix | - The transformation matrix. |
| void gdTextOptionsInit | ( | gdTextOptions * | options | ) |
Initialize text options to defaults.
Defaults are basic shaping, line spacing of 1.0, and zeroed reserved fields.
| options | The options structure to initialize. |