Class: PSD::LayerStyles
- Inherits:
-
Object
- Object
- PSD::LayerStyles
- Defined in:
- lib/psd/renderer/layer_styles.rb,
lib/psd/renderer/layer_styles/drop_shadow.rb,
lib/psd/renderer/layer_styles/color_overlay.rb
Defined Under Namespace
Classes: ColorOverlay, DropShadow
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' }.freeze
Instance Attribute Summary collapse
-
#canvas ⇒ Object
readonly
Returns the value of attribute canvas.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #apply! ⇒ Object
-
#initialize(canvas) ⇒ LayerStyles
constructor
A new instance of LayerStyles.
Constructor Details
#initialize(canvas) ⇒ LayerStyles
Returns a new instance of LayerStyles.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/psd/renderer/layer_styles.rb', line 36 def initialize(canvas) @canvas = canvas @node = @canvas.node @data = @node.layer.info[:object_effects] if @data.nil? @applied = true else @data = @data.data @applied = false end end |
Instance Attribute Details
#canvas ⇒ Object (readonly)
Returns the value of attribute canvas.
34 35 36 |
# File 'lib/psd/renderer/layer_styles.rb', line 34 def canvas @canvas end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
34 35 36 |
# File 'lib/psd/renderer/layer_styles.rb', line 34 def data @data end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
34 35 36 |
# File 'lib/psd/renderer/layer_styles.rb', line 34 def node @node end |
Instance Method Details
#apply! ⇒ Object
49 50 51 52 53 54 |
# File 'lib/psd/renderer/layer_styles.rb', line 49 def apply! return if @applied || data.nil? ColorOverlay.new(self).apply! if ColorOverlay.should_apply?(data) DropShadow.new(self).apply! if DropShadow.should_apply?(data) end |