Module: PSD::Renderer::CanvasManagement

Included in:
PSD::Renderer
Defined in:
lib/psd/renderer/canvas_management.rb

Instance Method Summary collapse

Instance Method Details

#active_canvasObject



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_canvasObject



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_inspectObject



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