PixelGrid class final

The screen's device-pixel grid, in logical pixels: snapping a formula's origin and its thin rules onto it keeps a 1px bar one crisp line rather than a grey smear across two rows.

A devicePixelRatio of 0 (unknown) snaps nothing.

Constructors

PixelGrid(double devicePixelRatio)
The grid for devicePixelRatio device pixels per logical pixel.
const

Properties

devicePixelRatio → double
Device pixels per logical pixel; 0 for none.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rule(double start, double length) → (double, double)
One axis of a rule, start and length in logical pixels, as (start, length) on the grid when it is thin (under four device pixels): the length rounds to whole pixels, at least one, about the same centre. Longer extents are left alone, so a bar still meets the glyph it joins (a radical's surd) exactly along its length.
snap(Offset o) → Offset
o rounded to the nearest device pixel.
snapOnCanvas(Canvas canvas, Offset o) → Offset
o, a point in canvas's current coordinates, moved so it lands on a device pixel: for painters that know only their canvas (a CustomPainter), not their offset. Left alone under a transform that scales, skews or rotates.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

none → const PixelGrid
No snapping.