[−][src]Module prisma::channel
Provides helper scalar and channel types used internally by the color types allowing them to be used generically over the underlying types.
There are two fundamental levels to the channel abstractions: scalars and channels.
Scalar:
A scalar in prisma is a primitive number that implements one or more of the scalar traits. These
traits and impls are found in the scalar
module and provide basic methods
defining limits and properties of each type for the various kinds of channels there are.
There are currently 5 different scalars, each corresponding with a channel type:
- AngularChannelScalar A scalar usable in angular components (eg. hue in Hsv).
- BoundedChannelScalar
A scalar that is bound between a minimum and maximum valid value. This is the base of
NormalChannelScalar
andPosNormalChannelScalar
- FreeChannelScalar A scalar that has no upper and/or lower bound. These are used in many of the CIE spaces and are limited to only float values.
- NormalChannelScalar
A scalar that is valid in the interval
[-1,1]
(eg. YCbCr). For computational simplicity,prisma
uses[-1,1]
for allNormalChannel
's regardless of the conventional range. Color models using a different standard range provide a method to convert between them. - PosNormalChannelScalar
A scalar that is valid in the interval
[0,1]
(eg. Rgb). This is analogous toNormalChannelScalar
except without negative values.
The bounded scalars support integral and floating point primitives, whereas the angular and free channels only support floats.
Channel:
A channel is a wrapper type over a scalar that provides the functionality to manipulate the channel type correctly in a generic context. A color model is built from the appropriate channel types for the model.
The channel types are named based on the scalar traits they use:
Re-exports
pub use self::angular_channel::AngularChannel; |
pub use self::bounded_channel::NormalBoundedChannel; |
pub use self::bounded_channel::PosNormalBoundedChannel; |
pub use self::cast::ChannelFormatCast; |
pub use self::free_channel::FreeChannel; |
pub use self::free_channel::PosFreeChannel; |
pub use self::scalar::AngularChannelScalar; |
pub use self::scalar::BoundedChannelScalar; |
pub use self::scalar::FreeChannelScalar; |
pub use self::scalar::NormalChannelScalar; |
pub use self::scalar::PosNormalChannelScalar; |
pub use self::traits::ChannelCast; |
pub use self::traits::ColorChannel; |
Modules
angular_channel | A channel that is represented by an angle |
bounded_channel | Channels bounded between two values |
cast | Defines ChannelFormatCast for converting between channel formats |
free_channel | Channels with no upper and/or lower bound |
scalar | The scalar traits defining what primitives can be used in channels |
traits | Traits used by the color channels |