28package com.jogamp.graph.ui.shapes;
30import com.jogamp.opengl.GL2ES2;
31import com.jogamp.opengl.GLProfile;
32import com.jogamp.opengl.util.texture.TextureSequence;
33import com.jogamp.graph.curve.OutlineShape;
34import com.jogamp.graph.curve.Region;
35import com.jogamp.graph.curve.opengl.GLRegion;
36import com.jogamp.graph.curve.opengl.RegionRenderer;
37import com.jogamp.graph.curve.opengl.TextRegionUtil;
38import com.jogamp.graph.font.Font;
39import com.jogamp.graph.font.Font.Glyph;
40import com.jogamp.graph.ui.GraphShape;
41import com.jogamp.math.geom.AABBox;
42import com.jogamp.math.geom.plane.AffineTransform;
52 private float fontScale;
53 private CharSequence text;
69 this.fontScale = fontScale;
94 public boolean setText(
final CharSequence text) {
95 if( !this.text.equals(text) ) {
147 if( !this.font.
equals(font) ) {
185 if( this.fontScale != fontScale ) {
186 this.fontScale = fontScale;
221 resetGLRegion(glp, gl,
null, vertIndCount[0], vertIndCount[1]);
226 fbox = font.
processString(glyphVisitor, tempT1, text, tempT2, tempT3);
233 final int m = Math.min(text.length(), 8);
234 return super.getSubString()+
", fscale " + fontScale +
", '" + text.subSequence(0, m)+
"'";
A Generic shape objects which is defined by a list of Outlines.
final void setSharpness(final float s)
Sets sharpness, defaults to DEFAULT_SHARPNESS.
final void addOutlineShape(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor)
Add the given OutlineShape to this region with the given optional AffineTransform.
Text Type Rendering Utility Class adding the Font.Glyphs OutlineShape to a GLRegion.
static int[] countStringRegion(final Font font, final CharSequence str, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
Graph based GLRegion Shape.
final void resetGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, int vertexCount, int indexCount)
Reset the GLRegion and reserving its buffers to have a free capacity for vertexCount and indexCount e...
final Vec3f getScale()
Returns scale Vec3f reference.
final Shape validate(final GL2ES2 gl)
Validates the shape's underlying GLRegion.
final void markShapeDirty()
Marks the shape dirty, causing next draw() to recreate the Graph shape and reset the region.
final Vec4f rgbaColor
Default base-color w/o color channel, will be modulated w/ pressed- and toggle color.
final Shape setRotationPivot(final float px, final float py, final float pz)
Set unscaled rotation origin, aka pivot.
A GraphUI text label GraphShape.
float getFontScale()
Returns the font-scale factor, by which the em-sized type glyphs shall be scaled.
float getLineHeight()
Returns Font#getLineHeight() * getFontScale().
Font getFont()
Returns the Font used to render the text.
static AABBox getUnscaledGlyphBounds(final Font font, final CharSequence text)
Convenient shortcut to Font#getGlyphBounds(CharSequence, AffineTransform, AffineTransform).
boolean setFontScale(final float fontScale)
Sets the font-scale factor, by which the em-sized type glyphs shall be scaled.
boolean setText(final GL2ES2 gl, final CharSequence text)
Set the text to be rendered and immediately updates the shape if necessary.
void addShapeToRegion(final GLProfile glp, final GL2ES2 gl)
boolean setText(final CharSequence text)
Set the text to be rendered.
float getScaledLineHeight()
Returns Font#getLineHeight() * getFontScale() * getScaleY().
boolean setText(final GLProfile glp, final CharSequence text)
Set the text to be rendered and immediately updates the shape if necessary.
Label(final int renderModes, final Font font, final float fontScale, final CharSequence text)
Label ctor using a separate fontScale to scale the em-sized type glyphs.
boolean setFont(final Font font)
Set the Font used to render the text.
AABBox getUnscaledGlyphBounds()
Convenient shortcut to Font#getGlyphBounds(CharSequence, AffineTransform, AffineTransform) using getF...
CharSequence getText()
Returns the label text.
Label(final int renderModes, final Font font, final CharSequence text)
Label ctor using em-size type glyphs.
Axis Aligned Bounding Box.
final AABBox copy(final AABBox src)
Copy given AABBox 'src' values to this AABBox.
final Vec3f getCenter()
Returns computed center of this AABBox of getLow() and getHigh().
Specifies the the OpenGL profile.
General purpose Font.Glyph visitor.
boolean isNonContour()
Returns true if isWhitespace() or isUndefined().
Interface wrapper for font implementation.
float getLineHeight()
Returns line height, baseline-to-baseline in em-size [0..1], composed from ‘hhea’ table entries.
AABBox getGlyphBounds(final CharSequence string)
Try using getGlyphBounds(CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform ins...
AABBox processString(final Font.GlyphVisitor visitor, final AffineTransform transform, final CharSequence string)
Try using processString(GlyphVisitor, AffineTransform, CharSequence, AffineTransform,...
boolean equals(final Object o)
Returns true if other instance is of same type and NAME_UNIQUNAME is equal.