Package com.itextpdf.layout.renderer
Class ImageRenderer
java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.ImageRenderer
- All Implemented Interfaces:
-
IPropertyContainer
,ILeafElementRenderer
,IRenderer
-
Field Summary
Modifier and TypeFieldDescriptionprotected float
protected Float
protected Float
protected float
protected float
protected float
Fields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties
-
Constructor Summary
ConstructorDescriptionImageRenderer
(Image image) Creates an ImageRenderer from its corresponding layout object. -
Method Summary
Modifier and TypeMethodDescriptionprotected Rectangle
applyPaddings
(Rectangle rect, UnitValue[] paddings, boolean reverse) Applies given paddings on the given rectangleprotected ImageRenderer
autoScale
(LayoutArea layoutArea) void
draw
(DrawContext drawContext) Flushes the renderer subtree contents, i.e.float
Gets the maximum offset above the base line that thisILeafElementRenderer
extends to.Gets the border box of a renderer.float
Gets the maximum offset below the base line that thisILeafElementRenderer
extends to.float
Gets original height of the image, not the height set byImage.setHeight(float)
method.float
Gets original width of the image, not the width set byImage.setWidth(float)
method.Calculates min and max width values for current renderer.Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifIRenderer.layout(LayoutContext)
is called more than once.layout
(LayoutContext layoutContext) This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult
, representing the layout result, including occupied area, status, i.e.void
move
(float dxRight, float dyUp) Moves the renderer subtree by the specified offset.Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllProperties, addChild, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAction, applyBorderBox, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateBBox, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createXObject, deleteOwnProperty, deleteProperty, drawBackground, drawBorder, drawChildren, endElementOpacityApplying, endTransformationIfApplied, getBackgroundArea, getBorderRadii, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getModelElement, getOccupiedArea, getOccupiedAreaBBox, getOwnProperties, getOwnProperty, getPaddings, getParent, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, hasAbsoluteUnitValue, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveUnitValue, retrieveUnitValue, retrieveWidth, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
Methods inherited from interface com.itextpdf.layout.renderer.IRenderer
addChild, getChildRenderers, getModelElement, getOccupiedArea, getParent, getProperty, isFlushed, setParent
-
Field Details
-
fixedXPosition
-
fixedYPosition
-
pivotY
protected float pivotY -
deltaX
protected float deltaX -
imageWidth
protected float imageWidth -
imageHeight
protected float imageHeight
-
-
Constructor Details
-
ImageRenderer
Creates an ImageRenderer from its corresponding layout object.- Parameters:
-
image
- theImage
which this object should manage
-
-
Method Details
-
layout
Description copied from interface:IRenderer
This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult
, representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc.LayoutResult
can be extended to return custom layout results for custom elements, e.g.TextRenderer
usesTextLayoutResult
as its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called beforeIRenderer.draw(DrawContext)
, to prepare the renderer to be flushed to the output stream. -
draw
Description copied from class:AbstractRenderer
Flushes the renderer subtree contents, i.e. draws itself on canvas, adds necessary objects to thePdfDocument
etc.- Specified by:
-
draw
in interfaceIRenderer
- Overrides:
-
draw
in classAbstractRenderer
- Parameters:
-
drawContext
- contains thePdfDocument
to which the renderer subtree if flushed, thePdfCanvas
on which the renderer subtree is drawn and other additional parameters needed to perform drawing
-
getNextRenderer
Description copied from interface:IRenderer
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifIRenderer.layout(LayoutContext)
is called more than once.- Specified by:
-
getNextRenderer
in interfaceIRenderer
- Returns:
- new renderer instance
-
getBorderAreaBBox
Description copied from class:AbstractRenderer
Gets the border box of a renderer. This is a box used to draw borders.- Overrides:
-
getBorderAreaBBox
in classAbstractRenderer
- Returns:
- border box of a renderer
-
getImageWidth
public float getImageWidth()Gets original width of the image, not the width set byImage.setWidth(float)
method.- Returns:
- original image width
-
getImageHeight
public float getImageHeight()Gets original height of the image, not the height set byImage.setHeight(float)
method.- Returns:
- original image height
-
applyPaddings
Description copied from class:AbstractRenderer
Applies given paddings on the given rectangle- Overrides:
-
applyPaddings
in classAbstractRenderer
- Parameters:
-
rect
- a rectangle paddings will be applied on. -
paddings
- the paddings to be applied on the given rectangle -
reverse
- indicates whether paddings will be applied inside (in case of false) or outside (in case of false) the rectangle. - Returns:
-
a
border box
of the renderer
-
move
public void move(float dxRight, float dyUp) Description copied from class:AbstractRenderer
Moves the renderer subtree by the specified offset. This method affects occupied area of the renderer.- Specified by:
-
move
in interfaceIRenderer
- Overrides:
-
move
in classAbstractRenderer
- Parameters:
-
dxRight
- the x-axis offset in points. Positive value will move the renderer subtree to the right. -
dyUp
- the y-axis offset in points. Positive value will move the renderer subtree to the top.
-
getMinMaxWidth
Description copied from class:AbstractRenderer
Calculates min and max width values for current renderer.- Overrides:
-
getMinMaxWidth
in classAbstractRenderer
- Returns:
-
instance of
MinMaxWidth
-
autoScale
-
getAscent
public float getAscent()Description copied from interface:ILeafElementRenderer
Gets the maximum offset above the base line that thisILeafElementRenderer
extends to.- Specified by:
-
getAscent
in interfaceILeafElementRenderer
- Returns:
-
the upwards vertical offset of this
ILeafElementRenderer
-
getDescent
public float getDescent()Description copied from interface:ILeafElementRenderer
Gets the maximum offset below the base line that thisILeafElementRenderer
extends to.- Specified by:
-
getDescent
in interfaceILeafElementRenderer
- Returns:
-
the downwards vertical offset of this
ILeafElementRenderer
-