kuhlmaehn
Erfahrenes Mitglied
Hi,
ich hab jetzt gute 30 Minuten google durchforstet und darum frag ich jetzt mal
Warum wird in diesem Beispiel nicht als Alpha-Wert 0 ausgegeben, sondern 255 und wie setze bzw. lese ich den Alpha-Kanal denn dann richtig?
Danke!
ich hab jetzt gute 30 Minuten google durchforstet und darum frag ich jetzt mal

Warum wird in diesem Beispiel nicht als Alpha-Wert 0 ausgegeben, sondern 255 und wie setze bzw. lese ich den Alpha-Kanal denn dann richtig?
Code:
BufferedImage bi = new BufferedImage(40, 40, BufferedImage.TYPE_INT_ARGB);
for(int x = 0; x < bi.getWidth(); x++) {
for(int y = 0; y < bi.getHeight(); y++) {
Color col = new Color(22, 66, 88, 0);
int gcol = col.getRGB();
bi.setRGB(x, y, gcol);
}
}
int x = 4;
int y = 4;
Color c = new Color(bi.getRGB(x, y));
System.out.println(c.getRed() + " : " + c.getGreen() + " : " + c.getBlue() + " : " + c.getAlpha());