Class: RGhost::CMYKSpot
Overview
Creates CMYK Spot color space
Constant Summary
Constants included from RubyToPs
Instance Attribute Summary collapse
-
#black ⇒ Object
Returns the value of attribute black.
-
#cyan ⇒ Object
Returns the value of attribute cyan.
-
#magenta ⇒ Object
Returns the value of attribute magenta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#yellow ⇒ Object
Returns the value of attribute yellow.
Instance Method Summary collapse
-
#initialize(color = {:name => 'spot', :cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0}) ⇒ CMYKSpot
constructor
A new instance of CMYKSpot.
- #ps ⇒ Object
Methods inherited from Color
Methods included from RubyToPs
#array_to_stack, #hash_to_array, #pack_string, #ps_escape, #string_eval, #to_array, #to_bool, #to_string, #to_string_array
Methods inherited from PsObject
#<<, #call, #graphic_scope, #raw, #set, #to_s
Constructor Details
#initialize(color = {:name => 'spot', :cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0}) ⇒ CMYKSpot
Returns a new instance of CMYKSpot.
139 140 141 142 143 |
# File 'lib/rghost/color.rb', line 139 def initialize(color={:name => 'spot', :cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0}) @name = color[:name] color.delete(:name) @color = color end |
Instance Attribute Details
#black ⇒ Object
Returns the value of attribute black.
137 138 139 |
# File 'lib/rghost/color.rb', line 137 def black @black end |
#cyan ⇒ Object
Returns the value of attribute cyan.
137 138 139 |
# File 'lib/rghost/color.rb', line 137 def cyan @cyan end |
#magenta ⇒ Object
Returns the value of attribute magenta.
137 138 139 |
# File 'lib/rghost/color.rb', line 137 def magenta @magenta end |
#name ⇒ Object
Returns the value of attribute name.
137 138 139 |
# File 'lib/rghost/color.rb', line 137 def name @name end |
#yellow ⇒ Object
Returns the value of attribute yellow.
137 138 139 |
# File 'lib/rghost/color.rb', line 137 def yellow @yellow end |
Instance Method Details
#ps ⇒ Object
145 146 147 148 149 150 151 152 |
# File 'lib/rghost/color.rb', line 145 def ps value=case @color when Hash then [@color[:c] || @color[:cyan],@color[:m] || @color[:magenta] ,@color[:y] || @color[:yellow], @color[:k] || @color[:black]] when Array then @color end array_to_stack(value.map{|n| n > 1 ? n/100.0: n}) + "(#{@name.to_s}) findcmykcustomcolor \n/#{@name.to_s.gsub(' ', '_')} exch def\n\n#{@name.to_s.gsub(' ', '_')} 1 setcustomcolor" end |