[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gzz util/ColorUtil.java vob/vobs/Continuous...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz/gzz util/ColorUtil.java vob/vobs/Continuous... |
Date: |
Sun, 29 Dec 2002 10:04:28 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 02/12/29 10:04:28
Modified files:
gzz/util : ColorUtil.java
gzz/vob/vobs : ContinuousLineVob.java
Log message:
Fix to compile with Kaffe
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/ColorUtil.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/ContinuousLineVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gzz/gzz/util/ColorUtil.java
diff -u gzz/gzz/util/ColorUtil.java:1.6 gzz/gzz/util/ColorUtil.java:1.7
--- gzz/gzz/util/ColorUtil.java:1.6 Mon Oct 14 14:15:19 2002
+++ gzz/gzz/util/ColorUtil.java Sun Dec 29 10:04:28 2002
@@ -30,7 +30,7 @@
*/
public final class ColorUtil {
-public static final String rcsid = "$Id: ColorUtil.java,v 1.6 2002/10/14
18:15:19 tjl Exp $";
+public static final String rcsid = "$Id: ColorUtil.java,v 1.7 2002/12/29
15:04:28 benja Exp $";
public static Color[] fadingColors_line(int n) {
Color[] res = new Color[n];
@@ -59,24 +59,28 @@
return res;
}
+ /** Emulate Color.getRGBColorComponents
+ * for Java 1.1 (including Kaffe).
+ */
+ public static float[] getRGBColorComponents(Color c, float[] f) {
+ if(f == null) f = new float[3];
+
+ final int RED_MASK = 255 << 16;
+ final int GREEN_MASK = 255 << 8;
+ final int BLUE_MASK = 255;
+
+ int value = c.getRGB();
+ f[0] = ((value & RED_MASK) >> 16) / 255f;
+ f[1] = ((value & GREEN_MASK) >> 8) / 255f;
+ f[2] = (value & BLUE_MASK) / 255f;
+ return f;
+ }
+
public static String colorGLString(Color c) {
- //float[] f = c.getRGBColorComponents(null);
- //return ""+f[0]+" "+f[1]+" "+f[2];
-
-// Here is an inlined version of getRGBColorComponents() for VM's
-// that don't have it yet (eg. kaffe).
-
- final int RED_MASK = 255 << 16;
- final int GREEN_MASK = 255 << 8;
- final int BLUE_MASK = 255;
-
- int value = c.getRGB();
- return "" +
- ((value & RED_MASK) >> 16) / 255f + " " +
- ((value & GREEN_MASK) >> 8) / 255f + " " +
- (value & BLUE_MASK) / 255f;
- }
+ float[] f = getRGBColorComponents(c, null);
+ return ""+f[0]+" "+f[1]+" "+f[2];
+ }
/** Get the average color of an array of colors.
*/
Index: gzz/gzz/vob/vobs/ContinuousLineVob.java
diff -u gzz/gzz/vob/vobs/ContinuousLineVob.java:1.1
gzz/gzz/vob/vobs/ContinuousLineVob.java:1.2
--- gzz/gzz/vob/vobs/ContinuousLineVob.java:1.1 Wed Dec 18 11:10:58 2002
+++ gzz/gzz/vob/vobs/ContinuousLineVob.java Sun Dec 29 10:04:28 2002
@@ -11,7 +11,7 @@
/** Continuous line needs x,y,z points in float array.
*/
public class ContinuousLineVob extends Vob {
-public static final String rcsid = "$Id: ContinuousLineVob.java,v 1.1
2002/12/18 16:10:58 mudyc Exp $";
+public static final String rcsid = "$Id: ContinuousLineVob.java,v 1.2
2002/12/29 15:04:28 benja Exp $";
static private GL.Texture tex;
static private boolean needInit = true;
@@ -60,16 +60,17 @@
// GL implementation
// =================
+ static float[] tmp_floats = new float[3];
public int addToListGL(gzz.client.GraphicsAPI.RenderingSurface win,
int[] list, int curs, int coordsys1,
int coordsys2) {
if (needInit) loadTex();
- float [] tmp_floats = new float[3];
+ ColorUtil.getRGBColorComponents(color, tmp_floats);
GLRen.ContinuousLine cl =
GLRen.createContinuousLine(tex.getTexId(), width, points,
- color.getComponents(tmp_floats));
+ tmp_floats);
return cl.addToListGL(win, list, curs, coordsys1, coordsys2);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gzz util/ColorUtil.java vob/vobs/Continuous...,
Benja Fallenstein <=