AndroidCanvasBackend Class

Definition

Constant alpha, blend modes and annotations (ISO 32000-2 §11.3.6, §11.6.3, §11.6.4.4, §12.5.5) on the Android canvas.

public sealed class AndroidCanvasBackend : IDisposable

Remarks

It consumes display lists only. ISO 32000-2 §8.5.3: paths fill with the non-zero winding or even-odd rule (§8.5.3.3.2, §8.5.3.3.3), open subpaths closed, a trailing lone moveto ignored and a degenerate subpath given the device pixel under it (§8.5.3.3.1), as the software rasterizer does; strokes take the line parameters of §8.4.3 (width, cap, join, miter limit, dash pattern) in user space, so a non-uniform transform gives an elliptical pen; a zero width (§8.4.3.2) is a one-pixel pen in device space, and stroke adjustment (§10.7.5) rounds the width to whole device pixels and, like the thinnest line, moves the ends of horizontal and vertical segments onto the pixel grid, as the software rasterizer does; a degenerate subpath strokes as a dot only with round caps, and a zero-length dash is capped along the path, also at the very end of a subpath (§8.5.3.2, §8.4.3.6). Clipping (§8.5.4) intersects the canvas clip with each clipping path, saved and restored with the graphics state (§8.4.2). Colours convert to RGB through GetColorConverter(PdfColorSpace, ColorConversion, PdfDefaultColorSpaces?), so the engine's colour management decides them (§8.6, §10). Every edge is anti-aliased by the canvas.

Constant alpha and blend modes (§11.3.6, §11.6.3, §11.6.4.4) are the paints' own: the alpha goes into the paint's colour and the blend mode into the paint (Android 10, API level 29, and later; earlier versions composite as Normal and report it in Diagnostics). Annotations (§12.5.5) are placed as the software rasterizer places them (§12.5.3 NoZoom, NoRotate), clipped to their rectangle and composited as a layer with their opacity and blend mode.

Text (§9.3.6, §9.4.3, §9.9): glyphs of embedded TrueType and OpenType programs are drawn by Android's font engine from a font built from the program's bytes, once per program per backend (Android 12, API level 31, and later), unhinted and positioned exactly, each glyph checked once against its outline; every other program, a glyph the engine reads differently, and every glyph when ForceOutlines is set are filled from their outlines (§9.2.4) with the non-zero rule, so they match the software rasterizer as paths do. Stroked modes stroke the outlines in user space. Glyphs drawn from their outlines where a native font was expected are reported in Diagnostics.

Images (§8.9.4, §8.9.5) become Android bitmaps once per backend, kept within the document's image cache budget (ImageCacheBudget); reduced to few enough device pixels they are resampled as the software rasterizer resamples them, otherwise the canvas samples them. Stencil masks (§8.9.6.2) are alpha bitmaps painted in the fill colour; soft and explicit masks of another size (§8.9.6.3, §11.6.5.2) mask the image in a layer. Axial and radial shadings (§8.7.4.5.3, §8.7.4.5.4) are linear and two-point conical gradient shaders (a radial shading other than growing concentric circles needs Android 12, API level 31); function-based shadings (§8.7.4.5.2) a texture; meshes (§8.7.4.5.5 to §8.7.4.5.8) are rasterized by the backend at the device's pixels and reported in Diagnostics. Tiling patterns (§8.7.3) are rendered once per scale into a bitmap tile, repeated by a bitmap shader on the lattice the software rasterizer lays.

Not drawn yet: transparency groups and soft masks (#136), drawn as their content and reported.

Reuse one instance for many renders: its Android path, paints and matrix are created once and kept, so a warm replay allocates nothing per operation. An instance renders one page at a time; use one per thread to render in parallel (a document is safe for concurrent renders while nobody changes it). Dispose it to release its Android objects.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Properties (1)

Methods (6)