1
2 package org.freehep.graphicsio.raw;
3
4 import java.awt.Color;
5 import java.util.Locale;
6 import java.util.Properties;
7
8 import javax.imageio.ImageWriteParam;
9
10 import org.freehep.graphicsio.ImageParamConverter;
11 import org.freehep.util.UserProperties;
12
13
14
15
16
17 public class RawImageWriteParam extends ImageWriteParam implements
18 ImageParamConverter {
19
20 private final static String rootKey = RawImageWriteParam.class.getName();
21
22 public final static String BACKGROUND = rootKey + ".Background";
23
24 public final static String CODE = rootKey + ".Code";
25
26 public final static String PAD = rootKey + ".Pad";
27
28 private Color bkg;
29
30 private String code;
31
32 private int pad;
33
34 public RawImageWriteParam(Locale locale) {
35 super(locale);
36 bkg = null;
37 code = "ARGB";
38 pad = 1;
39 }
40
41 public ImageWriteParam getWriteParam(Properties properties) {
42 UserProperties p = new UserProperties(properties);
43 setBackground(p.getPropertyColor(BACKGROUND, bkg));
44 setCode(p.getProperty(CODE, code));
45 setPad(p.getPropertyInt(PAD, pad));
46 return this;
47 }
48
49 public Color getBackground() {
50 return bkg;
51 }
52
53 public void setBackground(Color bkg) {
54 this.bkg = bkg;
55 }
56
57 public String getCode() {
58 return code;
59 }
60
61 public void setCode(String code) {
62 this.code = code;
63 }
64
65 public int getPad() {
66 return pad;
67 }
68
69 public void setPad(int pad) {
70 this.pad = pad;
71 }
72 }