Gambas Documentation - /comp/gb.cairo/cairo

# Cairo (gb.cairo)

This class is used for drawing on an Image object or any CairoSurface with the Cairo library.

Before starting drawing anything, you must call the Begin method by passing it the Image where you want to draw.

Then you can call any of the drawing methods to define paths, stroke them, fill them, and so on...

When your drawing is finished, you must call the End method.

This class is static.

Static properties | Static methods | Constants
--- | --- | ---

Returns or sets the antialiasing mode of the rasterizer used for drawing shapes.
AntiAlias
Computes a bounding box in user coordinates covering the area inside the current clip.
ClipExtents
Returns or sets the dash pattern to be used by Cairo.Stroke.
Dash
Returns or sets the offset used for drawing dashes.
DashOffset
Returns the device you are drawing on with the Cairo class.
Device
Computes a bounding box in user coordinates covering the area that would be affected, (the "inked" area), by a Fill operation given the current path and fill parameters. If the current path is empty, returns an empty rectangle ((0,0), (0,0)). surface dimensions and clipping are not taken into account.
FillExtents
Returns or sets the current fill rule within the current drawing.
FillRule
Return the font used for drawing text.
Font
Returns or sets the current line cap style within the cairo context.
LineCap
Returns or sets the current line join style within the current cairo context.
LineJoin
Returns or sets the current line width. The line width value specifies the diameter of a pen that is circular in user space, though device-space pen may be an ellipse in general due to scaling/shear/rotation of the current transformation matrix (CTM).
LineWidth
Returns or sets the current transformation matrix.
Matrix
Returns or sets the current miter limit.
MiterLimit
Returns or sets the compositing operator to be used for all drawing operations. See each one of the constants below for details on the semantics of each available compositing operator.
Operator
Computes a bounding box in user-space coordinates covering the points on the current path. If the current path is empty, returns an empty rectangle. Stroke parameters, fill rule, surface dimensions and clipping are not taken into account.
PathExtents
Returns or sets the source pattern used for drawing.
Source
Checks whether an error has previously occurred, by returning the state of the current drawing.
Status
Computes a bounding box in user coordinates covering the area that would be affected, (the "inked" area), by a Cairo.Stroke operation given the current path and stroke parameters. If the current path is empty, returns an empty rectangle. Surface dimensions and clipping are not taken into account.
StrokeExtents
Returns or sets the tolerance used when converting paths into trapezoids.
Tolerance

