OMeshRect class

A Two Dimensional free-form rectangular mesh gradient defintion.

It is defined by a grid of vertices.

Vertices are defined by a normalized position in the range of 0.0 to 1.0, being the origin (position x=0.0, y=0.0) the top-left corner of the painted area and the bottom-right corner (position x=1.0, y=1.0). See the property vertices for more.

Vertices can be colored by assigning a color to each vertex. See the property colors for more.

Annotations

Constructors

OMeshRect.new({required int width, required int height, required List<OVertex> vertices, required List<Color?> colors, Color? fallbackColor, Color? backgroundColor, OMeshColorSpace? colorSpace, bool? smoothColors = true})
Creates a new OMeshRect.
const
OMeshRect.fromHash({required String hash})
Creates a new OMeshRect from a hash string.
factory
OMeshRect.lerp(OMeshRect a, OMeshRect b, double t)
Linearly interpolates between two OMeshRects.
factory

Properties

backgroundColor Color?
The color to use as background of the painted area.
final
colors List<Color?>
The color assigned to each vertex in the mesh.
final
colorSpace OMeshColorSpace
The color space used to interpolate colors.
final
fallbackColor Color?
The color to use when a corner vertex (a vertex that sits on the edge of the mesh) does not have a color assigned.
final
hashCode int
The hash code for this object.
no setteroverride
height int
The height of the mesh in number of vertices.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smoothColors bool
Whether to interpolate colors smoothly. If false, colors will be interpolated in a linear fashion from the lines of the mesh.
final
vertices List<OVertex>
The list of the positions of each vertex in the mesh.
final
width int
The width of the mesh in number of vertices.
final

Methods

clone() OMeshRect
Creates a copy of this OMeshRect.
copyWith({int? width, int? height, List<OVertex>? vertices, List<Color?>? colors, Color? fallbackColor, Color? backgroundColor, OMeshColorSpace? colorSpace, bool? smoothColors}) OMeshRect
Returns a new OMeshRect with the given properties.
getHash() String
Returns a hash string that represents the mesh.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setBackgroundColor(Color? backgroundColor) OMeshRect
Returns a new OMeshRect with the given backgroundColor.
setColor(Color? color, {required int onIndex}) OMeshRect
Returns a new OMeshRect with the given color at the given onIndex.
setColors(List<Color?> colors) OMeshRect
Returns a new OMeshRect with the given colors.
setColorSpace(OMeshColorSpace colorSpace) OMeshRect
Returns a new OMeshRect with the given colorSpace.
setFallbackColor(Color fallbackColor) OMeshRect
Returns a new OMeshRect with the given fallbackColor.
setSmoothColors(bool smoothColors) OMeshRect
Returns a new OMeshRect with the given smoothColors.
setVertex(OVertex vertex, {required int onIndex}) OMeshRect
Returns a new OMeshRect with the given vertex at the given onIndex.
setVertices(List<OVertex> vertices) OMeshRect
Returns a new OMeshRect with the given vertices.
toString() String
A string representation of this object.
override

Operators

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