Class: Tone
- Inherits:
-
Object
- Object
- Tone
- Defined in:
- lib/tone.rb
Overview
Setting gray to anything but 0 will increase processing time for color manipulation.
Color adjustments grouped into a single object. Tones consist of red, green, blue, and gray. Each color component uses a floating-point value and is restricted to the range -255 to 255. Gray, however, has the range of 0 to 255.
Instance Attribute Summary (collapse)
-
- (Float) blue
Value of the blue component from -255 to 255.
-
- (Float) gray
Value of the gray component from 0 to 255.
-
- (Float) green
Value of the green component from -255 to 255.
-
- (Float) red
Value of the red component from -255 to 255.
Instance Method Summary (collapse)
-
- (Tone) initialize(*args)
constructor
Creates the tone object and sets the initial values.
-
- (self) set(*args)
Sets all components at once.
Constructor Details
Instance Attribute Details
- (Float) blue
Value of the blue component from -255 to 255. Out of range values are automatically corrected.
50 51 52 |
# File 'lib/tone.rb', line 50 def blue @blue end |
- (Float) gray
Value of the gray component from 0 to 255. Out of range values are automatically corrected.
55 56 57 |
# File 'lib/tone.rb', line 55 def gray @gray end |
- (Float) green
Value of the green component from -255 to 255. Out of range values are automatically corrected.
45 46 47 |
# File 'lib/tone.rb', line 45 def green @green end |
- (Float) red
Value of the red component from -255 to 255. Out of range values are automatically corrected.
40 41 42 |
# File 'lib/tone.rb', line 40 def red @red end |
Instance Method Details
- (self) set(red, green, blue, gray = 255) - (self) set(tone)
Sets all components at once.
33 34 35 |
# File 'lib/tone.rb', line 33 def set(*args) fail NotImplementedError end |