Entry 4961
warum
Submitted by anonymous
on June 27, 2010 at 1:05 a.m.
Language: Java. Code size: 358 bytes.
private void convertToByte(int[] pixels32) throws InterruptedException { int c, r, g, b; //convert to grayscale double rw=1d/3d, gw=1d/3d, bw=1d/3d; for (int i=0; i < this.width*this.height; i++) { c = pixels32[i]; r = (c&0xff0000)>>16; g = (c&0xff00)>>8; b = c&0xff; data[i] = (byte)(r*rw + g*gw + b*bw + 0.5); } }
This snippet took 0.01 seconds to highlight.
Back to the Entry List or Home.