Package com.itextpdf.svg.renderers.impl
Class RectangleSvgNodeRenderer
- java.lang.Object
-
- com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
-
- com.itextpdf.svg.renderers.impl.RectangleSvgNodeRenderer
-
- All Implemented Interfaces:
ISvgNodeRenderer
public class RectangleSvgNodeRenderer extends AbstractSvgNodeRenderer
ISvgNodeRenderer
implementation for the <rect> tag.
-
-
Field Summary
Fields Modifier and Type Field Description private float
height
private float
rx
private boolean
rxPresent
private float
ry
private boolean
ryPresent
private float
width
private float
x
private float
y
-
Fields inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
attributesAndStyles, doFill, doStroke, partOfClipPath
-
-
Constructor Summary
Constructors Constructor Description RectangleSvgNodeRenderer()
Constructs a RectangleSvgNodeRenderer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
arc(float x1, float y1, float x2, float y2, float startAng, float extent, PdfCanvas cv)
(package private) float
checkRadius(float radius, float distance)
a radius must be positive, and cannot be more than half the distance in the dimension it is for.ISvgNodeRenderer
createDeepCopy()
Creates a deep copy of this renderer, including it's subtree of childrenprotected void
doDraw(SvgDrawContext context)
Draws this element to a canvas-like object maintained in the context.(package private) float
findCircularRadius(float rx, float ry, float width, float height)
In case of a circular radius, the calculation incheckRadius(float, float)
isn't enough: the radius cannot be more than half of the smallest dimension.Rectangle
getObjectBoundingBox(SvgDrawContext context)
Calculates the current object bounding box.private void
setParameters()
-
Methods inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
calculateViewPortTranslation, canConstructViewPort, canElementFill, deepCopyAttributesAndStyles, draw, getAttribute, getAttributeMapCopy, getAttributeOrDefault, getCurrentFontSize, getParent, parseAbsoluteLength, postDraw, preDraw, setAttribute, setAttributesAndStyles, setParent, setPartOfClipPath
-
-
-
-
Method Detail
-
doDraw
protected void doDraw(SvgDrawContext context)
Description copied from class:AbstractSvgNodeRenderer
Draws this element to a canvas-like object maintained in the context.- Specified by:
doDraw
in classAbstractSvgNodeRenderer
- Parameters:
context
- the object that knows the place to draw this element and maintains its state
-
getObjectBoundingBox
public Rectangle getObjectBoundingBox(SvgDrawContext context)
Description copied from interface:ISvgNodeRenderer
Calculates the current object bounding box.- Parameters:
context
- the current context, for instance it contains current viewport and available font data- Returns:
- the
Rectangle
representing the current object's bounding box, or null if bounding box is undefined
-
setParameters
private void setParameters()
-
arc
private void arc(float x1, float y1, float x2, float y2, float startAng, float extent, PdfCanvas cv)
-
checkRadius
float checkRadius(float radius, float distance)
a radius must be positive, and cannot be more than half the distance in the dimension it is for. e.g. rx <= width / 2
-
findCircularRadius
float findCircularRadius(float rx, float ry, float width, float height)
In case of a circular radius, the calculation incheckRadius(float, float)
isn't enough: the radius cannot be more than half of the smallest dimension. This method assumes thatcheckRadius(float, float)
has already run, and it is silently assumed (though not necessary for this method) that eitherrx
orry
is zero.
-
createDeepCopy
public ISvgNodeRenderer createDeepCopy()
Description copied from interface:ISvgNodeRenderer
Creates a deep copy of this renderer, including it's subtree of children- Returns:
- deep copy of this renderer
-
-