1    import javax.swing.*;
2    import java.awt.event.*;
3    import java.awt.*;
4    import java.util.*;
5    
6    public class PrefImage extends PrefEditor implements java.io.Serializable {
7    
8      private static final long serialVersionUID = Version.getSUID();
9    
10     public boolean newread = false;
11     public boolean newwrite =  true;
12     public int compress = 6;
13     public int filter  = 0;
14     public int chunksize = 10000;
15   
16     public PrefImage() {
17       name = "Image";
18     }
19   
20     public void newPane()  throws NoSuchFieldException {
21       pane = new javax.swing.Box(BoxLayout.Y_AXIS);
22       setParm("newread","Use new image reader");
23       setParm("newwrite","Use new image writer");
24       setParm("filter","Filter");
25       setParm("compress","Compress");
26       setParm("chunksize","Chunksize");
27     }
28   
29     public void save() {
30       if (pane==null) return;
31       super.save();
32   
33       if (filter<0) filter=0;
34       if (filter>2) filter=2;
35       if (compress<0) compress=0;
36       if (compress>9) compress=9;
37   
38       apply();
39     }
40   
41     public void apply() {
42       ImageFile.newread = newread;
43       ImageFile.newwrite =  newwrite;
44       PngEncoder.compress = compress;
45       PngEncoder.filter  = filter;
46       PngEncoder.chunksize = chunksize;
47     }
48   }
49   
50