Cauldron3D.Frame.Pixels (Cauldron3D v0.2.2)

Copy Markdown View Source

Whole runs of RGBA pixels, four bytes each.

Cauldron3D.Frame.Pixels.lay(under, above)
Cauldron3D.Frame.Pixels.through(pixels, table)

available?/0 says whether the C library loaded. Where it did not the same bytes are made in Elixir.

Summary

Functions

Whether the library is loaded and pixels are worked in C.

above laid over under, both RGBA of the same length: where above's alpha is 255 its colour, where 0 under's pixel, and otherwise each channel div(above * a + under * (255 - a), 255) with under's alpha kept.

pixels with each red, green and blue byte v replaced by byte v of the 256-byte table; alpha kept.

Functions

available?()

@spec available?() :: boolean()

Whether the library is loaded and pixels are worked in C.

lay(under, above)

@spec lay(binary(), binary()) :: binary()

above laid over under, both RGBA of the same length: where above's alpha is 255 its colour, where 0 under's pixel, and otherwise each channel div(above * a + under * (255 - a), 255) with under's alpha kept.

through(pixels, table)

@spec through(binary(), binary()) :: binary()

pixels with each red, green and blue byte v replaced by byte v of the 256-byte table; alpha kept.