class HexaPDF:: Layout:: ImageBox
Parent | HexaPDF::Layout::Box |
---|
An Image box object is used for displaying an image.
It can either be used directly or through the HexaPDF::Composer#image
method.
How an image is displayed inside an image box, depends on whether the width
and/or height
of the box has been set:
-
If one of them has been set, the other is adjusted to retain the image ratio.
composer.image(machu_picchu, width: 40) composer.image(machu_picchu, height: 40)
-
If both have been set, both are used as is.
composer.image(machu_picchu, width: 100, height: 30)
-
If neither has been set, the image is scaled to fit the available space.
composer.image(machu_picchu)
Also see: HexaPDF::Content::Canvas#image
Attributes
The image that is shown in the box.
Public Class Methods
Creates a new Image box object for the given image
argument which needs to be an image object (e.g. returned by HexaPDF::Document::Images#add
).
HexaPDF::Layout::Box::new
Public Instance Methods
Returns false
since the image is always drawn if it fits.
Fits the image into the available space, taking the initially set width and height into account (see the class description for details).