Adds a circular arc of the given Radius to the current path. The arc is centered at (XC, YC), begins at Angle1 and proceeds in the direction of increasing angles to end at Angle2. If Angle2 is less than Angle1 it will be progressively increased by `2 * π` until it is greater than Angle1.
Arc
ArcNegative
Starts drawing on the specified device.
Begin
Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by Cairo.Fill and according to the current fill rule (see Cairo.FillRule).
Clip
Adds a line segment to the path from the current point to the beginning of the current sub-path, (the most recent point passed to Cairo.MoveTo), and closes this sub-path. After this call the current point will be at the joined endpoint of the sub-path.
ClosePath
Creates a new Cairo pattern corresponding to an opaque or translucent color.
ColorPattern
Emits the current page for backends that support multiple pages, but doesn't clear it, so, the contents of the current page will be retained for the next page too.
CopyPage
Adds a cubic Bézier spline to the path from the current point to position (X3, Y3) in user-space coordinates, using (X1, Y1) and (X2, Y2) as the control points. After this call the current point will be (X3, Y3).
CurveTo
A drawing operator that generates the shape from a string of UTF-8 characters, rendered according to the current font.
DrawText
Ends a drawing.
End
A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled).
Fill
Creates a new Cairo pattern from an image.
ImagePattern
Tests whether the given point is inside the area that would be affected by a Cairo.Fill operation given the current path and filling parameters. surface dimensions and clipping are not taken into account.
InFill
Tests whether the given point is inside the area that would be affected by a Cairo.Stroke operation given the current path and stroking parameters. surface dimensions and clipping are not taken into account.
InStroke
Adds a line to the path from the current point to position (X, Y) in user-space coordinates. After this call the current point will be (X, Y).
LineTo
Creates a new linear gradient Cairo pattern along the line defined by (X0, Y0) and (X1, Y1), and using color stops defined by the Colors argument.
LinearGradient
A drawing operator that paints the current source using the alpha channel of pattern as a mask. (Opaque areas of pattern are painted with the source, transparent areas are not painted.)
Mask
Begin a new sub-path. After this call the current point will be (X, Y).
MoveTo
Clears the current path. After this call there will be no path and no current point.
NewPath
Begin a new sub-path.
NewSubPath
A drawing operator that paints the current source everywhere within the current clip region.
Paint
Creates a new radial gradient Cairo pattern between the two circles defined by (CX0, CY0, Radius0) and (CX1, CY1, Radius1), and using color stops defined by the Colors argument.
RadialGradient
Adds a closed sub-path rectangle of the given size to the current path at position (X, Y) in user-space coordinates.
Rectangle
Relative-coordinate version of Cairo.CurveTo.
RelCurveTo
Relative-coordinate version of Cairo.LineTo().
RelLineTo
Begin a new sub-path. After this call the current point will offset by (DX, DY).
RelMoveTo
Reset the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape containing the target surface. Equivalently, if infinity is too hard to grasp, one can imagine the clip region being reset to the exact bounds of the target surface.
ResetClip
Restores the drawing state to the state saved by a preceding call to Save and removes that state from the stack of saved states.
Restore
Modifies the current transformation matrix (CTM) by rotating the user-space axes by angle radians. The rotation of the axes takes places after any existing transformation of user space. The rotation direction for positive angles is from the positive X axis toward the positive Y axis.
Rotate
Makes a copy of the current drawing state and saves it on an internal stack of saved states.
Save
Modifies the current transformation matrix (CTM) by scaling the X and Y user-space axes by sx and sy respectively. The scaling of the axes takes place after any existing transformation of user space.
Scale
Emits and clears the current page for backends that support multiple pages.
ShowPage
Creates a new Cairo pattern corresponding to an opaque or translucent color.
SolidPattern
A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings.
Stroke
Adds closed paths for text to the current path. The generated path if filled, achieves an effect similar to that of `Cairo.DrawText`.
Text
Gets the extents for a string of text.
TextExtents
Modifies the current transformation matrix (CTM) by translating the user-space origin by (TX, TY).
Translate

