Package ca.cgjennings.layout
Class PageShape.GeometricShape
- java.lang.Object
-
- ca.cgjennings.layout.PageShape
-
- ca.cgjennings.layout.PageShape.GeometricShape
-
- Enclosing class:
- PageShape
public static class PageShape.GeometricShape extends PageShape
APageShapethat 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:- Creating a
GeometricShapeis fairly expensive; they should be reused where possible. - 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.
-
-
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 GeometricShape(java.awt.Shape s, java.awt.geom.Rectangle2D r)GeometricShape(java.awt.Shape s, java.awt.geom.Rectangle2D r, int numSlices)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebugDraw(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.doublegetLeftInset(double y1, double y2)Return the narrowest (maximum) left edge inset between y1 and y2.doublegetRightInset(double y1, double y2)Return the narrowest (maximum) right edge inset between y1 and y2.
-
-
-
Method Detail
-
debugDraw
public void debugDraw(java.awt.Graphics2D g, java.awt.geom.Rectangle2D rect)Description copied from class:PageShapeThis 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.
-
getLeftInset
public double getLeftInset(double y1, double y2)Description copied from class:PageShapeReturn the narrowest (maximum) left edge inset between y1 and y2. y1 must be <= y2.- Overrides:
getLeftInsetin classPageShape
-
getRightInset
public double getRightInset(double y1, double y2)Description copied from class:PageShapeReturn the narrowest (maximum) right edge inset between y1 and y2. y1 must be <= y2.- Overrides:
getRightInsetin classPageShape
-
-