aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-18 05:15:16 +0200
committerSven Gothel <[email protected]>2023-04-18 05:15:16 +0200
commitc65c750e032118f229050ff8e834961264ed0591 (patch)
tree8500286ca6086eb21a9b275ccd586185090b1500 /src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java
parentcd845589eea6c7773007e013bd5f2f37242cbe1a (diff)
Graph + GraphUI: Consolidate Vertex: Drop SVertex and factory, use Vec[234]f instead of float[] and remove unused VectorUtil methods
After Matrix4f consolidation and proving same or better performance on non array types, this enhances code readability, simplifies API, reduces bugs and may improve performance. GraphUI: - Have RoundButton as a functional class to make a round or rectangular backdrop, i.e. impl. addShapeToRegion() via reused addRoundShapeToRegion()
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/RoundButton.java26
1 files changed, 24 insertions, 2 deletions
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();