Color class abstract
The abstract Color class is the base class for all specific color classes and Pixel classes. Colors are iterable, iterating over its channels.
- Inheritance
- Implementers
Constructors
- Color()
Properties
- a ↔ num
-
Alpha channel.
getter/setter pair
- aNormalized ↔ num
-
Normalized [0, 1] alpha.
getter/setter pair
- b ↔ num
-
Blue channel.
getter/setter pair
- bNormalized ↔ num
-
Normalized [0, 1] blue.
getter/setter pair
- first → num
-
The first element.
no setterinherited
- format → Format
-
The Format of the color.
no setter
- g ↔ num
-
Green channel.
getter/setter pair
- gNormalized ↔ num
-
Normalized [0, 1] green.
getter/setter pair
- hashCode → int
-
Compute a hashCode for this color.
no setteroverride
- hasPalette → bool
-
True if the color uses a palette.
no setter
- index ↔ num
-
Palette index value (or red channel if there is no palette).
getter/setter pair
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isHdrFormat → bool
-
True if the format is high dynamic range.
no setter
- isLdrFormat → bool
-
True if the format is low dynamic range.
no setter
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
num> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setterinherited - last → num
-
The last element.
no setterinherited
- length → int
-
The number of channels used by the color.
no setteroverride
- luminance → num
-
The luminance (grayscale) of the color.
no setter
- luminanceNormalized → num
-
no setter
- maxChannelValue → num
-
The maximum value for a color channel.
no setter
- maxIndexValue → num
-
The maximum value for a palette index.
no setter
- palette → Palette?
-
The palette used by the color, or null.
no setter
- r ↔ num
-
Red channel.
getter/setter pair
- rNormalized ↔ num
-
Normalized [0, 1] red.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → num
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods
-
any(
bool test(num element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
clone(
) → Color - Returns a copy of the color.
-
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.inherited -
convert(
{Format? format, int? numChannels, num? alpha}) → Color -
Convert the
format
and/or thenumChannels
of the color. IfnumChannels
is 4 and the current color does not have an alpha value, thenalpha
can specify what value to use for the new alpha channel. Ifalpha
is not given, then maxChannelValue will be used. -
elementAt(
int index) → num -
Returns the
index
th element.inherited -
every(
bool test(num element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> toElements(num element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(num element), {num orElse()?}) → num -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, num element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< num> other) → Iterable<num> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(num element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
getChannel(
Channel channel) → num -
Get a
channel
from the color. If the channel isn't available, 0 will be returned. -
getChannelNormalized(
Channel channel) → num -
Get the normalized [0, 1] value of a
channel
from the color. If the channel isn't available, 0 will be returned. -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(num element), {num orElse()?}) → num -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T toElement(num e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduce(
num combine(num value, num element)) → num -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
set(
Color color) → void -
The the values of this color to the given
color
. -
setRgb(
num r, num g, num b) → void -
Set the individual
r
,g
,b
channels of the color. -
setRgba(
num r, num g, num b, num a) → void -
Set the individual
r
,g
,b
,a
channels of the color. -
singleWhere(
bool test(num element), {num orElse()?}) → num -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< num> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(num value)) → Iterable< num> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
take(
int count) → Iterable< num> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(num value)) → Iterable< num> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< num> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< num> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this
.inherited -
where(
bool test(num element)) → Iterable< num> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator ==(
Object? other) → bool -
Tests if this color is equivalent to another Color.
override
-
operator [](
int index) → num - Gets a channel from the color by its index.
-
operator []=(
int index, num value) → void