Class PNG::Color
In: lib/png.rb
Parent: Object

A 32 bit RGBA color. Can be created from RGB or RGBA via new, numeric value or hex string via from, or HSV via from_hsv.

Methods

a   b   blend   from   from_hsv   g   intensity   new   r   rgb   to_ascii   to_hsv   |  

Constants

MAX = 255
Background = Color.from 0x00000000, "Transparent"   Transparent white
Black = Color.from 0x000000FF, "Black"
Blue = Color.from 0x0000FFFF, "Blue"
Brown = Color.from 0x996633FF, "Brown"
Bubblegum = Color.from 0xFF66FFFF, "Bubblegum"
Cyan = Color.from 0x00FFFFFF, "Cyan"
Gray = Color.from 0x7F7F7FFF, "Gray"
Green = Color.from 0x00FF00FF, "Green"
Magenta = Color.from 0xFF00FFFF, "Magenta"
Orange = Color.from 0xFF7F00FF, "Orange"
Purple = Color.from 0x7F007FFF, "Purple"
Red = Color.from 0xFF0000FF, "Red"
White = Color.from 0xFFFFFFFF, "White"
Yellow = Color.from 0xFFFF00FF, "Yellow"

External Aliases

== -> eql?

Attributes

values  [R] 

Public Class methods

Create a new color from a string or integer value. Can take an optional name as well.

Creates a new RGB color from HSV equivalent values.

Creates a new color with values red, green, blue, and alpha.

Public Instance methods

Alpha transparency component

Blue component

Blends color into this color returning a new blended color.

Green component

Returns a new color with an alpha value adjusted by i.

Red component

Return an array of RGB

An ASCII representation of this color, almost suitable for making ASCII art!

Returns HSV equivalent of the current color.

"Bitwise or" as applied to colors. Background color is considered false.

[Validate]