com.lizardtech.djvu
Class GPixel

java.lang.Object
  extended by com.lizardtech.djvu.GPixel
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
GPixelReference

public class GPixel
extends java.lang.Object
implements java.lang.Cloneable

This class represents a single pixel.

Version:
$Revision: 1.6 $
Author:
Bill C. Riemers

Field Summary
static GPixel BLACK
          A black pixel.
static GPixel BLUE
          A blue pixel.
static GPixel GREEN
          A green pixel.
static int NUMELEMS
          Number of colors in a pixel.
static GPixel RED
          A red pixel.
static GPixel WHITE
          A white pixel.
 
Constructor Summary
GPixel()
          Creates a new GPixel object.
GPixel(byte blue, byte green, byte red)
          Creates a new GPixel object.
 
Method Summary
 byte blueByte()
          Query the blue color.
 java.lang.Object clone()
          Create a clone of this pixel.
 boolean equals(java.lang.Object object)
          Test if two pixels are equal.
 int getBlue()
          Query the blue color.
 int getGreen()
          Query the green color.
 int getRed()
          Query the red color.
 byte greenByte()
          Query the green color.
 int hashCode()
          Generates a hashCode equal to 0xffRRGGBB.
 byte redByte()
          Query the red color.
 void set(GPixel ref)
          Copy the pixel values.
 void setBGR(int blue, int green, int red)
          Initialize a pixel with bgr values.
 void setBlue(byte blue)
          Set the blue color
 void setBlue(int blue)
          Set the blue color
 void setGray(byte gray)
          Set the gray color.
 void setGray(int gray)
          Set the gray color.
 void setGreen(byte green)
          Set the gray color.
 void setGreen(int green)
          Set the green color.
 void setRed(byte red)
          Set the red color.
 void setRed(int red)
          Set the red color.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE

public static final GPixel WHITE
A white pixel.


BLACK

public static final GPixel BLACK
A black pixel.


BLUE

public static final GPixel BLUE
A blue pixel.


GREEN

public static final GPixel GREEN
A green pixel.


RED

public static final GPixel RED
A red pixel.


NUMELEMS

public static final int NUMELEMS
Number of colors in a pixel.

See Also:
Constant Field Values
Constructor Detail

GPixel

public GPixel()
Creates a new GPixel object.


GPixel

public GPixel(byte blue,
              byte green,
              byte red)
Creates a new GPixel object.

Parameters:
blue - pixel value
green - pixel value
red - pixel value
Method Detail

setBGR

public void setBGR(int blue,
                   int green,
                   int red)
Initialize a pixel with bgr values.

Parameters:
blue - pixel value
green - pixel value
red - pixel value

setBlue

public void setBlue(byte blue)
Set the blue color

Parameters:
blue - pixel value

setBlue

public final void setBlue(int blue)
Set the blue color

Parameters:
blue - pixel value

getBlue

public final int getBlue()
Query the blue color.

Returns:
pixel value

blueByte

public byte blueByte()
Query the blue color.

Returns:
pixel value

clone

public java.lang.Object clone()
Create a clone of this pixel.

Overrides:
clone in class java.lang.Object
Returns:
the cloned pixel

equals

public final boolean equals(java.lang.Object object)
Test if two pixels are equal.

Overrides:
equals in class java.lang.Object
Parameters:
object - pixel to compare to
Returns:
true if red, green, and blue values are all equal

setGray

public final void setGray(byte gray)
Set the gray color.

Parameters:
gray - pixel value

setGray

public final void setGray(int gray)
Set the gray color.

Parameters:
gray - pixel value

setGreen

public void setGreen(byte green)
Set the gray color.

Parameters:
green - pixel value

setGreen

public final void setGreen(int green)
Set the green color.

Parameters:
green - pixel value

getGreen

public final int getGreen()
Query the green color.

Returns:
green pixel value

greenByte

public byte greenByte()
Query the green color.

Returns:
green pixel value

hashCode

public int hashCode()
Generates a hashCode equal to 0xffRRGGBB.

Overrides:
hashCode in class java.lang.Object
Returns:
hashCode of 0xffRRGGBB

setRed

public void setRed(byte red)
Set the red color.

Parameters:
red - pixel value

setRed

public final void setRed(int red)
Set the red color.

Parameters:
red - pixel value

getRed

public final int getRed()
Query the red color.

Returns:
red pixel value

redByte

public byte redByte()
Query the red color.

Returns:
red pixel value

set

public final void set(GPixel ref)
Copy the pixel values.

Parameters:
ref - pixel to copy