class WhirledPeas::Animator::RendererConsumer
Attributes
device[R]
height[R]
prev_pixel_grid[R]
rendered_frames[R]
template_factory[R]
width[R]
Public Class Methods
new(template_factory, device, width, height)
click to toggle source
# File lib/whirled_peas/animator/renderer_consumer.rb, line 8 def initialize(template_factory, device, width, height) @template_factory = template_factory @device = device @width = width @height = height @rendered_frames = [] @prev_pixel_grid = nil end
Public Instance Methods
add_frameset(frameset)
click to toggle source
# File lib/whirled_peas/animator/renderer_consumer.rb, line 17 def add_frameset(frameset) frameset.each_frame do |frame, duration, args| template = template_factory.build(frame, args) pixel_grid = Graphics::Renderer.new(template, width, height).paint strokes = prev_pixel_grid.nil? ? pixel_grid.to_s : pixel_grid.diff(prev_pixel_grid) rendered_frames << Device::RenderedFrame.new(strokes, duration) @prev_pixel_grid = pixel_grid end end
process()
click to toggle source
# File lib/whirled_peas/animator/renderer_consumer.rb, line 27 def process device.handle_rendered_frames(rendered_frames) end