Class AbstractPathShape
java.lang.Object
com.itextpdf.svg.renderers.path.impl.AbstractPathShape
- All Implemented Interfaces:
IPathShape
- Direct Known Subclasses:
CurveTo, EllipticalCurveTo, LineTo, MoveTo, QuadraticCurveTo
This class handles common behaviour in IPathShape implementations
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SvgDrawContextprotected String[]protected final IOperatorConverterprivate PathSvgNodeRendererThe properties of this shape.protected booleanWhether this is a relative operator or not.private AffineTransform -
Constructor Summary
ConstructorsConstructorDescriptionCreates newAbstractPathShapeinstance.AbstractPathShape(boolean relative) Creates newAbstractPathShapeinstance.AbstractPathShape(boolean relative, IOperatorConverter copier) Creates newAbstractPathShapeinstance. -
Method Summary
Modifier and TypeMethodDescription(package private) voidapplyTransform(double[] points) protected PointcreatePoint(String coordX, String coordY) abstract voiddraw()Draws this instruction to a canvas object.voidDraws this instruction to a canvas object.Gets the ending point on the canvas after the path shape has been drawn via theIPathShape.draw(PdfCanvas)method, in SVG space coordinates.getPathShapeRectangle(Point lastPoint) Get bounding rectangle of the current path shape.booleanReturns true when this shape is a relative operator.protected floatparseHorizontalLength(String length) Parse x axis length value.protected floatparseVerticalLength(String length) Parse y axis length value.voidsetContext(SvgDrawContext context) Set svg draw context for this shape.voidsetParent(PathSvgNodeRenderer parent) Set parent path for this shape.voidsetTransform(AffineTransform transform) SetsAffineTransformto apply before drawing the shape.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IPathShape
setCoordinates
-
Field Details
-
parent
-
transform
-
properties
-
relative
protected boolean relativeWhether this is a relative operator or not. -
copier
-
coordinates
-
context
-
-
Constructor Details
-
AbstractPathShape
public AbstractPathShape()Creates newAbstractPathShapeinstance. -
AbstractPathShape
public AbstractPathShape(boolean relative) Creates newAbstractPathShapeinstance.- Parameters:
relative- boolean defining whether this is a relative operator
-
AbstractPathShape
Creates newAbstractPathShapeinstance.- Parameters:
relative- boolean defining whether this is a relative operatorcopier-IOperatorConvertercopier for converting relative coordinates to absolute coordinates
-
-
Method Details
-
isRelative
public boolean isRelative()Description copied from interface:IPathShapeReturns true when this shape is a relative operator. False if it is an absolute operator.- Specified by:
isRelativein interfaceIPathShape- Returns:
- true if relative, false if absolute
-
createPoint
-
getEndingPoint
Description copied from interface:IPathShapeGets the ending point on the canvas after the path shape has been drawn via theIPathShape.draw(PdfCanvas)method, in SVG space coordinates.- Specified by:
getEndingPointin interfaceIPathShape- Returns:
- The
Pointrepresenting the final point in the drawn path. If the point does not exist or does not changenullmay be returned.
-
getPathShapeRectangle
Get bounding rectangle of the current path shape.- Specified by:
getPathShapeRectanglein interfaceIPathShape- Parameters:
lastPoint- start point for this shape- Returns:
- calculated rectangle
-
draw
Description copied from interface:IPathShapeDraws this instruction to a canvas object.Deprecated in favour of
draw()and later this method should be introduced in this interface, along withsetContext(SvgDrawContext)method. Since canvas can be got fromSvgDrawContextthePdfCanvasparameter is no more needed.- Specified by:
drawin interfaceIPathShape- Parameters:
canvas- to which this instruction is drawn
-
draw
public abstract void draw()Draws this instruction to a canvas object. -
setParent
Set parent path for this shape.- Parameters:
parent-PathSvgNodeRendererinstance
-
setContext
Set svg draw context for this shape.- Parameters:
context-SvgDrawContextinstance.
-
setTransform
SetsAffineTransformto apply before drawing the shape.- Parameters:
transform-AffineTransformto apply before drawing
-
parseHorizontalLength
-
parseVerticalLength
-
applyTransform
void applyTransform(double[] points)
-