Skip to main content

Module color

Module color 

Source
Expand description

Color types and operations.

Port of agg_color_rgba.h, agg_color_rgba.cpp, and agg_color_gray.h.

Provides RGBA and grayscale color types at different precisions:

  • Rgba — f64 components (linear working space)
  • Rgba8 — u8 components (8-bit per channel)
  • Rgba16 — u16 components (16-bit per channel)
  • Gray8 — u8 grayscale + alpha
  • Gray16 — u16 grayscale + alpha

Note: sRGB colorspace variants (srgba8, sgray8) from the C++ code are not included in Phase 1. They will be added when needed (they require sRGB lookup table infrastructure).

Structs§

Gray8
Grayscale color with u8 components (value + alpha). Port of C++ gray8T<linear>.
Gray16
Grayscale color with u16 components (value + alpha). Port of C++ gray16.
OrderAbgr
ABGR component order: A=0, B=1, G=2, R=3
OrderArgb
ARGB component order: A=0, R=1, G=2, B=3
OrderBgr
BGR component order: B=0, G=1, R=2
OrderBgra
BGRA component order: B=0, G=1, R=2, A=3
OrderRgb
RGB component order: R=0, G=1, B=2
OrderRgba
RGBA component order: R=0, G=1, B=2, A=3
Rgba
RGBA color with f64 components in range [0, 1]. Port of C++ rgba.
Rgba8
RGBA color with u8 components. Port of C++ rgba8T<linear> (linear colorspace variant).
Rgba16
RGBA color with u16 components. Port of C++ rgba16.

Functions§

argb8_packed
Create an Rgba8 from a packed ARGB value (0xAARRGGBB).
bgr8_packed
Create an Rgba8 from a packed BGR value (0xBBGGRR).
rgb8_packed
Create an Rgba8 from a packed RGB value (0xRRGGBB).
rgba_pre
Create a pre-multiplied Rgba color.