Class: Shape
Instance Attribute Summary collapse
-
#cr ⇒ Object
readonly
Returns the value of attribute cr.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#proc ⇒ Object
readonly
Returns the value of attribute proc.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes included from CairoTools
#bottom_margin, #canvas_height, #canvas_width, #left_margin, #preview, #right_margin, #surface, #top_margin
Instance Method Summary collapse
- #draw(cr, x, y) ⇒ Object
-
#initialize(name, width, height, proc) ⇒ Shape
constructor
A new instance of Shape.
Methods included from CairoTools
#circular_text, #clip!, #clouds, #create_text_box, #dimensions, #draw_image, #draw_text_box, #generate_image, #get_pixel, #gradient, #linear_gradient, #load_image, #margin, #radial_gradient, #rounded_rectangle, #set_color, #shadow, #transform, #transparent!
Methods included from Color
Constructor Details
#initialize(name, width, height, proc) ⇒ Shape
Returns a new instance of Shape.
4 5 6 |
# File 'lib/shape.rb', line 4 def initialize(name, width, height, proc) @name, @width, @height, @proc = name, width, height, proc end |
Instance Attribute Details
#cr ⇒ Object (readonly)
Returns the value of attribute cr.
3 4 5 |
# File 'lib/shape.rb', line 3 def cr @cr end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
3 4 5 |
# File 'lib/shape.rb', line 3 def height @height end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/shape.rb', line 3 def name @name end |
#proc ⇒ Object (readonly)
Returns the value of attribute proc.
3 4 5 |
# File 'lib/shape.rb', line 3 def proc @proc end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
3 4 5 |
# File 'lib/shape.rb', line 3 def width @width end |
Instance Method Details
#draw(cr, x, y) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/shape.rb', line 8 def draw(cr, x, y) @cr = cr transform cr.matrix.translate(x, y) do instance_eval(&proc) end end |