Class PageShape.CompoundShape

  • Enclosing class:
    PageShape

    public static class PageShape.CompoundShape
    extends PageShape
    A PageShape that switches between two PageShapes at a specified Y-position. This may be used to build more complex shapes from simpler ones. Either or both of the shapes may themselves be CompoundShapes.

    The following example uses a compound shape to create a "plus" or "double cup" shape, that is, a cup shape that handles four corners instead of two:

     //     i1    i2
     //     +------+
     //     |      |
     // 0 +-+      +-+ 0  y1
     //   |          |
     //   +---+  +---+    y2
     //       |  |
     //       +--+
     //      i3  i4
     new PageShape.CompoundShape(
         new PageShape.CupShape( i1, i2, y1, 0, 0 ),
         y2,
         new PageShape.InsetShape( i3, i4 )
     );
     
    • Constructor Detail

      • CompoundShape

        public CompoundShape​(PageShape topShape,
                             double y,
                             PageShape bottomShape)
    • Method Detail

      • 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
      • 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