Package com.openhtmltopdf.render
Class BorderPainter
- java.lang.Object
-
- com.openhtmltopdf.render.BorderPainter
-
public class BorderPainter extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBorderPainter.RelativeBorderProperties
-
Constructor Summary
Constructors Constructor Description BorderPainter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidappendPath(java.awt.geom.Path2D path, float xOffset, float yOffset, float radiusVert, float radiusHoriz, float startAngle, float distance, float topWidth, float sideWidth, float scaleOffset, boolean left, float widthScale)static java.awt.geom.Path2DgenerateBorderBounds(java.awt.Rectangle bounds, BorderPropertySet border, boolean inside)Generates a full round rectangle that is made of bounds and borderstatic java.awt.geom.Path2DgenerateBorderShape(java.awt.Rectangle bounds, int side, BorderPropertySet border, boolean drawInterior)Generates one side of a borderstatic java.awt.geom.Path2DgenerateBorderShape(java.awt.Rectangle bounds, int side, BorderPropertySet border, boolean drawInterior, float scaledOffset)Generates one side of a borderstatic java.awt.geom.Path2DgenerateBorderShape(java.awt.Rectangle bounds, int side, BorderPropertySet border, boolean drawInterior, float scaledOffset, float widthScale)Generates one side of a borderprivate static java.awt.ShapegenerateSimpleBorderShape(java.awt.Rectangle bounds, int currentSide, BorderPropertySet border)Generate a simple rectangle without beveling for a solid border side.static voidpaint(java.awt.Rectangle bounds, int sides, BorderPropertySet border, RenderingContext ctx, int xOffset, boolean bevel)private static voidpaintBorderSide(OutputDevice outputDevice, BorderPropertySet border, java.awt.Rectangle bounds, int sides, int currentSide, IdentValue borderSideStyle, int xOffset, boolean bevel)private static voidpaintBorderSideShape(OutputDevice outputDevice, java.awt.Rectangle bounds, BorderPropertySet border, BorderPropertySet high, BorderPropertySet low, float offset, float scale, int sides, int currentSide, boolean bevel)private static voidpaintDoubleBorder(OutputDevice outputDevice, BorderPropertySet border, java.awt.Rectangle bounds, int sides, int currentSide, boolean bevel)private static voidpaintPatternedRect(OutputDevice outputDevice, java.awt.Rectangle bounds, BorderPropertySet border, BorderPropertySet color, float[] pattern, int sides, int currentSide, int xOffset)private static voidpaintSolid(OutputDevice outputDevice, java.awt.Rectangle bounds, BorderPropertySet border, float offset, float scale, int sides, int currentSide, boolean bevel)
-
-
-
Field Detail
-
TOP
public static final int TOP
- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
- See Also:
- Constant Field Values
-
BOTTOM
public static final int BOTTOM
- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
- See Also:
- Constant Field Values
-
ALL
public static final int ALL
- See Also:
- Constant Field Values
-
-
Method Detail
-
generateSimpleBorderShape
private static java.awt.Shape generateSimpleBorderShape(java.awt.Rectangle bounds, int currentSide, BorderPropertySet border)Generate a simple rectangle without beveling for a solid border side. Turning off beveling should disable anti-aliasing and work better with table cell borders. See https://github.com/danfickle/openhtmltopdf/issues/752
-
generateBorderBounds
public static java.awt.geom.Path2D generateBorderBounds(java.awt.Rectangle bounds, BorderPropertySet border, boolean inside)Generates a full round rectangle that is made of bounds and border- Parameters:
bounds- Dimmensions of the rectborder- The border specsinside- true if you want the inner bounds of borders- Returns:
- A Path that is all sides of the round rectangle
-
generateBorderShape
public static java.awt.geom.Path2D generateBorderShape(java.awt.Rectangle bounds, int side, BorderPropertySet border, boolean drawInterior)Generates one side of a border- Parameters:
bounds- bounds of the containerside- what side you wantborder- border propsdrawInterior- if you want it to be 2d or not, if false it will be just a line- Returns:
- a path for the side chosen!
-
generateBorderShape
public static java.awt.geom.Path2D generateBorderShape(java.awt.Rectangle bounds, int side, BorderPropertySet border, boolean drawInterior, float scaledOffset)Generates one side of a border- Parameters:
bounds- bounds of the containerside- what side you wantborder- border propsdrawInterior- if you want it to be 2d or not, if false it will be just a linescaledOffset- insets the border by multipling border widths by this variable, best use would be 1 or .5, cant see it for much other than that- Returns:
- a path for the side chosen!
-
generateBorderShape
public static java.awt.geom.Path2D generateBorderShape(java.awt.Rectangle bounds, int side, BorderPropertySet border, boolean drawInterior, float scaledOffset, float widthScale)Generates one side of a border- Parameters:
bounds- bounds of the containerside- what side you wantborder- border propsdrawInterior- if you want it to be 2d or not, if false it will be just a linescaledOffset- insets the border by multipling border widths by this variable, best use would be 1 or .5, cant see it for much other than thatwidthScale- scales the border widths by this factor, useful for drawing half borders for border types like groove or double- Returns:
- a path for the side chosen!
-
appendPath
private static void appendPath(java.awt.geom.Path2D path, float xOffset, float yOffset, float radiusVert, float radiusHoriz, float startAngle, float distance, float topWidth, float sideWidth, float scaleOffset, boolean left, float widthScale)
-
paint
public static void paint(java.awt.Rectangle bounds, int sides, BorderPropertySet border, RenderingContext ctx, int xOffset, boolean bevel)- Parameters:
xOffset- for determining starting point for patterns
-
paintBorderSide
private static void paintBorderSide(OutputDevice outputDevice, BorderPropertySet border, java.awt.Rectangle bounds, int sides, int currentSide, IdentValue borderSideStyle, int xOffset, boolean bevel)
-
paintDoubleBorder
private static void paintDoubleBorder(OutputDevice outputDevice, BorderPropertySet border, java.awt.Rectangle bounds, int sides, int currentSide, boolean bevel)
-
paintPatternedRect
private static void paintPatternedRect(OutputDevice outputDevice, java.awt.Rectangle bounds, BorderPropertySet border, BorderPropertySet color, float[] pattern, int sides, int currentSide, int xOffset)
- Parameters:
xOffset- for inline borders, to determine dash_phase of top and bottom
-
paintBorderSideShape
private static void paintBorderSideShape(OutputDevice outputDevice, java.awt.Rectangle bounds, BorderPropertySet border, BorderPropertySet high, BorderPropertySet low, float offset, float scale, int sides, int currentSide, boolean bevel)
-
paintSolid
private static void paintSolid(OutputDevice outputDevice, java.awt.Rectangle bounds, BorderPropertySet border, float offset, float scale, int sides, int currentSide, boolean bevel)
-
-