us.zuercher.gpx2map.plotter
Class AlphaPixel

java.lang.Object
  extended by us.zuercher.gpx2map.util.Point
      extended by us.zuercher.gpx2map.plotter.Pixel
          extended by us.zuercher.gpx2map.plotter.AlphaPixel

public class AlphaPixel
extends Pixel

AlphaPixel extends Pixel to provide a Pixel with alpha blending.

Author:
Stephan Zuercher

Field Summary
private  int alpha
          Alpha channel value.
 
Constructor Summary
AlphaPixel(int x, int y, Color c, int alpha)
          Constructs a new AlphaPixel with a specific color and arbitrary alpha value.
AlphaPixel(int x, int y, int r, int g, int b, int alpha)
          Constructs a new AlphaPixel with arbitrary color and alpha values.
 
Method Summary
 void apply(int[] rgbPixel)
          Applies this AlphaPixel's color and alpha values against the given pixel value.
 boolean equals(Object other)
          Tests whether this AlphaPixel is equal to another AlphaPixel.
 int getAlpha()
          Returns the alpha channel value for this Pixel.
 int hashCode()
          Returns a reasonable hash code for this AlphaPixel.
 String toString()
          Returns a reasonable string representation of this AlphaPixel.
 
Methods inherited from class us.zuercher.gpx2map.plotter.Pixel
asPoint, getBlue, getGreen, getRed
 
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

alpha

private final int alpha
Alpha channel value.

Constructor Detail

AlphaPixel

public AlphaPixel(int x,
                  int y,
                  int r,
                  int g,
                  int b,
                  int alpha)
Constructs a new AlphaPixel with arbitrary color and alpha values.

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

AlphaPixel

public AlphaPixel(int x,
                  int y,
                  Color c,
                  int alpha)
Constructs a new AlphaPixel with a specific color and arbitrary alpha value.

Parameters:
x - x position
y - y position
c - color
alpha - alpha value
Method Detail

getAlpha

public int getAlpha()
Returns the alpha channel value for this Pixel.

Returns:
the alpha channel value for this Pixel.

hashCode

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

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

equals

public boolean equals(Object other)
Tests whether this AlphaPixel is equal to another AlphaPixel. Able to test against standard Pixels. Does not throw ClassCastException.

Overrides:
equals in class Pixel
Parameters:
other - another AlphaPixel
Returns:
true if equal, false otherwise

toString

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

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

apply

public void apply(int[] rgbPixel)
Applies this AlphaPixel's color and alpha values against the given pixel value. Combines this pixel's color values with the existing color values based on the value of alpha.

Overrides:
apply in class Pixel
Parameters:
rgbPixel - a raster line pixel value.