Class: PSD::LayerStyles
- Inherits:
-
Object
- Object
- PSD::LayerStyles
- Defined in:
- lib/psd/layer_styles.rb
Constant Summary collapse
- BLEND_TRANSLATION =
Blend modes in layer effects use different keys than normal layer blend modes. Thanks Adobe.
{ 'Nrml' => 'norm', 'Dslv' => 'diss', 'Drkn' => 'dark', 'Mltp' => 'mul', 'CBrn' => 'idiv', 'linearBurn' => 'lbrn', 'Lghn' => 'lite', 'Scrn' => 'scrn', 'CDdg' => 'div', 'linearDodge' => 'lddg', 'Ovrl' => 'over', 'SftL' => 'sLit', 'HrdL' => 'hLit', 'vividLight' => 'vLit', 'linearLight' => 'lLit', 'pinLight' => 'pLit', 'hardMix' => 'hMix', 'Dfrn' => 'diff', 'Xclu' => 'smud', 'H ' => 'hue', 'Strt' => 'sat', 'Clr ' => 'colr', 'Lmns' => 'lum' }
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#layer ⇒ Object
readonly
Returns the value of attribute layer.
-
#png ⇒ Object
readonly
Returns the value of attribute png.
Instance Method Summary collapse
- #apply! ⇒ Object
-
#initialize(layer, png = nil) ⇒ LayerStyles
constructor
A new instance of LayerStyles.
Constructor Details
#initialize(layer, png = nil) ⇒ LayerStyles
Returns a new instance of LayerStyles.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/psd/layer_styles.rb', line 33 def initialize(layer, png=nil) @layer = layer @data = layer.info[:object_effects] @png = png || layer.image.to_png if @data.nil? @applied = true else @data = @data.data @applied = false end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
31 32 33 |
# File 'lib/psd/layer_styles.rb', line 31 def data @data end |
#layer ⇒ Object (readonly)
Returns the value of attribute layer.
31 32 33 |
# File 'lib/psd/layer_styles.rb', line 31 def layer @layer end |
#png ⇒ Object (readonly)
Returns the value of attribute png.
31 32 33 |
# File 'lib/psd/layer_styles.rb', line 31 def png @png end |
Instance Method Details
#apply! ⇒ Object
46 47 48 49 50 51 |
# File 'lib/psd/layer_styles.rb', line 46 def apply! return png if @applied || data.nil? if data.has_key?('SoFi') png end |