Class PageShape.GeometricShape

  • Enclosing class:
    PageShape

    public static class PageShape.GeometricShape
    extends PageShape
    A PageShape that takes its form from a drawing shape (java.awt.Shape). The result is similar to scan converting the source shape and adjusting the text margins to the first "on pixel" in each scan row (from the left or right edge depending on the margin). Notes:
    1. Creating a GeometricShape is fairly expensive; they should be reused where possible.
    2. A page shape only modifies the left and right margins of a line; unlike a drawing shape, a line of text cannot contain any interior gaps.
    • Constructor Detail

      • GeometricShape

        public GeometricShape​(java.awt.Shape s,
                              java.awt.geom.Rectangle2D r)
      • GeometricShape

        public GeometricShape​(java.awt.Shape s,
                              java.awt.geom.Rectangle2D r,
                              int numSlices)
    • Method Detail

      • debugDraw

        public void debugDraw​(java.awt.Graphics2D g,
                              java.awt.geom.Rectangle2D rect)
        Description copied from class: PageShape
        This function is called when the markup renderer is painting its text box for debugging purposes. It should draw lines or a shape to indicate how the margins are modified by this shape. The default implementation samples the left and right insets at regular intervals to construct an approximate shape. Subclasses are encouraged to override this to provide more efficient and/or more accurate implementations.
        Overrides:
        debugDraw in class PageShape
        Parameters:
        g - the graphics context to draw into
        rect - the rectangle within which text is being laid out
      • getLeftInset

        public double getLeftInset​(double y1,
                                   double y2)
        Description copied from class: PageShape
        Return the narrowest (maximum) left edge inset between y1 and y2. y1 must be <= y2.
        Overrides:
        getLeftInset in class PageShape
      • getRightInset

        public double getRightInset​(double y1,
                                    double y2)
        Description copied from class: PageShape
        Return the narrowest (maximum) right edge inset between y1 and y2. y1 must be <= y2.
        Overrides:
        getRightInset in class PageShape