Class: PSD::GradientMap
- Defined in:
- lib/psd/layer/info/gradient_map.rb
Instance Attribute Summary collapse
-
#color_model ⇒ Object
readonly
Returns the value of attribute color_model.
-
#color_stops ⇒ Object
readonly
Returns the value of attribute color_stops.
-
#dither ⇒ Object
readonly
Returns the value of attribute dither.
-
#interpolation ⇒ Object
readonly
Returns the value of attribute interpolation.
-
#maximum_color ⇒ Object
readonly
Returns the value of attribute maximum_color.
-
#minimum_color ⇒ Object
readonly
Returns the value of attribute minimum_color.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#random_seed ⇒ Object
readonly
Returns the value of attribute random_seed.
-
#reverse ⇒ Object
readonly
Returns the value of attribute reverse.
-
#roughness_factor ⇒ Object
readonly
Returns the value of attribute roughness_factor.
-
#showing_transparency ⇒ Object
readonly
Returns the value of attribute showing_transparency.
-
#transparency_stops ⇒ Object
readonly
Returns the value of attribute transparency_stops.
-
#using_vector_color ⇒ Object
readonly
Returns the value of attribute using_vector_color.
Attributes inherited from LayerInfo
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from LayerInfo
Constructor Details
This class inherits a constructor from PSD::LayerInfo
Instance Attribute Details
#color_model ⇒ Object (readonly)
Returns the value of attribute color_model.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def color_model @color_model end |
#color_stops ⇒ Object (readonly)
Returns the value of attribute color_stops.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def color_stops @color_stops end |
#dither ⇒ Object (readonly)
Returns the value of attribute dither.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def dither @dither end |
#interpolation ⇒ Object (readonly)
Returns the value of attribute interpolation.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def interpolation @interpolation end |
#maximum_color ⇒ Object (readonly)
Returns the value of attribute maximum_color.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def maximum_color @maximum_color end |
#minimum_color ⇒ Object (readonly)
Returns the value of attribute minimum_color.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def minimum_color @minimum_color end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def mode @mode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def name @name end |
#random_seed ⇒ Object (readonly)
Returns the value of attribute random_seed.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def random_seed @random_seed end |
#reverse ⇒ Object (readonly)
Returns the value of attribute reverse.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def reverse @reverse end |
#roughness_factor ⇒ Object (readonly)
Returns the value of attribute roughness_factor.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def roughness_factor @roughness_factor end |
#showing_transparency ⇒ Object (readonly)
Returns the value of attribute showing_transparency.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def showing_transparency @showing_transparency end |
#transparency_stops ⇒ Object (readonly)
Returns the value of attribute transparency_stops.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def transparency_stops @transparency_stops end |
#using_vector_color ⇒ Object (readonly)
Returns the value of attribute using_vector_color.
9 10 11 |
# File 'lib/psd/layer/info/gradient_map.rb', line 9 def using_vector_color @using_vector_color end |
Class Method Details
.should_parse?(key) ⇒ Boolean
5 6 7 |
# File 'lib/psd/layer/info/gradient_map.rb', line 5 def self.should_parse?(key) key == 'grdm' end |
Instance Method Details
#parse ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/psd/layer/info/gradient_map.rb', line 13 def parse # Version @file.seek 2, IO::SEEK_CUR @reverse = @file.read_boolean @dither = @file.read_boolean @name = @file.read_unicode_string color_stops = @file.read_short @color_stops = color_stops.times.map do color = { location: @file.read_int, midpoint: @file.read_int, color: @file.read_space_color } # Mystery padding @file.seek 2, IO::SEEK_CUR color end transparency_stops = @file.read_short @transparency_stops = transparency_stops.times.map do { location: @file.read_int, midpoint: @file.read_int, opacity: @file.read_short } end expansion_count = @file.read_short if expansion_count > 0 @interpolation = @file.read_short length = @file.read_short if length >= 32 @mode = @file.read_short @random_seed = @file.read_int @showing_transparency = @file.read_short > 0 @using_vector_color = @file.read_short > 0 @roughness_factor = @file.read_int @color_model = @file.read_short @minimum_color = 4.times.map do @file.read_short >> 8 end @maximum_color = 4.times.map do @file.read_short >> 8 end end end @file.seek 2, IO::SEEK_CUR end |