Canvas

class Canvas : Closable

Provides 2D (two dimensional) graphics drawing functionality that is applied to a Surface.

class Canvas : Closable
class Canvas : Closable

Types

Companion
Link copied to clipboard
common
object Companion

Functions

changeDash
Link copied to clipboard
common
fun changeDash(dashes: DoubleArray, offset: Double)
Changes the dash pattern to be used by stroke.
fun changeDash(dashes: DoubleArray, offset: Double)
fun changeDash(dashes: DoubleArray, offset: Double)
changeSourceRgb
Link copied to clipboard
common
fun changeSourceRgb(red: Double, green: Double, blue: Double)
Changes the source pattern to an opaque color.
fun changeSourceRgb(red: Double, green: Double, blue: Double)
fun changeSourceRgb(red: Double, green: Double, blue: Double)
changeSourceRgba
Link copied to clipboard
common
fun changeSourceRgba(red: Double, green: Double, blue: Double, alpha: Double)
Sets the source pattern to a translucent color.
fun changeSourceRgba(red: Double, green: Double, blue: Double, alpha: Double)
fun changeSourceRgba(red: Double, green: Double, blue: Double, alpha: Double)
close
Link copied to clipboard
open override fun close()
open override fun close()
abstract fun close()
copyPage
Link copied to clipboard
common
fun 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.
fun copyPage()
fun copyPage()
fetchDash
Link copied to clipboard
common
fun fetchDash(): Pair<DoubleArray, Double>
Gets the current dash array.
fun fetchDash(): Pair<DoubleArray, Double>
fun fetchDash(): Pair<DoubleArray, Double>
fill
Link copied to clipboard
common
fun fill()
A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled).
fun fill()
fun fill()
fillExtents
Link copied to clipboard
common
fun fillExtents(): FillExtentsResult
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.
fun fillExtents(): FillExtentsResult
fun fillExtents(): FillExtentsResult
fillPreserve
Link copied to clipboard
common
fun fillPreserve()
A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled).
fun fillPreserve()
fun fillPreserve()
inFill
Link copied to clipboard
common
fun inFill(xPos: Double, yPos: Double): Boolean
Tests whether the given point is inside the area that would be affected by a fill operation given the current path and filling parameters.
fun inFill(xPos: Double, yPos: Double): Boolean
fun inFill(xPos: Double, yPos: Double): Boolean
inStroke
Link copied to clipboard
common
fun inStroke(xPos: Double, yPos: Double): Boolean
Tests whether the given point is inside the area that would be affected by a stroke operation given the current path and stroking parameters.
fun inStroke(xPos: Double, yPos: Double): Boolean
fun inStroke(xPos: Double, yPos: Double): Boolean
showPage
Link copied to clipboard
common
fun showPage()
Emits and clears the current page for backends that support multiple pages.
fun showPage()
fun showPage()
statusCode
Link copied to clipboard
common
fun statusCode(): UInt
Provides the status code for this Canvas.
fun statusCode(): UInt
fun statusCode(): UInt
stroke
Link copied to clipboard
common
fun stroke()
A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings.
fun stroke()
fun stroke()
strokeExtents
Link copied to clipboard
common
fun strokeExtents(): StrokeExtentsResult
Computes a bounding box in user coordinates covering the area that would be affected, (the inked area), by a stroke operation given the current path and stroke parameters.
fun strokeExtents(): StrokeExtentsResult
fun strokeExtents(): StrokeExtentsResult
strokePreserve
Link copied to clipboard
common
fun strokePreserve()
A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings.
fun strokePreserve()
fun strokePreserve()
use
Link copied to clipboard
common
fun use(init: Canvas.() -> Unit)
A DSL to use the Canvas, which is closed along with its associated Surface after init has been called.
fun use(init: Canvas.() -> Unit)
fun use(init: Canvas.() -> Unit)

Properties

cairoPtr
Link copied to clipboard
linuxArm32
val cairoPtr: CPointer<cairo_t>?
cairoPtr
Link copied to clipboard
linuxX64
val cairoPtr: CPointer<cairo_t>?
dashCount
Link copied to clipboard
val dashCount: Int
The length of the dash array, or 0 if no dash array is set.
val dashCount: Int
val dashCount: Int
fillRule
Link copied to clipboard
var fillRule: FillRule
The current fill rule for the Canvas.
var fillRule: FillRule
var fillRule: FillRule
isClosed
Link copied to clipboard
common
abstract val isClosed: Boolean
isClosed
Link copied to clipboard
linuxArm32
open override val isClosed: Boolean
isClosed
Link copied to clipboard
linuxX64
open override val isClosed: Boolean
lineCap
Link copied to clipboard
var lineCap: LineCap
The current line cap style for the Canvas.
var lineCap: LineCap
var lineCap: LineCap
lineJoin
Link copied to clipboard
var lineJoin: LineJoin
The current line join style for the Canvas.
var lineJoin: LineJoin
var lineJoin: LineJoin
lineWidth
Link copied to clipboard
var lineWidth: Double
The current line width for the Canvas.
var lineWidth: Double
var lineWidth: Double
miterLimit
Link copied to clipboard
var miterLimit: Double
The current miter limit for the Canvas.
var miterLimit: Double
var miterLimit: Double
operator
Link copied to clipboard
linuxArm32
var operator: _cairo_operator
The compositing operator to be used for ALL drawing operations.
operator
Link copied to clipboard
linuxX64
var operator: _cairo_operator
The compositing operator to be used for ALL drawing operations.
surface
Link copied to clipboard
linuxArm32
val surface: Surface
surface
Link copied to clipboard
linuxX64
val surface: Surface
tolerance
Link copied to clipboard
var tolerance: Double
The tolerance (in device units; typically pixels) used when converting paths into trapezoids.
var tolerance: Double
var tolerance: Double