package matrix

Build not yet checked
  1. Overview
  2. Docs
Fast, modern terminal toolkit for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.3.0.tbz
sha256=a92cbbcbe016fb19fb0a749222da0e459a9567aef3f4c7340d9bd6b71c53ed6f
sha512=6a7ab054605538bb31a2b73a1a6d093981a2704c9f0af5852221c05735290d74aca7c7282298c4d0f91e86a800e2ccd94b4918af883cd963449c758eb6b272b3

doc/matrix.ansi/Ansi/Color/Packed/index.html

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).

Sourcetype color = t

The type for colors, Color.t.

Sourceval encode : color -> int

encode c is c packed.

Sourceval decode : int -> color

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.

Sourceval red : int -> int
Sourceval green : int -> int
Sourceval blue : int -> int
Sourceval alpha : int -> int

red p, green p, blue p and alpha p are the components of the snapshot of p, in [0;255].

Sourceval red_f : int -> float
Sourceval green_f : int -> float
Sourceval blue_f : int -> float
Sourceval alpha_f : int -> float

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].

Sourceval intent : int -> intent

intent p is the intent of p.

Sourceval indexed_slot : int -> int

indexed_slot p is the palette entry of p when intent p is Indexed _, and meaningless otherwise.

Sourceval with_alpha : int -> int -> int

with_alpha p a is p with alpha a, clamped to [0;255], and the same RGB and intent.

Sourceval blend : src:int -> dst:int -> int

blend ~src ~dst is Color.blend ~src ~dst on packed colors. It allocates nothing.

Sourceval of_rgba_f : float -> float -> float -> float -> int

of_rgba_f r g b a is Color.of_rgba_f r g b a packed.