class Glimmer::LibUI::ImagePathRenderer

Public Class Methods

new(area_proxy, shapes) click to toggle source
# File lib/glimmer/libui/image_path_renderer.rb, line 6
def initialize(area_proxy, shapes)
  @area_proxy = area_proxy
  @shapes = shapes
end

Public Instance Methods

render() click to toggle source
# File lib/glimmer/libui/image_path_renderer.rb, line 11
def render
  work = Proc.new do
    @shapes.each do |shape|
      path {
        rectangle(shape[:x], shape[:y], shape[:width], shape[:height])
    
        fill shape[:color]
      }
    end
  end
  if @area_proxy.nil?
    # Ensure it renders without a parent
    Glimmer::DSL::Engine.add_content(nil, Glimmer::DSL::Libui::ControlExpression.new, 'image', &work)
  else
    work.call
  end
end