public interface JRCommonImage extends JRCommonGraphicElement, JRBoxContainer
scaleImage
attribute (see getScaleImageValue()
) allows users
to choose one of the following values:
Clip
FillFrame
RetainShape
RealHeight
RealSize
RealHeight
and RealSize
. The difference between them is that the former always preserves the
width of the image element, while the latter adjusts the width of the image when the
actual image width is smaller than the design image width. Adjusting the image width is
useful when a border needs to be drawn around the image; if the image width is not
adjusted, then the border might get drawn according to the design image width and some
empty space would be left between the image and the border.
In order for image stretching to work, the actual image size needs to be known at report
fill time. For images that use image files as sources, the image size will always be
known. For images that use other type of renderers, the image size is determined by
calling the getDimension()
method on the image renderer object, which is an instance
of a class that implements Renderable
. If the
method returns a null dimension, the actual image size will not be known and the image
will not stretch, but will render inside the area given by the design image width and
height.
Another inherent limitation is that images that have delayed evaluation will not be able
to stretch. Stretching such images is not supported because the actual image size can only
be know after the image has been positioned in the generated report and other elements
have been placed beneath the image, and stretching the image at this point would disturb
the layout of the generated report.
Stretching images will always preserve proportions and will never get deformed. Any
scaling which performed to the image will be performed uniformly on the horizontal and
vertical axes.
If the actual image width is larger than the design width of the image element, the image
will be scaled down to fit the element width set at design time. In other words, the design
image width acts as an upper limit of the width of the generated image.
When the engine stretches an image, if the actual image height is bigger than the vertical
space left to the bottom of the page, the image will cause the band to overflow and the
engine will render the image on the new report page or column. If the vertical space
available here is still not enough to render the image at its actual size, the image will be
scaled down to fit the available height.
Note that if the actual height of the image is smaller than the declared height of the
image, the height of the generated image will not be decreased. The produced image will
always be at least as tall as the design image element, its height can only be increased
when the report is filled.Renderable
Modifier and Type | Method and Description |
---|---|
ScaleImageEnum |
getOwnScaleImageValue()
Gets the image own scale type.
|
ScaleImageEnum |
getScaleImageValue()
Gets the image scale type.
|
void |
setScaleImage(ScaleImageEnum scaleImageEnum)
Sets the image scale type.
|
getFillValue, getLinePen, getOwnFillValue, setFill
getBackcolor, getForecolor, getHeight, getKey, getModeValue, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode
getDefaultLineColor, getDefaultLineWidth
getDefaultStyleProvider, getStyle, getStyleNameReference
getDefaultLineColor, getLineBox
ScaleImageEnum getScaleImageValue()
ScaleImageEnum
ScaleImageEnum getOwnScaleImageValue()
ScaleImageEnum
void setScaleImage(ScaleImageEnum scaleImageEnum)
scaleImageEnum
- a value representing one of the scale type constants in ScaleImageEnum
Copyright © 2015. All rights reserved.