Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image transparency lulz
#1
Code:
public void setAlpha(int alpha, int width, int height) {
        if (alpha < 0)
                alpha = 0;
        else if (alpha > 100)
                alpha = 100;

        alpha *= 2.55;

        int w = width;
        int h = height;

        int[] pixels = new int[w * h];

        pixels = this.image.getRGB(0, 0, w, h, pixels, 0, w);

        for(int i = 0; i < pixels.length; i++)
                pixels[i] = ((pixels[i] == 0) ? 0 << 24 : alpha << 24) | (pixels[i] & 0xffffff);

        this.image.setRGB(0, 0, w, h, pixels, 0, w);
    }

Enjoy, rofl.
My SMF Modifications:
http://anthony.vibrantvps.com/smf
Reply


Messages In This Thread
Image transparency lulz - by Project Evolution - 03-06-2010, 08:57 AM
RE: Image transparency lulz - by Foresight - 03-06-2010, 09:33 PM

Forum Jump:


Users browsing this thread: 8 Guest(s)