Class GeneralPath
- java.lang.Object
-
- org.openscience.cdk.renderer.elements.GeneralPath
-
- All Implemented Interfaces:
IRenderingElement
public class GeneralPath extends Object implements IRenderingElement
A path of rendering elements from the elements.path package.- Author:
- Arvid
- Source code:
- main
- Belongs to CDK module:
- renderbasic
-
-
Field Summary
Fields Modifier and Type Field Description ColorcolorThe color of the path.List<PathElement>elementsThe elements in the path.booleanfillFill the shape instead of drawing outline.doublestrokeThe width of the stroke.static intWIND_EVEN_ODDstatic intWIND_NON_ZEROintwindingWinding rule for determining path interior.
-
Constructor Summary
Constructors Constructor Description GeneralPath(List<PathElement> elements, Color color)Make a path from a list of path elements.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IRenderingVisitor v)Converts thisTextElementinto widget specific objects.GeneralPathoutline(double newStroke)Outline the general path with the specified stroke size.static GeneralPathoutlineOf(Shape shape, double stroke, Color color)Create an outline path of the specified Java 2D Shape and color.GeneralPathrecolor(Color newColor)Recolor the path with the specified color.static GeneralPathshapeOf(Shape shape, Color color)Create a filled path of the specified Java 2D Shape and color.AreatoArea()Convert the GeneralPath to an awt.Area.
-
-
-
Field Detail
-
color
public final Color color
The color of the path.
-
stroke
public final double stroke
The width of the stroke.
-
fill
public final boolean fill
Fill the shape instead of drawing outline.
-
elements
public final List<PathElement> elements
The elements in the path.
-
winding
public final int winding
Winding rule for determining path interior.
-
WIND_EVEN_ODD
public static final int WIND_EVEN_ODD
- See Also:
PathIterator.WIND_EVEN_ODD, Constant Field Values
-
WIND_NON_ZERO
public static final int WIND_NON_ZERO
- See Also:
PathIterator.WIND_NON_ZERO, Constant Field Values
-
-
Constructor Detail
-
GeneralPath
public GeneralPath(List<PathElement> elements, Color color)
Make a path from a list of path elements.- Parameters:
elements- the elements that make up the pathcolor- the color of the path
-
-
Method Detail
-
recolor
public GeneralPath recolor(Color newColor)
Recolor the path with the specified color.- Parameters:
newColor- new path color- Returns:
- the recolored path
-
outline
public GeneralPath outline(double newStroke)
Outline the general path with the specified stroke size.- Parameters:
newStroke- new stroke size- Returns:
- the outlined path
-
accept
public void accept(IRenderingVisitor v)
Converts thisTextElementinto widget specific objects.- Specified by:
acceptin interfaceIRenderingElement- Parameters:
v- Toolkit specific widget factory.
-
shapeOf
public static GeneralPath shapeOf(Shape shape, Color color)
Create a filled path of the specified Java 2D Shape and color.- Parameters:
shape- Java 2D shapecolor- the color to fill the shape with- Returns:
- a new general path
-
outlineOf
public static GeneralPath outlineOf(Shape shape, double stroke, Color color)
Create an outline path of the specified Java 2D Shape and color.- Parameters:
shape- Java 2D shapecolor- the color to draw the outline with- Returns:
- a new general path
-
toArea
public Area toArea()
Convert the GeneralPath to an awt.Area.- Returns:
- the area
-
-