public class ImageRenderer extends AbstractRenderer implements ILeafElementRenderer
Modifier and Type | Field and Description |
---|---|
protected float |
deltaX |
protected Float |
fixedXPosition |
protected Float |
fixedYPosition |
protected float |
imageHeight |
protected float |
imageWidth |
protected float |
pivotY |
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties
Constructor and Description |
---|
ImageRenderer(Image image)
Creates an ImageRenderer from its corresponding layout object.
|
Modifier and Type | Method and Description |
---|---|
protected Rectangle |
applyPaddings(Rectangle rect, UnitValue[] paddings, boolean reverse)
Applies given paddings on the given rectangle
|
protected ImageRenderer |
autoScale(LayoutArea layoutArea) |
void |
draw(DrawContext drawContext)
Flushes the renderer subtree contents, i.e.
|
float |
getAscent()
Gets the maximum offset above the base line that this ILeafElementRenderer extends to.
|
Rectangle |
getBorderAreaBBox()
Gets the border box of a renderer.
|
float |
getDescent()
Gets the maximum offset below the base line that this ILeafElementRenderer extends to.
|
float |
getImageHeight()
Gets original height of the image, not the height set by Image.setHeight(float) method.
|
float |
getImageWidth()
Gets original width of the image, not the width set by Image.setWidth(float) method.
|
MinMaxWidth |
getMinMaxWidth()
Calculates min and max width values for current renderer.
|
IRenderer |
getNextRenderer()
Gets a new instance of this class to be used as a next renderer, after this renderer is used, if IRenderer.layout(LayoutContext) is called more than once.
|
LayoutResult |
layout(LayoutContext layoutContext)
This method simulates positioning of the renderer, including all of its children, and returns the LayoutResult , representing the layout result, including occupied area, status, i.e.
|
void |
move(float dxRight, float dyUp)
Moves the renderer subtree by the specified offset.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addChild, getChildRenderers, getModelElement, getOccupiedArea, getParent, getProperty, isFlushed, setParent
deleteOwnProperty, getDefaultProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
protected Float fixedXPosition
protected Float fixedYPosition
protected float pivotY
protected float deltaX
protected float imageWidth
protected float imageHeight
public LayoutResult layout(LayoutContext layoutContext)
IRenderer
LayoutResult
, 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
uses TextLayoutResult
as its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called before IRenderer.draw(DrawContext)
, to prepare the renderer to be flushed to the output stream.
public void draw(DrawContext drawContext)
AbstractRenderer
PdfDocument
etc.
draw
in interface IRenderer
draw
in class AbstractRenderer
drawContext
- contains the PdfDocument
to which the renderer subtree if flushed, the PdfCanvas
on which the renderer subtree is drawn and other additional parameters needed to perform drawing
public IRenderer getNextRenderer()
IRenderer
IRenderer.layout(LayoutContext)
is called more than once.
getNextRenderer
in interface IRenderer
public Rectangle getBorderAreaBBox()
AbstractRenderer
getBorderAreaBBox
in class AbstractRenderer
public float getImageWidth()
Image.setWidth(float)
method.
public float getImageHeight()
Image.setHeight(float)
method.
protected Rectangle applyPaddings(Rectangle rect, UnitValue[] paddings, boolean reverse)
AbstractRenderer
applyPaddings
in class AbstractRenderer
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.
border box
of the renderer
public void move(float dxRight, float dyUp)
AbstractRenderer
move
in interface IRenderer
move
in class AbstractRenderer
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.
public MinMaxWidth getMinMaxWidth()
AbstractRenderer
getMinMaxWidth
in class AbstractRenderer
MinMaxWidth
protected ImageRenderer autoScale(LayoutArea layoutArea)
public float getAscent()
ILeafElementRenderer
ILeafElementRenderer
extends to.
getAscent
in interface ILeafElementRenderer
ILeafElementRenderer
public float getDescent()
ILeafElementRenderer
ILeafElementRenderer
extends to.
getDescent
in interface ILeafElementRenderer
ILeafElementRenderer
Copyright © 1998–2022 iText Group NV. All rights reserved.