summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-02-11 01:13:40 +0000
committerKenneth Russel <[email protected]>2007-02-11 01:13:40 +0000
commit2330ed8aafa2e100b7f0f1642b6b3101924f6cbb (patch)
treeaa5c3b0218e9b1277f3a66e3c2d231f4366c871f /src/classes/com/sun
parent54bfaee24c14157108e99e88e7d55ba41ca67edf (diff)
Added setColor(Color) convenience method
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1126 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/j2d/TextRenderer.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java
index 0ad84c90c..d5afc3d82 100755
--- a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java
+++ b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java
@@ -281,6 +281,22 @@ public class TextRenderer {
beginRendering(false, 0, 0);
}
+ private float[] compArray;
+ /** Changes the current color of this TextRenderer to the supplied
+ one. The default color is opaque white.
+
+ @param color the new color to use for rendering text
+ @throws GLException If an OpenGL context is not current when this method is called
+ */
+ public void setColor(Color color) throws GLException {
+ // Get color's RGBA components as floats in the range [0,1].
+ if (compArray == null) {
+ compArray = new float[4];
+ }
+ color.getRGBComponents(compArray);
+ setColor(compArray[0], compArray[1], compArray[2], compArray[3]);
+ }
+
/** Changes the current color of this TextRenderer to the supplied
one, where each component ranges from 0.0f - 1.0f. The alpha
component, if used, does not need to be premultiplied into the