pixelPerfect property
Draws the layer without antialiasing and on whole device pixels.
Tiles are separate drawImageRect calls that share an edge. With
antialiasing on, a shared edge that falls on a fractional coordinate is
drawn half-transparent by each tile; compositing two 50% edges leaves 25%
of the background showing through, which reads as a dark line between
tiles. It appears and disappears as the camera moves, because the
fractional part changes with it.
With antialiasing off the rasterizer gives every pixel to exactly one of the two quads, so there is no background left to show through. The layer translation is rounded to whole device pixels as well, which keeps each tile at a stable sub-pixel phase instead of crawling as the camera moves.
Turn it off for layers that rely on smooth (non pixel-art) edges.
Implementation
bool get pixelPerfect => _pixelPerfect;
Implementation
set pixelPerfect(bool value) {
if (_pixelPerfect == value) {
return;
}
_pixelPerfect = value;
paint.isAntiAlias = !value;
}