[OpenJDK 2D-Dev] Review Request for bug (JDK-8080287): The image of BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_ARGB_PRE is blank

Jim Graham james.graham at oracle.com
Sat Aug 1 00:08:38 UTC 2015


On 7/31/15 4:24 PM, Jim Graham wrote:
> I'm guessing that you are trying to change the alpha of all colors to
> 0xff?  Then this is the proper loop:
>
>      int alpha = 0xff << 24;
>      for (int cy=0; cy < dst.getHeight(); cy++) {
>          for (int cx=0; cx < dst.getWidth(); cx++) {
>              int color = dst.getRGB(cx, cy);
>              dst.setRGB(cx, cy, color | (0xff << 24));
>          }
>      }

Make that:

               dst.setRGB(cx, cy, color | alpha);

			...jim



More information about the 2d-dev mailing list