(OutputStream out, int[] pixels)
| 221 | } |
| 222 | |
| 223 | void writeRGBImage(OutputStream out, int[] pixels) throws IOException { |
| 224 | long bytesWritten = 0L; |
| 225 | long size = 3L*fi.width*fi.height; |
| 226 | int count = fi.width*24; |
| 227 | byte[] buffer = new byte[count]; |
| 228 | while (bytesWritten<size) { |
| 229 | if ((bytesWritten+count)>size) |
| 230 | count = (int)(size-bytesWritten); |
| 231 | int j = (int)(bytesWritten/3L); |
| 232 | for (int i=0; i<count; i+=3) { |
| 233 | buffer[i] = (byte)(pixels[j]>>16); //red |
| 234 | buffer[i+1] = (byte)(pixels[j]>>8); //green |
| 235 | buffer[i+2] = (byte)pixels[j]; //blue |
| 236 | j++; |
| 237 | } |
| 238 | out.write(buffer, 0, count); |
| 239 | bytesWritten += count; |
| 240 | showProgress((double)bytesWritten/size); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | void writeRGBStack(OutputStream out, Object[] stack) throws IOException { |
| 245 | showProgressBar = false; |
no test coverage detected