All Packages Class Hierarchy This Package Previous Next Index
Class sg.Pixel
java.lang.Object
|
+----sg.Pixel
- public class Pixel
- extends Object
The class Pixel
defines an object representing
the coordinates of a pixel for a simple graphics device.
In a pixel coordinate system the x-coordinate increases as the pixel
moves horzionally to the right, and the y-coordinate increases as the
pixel moves vertically down.
-
Pixel()
- Constructs and initializes a Pixel initialized with (0, 0).
-
Pixel(int, int)
- Constructs and initializes a Pixel from the specified x and y
coordinates.
-
Pixel(Pixel)
- Constructs and initializes a Pixel with the same location as
the specified Pixel.
-
equals(Pixel)
- Checks whether two pixels are equal.
-
move(int, int)
- Moves the pixel to the specified location.
-
toString()
- Returns the String representation of the object Pixel.
-
translate(int, int)
- Translates the pixel.
Pixel
public Pixel()
- Constructs and initializes a Pixel initialized with (0, 0).
Pixel
public Pixel(Pixel p) throws PixelException
- Constructs and initializes a Pixel with the same location as
the specified Pixel.
- Parameters:
- p - a pixel
- Throws: PixelException
- Throws exception if either coordinate
of the pixel is negative.
Pixel
public Pixel(int x,
int y) throws PixelException
- Constructs and initializes a Pixel from the specified x and y
coordinates.
- Parameters:
- x - the x coordinate
- y - the y coordinate
- Throws: PixelException
- Throws exception if either coordinate,
x or y, is negative.
move
public void move(int x,
int y)
- Moves the pixel to the specified location.
- Parameters:
- x - the x coordinate of the new location
- y - the y coordinate of the new location
- Returns:
- void
translate
public void translate(int x,
int y)
- Translates the pixel.
- Parameters:
- x - translate the x coordinate by this value
- y - translate the y coordinate by this value
- Returns:
- void
equals
public boolean equals(Pixel p)
- Checks whether two pixels are equal.
- Parameters:
- p - check to see if object is equal to p.
- Returns:
- true if the coordinates of the two pixels are equal; false
otherwise.
toString
public String toString()
- Returns the String representation of the object Pixel.
- Returns:
- String
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index