class Rabbit::Renderer::SceneNodeWidget
Attributes
Public Class Methods
Source
# File lib/rabbit/renderer/scene-node-widget.rb, line 26 def initialize(canvas, element, x, y, width, height) super() @canvas = canvas @size = @canvas.renderer.size @element = element @x = x @y = y @width = width @height = height end
Calls superclass method
Public Instance Methods
Source
# File lib/rabbit/renderer/scene-node-widget.rb, line 37 def virtual_do_measure(orientation, for_size) if orientation == Gtk::Orientation::VERTICAL [@height, @height, -1, -1] else [@width, @width, -1, -1] end end
Source
# File lib/rabbit/renderer/scene-node-widget.rb, line 45 def virtual_do_snapshot(snapshot) # For backward compatibility. Legacy DrawingArea based # renderer. Legacy DrawingAare based renderer uses uses {x: 0, # y: 0, width: @canvas.width, height: @canvas.height} coordinate # for all elements. Scene based renderer uses {x: element.x, y: # element.y, width: element.width, height: element.height} for # each element. @canvas.renderer.push_snapshot(snapshot, @x, @y) do snapshot.scale(*@size.logical_scale) snapshot.translate([ @size.logical_margin_left, @size.logical_margin_top, ]) @element.scene_snapshot(self, snapshot, @canvas, @width, @height) end end