/ Published in: Java
nifty little function when you want transparent images such as sprite sheets
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
{ { // the color we are looking for... Alpha bits are set to opaque public int markerRGB = c.getRGB() | 0xFF000000; public final int filterRGB(int x, int y, int rgb) { if ( ( rgb | 0xFF000000 ) == markerRGB ) { // Mark the alpha bits as zero - transparent return 0x00FFFFFF & rgb; } else { // nothing to do return rgb; } } }; }