(class)
public final Pixel
Represents a pixel, holding the red, green, blue, and alpha channels.
Description
The channels are stored in an arbitrary internal format but are guaranteed to contain at least 8 bits of precision and can be interpreted as either floating point values or
uint8s.
- A floating point value of 0.0 corresponds to a uint8 value of 0.
- A floating point value of 1.0 corresponds to a uint8 value of 255.
- Float values less than 0.0 are saturated to 0.0.
- Float values greater than 1.0 are saturated to 1.0.
| create: | Creates a Pixel from floating point red, green, blue, and alpha components. |
| factory public inline | {Pixel.create}:Pixel |
| from-float: | Creates a Pixel from floating point red, green, blue, and alpha components. |
| factory public inline | {Pixel.from-float}:Pixel |
| from-int: | Constructs a Pixel from int alpha, red, green and blue components. |
| factory public inline | {Pixel.from-int}:Pixel |
| from-uint8: | Constructs a Pixel from uint8 alpha, red, green and blue components. |
| constructor public inline | {Pixel.from-uint8} |
| factory public implicit inline | {Pixel.uninitialized}:Pixel |
| alpha: | Returns the alpha component of a Pixel as a float. |
accessor public final inline Pixel.alpha:
float
accessor public final inline Pixel.alpha-as-uint8:
uint8
| blue: | Returns the blue component of a Pixel as a float. |
accessor public final inline Pixel.blue:
float
accessor public final inline Pixel.blue-as-uint8:
uint8
| green: | Returns the green component of a Pixel as a float. |
accessor public final inline Pixel.green:
float
accessor public final inline Pixel.green-as-uint8:
uint8
| red: | Returns the red component of a Pixel as a float. |
accessor public final inline Pixel.red:
float
accessor public final inline Pixel.red-as-uint8:
uint8
| average2: | Averages the values of two pixels. |
| average4: | Averages the values of four pixels. |
| public inline | {Pixel.average4}:Pixel |
| divide: | Divides a Pixel by a specified value. |
| public | {Pixel.interpolate}:Pixel |
| public inline | {Pixel.interpolate-0-to-256}:Pixel |
| public | {Pixel.interpolate-float}:Pixel |
| multiply: | Multiplies a Pixel by a specified value. |
| subtract: | Subtracts one Pixel from another. |
(factory)
| public inline | {Pixel.create}:Pixel |
Creates a Pixel from floating point red, green, blue, and alpha components.
red, green, blue: The red, green, and blue values.
alpha: The alpha value.
Notes
Components are saturated to [0,1] scale.
Returns
The created Pixel.
(factory)
| public inline | {Pixel.from-float}:Pixel |
Creates a Pixel from floating point red, green, blue, and alpha components.
red, green, blue: The red, green, and blue values.
alpha: The alpha value.
Notes
Components are clamped to [0,1] scale.
Returns
The created Pixel.
(factory)
| public inline | {Pixel.from-int}:Pixel |
Constructs a Pixel from int alpha, red, green and blue components.
red, green, blue: The red, green and blue values.
alpha: The alpha value.
Notes
Components are saturated to [0,255] scale.
Returns
The created Pixel.
(constructor)
| public inline | {Pixel.from-uint8} |
Constructs a Pixel from uint8 alpha, red, green and blue components.
red, green, blue: The red, green and blue values.
alpha: The alpha value.
Returns
The created Pixel.
(factory)
| public implicit inline | {Pixel.uninitialized}:Pixel |
Constructs uninitialized value for pixel.
Description
Introduced in:
version 6.0
(accessor)
accessor public final inline Pixel.alpha:
float Returns the alpha component of a Pixel as a float.
(accessor)
accessor public final inline Pixel.alpha-as-uint8:
uint8 Returns the alpha component of a Pixel as a uint8.
(accessor)
accessor public final inline Pixel.blue:
float Returns the blue component of a Pixel as a float.
(accessor)
accessor public final inline Pixel.blue-as-uint8:
uint8 Returns the blue component of a Pixel as a uint8.
(accessor)
accessor public final inline Pixel.green:
float Returns the green component of a Pixel as a float.
(accessor)
accessor public final inline Pixel.green-as-uint8:
uint8 Returns the green component of a Pixel as a uint8.
(accessor)
accessor public final inline Pixel.red:
float Returns the red component of a Pixel as a float.
(accessor)
accessor public final inline Pixel.red-as-uint8:
uint8 Returns the red component of a Pixel as a uint8.
(class proc)
Adds two Pixels.
Description
Adds the pixels by adding their corresponding alpha, red, green, and blue channels.
pixel0, pixel1: the pixels to add.
Returns
A pixel whose value is the computed sum.
(class proc)
Averages the values of two pixels.
Description
It computes the average by averaging each channel.
pixel0, pixel1: The pixels whose values are averaged.
Returns
A Pixel whose value is the averaged value.
(class proc)
| public inline | {Pixel.average4}:Pixel |
Averages the values of four pixels.
Description
It computes the average by averaging each channel.
pixel0, pixel1, pixel2, pixel3: The pixels whose values are averaged.
Returns
A Pixel whose value is the averaged value.
(class proc)
Divides a Pixel by a specified value.
Description
Returns a Pixel whose value is pixel / divisor.
Returns
A pixel whose value is the computed value.
(class proc)
| public | {Pixel.interpolate}:Pixel |
Blends two Pixels by using a blend factor, specified as a Fraction in the range [0, 1].
Description
The blended pixel is computed as: pixel0 * (1 - blend-factor) + pixel1 * blend-factor
pixel0: The pixel whose channels are each multiplied by (1 - blend-factor) to compute the blended pixel.
blend-factor: The blend factor. blend-factor must be in the range [0, 1].
pixel1: The pixel whose channels are each multiplied by blend-factor to compute the blended pixel.
Returns
A Pixel whose value is the blended result.
(class proc)
| public inline | {Pixel.interpolate-0-to-256}:Pixel |
Blends two Pixels by using a blend factor, specified as an int in the range [0, 256].
Description
The blended pixel is computed as: pixel0 * (1 - blend-factor/256) + pixel1 * blend-factor/256
pixel0: The pixel whose channels are each multiplied by (1 - blend-factor/256) to compute the blended pixel.
blend-factor: The blend factor. blend-factor must be in the range [0, 256].
pixel1: The pixel whose channels are each multiplied by blend-factor/256 to compute the blended pixel.
Returns
A Pixel whose value is the blended result.
Notes
Using a scale of blend-factor=[0,256] instead of [0,255] allows certain optimizations.
(class proc)
| public | {Pixel.interpolate-float}:Pixel |
Blends two Pixels by using a blend factor, specified as a Fraction in the range [0, 1].
Description
The blended pixel is computed as: pixel0 * (1 - blend-factor) + pixel1 * blend-factor
pixel0: The pixel whose channels are each multiplied by (1 - blend-factor) to compute the blended pixel.
blend-factor: The blend factor. blend-factor must be in the range [0, 1].
pixel1: The pixel whose channels are each multiplied by blend-factor to compute the blended pixel.
Returns
A Pixel whose value is the blended result.
(class proc)
Multiplies two Pixels.
Description
Returns a Pixel whose value is pixel0 * pixel1.
Returns
A pixel whose value is the computed product.
(class proc)
Multiplies a Pixel by a specified value.
Description
Returns a Pixel whose value is p * m.
Returns
A pixel whose value is the computed product.
(class proc)
Subtracts one Pixel from another.
Description
Returns a Pixel whose value is pixel0 - pixel1.
Returns
A pixel whose value is the computed difference.