Module: PSD::Renderer::CanvasManagement
- Included in:
- PSD::Renderer
- Defined in:
- lib/psd/renderer/canvas_management.rb
Instance Method Summary collapse
- #active_canvas ⇒ Object
- #create_group_canvas(node, width = @width, height = @height, opts = {}) ⇒ Object
- #pop_canvas ⇒ Object
- #push_canvas(canvas) ⇒ Object
- #stack_inspect ⇒ Object
Instance Method Details
#active_canvas ⇒ Object
4 5 6 |
# File 'lib/psd/renderer/canvas_management.rb', line 4 def active_canvas @canvas_stack.last end |
#create_group_canvas(node, width = @width, height = @height, opts = {}) ⇒ Object
8 9 10 11 |
# File 'lib/psd/renderer/canvas_management.rb', line 8 def create_group_canvas(node, width = @width, height = @height, opts = {}) PSD.logger.debug "Group canvas created. Node = #{node.name || ":root:"}, width = #{width}, height = #{height}" push_canvas Canvas.new(node, width, height, @opts.merge(opts)) end |
#pop_canvas ⇒ Object
17 18 19 |
# File 'lib/psd/renderer/canvas_management.rb', line 17 def pop_canvas @canvas_stack.pop end |
#push_canvas(canvas) ⇒ Object
13 14 15 |
# File 'lib/psd/renderer/canvas_management.rb', line 13 def push_canvas(canvas) @canvas_stack << canvas end |
#stack_inspect ⇒ Object
21 22 23 |
# File 'lib/psd/renderer/canvas_management.rb', line 21 def stack_inspect @canvas_stack.map { |c| c.node.name || ":root:" }.join("\n") end |