comparison gnv-artifacts/src/main/java/de/intevation/gnv/raster/RasterToPPM.java @ 801:d766fe2d917a

More javadoc. gnv-artifacts/trunk@883 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Apr 2010 16:53:43 +0000
parents c4156275c1e1
children f953c9a559d8
comparison
equal deleted inserted replaced
800:db5b04ecb426 801:d766fe2d917a
4 4
5 import java.io.IOException; 5 import java.io.IOException;
6 import java.io.OutputStream; 6 import java.io.OutputStream;
7 7
8 /** 8 /**
9 * Little helper class to write a Raster into an output stream
10 * as a Netpbm PPM file.
9 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> 11 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
10 */ 12 */
11 public class RasterToPPM 13 public class RasterToPPM
12 { 14 {
13 private RasterToPPM() { 15 private RasterToPPM() {
14 } 16 }
15 17
16 public static void writeToPPM(Raster raster, Palette palette, OutputStream out) 18 /**
19 * Writes a Raster to a given stream as PPM.
20 * @param raster The raster to be written.
21 * @param palette The palette used to figure out the rgb values.
22 * @param out The stream to write into.
23 * @throws IOException Thrown if some error occurred during writing
24 * data to the output stream.
25 */
26 public static void writeToPPM(
27 Raster raster,
28 Palette palette,
29 OutputStream out
30 )
17 throws IOException 31 throws IOException
18 { 32 {
19 int W = raster.getWidth(); 33 int W = raster.getWidth();
20 int H = raster.getHeight(); 34 int H = raster.getHeight();
21 out.write(("P6\n" + W + " " + H + "\n255\n").getBytes("US-ASCII")); 35 out.write(("P6\n" + W + " " + H + "\n255\n").getBytes("US-ASCII"));

http://dive4elements.wald.intevation.org