Color getAlpha() not working as intended

Posted by Arvy on Stack Overflow See other posts from Stack Overflow or by Arvy
Published on 2014-08-21T22:17:21Z Indexed on 2014/08/21 22:19 UTC
Read the original article Hit count: 144

Filed under:
|

I was making a program where I load an image and after that I do something with opaque pixels. Transparent pixels showed up as black pixels, but after some time I found the cause:

                                Color c = new Color (input.getRGB(x, y));
    Works->                      if ((input.getRGB(x, y) & 0xFF000000) != 0x00000000) {  do_smth();}
    Returns true at all times->  if (c.getAlpha() != 0) { do_smth(); }

So why it does not work?

© Stack Overflow or respective owner

Related posts about java

Related posts about bufferedimage