Use the default antialiasing for the subsystem and target device.
AntiAliasDefault
Perform single-color antialiasing (using shades of gray for black text on a white background, for example).
AntiAliasGray
Use a bilevel alpha mask.
AntiAliasNone
Perform antialiasing by taking advantage of the order of subpixel elements on devices such as LCD panels.
AntiAliasSubPixel
Pixels outside of the source pattern are fully transparent.
ExtendNone
Pixels outside of the pattern copy the closest pixel from the source.
ExtendPad
The pattern is tiled by reflecting at the edges.
ExtendReflect
The pattern is tiled by repeating.
ExtendRepeat
Constant used to select how paths are filled.
FillRuleEvenOdd
Constant used to select how paths are filled.
FillRuleWinding
The highest-quality available, performance may not be suitable for interactive use.
FilterBest
Linear interpolation in two dimensions.
FilterBilinear
A high-performance filter, with quality similar to FilterNearest.
FilterFast
This filter value is currently unimplemented, and should not be used in current code.
FilterGaussian
A reasonable-performance filter, with quality similar to FilterBilinear.
FilterGood
Nearest-neighbor filtering.
FilterNearest
Italic font style.
FontSlantItalic
Upright font style.
FontSlantNormal
Oblique font style.
FontSlantOblique
Bold font weight.
FontWeightBold
Normal font weight.
FontWeightNormal
Specifies to render the endpoints of the path when stroking by starting(stopping) the line exactly at the start(end) point.
LineCapButt
Specifies to render the endpoints of the path when stroking by using a round ending, the center of the circle being the end point.
LineCapRound
Specifies to render the endpoints of the path when stroking by using squared ending, the center of the square being the end point.
LineCapSquare
Specifies to render the junction of two lines by using a cut-off join, the join being cut off at half the line width from the joint point.
LineJoinBevel
Specifies to render the junction of two lines by using a sharp (angled) corner.
LineJoinMiter
Specifies to render the junction of two lines by using a rounded join, the center of the circle being the joint point.
LineJoinRound
Compositing operator that draws the source on top of destination content and only there.
OperatorATop
Compositing operator that accumulates the source and destination layers.
OperatorAdd
Compositing operator that clears the destination layer (bounded).
OperatorClear
Compositing operator that ignores the source.
OperatorDest
Compositing operator that leaves the destination on top of source content and only there (unbounded).
OperatorDestATop
Compositing operator that leaves the destination only where there was source content (unbounded).
OperatorDestIn
Compositing operator that leaves the destination only where there was no source content.
OperatorDestOut
Compositing operator that draws the destination on top of the source.
OperatorDestOver
Compositing operator that draws the source where there was destination content (unbounded).
OperatorIn
Compositing operator that draws the source where there was no destination content (unbounded).
OperatorOut
Compositing operator that draws the source layer on top of the destination layer (bounded).
OperatorOver
Compositing operator that behaves like OperatorOver, but assuming source and dest are disjoint geometries.
OperatorSaturate
Compositing operator that replaces the destination layer (bounded).
OperatorSource
Compositing operator that shows source and destination where there is only one of them.
OperatorXor
This constant is used by the Status property to represent the following error:
StatusClipNotRepresentable
This constant is used by the Status property to represent the following error:
StatusFileNotFound
This constant is used by the Status property to represent the following error:
StatusFontTypeMismatch
This constant is used by the Status property to represent the following error:
StatusInvalidClusters
This constant is used by the Status property to represent the following error:
StatusInvalidContent
This constant is used by the Status property to represent the following error:
StatusInvalidDash
This constant is used by the Status property to represent the following error:
StatusInvalidDscComment
This constant is used by the Status property to represent the following error:
StatusInvalidFormat
This constant is used by the Status property to represent the following error:
StatusInvalidIndex
This constant is used by the Status property to represent the following error:
StatusInvalidMatrix
This constant is used by the Status property to represent the following error:
StatusInvalidPathData
This constant is used by the Status property to represent the following error:
StatusInvalidPopGroup
This constant is used by the Status property to represent the following error:
StatusInvalidRestore
This constant is used by the Status property to represent the following error:
StatusInvalidSlant
This constant is used by the Status property to represent the following error:
StatusInvalidStatus
This constant is used by the Status property to represent the following error:
StatusInvalidStride
This constant is used by the Status property to represent the following error:
StatusInvalidString
This constant is used by the Status property to represent the following error:
StatusInvalidVisual
This constant is used by the Status property to represent the following error:
StatusInvalidWeight
This constant is used by the Status property to represent the following error:
StatusNegativeCount
This constant is used by the Status property to represent the following error:
StatusNoCurrentPoint
This constant is used by the Status property to represent the following error:
StatusNoMemory
This constant is used by the Status property to represent the following error:
StatusNullPointer
This constant is used by the Status property to represent the following error:
StatusPatternTypeMismatch
This constant is used by the Status property to represent the following error:
StatusReadError
This constant is used by the Status property when no error has occured.
StatusSuccess
This constant is used by the Status property to represent the following error:
StatusSurfaceFinished
This constant is used by the Status property to represent the following error:
StatusSurfaceTypeMismatch
This constant is used by the Status property to represent the following error:
StatusTempFileError
This constant is used by the Status property to represent the following error:
StatusUserFontError
This constant is used by the Status property to represent the following error:
StatusUserFontImmutable
This constant is used by the Status property to represent the following error:
StatusWriteError