diff options
author | Sven Göthel <[email protected]> | 2024-02-01 15:37:03 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-01 15:37:03 +0100 |
commit | 9ff736464e0d2762c424bab66bc6d03ccc6e6d11 (patch) | |
tree | 14e1a383a86bca406608841c7e3acf5d44cbee11 /src/graphui/classes/com/jogamp/graph/ui/shapes | |
parent | ca846bc67e6a074a182e97f29b3c34b90a12cac3 (diff) |
Bug 805: Graph/GraphUI TextureSequence Scale: Move Region.COLORTEXTURE_LETTERBOX_RENDERING_BIT to TextureSequence and add enabling/disabling of aratio adjustment + letter-box back-color
TextureSequence color-texture params fetched from Graph VBORegion* and fed into shader.
This allows more flexibility in aspect-ratio adjustment as well as setting a clipping background color for
the added letter-box space.
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/shapes')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java | 35 |
1 files changed, 30 insertions, 5 deletions
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 de5c43be1..89ec7ffea 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java @@ -32,6 +32,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.ui.GraphShape; +import com.jogamp.math.Vec4f; import com.jogamp.opengl.util.texture.TextureSequence; /** @@ -56,17 +57,41 @@ public abstract class TexSeqButton extends BaseButton { public final TextureSequence getTextureSequence() { return this.texSeq; } /** - * Sets a renderMode {@link Region#COLORTEXTURE_LETTERBOX_RENDERING_BIT} on or off. + * See {@link TextureSequence#setARatioAdjustment(boolean)}. * @return this instance for chaining */ - public TexSeqButton setTextureLetterbox(final boolean v) { - if( getTextureLetterbox() != v ) { - renderModes = Region.setRenderMode(renderModes, Region.COLORTEXTURE_LETTERBOX_RENDERING_BIT, v); + public TexSeqButton setARatioAdjustment(final boolean v) { + if( useARatioAdjustment() != v ) { + texSeq.setARatioAdjustment(v); markShapeDirty(); } return this; } - public boolean getTextureLetterbox() { return Region.isColorTextureLetterbox(renderModes); } + /** + * See {@link TextureSequence#useARatioAdjustment()}. + */ + public boolean useARatioAdjustment() { return texSeq.useARatioAdjustment(); } + + /** + * See {@link TextureSequence#setARatioLetterbox(boolean, Vec4f)}. + * @param v new value for {@link #useARatioLetterbox()} + * @param backColor optional background color for added letter-box space, defaults to transparent zero + * @return this instance for chaining + */ + public TexSeqButton setARatioLetterbox(final boolean v, final Vec4f backColor) { + if( useAspectRatioLetterbox() != v ) { + texSeq.setARatioLetterbox(v, backColor); + markShapeDirty(); + } + return this; + } + /** + * See {@link TextureSequence#useARatioLetterbox()}. + */ + public boolean useAspectRatioLetterbox() { return texSeq.useARatioLetterbox(); } + + /** See {@link TextureSequence#getARatioLetterboxBackColor()}. */ + public Vec4f getARatioLetterboxBackColor() { return texSeq.getARatioLetterboxBackColor(); } @Override protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) { |