Pixel - Serabe/rinzelight GitHub Wiki

Pixel

In rinzelight.pixel there are a few functions for working with pixel. There is a pixel structure (pixel-packet) too. Most of time, it is easier to work directly with four-elements vectors.

pixel-packet

pixel-packet contains four fields, one for each channel. For creating them, it is adviced to use the function create-pixel that accepts either one, three or four arguments.

round-to-quantum

Given a value, if it is negative, it returns zero; if it is greter than (quantum-range), it returns (quantum-range). It returns the value itself otherwise.

Whenever you use a value for a channel, use round-to-quantum for avoiding problems.

invert-sample-value

Given a value, returns the difference between (quantum-range) and that value.

invert-pixel

Same as before but for every channel but alpha.

intensity

It is a macro that returns the intensity of a pixel. Intensity is defined by the following formula:

0.299 * red + 0.587 * green + 0.114 * blue

⚠️ **GitHub.com Fallback** ⚠️