RayRgb16 class base

16-bit RGB color implementation with support for high precision color operations.

Stored internally as four separate 16-bit integer components (ARGB). Each color channel uses 16 bits (0-65535 range) for professional imaging applications.

Constructor Options:

Const constructors (compile-time constants):

  • RayRgb16() - Native 16-bit values (0-65535)
  • RayRgb16.fromRgbNative() - Native 16-bit RGB values
  • RayRgb16.fromArgbNative() - Native 16-bit ARGB values
  • RayRgb16.empty() - Transparent black

Factory constructors (runtime flexibility):

  • RayRgb16.fromComponents() - 0-255 range with num support
  • RayRgb16.fromComponentsNormalized() - 0.0-1.0 normalized values
Inheritance
Available extensions

Constructors

RayRgb16.empty()
Creates a transparent black color.
const
RayRgb16.fromComponents(num red, num green, num blue, [num alpha = 255])
Creates a RayRgb16 from individual RGBA component values (0-255).
factory
RayRgb16.fromComponentsNative(int red, int green, int blue, [int alpha = 65535])
Creates a RayRgb16 from individual RGBA component values with native 16-bit precision.
const
RayRgb16.fromComponentsNormalized(num red, num green, num blue, [num alpha = 1.0])
Creates a RayRgb16 from 0.0-1.0 normalized values.
factory
RayRgb16.fromJson(Map<String, dynamic> json)
Creates a RayRgb16 for JSON deserialization.
factory
RayRgb16.fromList(List<num> values)
Creates a RayRgb16 from a list of component values.
factory
RayRgb16.fromListNative(List<int> values)
Creates a RayRgb16 from a list of native 16-bit component values (0-65535).
RayRgb16.fromRgb8(dynamic rgb8Color)
Creates a RayRgb16 from an 8-bit RGB color, upscaling to 16-bit.
factory

Properties

alpha num
The alpha channel of this color as a normalized 8-bit value (0-255).
no setteroverride
alphaNative int
The alpha channel of this color in native 16-bit value (0-65535).
no setteroverride
alphaNormalized double
The alpha channel as a normalized value (0.0-1.0).
no setterinherited
blue num
The blue channel of this color as a normalized 8-bit value (0-255). Returns precise fractional values for 16-bit colors.
no setteroverride
blueNative int
The blue channel of this color in native 16-bit value (0-65535).
no setteroverride
blueNormalized double
The blue channel as a normalized value (0.0-1.0).
no setterinherited
colorSpace ColorSpace
The color space used by this Ray implementation.
no setteroverride
green num
The green channel of this color as a normalized 8-bit value (0-255). Returns precise fractional values for 16-bit colors.
no setteroverride
greenNative int
The green channel of this color in native 16-bit value (0-65535).
no setteroverride
greenNormalized double
The green channel as a normalized value (0.0-1.0).
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
inverse RayRgb16
Returns the color with inverted color values, preserving opacity.
no setteroverride
inversePrecise → (double, double, double, double)
Shared inverse calculation helper that preserves fractional precision. Returns inverted RGBA values as doubles to preserve precision.
no setterinherited
luminance double
Returns the relative luminance of the color (0.0 = darkest, 1.0 = lightest).
no setterinherited
opacity double
The opacity of this color (0.0 = transparent, 1.0 = opaque).
no setterinherited
red num
The red channel of this color as a normalized 8-bit value (0-255). Returns precise fractional values for 16-bit colors.
no setteroverride
redNative int
The red channel of this color in native 16-bit value (0-65535).
no setteroverride
redNormalized double
The red channel as a normalized value (0.0-1.0).
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

computeLuminance() double
Computes the relative luminance using WCAG 2.0 specification (0.0-1.0). Where R, G, B are the linearized color components.
inherited
lerp(Ray other, double t) RayRgb16
Linearly interpolates between this color and other.
override
lerpPrecise(Ray other, double t) → (double, double, double, double)
Shared lerp calculation helper that preserves fractional precision. Returns interpolated RGBA values as doubles to preserve precision.
inherited
maxContrast(Ray a, Ray b) Ray
Returns the color (a or b) with the highest contrast to this color.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toColor() Color

Available on Ray, provided by the RayToFlutterColor extension

Converts this RayRgb8 to a Flutter Color.
toColorSpace<T extends Ray>() → T
Converts this color to a different color space.
inherited
toColorWithOpacity(double opacity) Color

Available on Ray, provided by the RayToFlutterColor extension

Converts this Ray to a Flutter Color with specific opacity.
toHsl() RayHsl
Converts this color to HSL representation.
override
toJson() Map<String, dynamic>
Returns the color as a JSON-serializable value.
override
toList() List<num>
Returns the color components as a list.
override
toOklab() RayOklab
Converts this color to Oklab representation.
override
toOklch() RayOklch
Converts this color to Oklch representation.
inherited
toRgb16() RayRgb16
Converts this color to 16-bit RGB representation.
override
toRgb8() RayRgb8
Optimized bit-depth conversion methods
override
toRgbaStr() String
Converts the color to a CSS rgba() string.
inherited
toRgbStr() String
Converts the color to a CSS rgb() string.
inherited
toString() String
A string representation of this object.
override
withAlpha(double alpha) RayRgb16
Creates a new RayRgb16 with the same RGB values but a different alpha.
override
withAlphaNative(int alpha) RayRgb16
Creates a new RayRgb16 with a different alpha using native precision.
override
withBlue(double blue) RayRgb16
Creates a new RayRgb16 with a different blue component.
override
withBlueNative(int blue) RayRgb16
Creates a new RayRgb16 with a different blue component using native precision.
override
withGreen(double green) RayRgb16
Creates a new RayRgb16 with a different green component.
override
withGreenNative(int green) RayRgb16
Creates a new RayRgb16 with a different green component using native precision.
override
withOpacity(double opacity) RayRgb16
Creates a new color with different opacity (0.0-1.0).
inherited
withRed(double red) RayRgb16
Creates a new RayRgb16 with a different red component.
override
withRedNative(int red) RayRgb16
Creates a new RayRgb16 with a different red component using native precision.
override

Operators

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

Static Methods

parse(String value) RayRgb16
Parses a color string and returns a RayRgb16.
override