create method

  1. @override
P create({
  1. C? red,
  2. C? green,
  3. C? blue,
  4. C? alpha,
})
override

Creates a new pixel with the given channel values.

The red, green, blue, and alpha values are optional.

If omitted, the corresponding channel value is set to the minimum value, except for the alpha channel which is set to the maximum value by default.

Example

// Creating a fully opaque red pixel.
final pixel = abgr8888.create(red: 0xFF);

// Creating a semi-transparent red pixel.
final pixel = abgr8888.create(red: 0xFF, alpha: 0x80);

Implementation

@override
P create({
  C? red,
  C? green,
  C? blue,
  C? alpha,
}) {
  return copyWith(
    zero,
    red: red ?? minRed,
    green: green ?? minGreen,
    blue: blue ?? minBlue,
    alpha: alpha ?? maxAlpha,
  );
}