class HexaPDF:: Content:: GraphicObject:: Geom2D
| Parent | Object |
|---|
This class provides support for drawing Geom2D objects like line segments and polygons.
By default, the paths for the objects are not only added to the canvas but are also stroked or filled (depending on the specific Geom2D object).
Supported Geom2D objects are:
-
Geom2D::Point
-
Geom2D::Segment
-
Geom2D::Polygon
-
Geom2D::PolygonSet
Examples:
canvas.draw(:geom2d, object: ::Geom2D::Point(-10, 10))
canvas.draw(:geom2d, object: ::Geom2D::Polygon([10, 10], [30, 20], [0, 50]))Attributes
Public Class Methods
Public Instance Methods
Configures the Geom2D drawing support object. The following arguments are allowed:
- :object
-
The object that should be drawn. If this argument has not been set before and is also not given, an error will be raised when calling
draw. - :point_radius
-
The radius of the points when drawing points.
- :path_only
-
Whether only the path should be drawn.
Any arguments not specified are not modified and retain their old value, see the getter methods for the inital values.
Returns self.
Examples:
obj = canvas.graphic_object(:geom2d, object: ::Geom2D::Point(0, 0))
canvas.draw(obj)
canvas.opacity(fill_alpha: 0.5).fill_color("hp-blue").
draw(obj, point_radius: 10)



