Method: HexaPDF::Layout::Box#initialize
- Defined in:
- lib/hexapdf/layout/box.rb
#initialize(width: 0, height: 0, style: Style.new, &block) ⇒ Box
:call-seq:
Box.new(width: 0, height: 0, style: Style.new) {|canv, box| block} -> box
Creates a new Box object with the given width and height that uses the provided block when it is asked to draw itself on a canvas (see #draw).
Since the final location of the box is not known beforehand, the drawing operations inside the block should draw inside the rectangle (0, 0, content_width, content_height) - note that the width and height of the box may not be known beforehand.
96 97 98 99 100 101 |
# File 'lib/hexapdf/layout/box.rb', line 96 def initialize(width: 0, height: 0, style: Style.new, &block) @width = @initial_width = width @height = @initial_height = height @style = (style.kind_of?(Style) ? style : Style.new(**style)) @draw_block = block end |