|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.display.MeasuredImage
org.opensourcephysics.display2d.ByteRaster
public class ByteRaster
A ByteRaster contains an array of bytes where each byte represents an image pixel. The image dimensions are the same as the dimensions of the byte array.
| Field Summary | |
|---|---|
protected double |
scaleFactor
|
| Fields inherited from class org.opensourcephysics.display.MeasuredImage |
|---|
image, visible, xmax, xmin, ymax, ymin |
| Constructor Summary | |
|---|---|
ByteRaster(int _nx,
int _ny)
Constructs a byte raster with the given size. |
|
| Method Summary | |
|---|---|
void |
createDefaultColors()
Sets the default palette. |
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws the image on the panel. |
byte[][] |
getColorPalette()
Gets the current palette. |
java.awt.Dimension |
getInterior(DrawingPanel panel)
Gets the dimension of the lattice in pixel units. |
int |
getNx()
Gets the number of x entries. |
int |
getNy()
Gets the number of y entries. |
byte |
getValue(int ix,
int iy)
Gets a raster value from the given location. |
int |
indexFromPoint(double x,
double y)
Determines the lattice index (row-major order) from given x and y world coordinates Returns -1 if the world coordinates are outside the lattice. |
double |
indexToX(int i)
Gets the x coordinate for the given index. |
double |
indexToY(int i)
Gets the y coordinate for the given index. |
void |
randomize()
Randomizes the lattice values. |
void |
resizeLattice(int nx,
int ny)
Resizes the raster using the given number of x and y entries. |
void |
resizeRaster(int _nx,
int _ny)
Resizes the raster using the given number of x and y entries. |
void |
setAll(byte[][] val)
Sets a block of data to new values. |
void |
setAll(byte[][] val,
double xmin,
double xmax,
double ymin,
double ymax)
Sets the lattice values and scale. |
void |
setBlock(byte[][] val)
Sets a block of values starting at location (0,0). |
void |
setBlock(int ix_offset,
int iy_offset,
byte[][] val)
Sets a block of values using byte data. |
void |
setBlock(int ix_offset,
int iy_offset,
int[][] val)
Sets a block of values using integer data. |
void |
setBWPalette()
Sets the black and white palette. |
void |
setCol(int ix,
int iy_offset,
byte[] val)
Sets a column of values. |
void |
setColorPalette(java.awt.Color[] colors)
Sets the color palette to the given array of colors. |
void |
setGridLineColor(java.awt.Color c)
Sets the color for grid line boundaries |
void |
setIndexedColor(int i,
java.awt.Color color)
Sets the color for a single index. |
void |
setRow(int iy,
int ix_offset,
byte[] val)
Sets a row of cells to new values starting at the given column. |
void |
setShowGridLines(boolean showGridLines)
Outlines the lattice boundaries with a grid. |
void |
setUnderEjs(boolean underEjs)
|
void |
setValue(int ix,
int iy,
byte val)
Sets a pixel at the given location to a new value. |
javax.swing.JFrame |
showLegend()
Shows the color associated with each value. |
int |
xToIndex(double x)
Gets closest index from the given x world coordinate. |
int |
yToIndex(double y)
Gets closest index from the given y world coordinate. |
| Methods inherited from class org.opensourcephysics.display.MeasuredImage |
|---|
getXMax, getXMin, getYMax, getYMin, isMeasured, setImage, setMinMax, setVisible, setXMax, setXMin, setYMax, setYMin |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.opensourcephysics.display2d.ByteLattice |
|---|
setMinMax, setVisible, setXMax, setXMin, setYMax, setYMin |
| Methods inherited from interface org.opensourcephysics.display.Measurable |
|---|
getXMax, getXMin, getYMax, getYMin, isMeasured |
| Field Detail |
|---|
protected double scaleFactor
| Constructor Detail |
|---|
public ByteRaster(int _nx,
int _ny)
_nx - the number of values in x direction_ny - the number of values in y direction| Method Detail |
|---|
public void resizeLattice(int nx,
int ny)
resizeLattice in interface ByteLatticenx - the number of x entriesny - the number of y entries
public void resizeRaster(int _nx,
int _ny)
_nx - the number of x entries_ny - the number of y entriespublic int getNx()
getNx in interface ByteLatticepublic int getNy()
getNy in interface ByteLatticepublic void setUnderEjs(boolean underEjs)
public void draw(DrawingPanel panel,
java.awt.Graphics g)
draw in interface Drawabledraw in class MeasuredImagepanel - g - public void randomize()
randomize in interface ByteLatticepublic java.awt.Dimension getInterior(DrawingPanel panel)
getInterior in interface Dimensionedpanel -
public void setAll(byte[][] val)
val -
public void setAll(byte[][] val,
double xmin,
double xmax,
double ymin,
double ymax)
setAll in interface ByteLatticeval - int[][] the new valuesxmin - doublexmax - doubleymin - doubleymax - doublepublic void setBlock(byte[][] val)
setBlock in interface ByteLatticeval -
public void setBlock(int ix_offset,
int iy_offset,
byte[][] val)
setBlock in interface ByteLatticeix_offset - iy_offset - val -
public void setBlock(int ix_offset,
int iy_offset,
int[][] val)
ix_offset - iy_offset - val -
public void setCol(int ix,
int iy_offset,
byte[] val)
setCol in interface ByteLatticeix - the x index of the columniy_offset - the y offset in the columnval - values in column
public void setRow(int iy,
int ix_offset,
byte[] val)
setRow in interface ByteLatticeiy - the row that will be setix_offset - the offsetval - the value
public void setValue(int ix,
int iy,
byte val)
setValue in interface ByteLatticeix - iy - val -
public byte getValue(int ix,
int iy)
getValue in interface ByteLatticeix - iy -
public void setBWPalette()
public void setColorPalette(java.awt.Color[] colors)
setColorPalette in interface ByteLatticecolors - public byte[][] getColorPalette()
public void createDefaultColors()
createDefaultColors in interface ByteLattice
public void setIndexedColor(int i,
java.awt.Color color)
setIndexedColor in interface ByteLatticei - color - public javax.swing.JFrame showLegend()
showLegend in interface ByteLatticepublic void setShowGridLines(boolean showGridLines)
setShowGridLines in interface ByteLatticeshowGridLines - public void setGridLineColor(java.awt.Color c)
setGridLineColor in interface ByteLatticec -
public int indexFromPoint(double x,
double y)
indexFromPoint in interface ByteLatticex - y -
public int xToIndex(double x)
xToIndex in interface ByteLatticex - double the coordinate
public double indexToX(int i)
i - int
public int yToIndex(double y)
yToIndex in interface ByteLatticey - double the coordinate
public double indexToY(int i)
i - int
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||