diff options
author | Sven Göthel <[email protected]> | 2024-01-28 06:39:29 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-28 06:39:29 +0100 |
commit | 62a1f18e98df6783d487f7dfbbc83026b04a19b8 (patch) | |
tree | bf14449ba93426eaaa85ddccff44c9ebec973600 /src/graphui/classes/com | |
parent | d46c8e7f5288fb07e632b063462a6c08bba91fb2 (diff) |
GraphUI Misc Cleanup: Move get*Font() helper to Scene; Allow GraphShape.drawImpl0(..) override;
Diffstat (limited to 'src/graphui/classes/com')
3 files changed, 24 insertions, 19 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java index 6f3b7bb71..0cc48b627 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java @@ -146,7 +146,7 @@ public abstract class GraphShape extends Shape { } @Override - protected final void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final Vec4f rgba) { + protected void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final Vec4f rgba) { renderer.setColorStatic(rgba); region.draw(gl, renderer); } diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java index 7f47b2d98..9ebacf2ec 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java @@ -28,6 +28,7 @@ package com.jogamp.graph.ui; import java.io.File; +import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; @@ -53,6 +54,8 @@ import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.font.Font; +import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.ui.Shape.Visitor2; import com.jogamp.math.FloatUtil; import com.jogamp.math.Matrix4f; @@ -127,6 +130,25 @@ public final class Scene implements Container, GLEventListener { return FloatUtil.getZBufferEpsilon(zBits, setup.getSceneDist(), setup.getZNear()); } + /** Returns {@link FontFactory#getDefault()} font or null if n/a */ + public static Font getDefaultFont() { + try { + return FontFactory.getDefault().getDefault(); + } catch(final IOException ioe) { + ioe.printStackTrace(); + return null; + } + } + /** Returns the default symbols font or null if n/a */ + public static Font getSymbolsFont() { + try { + return FontFactory.get(FontFactory.SYMBOLS).getDefault(); + } catch(final IOException ioe) { + ioe.printStackTrace(); + return null; + } + } + private static final boolean DEBUG = false; private final List<Shape> shapes = new CopyOnWriteArrayList<Shape>(); diff --git a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java index e2912bdf4..dae0700f8 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java +++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java @@ -106,7 +106,7 @@ public class MediaPlayer extends Widget { { super( new BoxLayout(aratio, 1, Alignment.None) ); - final Font fontInfo = getInfoFont(), fontSymbols = getSymbolsFont(); + final Font fontInfo = Scene.getDefaultFont(), fontSymbols = Scene.getSymbolsFont(); if( null == fontInfo || null == fontSymbols ) { return; } @@ -594,23 +594,6 @@ public class MediaPlayer extends Widget { ctrlSlider.getKnob().setDraggable(true); } - /** Returns the used info font or null if n/a */ - public static Font getInfoFont() { - try { - return FontFactory.get(FontFactory.UBUNTU).getDefault(); - } catch(final IOException ioe) { - ioe.printStackTrace(); - return null; - } - } - - /** Returns the used symbols font or null if n/a */ - public static Font getSymbolsFont() { - try { - return FontFactory.get(FontFactory.SYMBOLS).getDefault(); - } catch(final IOException ioe) { - ioe.printStackTrace(); - return null; } } |