Method: HexaPDF::Content::GraphicObject::Geom2D#draw

Defined in:
lib/hexapdf/content/graphic_object/geom2d.rb

#draw(canvas) ⇒ Object

Draws the Geom2D object onto the given Canvas.

Examples:

#>pdf-center
obj = canvas.graphic_object(:geom2d, object: ::Geom2D::Point(0, 0))
obj.draw(canvas)


138
139
140
141
142
143
144
145
146
147
148
# File 'lib/hexapdf/content/graphic_object/geom2d.rb', line 138

def draw(canvas)
  case @object
  when ::Geom2D::Point then draw_point(canvas)
  when ::Geom2D::Segment then draw_segment(canvas)
  when ::Geom2D::Rectangle then draw_rectangle(canvas)
  when ::Geom2D::Polygon then draw_polygon(canvas)
  when ::Geom2D::PolygonSet then draw_polygon_set(canvas)
  else
    raise HexaPDF::Error, "Object of type #{@object.class} unusable"
  end
end