Class IntegerRaster

java.lang.Object
org.opensourcephysics.display.MeasuredImage
org.opensourcephysics.display2d.IntegerRaster
All Implemented Interfaces:
Dimensioned, Drawable, Measurable

public class IntegerRaster extends MeasuredImage implements Dimensioned
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 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

      public Dimension getInterior(DrawingPanel panel)
      Gets the dimension of the lattice in pixel units.
      Specified by:
      getInterior in interface Dimensioned
      Parameters:
      panel -
      Returns:
      the dimension
    • draw

      public void draw(DrawingPanel panel, Graphics g)
      Draws the image and the grid.
      Specified by:
      draw in interface Drawable
      Overrides:
      draw in class MeasuredImage
      Parameters:
      panel -
      g -