Package com.jogamp.graph.geom
Class Outline
java.lang.Object
com.jogamp.graph.geom.Outline
- All Implemented Interfaces:
Comparable<Outline>
Define a single continuous stroke by control vertices.
The vertices define the shape of the region defined by this
outline. The Outline can contain a list of off-curve and on-curve
vertices which define curved regions.
Note: An outline should be closed to be rendered as a region.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Insert theVertex
element at the givenposition
to the outline loop/strip.final void
Appends a vertex to the outline loop/strip.final int
Compare two outline's Bounding Box size.boolean
final AABBox
final Vertex
final Vertex
getVertex
(int index) final int
int
getVertexIndex
(Vertex vertex) final int
hashCode()
final boolean
isClosed()
final boolean
isEmpty()
final Vertex
removeVertex
(int position) Removes theVertex
element at the givenposition
.final boolean
setClosed
(boolean closeTail) Ensure this outline is closed.final void
Replaces theVertex
element at the givenposition
.final void
setVertices
(ArrayList<Vertex> vertices) Use the given outline loop/strip.toString()
final Outline
transform
(jogamp.graph.geom.plane.AffineTransform t, Vertex.Factory<? extends Vertex> vertexFactory) Return a transformed instance with all vertices are copied and transformed.
-
Constructor Details
-
Outline
public Outline()Create an outline defined by control vertices. An outline can contain off Curve vertices which define curved regions in the outline. -
Outline
Copy ctor
-
-
Method Details
-
getVertexCount
public final int getVertexCount() -
addVertex
Appends a vertex to the outline loop/strip.- Parameters:
vertex
- Vertex to be added- Throws:
NullPointerException
- if theVertex
element is null
-
addVertex
public final void addVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException Insert theVertex
element at the givenposition
to the outline loop/strip.- Parameters:
position
- of the added Vertexvertex
- Vertex object to be added- Throws:
NullPointerException
- if theVertex
element is nullIndexOutOfBoundsException
- if position is out of range (position < 0 || position > getVertexNumber())
-
setVertex
public final void setVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException Replaces theVertex
element at the givenposition
.Sets the bounding box dirty, hence a next call to
getBounds()
will validate it.- Parameters:
position
- of the replaced Vertexvertex
- replacement Vertex object- Throws:
NullPointerException
- if theOutline
element is nullIndexOutOfBoundsException
- if position is out of range (position < 0 || position >= getVertexNumber())
-
getVertex
-
getVertexIndex
-
removeVertex
Removes theVertex
element at the givenposition
.Sets the bounding box dirty, hence a next call to
getBounds()
will validate it.- Parameters:
position
- of the to be removed Vertex- Throws:
IndexOutOfBoundsException
- if position is out of range (position < 0 || position >= getVertexNumber())
-
isEmpty
public final boolean isEmpty() -
getLastVertex
-
getVertices
-
setVertices
Use the given outline loop/strip.Validates the bounding box.
- Parameters:
vertices
- the new outline loop/strip
-
isClosed
public final boolean isClosed() -
setClosed
public final boolean setClosed(boolean closeTail) Ensure this outline is closed.Checks whether the last vertex equals to the first. If not equal, it either appends a clone of the first vertex or prepends a clone of the last vertex, depending on
closeTail
.- Parameters:
closeTail
- if true, a clone of the first vertex will be appended, otherwise a clone of the last vertex will be prepended.- Returns:
- true if closing performed, otherwise false for NOP
-
transform
public final Outline transform(jogamp.graph.geom.plane.AffineTransform t, Vertex.Factory<? extends Vertex> vertexFactory) Return a transformed instance with all vertices are copied and transformed. -
getBounds
-
compareTo
Compare two outline's Bounding Box size.- Specified by:
compareTo
in interfaceComparable<Outline>
- See Also:
-
equals
-
hashCode
public final int hashCode() -
toString
-