Clip enum

Different ways to clip content.

See also:

Inheritance
Available extensions

Values

none → const Clip

No clip at all.

This is the default option for most widgets: if the content does not overflow the widget boundary, don't pay any performance cost for clipping.

If the content does overflow, consider the following Clip options:

hardEdge → const Clip

Clip, but do not apply anti-aliasing.

This mode enables clipping, but curves and non-axis-aligned straight lines will be jagged as no effort is made to anti-alias.

Faster than other clipping modes, but slower than none.

This is a reasonable choice when clipping is needed, if the container is an axis- aligned rectangle or an axis-aligned rounded rectangle with very small corner radii.

See also:

  • antiAlias, recommended when clipping is needed and the shape is not an axis-aligned rectangle.
antiAlias → const Clip

Clip with anti-aliasing.

This mode has anti-aliased clipping edges, which reduces jagged edges when the clip shape itself has edges that are diagonal, curved, or otherwise not axis-aligned.

This is much faster than antiAliasWithSaveLayer, but slower than hardEdge.

Unlike hardEdge and antiAliasWithSaveLayer, this clipping can have bleeding edge artifacts (Skia Fiddle example).

See also:

antiAliasWithSaveLayer → const Clip

Clip with anti-aliasing and saveLayer immediately following the clip.

This mode not only clips with anti-aliasing, but also allocates an offscreen buffer. All subsequent paints are carried out on that buffer before finally being clipped and composited back.

This is very slow. It has no bleeding edge artifacts, unlike antiAlias, but it changes the semantics as it introduces an offscreen buffer. For example, see this Skia Fiddle without saveLayer and this Skia Fiddle with saveLayer.

Use this mode only if necessary. For example, if you have an image overlaid on a very different background color. In these cases, consider if you can avoid overlaying multiple colors in one location (e.g. by having the background color only present where the image is absent). If possible, prefer antiAlias as it is much faster.

See also:

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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
toString() String
A string representation of this object.
inherited

Operators

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

Constants

values → const List<Clip>
A constant List of the values in this enum, in order of their declaration.