Method: HexaPDF::Content::Canvas#graphic_object
- Defined in:
- lib/hexapdf/content/canvas.rb
#graphic_object(obj, **options) ⇒ Object
:call-seq:
canvas.graphic_object(obj, **) => obj
canvas.graphic_object(name, **) => graphic_object
Returns the named graphic object, configured with the given options.
If an object responding to :configure is given, it is used. Otherwise the graphic object is looked up via the given name in the configuration option ‘graphic_object.map’. Either way, the graphic object is then configured with the given options if at least one is given.
Examples:
#>pdf
obj = canvas.graphic_object(:solid_arc, cx: 100, cy: 100, inner_a: 20, inner_b: 10,
outer_a: 50, outer_b: 40, end_angle: 135)
canvas.draw(obj).stroke
See: #draw, GraphicObject
1509 1510 1511 1512 1513 1514 1515 |
# File 'lib/hexapdf/content/canvas.rb', line 1509 def graphic_object(obj, **) unless obj.respond_to?(:configure) obj = context.document.config.constantize('graphic_object.map', obj) end obj = obj.configure(**) unless .empty? && obj.respond_to?(:draw) obj end |