This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.awt.image.IndexColorModel
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Thu, 19 Jun 2003 11:37:20 +0200
- Subject: FYI: Patch: java.awt.image.IndexColorModel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch merge java.awt.image.IndexColorModel
again with classpath.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+8YRQWSOgCCdjSDsRAsO/AJ4z2sWKXM6Br+LnhC98LoaJQMQ+sQCeILO1
G0OLSqe6V/gCGo6xAk1kwCA=
=nuqT
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1959
diff -u -b -B -r1.1959 ChangeLog
--- ChangeLog 18 Jun 2003 08:56:53 -0000 1.1959
+++ ChangeLog 19 Jun 2003 09:28:42 -0000
@@ -1,3 +1,8 @@
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/IndexColorModel.java:
+ New version from classpath.
+
2003-06-18 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SelectorImpl.java
Index: java/awt/image/IndexColorModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/IndexColorModel.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 IndexColorModel.java
--- java/awt/image/IndexColorModel.java 9 Aug 2002 04:26:16 -0000 1.4
+++ java/awt/image/IndexColorModel.java 19 Jun 2003 09:28:42 -0000
@@ -39,7 +39,6 @@
package java.awt.image;
/**
- *
* @author C. Brian Jones (cbj@gnu.org)
*/
public class IndexColorModel extends ColorModel
@@ -63,7 +61,8 @@
* @param blues the blue component of all colors
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues) {
+ byte[] blues)
+ {
this(bits, size, reds, greens, blues, (byte[])null);
}
@@ -81,7 +80,8 @@
* @param trans the index of the transparent color
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues, int trans) {
+ byte[] blues, int trans)
+ {
this(bits, size, reds, greens, blues, (byte[])null);
this.trans = trans;
}
@@ -100,26 +100,31 @@
* @param alphas the alpha component of all colors
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues, byte[] alphas) {
+ byte[] blues, byte[] alphas)
+ {
super(bits);
map_size = size;
opaque = (alphas == null);
rgb = new int[size];
- if (alphas == null) {
- for (int i = 0; i < size; i++) {
- rgb[i] = 0xff000000 |
- ((reds[i] & 0xff) << 16) |
- ((greens[i] & 0xff) << 8) |
- (blues[i] & 0xff);
+ if (alphas == null)
+ {
+ for (int i = 0; i < size; i++)
+ {
+ rgb[i] = (0xff000000
+ | ((reds[i] & 0xff) << 16)
+ | ((greens[i] & 0xff) << 8)
+ | (blues[i] & 0xff));
}
}
- else {
- for (int i = 0; i < size; i++) {
- rgb[i] = ((alphas[i] & 0xff) << 24 |
- ((reds[i] & 0xff) << 16) |
- ((greens[i] & 0xff) << 8) |
- (blues[i] & 0xff));
+ else
+ {
+ for (int i = 0; i < size; i++)
+ {
+ rgb[i] = ((alphas[i] & 0xff) << 24
+ | ((reds[i] & 0xff) << 16)
+ | ((greens[i] & 0xff) << 8)
+ | (blues[i] & 0xff));
}
}
}
@@ -137,7 +142,8 @@
* @param hasAlpha <code>cmap</code> has alpha values
*/
public IndexColorModel(int bits, int size, byte[] cmap, int start,
- boolean hasAlpha) {
+ boolean hasAlpha)
+ {
this(bits, size, cmap, start, hasAlpha, -1);
}
@@ -155,49 +161,56 @@
* @param trans the index of the transparent color
*/
public IndexColorModel(int bits, int size, byte[] cmap, int start,
- boolean hasAlpha, int trans) {
+ boolean hasAlpha, int trans)
+ {
super(bits);
map_size = size;
opaque = !hasAlpha;
this.trans = trans;
}
- public final int getMapSize() {
+ public final int getMapSize ()
+ {
return map_size;
}
/**
* Get the index of the transparent color in this color model
*/
- public final int getTransparentPixel() {
+ public final int getTransparentPixel ()
+ {
return trans;
}
/**
* <br>
*/
- public final void getReds(byte[] r) {
+ public final void getReds (byte[] r)
+ {
getComponents( r, 2 );
}
/**
* <br>
*/
- public final void getGreens(byte[] g) {
+ public final void getGreens (byte[] g)
+ {
getComponents( g, 1 );
}
/**
* <br>
*/
- public final void getBlues(byte[] b) {
+ public final void getBlues (byte[] b)
+ {
getComponents( b, 0 );
}
/**
* <br>
*/
- public final void getAlphas(byte[] a) {
+ public final void getAlphas (byte[] a)
+ {
getComponents( a, 3 );
}
@@ -210,54 +223,59 @@
/**
* Get the red component of the given pixel.
- * <br>
*/
- public final int getRed(int pixel) {
+ public final int getRed (int pixel)
+ {
if( pixel < map_size )
return (int)(( generateMask( 2 ) & rgb[pixel]) >> (2 * pixel_bits ) );
+
return 0;
}
/**
* Get the green component of the given pixel.
- * <br>
*/
- public final int getGreen(int pixel) {
+ public final int getGreen (int pixel)
+ {
if( pixel < map_size )
return (int)(( generateMask( 1 ) & rgb[pixel]) >> (1 * pixel_bits ) );
+
return 0;
}
/**
* Get the blue component of the given pixel.
- * <br>
*/
- public final int getBlue(int pixel) {
+ public final int getBlue (int pixel)
+ {
if( pixel < map_size )
return (int)( generateMask( 0 ) & rgb[pixel]);
+
return 0;
}
/**
* Get the alpha component of the given pixel.
- * <br>
*/
- public final int getAlpha(int pixel) {
+ public final int getAlpha (int pixel)
+ {
if( pixel < map_size )
return (int)(( generateMask( 3 ) & rgb[pixel]) >> (3 * pixel_bits ) );
+
return 0;
}
/**
* Get the RGB color value of the given pixel using the default
* RGB color model.
- * <br>
*
* @param pixel a pixel value
*/
- public final int getRGB(int pixel) {
+ public final int getRGB (int pixel)
+ {
if( pixel < map_size )
return rgb[pixel];
+
return 0;
}