aboutsummaryrefslogtreecommitdiffstats
path: root/trunk/ardor3d-ui/src/main/java
diff options
context:
space:
mode:
authorRenanse <[email protected]>2012-11-14 11:15:43 -0600
committerRenanse <[email protected]>2012-11-14 11:15:43 -0600
commitf79ddc350593a07864b7925761fc81140d8e9f39 (patch)
tree8f6ae7ebf02118eac43f7c492f5deb2583a498a6 /trunk/ardor3d-ui/src/main/java
parent83b7defc2cebd21b9e62665ae06ad9e33af38316 (diff)
Fixed issues with tint color - was not copied by copy constructor; was
not copied into Character Descriptor, allowing for unintended modification. Added ability to modify just tint alpha without knowing/modifying tint color (idea from forum user rabitH5)
Diffstat (limited to 'trunk/ardor3d-ui/src/main/java')
-rw-r--r--trunk/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/trunk/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java b/trunk/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java
index a99df29..2daa02f 100644
--- a/trunk/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java
+++ b/trunk/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java
@@ -10,6 +10,7 @@
package com.ardor3d.extension.ui.text;
+import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
public class CharacterDescriptor {
@@ -34,7 +35,7 @@ public class CharacterDescriptor {
private double _scale = 1;
/** tiny to apply - optional */
- private ReadOnlyColorRGBA _tint = null;
+ private ColorRGBA _tint = null;
public CharacterDescriptor(final int x, final int y, final int width, final int height, final int xAdvance) {
this(xAdvance, y, width, height, xAdvance, 0, 0, 1, null);
@@ -54,6 +55,7 @@ public class CharacterDescriptor {
_xAdvance = xAdvance;
_xOffset = xOffset;
_yOffset = yOffset;
+ setTint(tint);
}
public int getXAdvance() {
@@ -97,6 +99,20 @@ public class CharacterDescriptor {
}
public void setTint(final ReadOnlyColorRGBA tint) {
- _tint = tint;
+ if (tint == null) {
+ _tint = null;
+ } else if (_tint == null) {
+ _tint = new ColorRGBA(tint);
+ } else {
+ _tint.set(tint);
+ }
+ }
+
+ public void setTintAlpha(final float alpha) {
+ if (_tint == null) {
+ _tint = new ColorRGBA(1.0f, 1.0f, 1.0f, alpha);
+ } else {
+ _tint.setAlpha(alpha);
+ }
}
}