us.zuercher.gpx2map.plotter
Class Pixel

java.lang.Object
  extended by us.zuercher.gpx2map.util.Point
      extended by us.zuercher.gpx2map.plotter.Pixel
Direct Known Subclasses:
AlphaPixel

public class Pixel
extends Point

Pixel extends Point and adds Color information.

Author:
Stephan Zuercher

Field Summary
private  int b
          RGB color information.
private  int g
          RGB color information.
private  int r
          RGB color information.
 
Constructor Summary
Pixel(int x, int y, Color c)
          Constructs a new Pixel with a specific Color.
Pixel(int x, int y, int r, int g, int b)
          Constructs a new Pixel with arbitrary color values and location.
Pixel(Point point, Color c)
          Constructs a new Pixel with a specific Color.
 
Method Summary
 void apply(int[] rgbPixel)
          Applies this pixel's color values to an element of a raster line.
 Point asPoint()
          Converts this Pixel to a plain Point.
 boolean equals(Object other)
          Compares this Pixel against another for equality.
 int getBlue()
          Returns the blue color value.
 int getGreen()
          Returns the green color value.
 int getRed()
          Returns the red color value.
 int hashCode()
          Returns a reasonable hash code for a Pixel.
 String toString()
          Returns a reasonable string representation of this Pixel.
 
Methods inherited from class us.zuercher.gpx2map.util.Point
above, below, distanceTo, equals, getX, getY, leftOf, rightOf, within, within
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

r

private final int r
RGB color information.


g

private final int g
RGB color information.


b

private final int b
RGB color information.

Constructor Detail

Pixel

Pixel(int x,
      int y,
      int r,
      int g,
      int b)
Constructs a new Pixel with arbitrary color values and location.

Parameters:
x - x position
y - y position
r - red value
g - green value
b - blue value

Pixel

Pixel(int x,
      int y,
      Color c)
Constructs a new Pixel with a specific Color.

Parameters:
x - x position
y - y position
c - color

Pixel

Pixel(Point point,
      Color c)
Constructs a new Pixel with a specific Color.

Parameters:
point - x/y position
c - color
Method Detail

getRed

public int getRed()
Returns the red color value.

Returns:
the red color value.

getGreen

public int getGreen()
Returns the green color value.

Returns:
the green color value.

getBlue

public int getBlue()
Returns the blue color value.

Returns:
the blue color value.

hashCode

public int hashCode()
Returns a reasonable hash code for a Pixel.

Overrides:
hashCode in class Point
Returns:
a reasonable hash code for a Pixel.

equals

public boolean equals(Object other)
Compares this Pixel against another for equality.

Overrides:
equals in class Point
Parameters:
other - the other Pixel
Returns:
true if the Pixels are equal, false otherwise
Throws:
ClassCastException - if other is not a Pixel

toString

public String toString()
Returns a reasonable string representation of this Pixel.

Overrides:
toString in class Point
Returns:
a reasonable string representation of this Pixel.

asPoint

public Point asPoint()
Converts this Pixel to a plain Point.

Returns:
this Pixel converted to a plain Point.

apply

public void apply(int[] rgbPixel)
Applies this pixel's color values to an element of a raster line. Simplly overwrites the values in the given array.

Parameters:
rgbPixel - element of a raster line