MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / MeasuredImage

Class MeasuredImage

src/org/opensourcephysics/display/MeasuredImage.java:24–170  ·  view source on GitHub ↗

MeasuredImage contains an image and a scale in world units. When a MeasuredImage is added to a drawing panel, the image will scale itself to the panel's world units. @author Wolfgang Christian @version 1.0

Source from the content-addressed store, hash-verified

22 * @version 1.0
23 */
24public class MeasuredImage implements Measurable {
25 protected BufferedImage image;
26 protected double xmin, xmax, ymin, ymax;
27 protected boolean visible = true;
28 protected double[] minmax = new double[2];
29
30 /**
31 * Constructs a MeasuredImage with a pixel scale.
32 *
33 */
34 public MeasuredImage() {
35 this(null, 0, 0, 0, 0);
36 }
37
38 /**
39 * Constructs a MeasuredImage with a pixel scale.
40 *
41 * @param image the image
42 */
43 public MeasuredImage(BufferedImage image) {
44 this(image, 0, image.getWidth(), 0, image.getHeight());
45 }
46
47 /**
48 * Constructs a MeasuredImage with the given scale.
49 *
50 * @param _image
51 * @param _xmin
52 * @param _xmax
53 * @param _ymin
54 * @param _ymax
55 */
56 public MeasuredImage(BufferedImage _image, double _xmin, double _xmax, double _ymin, double _ymax) {
57 image = _image;
58 xmin = _xmin;
59 xmax = _xmax;
60 ymin = _ymin;
61 ymax = _ymax;
62 }
63
64 public void setImage(BufferedImage _image) {
65 image = _image;
66 }
67
68 public BufferedImage getImage() {
69 return image;
70 }
71
72 /**
73 * Sets the visibility of the lattice.
74 * Drawing will be disabled if visible is false.
75 *
76 * @param isVisible
77 */
78 public void setVisible(boolean isVisible) {
79 visible = isVisible;
80 }
81

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected