diff options
Diffstat (limited to 'src/jogamp/graph/curve/text')
-rw-r--r-- | src/jogamp/graph/curve/text/GlyphShape.java | 31 | ||||
-rw-r--r-- | src/jogamp/graph/curve/text/GlyphString.java | 27 |
2 files changed, 28 insertions, 30 deletions
diff --git a/src/jogamp/graph/curve/text/GlyphShape.java b/src/jogamp/graph/curve/text/GlyphShape.java index 8e16de1a4..78ae7396c 100644 --- a/src/jogamp/graph/curve/text/GlyphShape.java +++ b/src/jogamp/graph/curve/text/GlyphShape.java @@ -32,8 +32,7 @@ import java.util.ArrayList; import jogamp.graph.geom.plane.PathIterator; import com.jogamp.graph.geom.Line; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.curve.OutlineShape; @@ -48,7 +47,7 @@ public class GlyphShape { /** Create a new Glyph shape * based on Parametric curve control polyline */ - public GlyphShape(Point.Factory<? extends PointTex> factory){ + public GlyphShape(Vertex.Factory<? extends Vertex> factory){ shape = new OutlineShape(factory); } @@ -57,7 +56,7 @@ public class GlyphShape { * * @see PathIterator */ - public GlyphShape(Point.Factory<? extends PointTex> factory, PathIterator pathIterator){ + public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){ this(factory); if(null != pathIterator){ @@ -72,9 +71,9 @@ public class GlyphShape { shape.transformOutlines(OutlineShape.QUADRATIC_NURBS); } - public final Point.Factory<? extends PointTex> pointFactory() { return shape.pointFactory(); } + public final Vertex.Factory<? extends Vertex> pointFactory() { return shape.pointFactory(); } - private void addVertexToLastOutline(PointTex vertex){ + private void addVertexToLastOutline(Vertex vertex){ shape.addVertex(vertex); } @@ -83,40 +82,40 @@ public class GlyphShape { if(!shape.getLastOutline().isEmpty()){ shape.addEmptyOutline(); } - PointTex vert = pointFactory().create(coords[0],coords[1]); + Vertex vert = pointFactory().create(coords[0],coords[1]); vert.setOnCurve(true); addVertexToLastOutline(vert); numVertices++; } else if(segmentType == PathIterator.SEG_LINETO){ - PointTex vert1 = pointFactory().create(coords[0],coords[1]); + Vertex vert1 = pointFactory().create(coords[0],coords[1]); vert1.setOnCurve(true); addVertexToLastOutline(vert1); numVertices++; } else if(segmentType == PathIterator.SEG_QUADTO){ - PointTex vert1 = pointFactory().create(coords[0],coords[1]); + Vertex vert1 = pointFactory().create(coords[0],coords[1]); vert1.setOnCurve(false); addVertexToLastOutline(vert1); - PointTex vert2 = pointFactory().create(coords[2],coords[3]); + Vertex vert2 = pointFactory().create(coords[2],coords[3]); vert2.setOnCurve(true); addVertexToLastOutline(vert2); numVertices+=2; } else if(segmentType == PathIterator.SEG_CUBICTO){ - PointTex vert1 = pointFactory().create(coords[0],coords[1]); + Vertex vert1 = pointFactory().create(coords[0],coords[1]); vert1.setOnCurve(false); addVertexToLastOutline(vert1); - PointTex vert2 = pointFactory().create(coords[2],coords[3]); + Vertex vert2 = pointFactory().create(coords[2],coords[3]); vert2.setOnCurve(false); addVertexToLastOutline(vert2); - PointTex vert3 = pointFactory().create(coords[4],coords[5]); + Vertex vert3 = pointFactory().create(coords[4],coords[5]); vert3.setOnCurve(true); addVertexToLastOutline(vert3); @@ -150,21 +149,21 @@ public class GlyphShape { * @param sharpness sharpness of the curved regions default = 0.5 * @return ArrayList of triangles which define this shape */ - public ArrayList<Triangle<PointTex>> triangulate(float sharpness){ + public ArrayList<Triangle<Vertex>> triangulate(float sharpness){ return shape.triangulate(sharpness); } /** Get the list of Vertices of this Object * @return arrayList of Vertices */ - public ArrayList<PointTex> getVertices(){ + public ArrayList<Vertex> getVertices(){ return shape.getVertices(); } /** Get the list of AA lines defined by this object * @return arraylist of lines */ - public ArrayList<Line<PointTex>> getLines(){ + public ArrayList<Line<Vertex>> getLines(){ return shape.getLines(); } } diff --git a/src/jogamp/graph/curve/text/GlyphString.java b/src/jogamp/graph/curve/text/GlyphString.java index 75d7e4402..a7418c6de 100644 --- a/src/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogamp/graph/curve/text/GlyphString.java @@ -29,10 +29,9 @@ package jogamp.graph.curve.text; import java.util.ArrayList; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; -import com.jogamp.graph.geom.opengl.Vertex; +import com.jogamp.graph.geom.opengl.SVertex; import javax.media.opengl.GLContext; @@ -47,26 +46,26 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderState; public class GlyphString { - private final Point.Factory<? extends PointTex> pointFactory; + private final Vertex.Factory<? extends Vertex> pointFactory; private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>(); private String str = ""; private String fontname = ""; private Region region; - private Vertex origin = new Vertex(); + private SVertex origin = new SVertex(); /** Create a new GlyphString object * @param fontname the name of the font that this String is * associated with * @param str the string object */ - public GlyphString(Point.Factory<? extends PointTex> factory, String fontname, String str){ + public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){ pointFactory = factory; this.fontname = fontname; this.str = str; } - public final Point.Factory<? extends PointTex> pointFactory() { return pointFactory; } + public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; } public void addGlyphShape(GlyphShape glyph){ glyphs.add(glyph); @@ -95,10 +94,10 @@ public class GlyphString { } } - private ArrayList<Triangle<PointTex>> initializeTriangles(float sharpness){ - ArrayList<Triangle<PointTex>> triangles = new ArrayList<Triangle<PointTex>>(); + private ArrayList<Triangle<Vertex>> initializeTriangles(float sharpness){ + ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>(); for(GlyphShape glyph:glyphs){ - ArrayList<Triangle<PointTex>> tris = glyph.triangulate(sharpness); + ArrayList<Triangle<Vertex>> tris = glyph.triangulate(sharpness); triangles.addAll(tris); } return triangles; @@ -113,13 +112,13 @@ public class GlyphString { region = RegionFactory.create(context, st, type); region.setFlipped(true); - ArrayList<Triangle<PointTex>> tris = initializeTriangles(shaprness); + ArrayList<Triangle<Vertex>> tris = initializeTriangles(shaprness); region.addTriangles(tris); int numVertices = region.getNumVertices(); for(GlyphShape glyph:glyphs){ - ArrayList<PointTex> gVertices = glyph.getVertices(); - for(PointTex vert:gVertices){ + ArrayList<Vertex> gVertices = glyph.getVertices(); + for(Vertex vert:gVertices){ vert.setId(numVertices++); } region.addVertices(gVertices); @@ -152,7 +151,7 @@ public class GlyphString { /** Get the Origion of this GlyphString * @return */ - public PointTex getOrigin() { + public Vertex getOrigin() { return origin; } |