PictureTile class

background-image: url(dots.svg); background-size: 8px 8px: a picture drawn at a TILE of its own size and REPEATED over the box (css-backgrounds-3 3.4, 3.9) -- a grid of dots, a checker, a dotted rule -- or, with color, mask-image doing the same to a box painted in one colour (css-masking-1 7.6, 7.7: a mask is laid out like a background, and what shows is the colour as far as the tile's alpha says). No Flutter widget repeats a picture it did not decode itself: DecorationImage repeats an ImageProvider, and a vector is a widget.

The child -- the picture, an SvgPicture or an Image -- is laid out at the tile's size and painted ONCE into an image at the device's pixel ratio, which is what Chrome does with a tile (Blink records the picture into the tile and Skia rasterises that record once, then repeats the pixels); the image is then repeated as an ImageShader read pixel for pixel (FilterQuality.none) -- or, for a tile that is not a whole number of device pixels, rasterised at the next whole number up and scaled back down bilinearly, as Chrome does (see _sampling). The child is painted nowhere else, and is not hit-tested: it is a picture, not content.

The image is drawn again whenever the child paints differently. A child with LAYERS OF ITS OWN -- a RepaintBoundary round a picture that is still loading or changes, an opacity layer -- repaints them without telling its parent, so its layers are kept live in this box's own layer and the tile is rasterised again from them whenever one of them changes (in the frame it changes, as its repaint is composited).

The tile's size is width by height in logical px; null on an axis is auto (css-backgrounds-3 3.9 and css-images-3 5.3): the other axis through the picture's ratio (width over height) where it has one, else the box's. Both null is the picture's ratio at the largest size the box holds (contain), or the box itself where it has no ratio either.

x and y place the first tile in the room the box has past it, as a share, as background-position does, and dx and dy move it on by a length; every copy moves with it, laid to either side (css-backgrounds-3 3.6). The first tile starts at the box's corner SNAPPED TO A CSS PIXEL (half up), and the tiles are cut to the box's edges snapped the same way, as Blink snaps a box's paint rect.

repeatX and repeatY off lay the tile once along that axis (no-repeat). roundX and roundY are round on that axis (css-backgrounds-3 3.4): the tile is resized so that a whole number of them -- as many as come nearest, at least one -- fits the box, and where only one axis rounds and the other is auto, the other is scaled with it to keep the tile's shape.

On a spaceX (or spaceY) axis the tile is spaced (3.4): laid as many whole times as the box holds, the first against the box's near edge and the last against its far one, the room left over shared out evenly between the copies -- in Blink's 1/64 px, the remainder dropped -- and the position is not read; where the box holds fewer than two copies the tile is laid once, where x and dx put it, as no-repeat lays it (repeatX is not read on that axis either way). Chrome records the tile and the room after it as ONE cell of the pattern and rasterises that (Image::DrawPattern's spacing), and so does this: the picture drawn into the corner of a cell the gap bigger, the rest of the cell clear.

A TILE A SHARE OF THE BOX: widthFactor (or heightFactor) is the tile's side as that share of the box's, width (or height) added to it -- mask-size: 100% is widthFactor: 1 and the height through the picture's ratio (css-backgrounds-3 3.9), which is the box's size to say when it is laid out. An Indonesian news site's chevrons are a picture fitted to the width of a link a share sizes, laid again down it.

A mask color is kept where the picture is; with hole, where it is NOT -- the picture excluded from a layer that keeps the whole box, one less the picture's alpha (css-masking-1 7.9, source-xor over an opaque layer), and the whole box outside a tile laid once. With luminance the picture masks by how light it is times how opaque (css-masking-1 7.2): Blink's luma of its PREMULTIPLIED colour, 0.2126 R + 0.7152 G + 0.0722 B turned into alpha -- the tile laid over black, which makes each pixel opaque in its premultiplied colour, and its light read as the alpha; round the picture there is none.

Inheritance

Constructors

PictureTile({Key? key, double? width, double? height, double? ratio, double x = 0, double y = 0, double dx = 0, double dy = 0, bool repeatX = true, bool repeatY = true, bool roundX = false, bool roundY = false, bool spaceX = false, bool spaceY = false, double? widthFactor, double? heightFactor, Color? color, bool hole = false, bool luminance = false, required Widget child})
const

Properties

child → Widget?
The widget below this widget in the tree.
finalinherited
color → Color?
The colour a mask lets through: the tiles are painted in it, each pixel as opaque as the picture is there. Null paints the picture.
final
dx → double
final
dy → double
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
final
heightFactor → double?
The tile's side as a share of the box's, width or height added.
final
hole → bool
The mask color where the picture is not, rather than where it is.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
luminance → bool
The picture read by its luminance, not its alpha.
final
ratio → double?
final
repeatX → bool
final
repeatY → bool
final
roundX → bool
final
roundY → bool
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spaceX → bool
space along that axis: as many whole copies as the box holds, spread from edge to edge.
final
spaceY → bool
space along that axis: as many whole copies as the box holds, spread from edge to edge.
final
width → double?
final
widthFactor → double?
The tile's side as a share of the box's, width or height added.
final
x → double
final
y → double
final

Methods

createElement() → SingleChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
createRenderObject(BuildContext context) → RenderPictureTile
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
didUnmountRenderObject(covariant RenderObject renderObject) → void
This method is called when a RenderObject that was previously associated with this widget is removed from the render tree. The provided RenderObject will be of the same type as the one created by this widget's createRenderObject method.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited
updateRenderObject(BuildContext context, covariant RenderPictureTile renderObject) → void
Copies the configuration described by this RenderObjectWidget to the given RenderObject, which will be of the same type as returned by this object's createRenderObject.
override

Operators

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