diff options
author | Sven Gothel <[email protected]> | 2014-02-23 06:11:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-23 06:11:11 +0100 |
commit | f51933f0ebe9ae030c26c066e59a728ce08b8559 (patch) | |
tree | 6723e2343b80a487dba73d51609e2d8fee120b1a /src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java | |
parent | b68794ae48cf2f133abd9d822f08207cf3404c17 (diff) |
Bug 801: Graph TextRenderer Cleanup Part-1a (unclean)
Remark: This commit is unclean and requires 'Part-1b' due to
merging this commit after more than 2 years!
Graph:
- Use List<OutlineShape> instead of array
allowing more flexible memory managment.
- GLRegion -> Region promotion:
- Region create(List<OutlineShape> outlineShapes, int renderModes)
- Region create(OutlineShape outlineShape, int renderModes)
- Region additions
- void addOutlineShape(OutlineShape shape)
- void addOutlineShapes(List<OutlineShape> shapes)
- RegionRenderer
- draw(..) remove 'position', redundant
-
- Deprecate 'TextRenderer' and 'GlyphString'
Use Region.create(Font.getOutlineShapes(...)) + RegionRenderer instead.
- FontInt -> Font promotion (make public)
- getOutlineShape and getOutlineShapes
- Font.Glyph additions
- 'getID(), hashCode()'
- 'float getScale(float pixelSize)'
- GlyphShape
- Add reference to Glyph allowing GlyphString
to access the font metrics for translation and scaling
- Experimental pre-scale/translation in GlyphString
using default font size and it's metrics
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java index 578148699..12da966a2 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java @@ -29,71 +29,84 @@ package jogamp.graph.curve.text; import java.util.ArrayList; +import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.math.Quaternion; +// import com.jogamp.graph.math.Quaternion; public class GlyphShape { - private Quaternion quat= null; - private OutlineShape shape = null; + // private Quaternion quat= null; + private Glyph glyph; + private OutlineShape shape; /** Create a new Glyph shape * based on Parametric curve control polyline */ public GlyphShape(Vertex.Factory<? extends Vertex> factory){ - shape = new OutlineShape(factory); + this.shape = new OutlineShape(factory); + this.glyph = null; } /** Create a new GlyphShape from a {@link OutlineShape} * @param factory vertex impl factory {@link Factory} * @param shape {@link OutlineShape} representation of the Glyph */ - public GlyphShape(Vertex.Factory<? extends Vertex> factory, OutlineShape shape){ + public GlyphShape(Vertex.Factory<? extends Vertex> factory, Glyph glyph, OutlineShape shape){ this(factory); this.shape = shape; - this.shape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS); + this.shape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS); + this.glyph = glyph; + } + + public final void destroy() { + shape.clear(); + shape = null; + glyph = null; } public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); } - public OutlineShape getShape() { + public final Glyph getGlyph() { + return glyph; + } + + public final OutlineShape getShape() { return shape; } - public int getNumVertices() { + public final int getNumVertices() { return shape.getVertices().size(); } /** Get the rotational Quaternion attached to this Shape * @return the Quaternion Object - */ - public Quaternion getQuat() { + public final Quaternion getQuat() { return quat; } - /** Set the Quaternion that shall defien the rotation + * Set the Quaternion that shall defien the rotation * of this shape. * @param quat - */ - public void setQuat(Quaternion quat) { + public final void setQuat(Quaternion quat) { this.quat = quat; } + */ /** Triangluate the glyph shape * @return ArrayList of triangles which define this shape */ - public ArrayList<Triangle> triangulate(){ + public final ArrayList<Triangle> triangulate(){ return shape.triangulate(); } /** Get the list of Vertices of this Object * @return arrayList of Vertices */ - public ArrayList<Vertex> getVertices(){ + public final ArrayList<Vertex> getVertices(){ return shape.getVertices(); } } |