/Users/lyon/j4p/src/gui/ImageBean.java
|
1 package gui;
2
3 import j2d.ShortImageBean;
4
5 import java.awt.*;
6 import java.awt.image.ColorModel;
7 import java.io.File;
8
9 public class ImageBean implements ImageBeanInterface {
10
11 private Image image;
12 private ColorModel cm = ColorModel.getRGBdefault();
13 private int w = 0;
14 private int h = 0;
15
16 // A default file name..set to null
17 // to start with file open dialog.
18 // Set to string to start with an image.
19 // Use a fully qualified path name, in quotes.
20 private File f = null;
21
22 private boolean fromFile = false;
23
24 public Image getImage() {
25 return image;
26 }
27
28 public void setImage(ShortImageBean sib) {
29 image = sib.getImage();
30 w = sib.getWidth();
31 h = sib.getHeight();
32 }
33
34
35 public void setImage(Image _image) {
36 this.image = _image;
37 w = image.getWidth(null);
38 h = image.getHeight(null);
39 }
40
41 public ColorModel getColorModel() {
42 return cm;
43 }
44
45 public boolean isFromFile() {
46 return fromFile;
47 }
48
49 public void setFromFile(boolean fromFile) {
50 this.fromFile = fromFile;
51 }
52
53 public int getImageWidth() {
54 return w;
55 }
56
57
58 public int getImageHeight() {
59 return h;
60 }
61
62 public void setImageHeight(int _h) {
63 h = _h;
64 }
65
66 public void setImageWidth(int _w) {
67 w = _w;
68 }
69
70
71 public File getFile() {
72 return f;
73 }
74
75 public void setFile(File _f) {
76 f = _f;
77 setFromFile(true);
78 }
79 }
80
81