Class PixelModel

java.lang.Object
org.loboevolution.img.PixelModel

public class PixelModel extends Object
Stores the x and y coordinate of a pixel. Either both coordinate is positive or zero, indicating a valid pixel, or both are -1, indicating no pixel is selected or should be shown. Author Kazo Csaba
  • Constructor Details

    • PixelModel

      public PixelModel()
  • Method Details

    • addChangeListener

      public void addChangeListener(ChangeListener listener)
      Adds a ChangeListener to the model.
      Parameters:
      listener - the listener to add
    • removeChangeListener

      public void removeChangeListener(ChangeListener listener)
      Removes a ChangeListener from the model.
      Parameters:
      listener - the listener to remove
    • fireChange

      protected void fireChange()
      Notifies the registered listeners that the model has changed.
    • set

      public void set(int x, int y)
      Changes the pixel stored in this model. If either coordinate is negative, the new value of the model will be (-1, -1).
      Parameters:
      x - the new x coordinate
      y - the new y coordinate
    • getX

      public int getX()
      Returns the current x coordinate.
      Returns:
      the x coordinate
    • getY

      public int getY()
      Returns the current y coordinate.
      Returns:
      the y coordinate
    • isInvalid

      public boolean isInvalid()
      Returns whether the pixel is marked as invalid by setting one of the coordinates to -1.
      Returns:
      true if the model does not have a valid pixel