CoreGraphicsCanvas

class CoreGraphicsCanvas(ctx: CGContextRef) : KiteCanvas

KiteCanvas backed by an iOS / macOS CGContextRef. Pure CoreGraphics: no Compose, no Skia. The natural choice for native iOS apps using UIKit or SwiftUI; pass the context from your custom UIView's drawRect: or the UIGraphicsImageRenderer.image { ctx in … } block straight in.

Pair with ApplePdfRasterizer for the "give me a PNG" headless use case.

Memory: every Core Foundation / Core Graphics ref we allocate (gradient, colour space, image, CFData) is paired with a release call. Nothing escapes. Kotlin/Native objects don't leak, and we never hand a CG ref to caller code.

Constructors

Link copied to clipboard
constructor(ctx: CGContextRef)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun applySoftMask(kind: SoftMask.Kind, maskBBox: KiteRectangle, maskCtm: KiteMatrix, render: () -> Unit, renderMask: (KiteCanvas) -> Unit)

open override fun applySoftMask(kind: SoftMask.Kind, maskBBox: KiteRectangle, maskCtm: KiteMatrix, transfer: KiteMaskTransfer?, render: () -> Unit, renderMask: (KiteCanvas) -> Unit)

ISO 32000-1, 11.6.5.2: the mask group draws into a bitmap of its own. Its alpha, or its luminosity over a black backdrop, becomes a grey mask that the content paints through with CGContextClipToMask. So the mask group's colours never reach the page, and each paint keeps its own blend mode against the page (#79). The transfer table maps each value of the grey mask.

Link copied to clipboard
open override fun beginPage(widthPt: Double, heightPt: Double, deviceCtm: KiteMatrix)
Link copied to clipboard
open override fun beginTransparencyGroup(bbox: KiteRectangle, ctm: KiteMatrix, isolated: Boolean, knockout: Boolean, alpha: Double, blendMode: KiteBlendMode)
Link copied to clipboard
open override fun drawGlyphs(glyphs: List<TextGlyph>, fontSize: Double, unitsPerEm: Int, hasOutlines: Boolean, fontSpec: FontSpec, textToDevice: KiteMatrix, color: RgbColor, alpha: Double, blendMode: KiteBlendMode)
Link copied to clipboard
open override fun drawImage(image: KiteImageData, ctm: KiteMatrix, alpha: Double)
open override fun drawImage(image: KiteImageData, ctm: KiteMatrix, alpha: Double, blendMode: KiteBlendMode)
Link copied to clipboard
open override fun endPage()
Link copied to clipboard
open override fun endTransparencyGroup()
Link copied to clipboard
open override fun fillPath(path: KitePath, ctm: KiteMatrix, color: RgbColor, evenOdd: Boolean, alpha: Double, blendMode: KiteBlendMode)
Link copied to clipboard
open override fun fillShading(shading: KiteShading, ctm: KiteMatrix, clipPath: KitePath?, alpha: Double, blendMode: KiteBlendMode)
Link copied to clipboard
open fun hostGlyphOutline(text: String, fontSpec: FontSpec): KitePath?
Link copied to clipboard
open override fun popClip()
Link copied to clipboard
open override fun pushClip(path: KitePath, ctm: KiteMatrix, evenOdd: Boolean)
Link copied to clipboard
open override fun strokePath(path: KitePath, ctm: KiteMatrix, color: RgbColor, lineWidth: Double, alpha: Double, blendMode: KiteBlendMode, dashArray: List<Double>?, dashPhase: Double, lineCap: Int, lineJoin: Int, miterLimit: Double)