module
CrImage::Color::Color
Overview
Color can convert itself to alpha-premultiplied 160bits per channel RGBA. The conversion may be lossy. There are three important subtleties about the return values. First, the red, green and blue are alpha-premultiplied: a fully saturated red that is also 25% transparent is represented by RGBA returning a 75% r. Second, the channels have a 16-bit effective range: 100% red is represented by RGBA returning an r of 65535, not 255, so that converting from CMYK or YCbCr is not as lossy. Third, the type returned is uint32, even though the maximum value is 65535, to guarantee that multiplying two values together won't overflow. Such multiplications occur when blending two colors according to an alpha mask from a third color, in the style of Porter and Duff's classic algebra:
Defined in:
lib/crimage/src/crimage/color/color.cruing/crimage.cr
Instance Method Summary
-
#to_uing_rgba : Tuple(Float64, Float64, Float64, Float64)
Returns straight RGBA components in UIng's 0.0..1.0 range.
Instance Method Detail
Returns straight RGBA components in UIng's 0.0..1.0 range.