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

Quick Search    Search Deep

Source code: com/memoire/dja/DjaLoadSaveImage.java


1   /**
2    * @modification $Date: 2001/12/03 16:28:08 $
3    * @statut       unstable
4    * @file         DjaLoadSaveImage.java
5    * @version      0.36
6    * @author       Guillaume Desnoix
7    * @email        guillaume@desnoix.com
8    * @license      GNU General Public License 2 (GPL2)
9    * @copyright    1998-2001 Guillaume Desnoix
10   */
11  
12  package com.memoire.dja;
13  
14  import com.memoire.bu.*;
15  import com.memoire.dja.*;
16  
17  import java.awt.*;
18  import java.io.*;
19  import java.util.*;
20  
21  public abstract class DjaLoadSaveImage
22         implements DjaLoadSaveInterface
23  {
24    private String format_;
25  
26    public DjaLoadSaveImage(String _format)
27    {
28      format_=_format;
29    }
30  
31    public final boolean canLoad() { return false; }
32    public final boolean canSave() { return true; }
33  
34    public final DjaVector load(File _file)
35      throws Exception
36    {
37      throw new Exception("Not implemented");
38    }
39  
40    public final void save(File _file, DjaVector _vector)
41      throws Exception
42    {
43      DjaGrid grid=null;
44  
45      if(_vector.size()!=0)
46      {
47        DjaObject o=(DjaObject)_vector.elementAt(0);
48        grid=o.getGrid();
49      }
50  
51      if(grid==null) grid=new DjaGrid();
52      Image   i   =grid.getImage();
53      BuImageEncoder.save(i,_file.getAbsolutePath(),format_);
54    }
55  
56    public final BuFileFilter getFilter()
57    {
58      return new BuFileFilter
59        (new String[] { format_.toLowerCase(), format_.toUpperCase() },
60        format_+" images");
61    }
62  }