Class AbstractPathShape

java.lang.Object
com.itextpdf.svg.renderers.path.impl.AbstractPathShape
All Implemented Interfaces:
IPathShape
Direct Known Subclasses:
CurveTo, EllipticalCurveTo, LineTo, MoveTo, QuadraticCurveTo

public abstract class AbstractPathShape extends Object implements IPathShape
This class handles common behaviour in IPathShape implementations
  • Field Details

    • properties

      protected Map<String,String> properties
      The properties of this shape.
    • relative

      protected boolean relative
      Whether this is a relative operator or not.
    • copier

      protected final IOperatorConverter copier
    • coordinates

      protected String[] coordinates
    • context

      protected SvgDrawContext context
  • Constructor Details

    • AbstractPathShape

      public AbstractPathShape()
    • AbstractPathShape

      public AbstractPathShape (boolean relative)
    • AbstractPathShape

      public AbstractPathShape (boolean relative, IOperatorConverter copier)
  • Method Details

    • isRelative

      public boolean isRelative()
      Description copied from interface: IPathShape
      Returns true when this shape is a relative operator. False if it is an absolute operator.
      Specified by:
      isRelative in interface IPathShape
      Returns:
      true if relative, false if absolute
    • createPoint

      protected Point createPoint (String coordX, String coordY)
    • getEndingPoint

      public Point getEndingPoint()
      Description copied from interface: IPathShape
      Gets the ending point on the canvas after the path shape has been drawn via the IPathShape.draw(PdfCanvas) method, in SVG space coordinates.
      Specified by:
      getEndingPoint in interface IPathShape
      Returns:
      The Point representing the final point in the drawn path. If the point does not exist or does not change null may be returned.
    • getPathShapeRectangle

      public Rectangle getPathShapeRectangle (Point lastPoint)
      Get bounding rectangle of the current path shape.
      Specified by:
      getPathShapeRectangle in interface IPathShape
      Parameters:
      lastPoint - start point for this shape
      Returns:
      calculated rectangle
    • draw

      public void draw (PdfCanvas canvas)
      Description copied from interface: IPathShape
      Draws this instruction to a canvas object.

      Deprecated in favour of draw() and later this method should be introduced in this interface, along with setContext(SvgDrawContext) method. Since canvas can be got from SvgDrawContext the PdfCanvas parameter is no more needed.

      Specified by:
      draw in interface IPathShape
      Parameters:
      canvas - to which this instruction is drawn
    • draw

      public abstract void draw()
      Draws this instruction to a canvas object.
    • setParent

      public void setParent (PathSvgNodeRenderer parent)
      Set parent path for this shape.
      Parameters:
      parent - PathSvgNodeRenderer instance
    • setContext

      public void setContext (SvgDrawContext context)
      Set svg draw context for this shape.
      Parameters:
      context - SvgDrawContext instance.
    • setTransform

      public void setTransform (AffineTransform transform)
      Sets AffineTransform to apply before drawing the shape.
      Parameters:
      transform - AffineTransform to apply before drawing
    • parseHorizontalLength

      protected float parseHorizontalLength (String length)
      Parse x axis length value.
      Parameters:
      length - String length for parsing
      Returns:
      absolute length in points
    • parseVerticalLength

      protected float parseVerticalLength (String length)
      Parse y axis length value.
      Parameters:
      length - String length for parsing
      Returns:
      absolute length in points