aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com/jogamp/graph/ui/shapes
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/shapes')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java22
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/CrossHair.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java26
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java17
5 files changed, 31 insertions, 38 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
index e8b0be863..0f754d32a 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
@@ -37,6 +37,7 @@ import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.ui.GraphShape;
import com.jogamp.opengl.math.Vec2f;
import com.jogamp.opengl.math.Vec3f;
+import com.jogamp.opengl.math.Vec4f;
import com.jogamp.opengl.math.geom.AABBox;
import jogamp.graph.ui.shapes.Label0;
@@ -72,7 +73,7 @@ public class Button extends RoundButton {
final String labelText, final float width,
final float height) {
super(renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height);
- this.label = new Label0(labelFont, labelText, new float[] { 1.33f, 1.33f, 1.33f, 1.0f }); // 0.75 * 1.33 = 1.0
+ this.label = new Label0(labelFont, labelText, new Vec4f( 1.33f, 1.33f, 1.33f, 1.0f )); // 0.75 * 1.33 = 1.0
setColor(0.75f, 0.75f, 0.75f, 1.0f);
setPressedColorMod(0.9f, 0.9f, 0.9f, 0.7f);
setToggleOffColorMod(0.65f, 0.65f, 0.65f, 1.0f);
@@ -93,16 +94,7 @@ public class Button extends RoundButton {
@Override
protected void addShapeToRegion() {
- final OutlineShape shape = new OutlineShape(vertexFactory);
- if(corner == 0.0f) {
- createSharpOutline(shape, twoPassLabelZOffset);
- } else {
- createCurvedOutline(shape, twoPassLabelZOffset);
- }
- shape.setIsQuadraticNurbs();
- shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
- box.resize(shape.getBounds());
+ addRoundShapeToRegion( twoPassLabelZOffset );
// Precompute text-box size .. guessing pixelSize
final float lw = box.getWidth() * ( 1f - spacingX ) ;
@@ -133,12 +125,6 @@ public class Button extends RoundButton {
if( DEBUG_DRAW ) {
System.err.printf("Button.X: lbox2 %s%n", lbox2);
}
-
- setRotationPivot( ctr );
-
- if( DEBUG_DRAW ) {
- System.err.println("XXX.Button: Added Shape: "+shape+", "+box);
- }
}
public float get2PassLabelZOffset() { return twoPassLabelZOffset; }
@@ -174,7 +160,7 @@ public class Button extends RoundButton {
markShapeDirty();
}
- public final float[] getLabelColor() {
+ public final Vec4f getLabelColor() {
return label.getColor();
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/CrossHair.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/CrossHair.java
index 3e36422a4..f0c6b1369 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/CrossHair.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/CrossHair.java
@@ -59,7 +59,7 @@ public class CrossHair extends GraphShape {
@Override
protected void addShapeToRegion() {
- final OutlineShape shape = new OutlineShape(vertexFactory);
+ final OutlineShape shape = new OutlineShape();
final float lwh = lineWidth/2f;
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java
index 339ecf645..dd6a272cb 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java
@@ -59,7 +59,7 @@ public class Rectangle extends GraphShape {
@Override
protected void addShapeToRegion() {
- final OutlineShape shape = new OutlineShape(vertexFactory);
+ final OutlineShape shape = new OutlineShape();
final float x1 = 0f;
final float y1 = 0f;
final float x2 = getWidth();
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java
index 4ea154c09..672d99c3e 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java
@@ -40,7 +40,7 @@ import com.jogamp.graph.ui.GraphShape;
* To render it rectangular, {@link #setCorner(float)} to zero.
* </p>
*/
-public abstract class RoundButton extends GraphShape {
+public class RoundButton extends GraphShape {
/** {@value} */
public static final float DEFAULT_CORNER = 1f;
@@ -48,7 +48,7 @@ public abstract class RoundButton extends GraphShape {
protected float height;
protected float corner = DEFAULT_CORNER;
- protected RoundButton(final int renderModes, final float width, final float height) {
+ public RoundButton(final int renderModes, final float width, final float height) {
super(renderModes);
this.width = width;
this.height = height;
@@ -67,6 +67,28 @@ public abstract class RoundButton extends GraphShape {
return this;
}
+ @Override
+ protected void addShapeToRegion() {
+ addRoundShapeToRegion(0f);
+ }
+ protected OutlineShape addRoundShapeToRegion(final float zOffset) {
+ final OutlineShape shape = new OutlineShape();
+ if(corner == 0.0f) {
+ createSharpOutline(shape, zOffset);
+ } else {
+ createCurvedOutline(shape, zOffset);
+ }
+ shape.setIsQuadraticNurbs();
+ shape.setSharpness(oshapeSharpness);
+ region.addOutlineShape(shape, null, rgbaColor);
+ box.resize(shape.getBounds());
+ setRotationPivot( box.getCenter() );
+ if( DEBUG_DRAW ) {
+ System.err.println("GraphShape.RoundButton: Added Shape: "+shape+", "+box);
+ }
+ return shape;
+ }
+
protected void createSharpOutline(final OutlineShape shape, final float zOffset) {
final float tw = getWidth();
final float th = getHeight();
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java
index 2f7d85198..87a86e706 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java
@@ -62,21 +62,6 @@ public abstract class TexSeqButton extends RoundButton {
@Override
protected void addShapeToRegion() {
- final OutlineShape shape = new OutlineShape(vertexFactory);
- if(corner == 0.0f) {
- createSharpOutline(shape, 0f);
- } else {
- createCurvedOutline(shape, 0f);
- }
- shape.setIsQuadraticNurbs();
- shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
- box.resize(shape.getBounds());
-
- setRotationPivot( box.getCenter() );
-
- if( DEBUG_DRAW ) {
- System.err.println("XXX.UIShape.TextureSeqButton: Added Shape: "+shape+", "+box);
- }
+ addRoundShapeToRegion( 0f );
}
}