Pixel (class)
public final Pixel
Import from: CURL.GUI.STANDARD. Defined in package CURL.GRAPHICS.MAP.

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.

Constructors
create:Creates a Pixel from floating point red, green, blue, and alpha components.
factory public inline {Pixel.create
red:double,
green:double,
blue:double,
alpha:double = 1.0
}:Pixel
from-float:Creates a Pixel from floating point red, green, blue, and alpha components.
factory public inline {Pixel.from-float
red:float,
green:float,
blue:float,
alpha:float = 1.0f
}:Pixel
from-int:Constructs a Pixel from int alpha, red, green and blue components.
factory public inline {Pixel.from-int
red:int,
green:int,
blue:int,
alpha:int = 255
}:Pixel
from-uint8:Constructs a Pixel from uint8 alpha, red, green and blue components.
constructor public inline {Pixel.from-uint8
red:uint8,
green:uint8,
blue:uint8,
alpha:uint8 = 255
}
uninitialized:Constructs uninitialized value for pixel.
factory public implicit inline {Pixel.uninitialized}:Pixel

Properties
alpha:Returns the alpha component of a Pixel as a float.
accessor public final inline Pixel.alpha:float
alpha-as-uint8:Returns the alpha component of a Pixel as a uint8.
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
blue-as-uint8:Returns the blue component of a Pixel as a uint8.
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
green-as-uint8:Returns the green component of a Pixel as a uint8.
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
red-as-uint8:Returns the red component of a Pixel as a uint8.
accessor public final inline Pixel.red-as-uint8:uint8

Class Procedures
add:Adds two Pixels.
public inline {Pixel.add pixel0:Pixel, pixel1:Pixel}:Pixel
average2:Averages the values of two pixels.
public inline {Pixel.average2 pixel0:Pixel, pixel1:Pixel}:Pixel
average4:Averages the values of four pixels.
public inline {Pixel.average4
pixel0:Pixel,
pixel1:Pixel,
pixel2:Pixel,
pixel3:Pixel
}:Pixel
divide:Divides a Pixel by a specified value.
public inline {Pixel.divide pixel:Pixel, divisor:double}:Pixel
interpolate:Blends two Pixels by using a blend factor, specified as a Fraction in the range [0, 1].
public {Pixel.interpolate
pixel0:Pixel,
blend-factor:Fraction,
pixel1:Pixel
}:Pixel
interpolate-0-to-256:Blends two Pixels by using a blend factor, specified as an int in the range [0, 256].
public inline {Pixel.interpolate-0-to-256
pixel0:Pixel,
blend-factor:int,
pixel1:Pixel
}:Pixel
interpolate-float:Blends two Pixels by using a blend factor, specified as a Fraction in the range [0, 1].
public {Pixel.interpolate-float
pixel0:Pixel,
blend-factor:FloatFraction,
pixel1:Pixel
}:Pixel
modulate:Multiplies two Pixels.
public inline {Pixel.modulate pixel0:Pixel, pixel1:Pixel}:Pixel
multiply:Multiplies a Pixel by a specified value.
public inline {Pixel.multiply pixel:Pixel, multiplier:double}:Pixel
subtract:Subtracts one Pixel from another.
public inline {Pixel.subtract pixel0:Pixel, pixel1:Pixel}:Pixel



Constructor Details
create (factory)
public inline {Pixel.create
red:double,
green:double,
blue:double,
alpha:double = 1.0
}: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.


from-float (factory)
public inline {Pixel.from-float
red:float,
green:float,
blue:float,
alpha:float = 1.0f
}: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.


from-int (factory)
public inline {Pixel.from-int
red:int,
green:int,
blue:int,
alpha:int = 255
}: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.


from-uint8 (constructor)
public inline {Pixel.from-uint8
red:uint8,
green:uint8,
blue:uint8,
alpha:uint8 = 255
}

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.


uninitialized (factory)
public implicit inline {Pixel.uninitialized}:Pixel

Constructs uninitialized value for pixel.

Description

Produces value with red, green, blue, and alpha set to zero.
Introduced in: version 6.0



Property Details
alpha (accessor)
accessor public final inline Pixel.alpha:float

Returns the alpha component of a Pixel as a float.



alpha-as-uint8 (accessor)
accessor public final inline Pixel.alpha-as-uint8:uint8

Returns the alpha component of a Pixel as a uint8.



blue (accessor)
accessor public final inline Pixel.blue:float

Returns the blue component of a Pixel as a float.



blue-as-uint8 (accessor)
accessor public final inline Pixel.blue-as-uint8:uint8

Returns the blue component of a Pixel as a uint8.



green (accessor)
accessor public final inline Pixel.green:float

Returns the green component of a Pixel as a float.



green-as-uint8 (accessor)
accessor public final inline Pixel.green-as-uint8:uint8

Returns the green component of a Pixel as a uint8.



red (accessor)
accessor public final inline Pixel.red:float

Returns the red component of a Pixel as a float.



red-as-uint8 (accessor)
accessor public final inline Pixel.red-as-uint8:uint8

Returns the red component of a Pixel as a uint8.





Class Procedure Details
add (class proc)
public inline {Pixel.add pixel0:Pixel, pixel1:Pixel}:Pixel

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.


average2 (class proc)
public inline {Pixel.average2 pixel0:Pixel, pixel1:Pixel}:Pixel

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.


average4 (class proc)
public inline {Pixel.average4
pixel0:Pixel,
pixel1:Pixel,
pixel2:Pixel,
pixel3:Pixel
}: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.


divide (class proc)
public inline {Pixel.divide pixel:Pixel, divisor:double}:Pixel

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.


interpolate (class proc)
public {Pixel.interpolate
pixel0:Pixel,
blend-factor:Fraction,
pixel1:Pixel
}: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.


interpolate-0-to-256 (class proc)
public inline {Pixel.interpolate-0-to-256
pixel0:Pixel,
blend-factor:int,
pixel1:Pixel
}: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.


interpolate-float (class proc)
public {Pixel.interpolate-float
pixel0:Pixel,
blend-factor:FloatFraction,
pixel1:Pixel
}: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.


modulate (class proc)
public inline {Pixel.modulate pixel0:Pixel, pixel1:Pixel}:Pixel

Multiplies two Pixels.

Description

Returns a Pixel whose value is pixel0 * pixel1.

Returns

A pixel whose value is the computed product.


multiply (class proc)
public inline {Pixel.multiply pixel:Pixel, multiplier:double}:Pixel

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.


subtract (class proc)
public inline {Pixel.subtract pixel0:Pixel, pixel1:Pixel}:Pixel

Subtracts one Pixel from another.

Description

Returns a Pixel whose value is pixel0 - pixel1.

Returns

A pixel whose value is the computed difference.