Sha256: 3130897f866df8a62d9e5ed19dfa61c22e2f3df4801b5c9087b813b304f1c904
Contents?: true
Size: 999 Bytes
Versions: 4
Compression:
Stored size: 999 Bytes
Contents
require 'psd/node' class PSD module Node class Layer < PSD::Node::Base attr_reader :layer [:text, :ref_x, :ref_y, :blending_mode].each do |prop| delegate prop, to: :@layer delegate "#{prop}=", to: :@layer end def empty? width == 0 || height == 0 end # Exports this layer to a Hash. def to_hash super.merge({ type: :layer, text: @layer.text, ref_x: @layer.reference_point.x, ref_y: @layer.reference_point.y, mask: @layer.mask.to_hash, image: { width: @layer.image.width, height: @layer.image.height, channels: @layer.channels_info } }) end # If the method is missing, we blindly send it to the layer. # The layer handles the case in which the method doesn't exist. def method_missing(method, *args, &block) @layer.send(method, *args, &block) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
psd-3.1.5 | lib/psd/nodes/layer.rb |
psd-3.1.4 | lib/psd/nodes/layer.rb |
psd-3.1.3 | lib/psd/nodes/layer.rb |
psd-3.1.2 | lib/psd/nodes/layer.rb |