Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
.Cairo.Font
Cairo
AntiAlias
AntiAliasDefault
AntiAliasGray
AntiAliasNone
AntiAliasSubPixel
Arc
ArcNegative
Begin
Clip
ClipExtents
ClosePath
ColorPattern
CopyPage
CurveTo
Dash
DashOffset
Device
DrawText
End
ExtendNone
ExtendPad
ExtendReflect
ExtendRepeat
Fill
FillExtents
FillRule
FillRuleEvenOdd
FillRuleWinding
FilterBest
FilterBilinear
FilterFast
FilterGaussian
FilterGood
FilterNearest
Font
FontSlantItalic
FontSlantNormal
FontSlantOblique
FontWeightBold
FontWeightNormal
ImagePattern
InFill
InStroke
LinearGradient
LineCap
LineCapButt
LineCapRound
LineCapSquare
LineJoin
LineJoinBevel
LineJoinMiter
LineJoinRound
LineTo
LineWidth
Mask
Matrix
MiterLimit
MoveTo
NewPath
NewSubPath
Operator
OperatorAdd
OperatorATop
OperatorClear
OperatorDest
OperatorDestATop
OperatorDestIn
OperatorDestOut
OperatorDestOver
OperatorIn
OperatorOut
OperatorOver
OperatorSaturate
OperatorSource
OperatorXor
Paint
PathExtents
RadialGradient
Rectangle
RelCurveTo
RelLineTo
RelMoveTo
ResetClip
Restore
Rotate
Save
Scale
ShowPage
SolidPattern
Source
Status
StatusClipNotRepresentable
StatusFileNotFound
StatusFontTypeMismatch
StatusInvalidClusters
StatusInvalidContent
StatusInvalidDash
StatusInvalidDscComment
StatusInvalidFormat
StatusInvalidIndex
StatusInvalidMatrix
StatusInvalidPathData
StatusInvalidPopGroup
StatusInvalidRestore
StatusInvalidSlant
StatusInvalidStatus
StatusInvalidStride
StatusInvalidString
StatusInvalidVisual
StatusInvalidWeight
StatusNegativeCount
StatusNoCurrentPoint
StatusNoMemory
StatusNullPointer
StatusPatternTypeMismatch
StatusReadError
StatusSuccess
StatusSurfaceFinished
StatusSurfaceTypeMismatch
StatusTempFileError
StatusUserFontError
StatusUserFontImmutable
StatusWriteError
Stroke
StrokeExtents
Text
TextExtents
Tolerance
Translate
CairoExtents
CairoFontExtents
CairoMatrix
CairoPattern
CairoPdfSurface
CairoPsSurface
CairoSurface
CairoSvgSurface
CairoTextExtents
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.ext
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mongodb
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

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.

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

Static properties
AntiAlias   Returns or sets the antialiasing mode of the rasterizer used for drawing shapes.
ClipExtents   Computes a bounding box in user coordinates covering the area inside the current clip.
Dash   Returns or sets the dash pattern to be used by Cairo.Stroke.
DashOffset   Returns or sets the offset used for drawing dashes.
Device   Returns the device you are drawing on with the Cairo class.
FillExtents   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.
FillRule   Returns or sets the current fill rule within the current drawing.
Font   Return the font used for drawing text.
LineCap   Returns or sets the current line cap style within the cairo context.
LineJoin   Returns or sets the current line join style within the current cairo context.
LineWidth   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).
Matrix   Returns or sets the current transformation matrix.
MiterLimit   Returns or sets the current miter limit.
Operator   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.
PathExtents   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.
Source   Returns or sets the source pattern used for drawing.
Status   Checks whether an error has previously occurred, by returning the state of the current drawing.
StrokeExtents   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.
Tolerance   Returns or sets the tolerance used when converting paths into trapezoids.

Static methods
Arc   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.
ArcNegative  
Begin   Starts drawing on the specified device.
Clip   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).
ClosePath   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.
ColorPattern   Creates a new Cairo pattern corresponding to an opaque or translucent color.
CopyPage   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.
CurveTo   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).
DrawText   A drawing operator that generates the shape from a string of UTF-8 characters, rendered according to the current font.
End   Ends a drawing.
Fill   A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled).
ImagePattern   Creates a new Cairo pattern from an image.
InFill   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.
InStroke   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.
LineTo   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).
LinearGradient   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.
Mask   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.)
MoveTo   Begin a new sub-path. After this call the current point will be (X, Y).
NewPath   Clears the current path. After this call there will be no path and no current point.
NewSubPath   Begin a new sub-path.
Paint   A drawing operator that paints the current source everywhere within the current clip region.
RadialGradient   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.
Rectangle   Adds a closed sub-path rectangle of the given size to the current path at position (X, Y) in user-space coordinates.
RelCurveTo   Relative-coordinate version of Cairo.CurveTo.
RelLineTo   Relative-coordinate version of Cairo.LineTo().
RelMoveTo   Begin a new sub-path. After this call the current point will offset by (DX, DY).
ResetClip   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.
Restore   Restores the drawing state to the state saved by a preceding call to Save and removes that state from the stack of saved states.
Rotate   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.
Save   Makes a copy of the current drawing state and saves it on an internal stack of saved states.
Scale   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.
ShowPage   Emits and clears the current page for backends that support multiple pages.
SolidPattern   Creates a new Cairo pattern corresponding to an opaque or translucent color.
Stroke   A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings.
Text   Adds closed paths for text to the current path. The generated path if filled, achieves an effect similar to that of Cairo.DrawText.
TextExtents   Gets the extents for a string of text.
Translate   Modifies the current transformation matrix (CTM) by translating the user-space origin by (TX, TY).