package matrix
Module Color.PackedSource
Colors as immediate integers, for code that stores many colors, such as the planes of a grid.
A packed color is encode c. Its bit layout is private to this module, so code stores and compares packed colors and reads them only with these functions. The module requires a 64-bit platform (Sys.int_size >= 62).
decode p is the color p packs. Bits outside those of a packed color are ignored, and an integer whose intent bits are invalid decodes to default_bg.
red p, green p, blue p and alpha p are the components of the snapshot of p, in [0;255].
red_f p, green_f p, blue_f p and alpha_f p are the components of the snapshot of p, in [0.0;1.0].
indexed_slot p is the palette entry of p when intent p is Indexed _, and meaningless otherwise.
with_alpha p a is p with alpha a, clamped to [0;255], and the same RGB and intent.
blend ~src ~dst is Color.blend ~src ~dst on packed colors. It allocates nothing.
of_rgba_f r g b a is Color.of_rgba_f r g b a packed.