Package org.opensourcephysics.display2d
Class IntegerRaster
java.lang.Object
org.opensourcephysics.display.MeasuredImage
org.opensourcephysics.display2d.IntegerRaster
- All Implemented Interfaces:
Dimensioned
,Drawable
,Measurable
A IntegerRaster contains an array of integers where each integer represents an image pixel.
Because the image created by a IntegerRaster cannot be resized, the image dimensions
are the same as the dimensions of the integer array.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIntegerRaster
(int _nrow, int _ncol) Constructs IntegerRaster with the given size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the image and the grid.int
getCell
(int _row, int _col) Gets a lattice cell value.getInterior
(DrawingPanel panel) Gets the dimension of the lattice in pixel units.void
setBlock
(int row_offset, int col_offset, int[][] val) Sets a block of lattice cells to new values.void
setCell
(int _row, int _col, int val) Sets a lattice cell to a new value.void
setCol
(int row_offset, int col, int[] val) Sets a column of lattice cells to new values.void
setRow
(int row, int col_offset, int[] val) Sets a row of lattice cells to new values.Methods inherited from class org.opensourcephysics.display.MeasuredImage
getImage, 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.display.Drawable
isInteractive
-
Field Details
-
WHITE
public static int WHITE -
scaleFactor
protected double scaleFactor
-
-
Constructor Details
-
IntegerRaster
public IntegerRaster(int _nrow, int _ncol) Constructs IntegerRaster with the given size.- Parameters:
_nrow
- the number of rows_ncol
- the number of columns
-
-
Method Details
-
setBlock
public void setBlock(int row_offset, int col_offset, int[][] val) Sets a block of lattice cells to new values.- Parameters:
row_offset
-col_offset
-val
-
-
setRow
public void setRow(int row, int col_offset, int[] val) Sets a row of lattice cells to new values.- Parameters:
row
-col_offset
-val
-
-
setCol
public void setCol(int row_offset, int col, int[] val) Sets a column of lattice cells to new values.- Parameters:
row_offset
-col
-val
-
-
setCell
public void setCell(int _row, int _col, int val) Sets a lattice cell to a new value. -
getCell
public int getCell(int _row, int _col) Gets a lattice cell value.- Returns:
- the cell value.
-
getInterior
Gets the dimension of the lattice in pixel units.- Specified by:
getInterior
in interfaceDimensioned
- Parameters:
panel
-- Returns:
- the dimension
-
draw
Draws the image and the grid.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classMeasuredImage
- Parameters:
panel
-g
-
-