Package ca.cgjennings.layout
Class PageShape.CompoundShape
- java.lang.Object
-
- ca.cgjennings.layout.PageShape
-
- ca.cgjennings.layout.PageShape.CompoundShape
-
- Enclosing class:
- PageShape
public static class PageShape.CompoundShape extends PageShape
APageShape
that switches between twoPageShape
s 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 beCompoundShape
s.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 ) );
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ca.cgjennings.layout.PageShape
PageShape.CompoundShape, PageShape.CupShape, PageShape.GeometricShape, PageShape.InsetShape, PageShape.MergedShape
-
-
Field Summary
-
Fields inherited from class ca.cgjennings.layout.PageShape
RECTANGLE_SHAPE
-
-
Constructor Summary
Constructors Constructor Description CompoundShape(PageShape topShape, double y, PageShape bottomShape)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
debugDraw(java.awt.Graphics2D g, java.awt.geom.Rectangle2D rect)
This function is called when the markup renderer is painting its text box for debugging purposes.double
getLeftInset(double y1, double y2)
Return the narrowest (maximum) left edge inset between y1 and y2.double
getRightInset(double y1, double y2)
Return the narrowest (maximum) right edge inset between y1 and y2.
-
-
-
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 classPageShape
-
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 classPageShape
-
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.
-
-