Module: Silicium::Plotter::Color

Extended by:
ChunkyPNG::Color
Includes:
ChunkyPNG::Color
Defined in:
lib/plotter.rb

Overview

The Color module defines methods for handling colors. Within the Plotter library, the concepts of pixels and colors are both used, and they are both represented by a Integer.

Pixels/colors are represented in RGBA components. Each of the four components is stored with a depth of 8 bits (maximum value = 255 = Plotter::Color::MAX). Together, these components are stored in a 4-byte Integer.

A color will always be represented using these 4 components in memory. When the image is encoded, a more suitable representation can be used (e.g. rgb, grayscale, palette-based), for which several conversion methods are provided in this module.