class WhirledPeas::Graphics::Painter

Abstract base Painter class. Given a canvas and start coordinates (left, top), a painter is responsible for generating the “strokes” that display the element.

Attributes

name[R]
settings[R]

Public Class Methods

new(name, settings) click to toggle source
# File lib/whirled_peas/graphics/painter.rb, line 8
def initialize(name, settings)
  @settings = settings
  @name = name
end

Public Instance Methods

dimensions() click to toggle source

Return a dimension object that provider the `outer_width` and `outer_height` of the element being painted.

# File lib/whirled_peas/graphics/painter.rb, line 24
def dimensions
end
inspect() click to toggle source
# File lib/whirled_peas/graphics/painter.rb, line 27
def inspect
  "#{self.class.name.split('::').last}(name=#{name.inspect})"
end
paint(canvas, left, top, &block) click to toggle source

Paint the element onto the canvas by yielding strokes to the block. A stroke is composed of a left, top, and chars. E.g.

yield 10, 3, 'Hello World!'

paints the string “Hello World!” in the 10th column from the left, 3rd row down.

# File lib/whirled_peas/graphics/painter.rb, line 19
def paint(canvas, left, top, &block)
end