(OutputStream output)
| 3010 | |
| 3011 | |
| 3012 | protected boolean saveTIFF(OutputStream output) { |
| 3013 | // shutting off the warning, people can figure this out themselves |
| 3014 | /* |
| 3015 | if (format != RGB) { |
| 3016 | System.err.println("Warning: only RGB information is saved with " + |
| 3017 | ".tif files. Use .tga or .png for ARGB images and others."); |
| 3018 | } |
| 3019 | */ |
| 3020 | try { |
| 3021 | byte tiff[] = new byte[768]; |
| 3022 | System.arraycopy(TIFF_HEADER, 0, tiff, 0, TIFF_HEADER.length); |
| 3023 | |
| 3024 | tiff[30] = (byte) ((pixelWidth >> 8) & 0xff); |
| 3025 | tiff[31] = (byte) ((pixelWidth) & 0xff); |
| 3026 | tiff[42] = tiff[102] = (byte) ((pixelHeight >> 8) & 0xff); |
| 3027 | tiff[43] = tiff[103] = (byte) ((pixelHeight) & 0xff); |
| 3028 | |
| 3029 | int count = pixelWidth*pixelHeight*3; |
| 3030 | tiff[114] = (byte) ((count >> 24) & 0xff); |
| 3031 | tiff[115] = (byte) ((count >> 16) & 0xff); |
| 3032 | tiff[116] = (byte) ((count >> 8) & 0xff); |
| 3033 | tiff[117] = (byte) ((count) & 0xff); |
| 3034 | |
| 3035 | // spew the header to the disk |
| 3036 | output.write(tiff); |
| 3037 | |
| 3038 | for (int i = 0; i < pixels.length; i++) { |
| 3039 | output.write((pixels[i] >> 16) & 0xff); |
| 3040 | output.write((pixels[i] >> 8) & 0xff); |
| 3041 | output.write(pixels[i] & 0xff); |
| 3042 | } |
| 3043 | output.flush(); |
| 3044 | return true; |
| 3045 | |
| 3046 | } catch (IOException e) { |
| 3047 | e.printStackTrace(); |
| 3048 | } |
| 3049 | return false; |
| 3050 | } |
| 3051 | |
| 3052 | |
| 3053 | /** |
no test coverage detected