Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: joelib/io/types/PPM.java


1   ///////////////////////////////////////////////////////////////////////////////
2   //  Filename: $RCSfile: PPM.java,v $
3   //  Purpose:  Reader/Writer for Undefined files.
4   //  Language: Java
5   //  Compiler: JDK 1.4
6   //  Authors:  Joerg K. Wegner
7   //  Version:  $Revision: 1.1 $
8   //            $Date: 2003/10/13 13:23:23 $
9   //            $Author: wegner $
10  //
11  //  Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
12  //
13  //  This program is free software; you can redistribute it and/or modify
14  //  it under the terms of the GNU General Public License as published by
15  //  the Free Software Foundation version 2 of the License.
16  //
17  //  This program is distributed in the hope that it will be useful,
18  //  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  //  GNU General Public License for more details.
21  ///////////////////////////////////////////////////////////////////////////////
22  package joelib.io.types;
23  
24  import Acme.JPM.Encoders.PpmEncoder;
25  
26  import joelib.io.SimpleImageWriter;
27  
28  import java.awt.Image;
29  
30  import java.io.IOException;
31  import java.io.OutputStream;
32  
33  import org.apache.log4j.Category;
34  
35  
36  /*==========================================================================*
37   * CLASS DECLARATION
38   *==========================================================================*/
39  
40  /**
41   * Atom representation.
42   */
43  public class PPM extends SimpleImageWriter
44  {
45      //~ Static fields/initializers /////////////////////////////////////////////
46  
47      /*-------------------------------------------------------------------------*
48       * private static member variables
49       *-------------------------------------------------------------------------*/
50  
51      /**
52       *  Obtain a suitable logger.
53       */
54      private static Category logger = Category.getInstance("joelib.io.types.PPM");
55      private static final String description = new String(
56              "Portable Pixelmap (PPM) image");
57      private static final String[] extensions = new String[]{"ppm"};
58  
59      //~ Methods ////////////////////////////////////////////////////////////////
60  
61      public String outputDescription()
62      {
63          return description;
64      }
65  
66      public String[] outputFileExtensions()
67      {
68          return extensions;
69      }
70  
71      public boolean writeImage(Image image, OutputStream os)
72          throws IOException
73      {
74          PpmEncoder pc = new PpmEncoder(image, os);
75          pc.encode();
76  
77          return (true);
78      }
79  }
80  ///////////////////////////////////////////////////////////////////////////////
81  //  END OF FILE.
82  ///////////////////////////////////////////////////////////////////////////////