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

Class GrayscalePlot

src/org/opensourcephysics/display2d/GrayscalePlot.java:35–548  ·  view source on GitHub ↗

GrayscalePlot renders 2d data as a grayscale image. A grayscale plot looks similar to a grid plot with a grayscale color palette. However, it uses a different rendering model. @author Wolfgang Christian @created February 2, 2003 @version 1.0

Source from the content-addressed store, hash-verified

33 * @version 1.0
34 */
35public class GrayscalePlot extends MeasuredImage implements Plot2D {
36 GridData griddata;
37 double floor, ceil;
38 boolean autoscaleZ = true;
39 boolean symmetricZ=false;
40 short[] bwData; // 16 bits grayscale
41 Grid grid;
42 ZExpansion zMap = null;
43 private int ampIndex = 0; // amplitude index
44 private JFrame legendFrame;
45
46 /**
47 * Constructs a checker field with the given width and height.
48 * @param griddata
49 */
50 public GrayscalePlot(GridData griddata) {
51 setGridData(griddata);
52 update();
53 }
54
55 /**
56 * Gets the x coordinate for the given index.
57 *
58 * @param i int
59 * @return double the x coordinate
60 */
61 @Override
62public double indexToX(int i) {
63 return griddata.indexToX(i);
64 }
65
66 /**
67 * Gets the y coordinate for the given index.
68 *
69 * @param i int
70 * @return double the y coordinate
71 */
72 @Override
73public double indexToY(int i) {
74 return griddata.indexToY(i);
75 }
76
77 /**
78 * Gets closest index from the given x world coordinate.
79 *
80 * @param x double the coordinate
81 * @return int the index
82 */
83 @Override
84public int xToIndex(double x) {
85 return griddata.xToIndex(x);
86 }
87
88 /**
89 * Gets closest index from the given y world coordinate.
90 *
91 * @param y double the coordinate
92 * @return int the index

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected