Class: Rszr::Color::CMYA
Instance Attribute Summary collapse
-
#cyan ⇒ Object
readonly
Returns the value of attribute cyan.
-
#magenta ⇒ Object
readonly
Returns the value of attribute magenta.
-
#yellow ⇒ Object
readonly
Returns the value of attribute yellow.
Attributes inherited from Base
Instance Method Summary collapse
- #blue ⇒ Object
- #green ⇒ Object
-
#initialize(cyan, magenta, yellow, alpha = 255) ⇒ CMYA
constructor
A new instance of CMYA.
- #red ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(cyan, magenta, yellow, alpha = 255) ⇒ CMYA
Returns a new instance of CMYA.
7 8 9 10 11 12 |
# File 'lib/rszr/color/cmya.rb', line 7 def initialize(cyan, magenta, yellow, alpha = 255) if cyan < 0 || cyan > 255 || magenta < 0 || magenta > 255 || yellow < 0 || yellow > 255 || alpha < 0 || alpha > 255 raise ArgumentError, 'color out of range' end @cyan, @magenta, @yellow = cyan, magenta, yellow end |
Instance Attribute Details
#cyan ⇒ Object (readonly)
Returns the value of attribute cyan.
5 6 7 |
# File 'lib/rszr/color/cmya.rb', line 5 def cyan @cyan end |
#magenta ⇒ Object (readonly)
Returns the value of attribute magenta.
5 6 7 |
# File 'lib/rszr/color/cmya.rb', line 5 def magenta @magenta end |
#yellow ⇒ Object (readonly)
Returns the value of attribute yellow.
5 6 7 |
# File 'lib/rszr/color/cmya.rb', line 5 def yellow @yellow end |
Instance Method Details
#blue ⇒ Object
22 23 24 |
# File 'lib/rszr/color/cmya.rb', line 22 def blue 255 - yellow end |
#green ⇒ Object
18 19 20 |
# File 'lib/rszr/color/cmya.rb', line 18 def green 255 - magenta end |
#red ⇒ Object
14 15 16 |
# File 'lib/rszr/color/cmya.rb', line 14 def red 255 - cyan end |