color property

Color get color

The color to use when stroking or filling a shape.

Defaults to opaque black.

See also:

This color is not used when compositing. To colorize a layer, use colorFilter.

Implementation

Color get color {
  final double red = _data.getFloat32(_kColorRedOffset, _kFakeHostEndian);
  final double green = _data.getFloat32(_kColorGreenOffset, _kFakeHostEndian);
  final double blue = _data.getFloat32(_kColorBlueOffset, _kFakeHostEndian);
  final double alpha =
      1.0 - _data.getFloat32(_kColorAlphaOffset, _kFakeHostEndian);
  final ColorSpace colorSpace = _indexToColorSpace(
      _data.getInt32(_kColorSpaceOffset, _kFakeHostEndian));
  return Color.from(
      alpha: alpha,
      red: red,
      green: green,
      blue: blue,
      colorSpace: colorSpace);
}
set color (Color value)

Implementation

set color(Color value) {
  _data.setFloat32(_kColorRedOffset, value.r, _kFakeHostEndian);
  _data.setFloat32(_kColorGreenOffset, value.g, _kFakeHostEndian);
  _data.setFloat32(_kColorBlueOffset, value.b, _kFakeHostEndian);
  _data.setFloat32(_kColorAlphaOffset, 1.0 - value.a, _kFakeHostEndian);
  _data.setInt32(_kColorSpaceOffset, _colorSpaceToIndex(value.colorSpace),
      _kFakeHostEndian);
}