GP.Graphics
Class RGBCanvas

java.lang.Object
  |
  +--GP.Graphics.Shape
        |
        +--GP.Graphics.Image
              |
              +--GP.Graphics.Canvas
                    |
                    +--GP.Graphics.RGBCanvas
All Implemented Interfaces:
Behavioral, Colorable, Graphic, Movable, Orientable, Originable, Playable, Positionable, Reactive, Refreshable, RGBConstants, Scalable, Selectable, Viewable

public class RGBCanvas
extends Canvas
implements RGBConstants


Fields inherited from class GP.Graphics.Shape
ourNumShapes
 
Fields inherited from interface GP.Graphics.RGBConstants
AlphaMask, AlphaShift, BlueMask, BlueShift, GreenMask, GreenShift, RedMask, RedShift
 
Constructor Summary
RGBCanvas(Container container, Image image)
          This constructor creates a RGBCanvas based on the given image.
RGBCanvas(Container container, Size size)
          This is a constructor for a RGBCanvas which takes a container and a size.
 
Method Summary
 int GetBlue(int x, int y)
          This function is used to set the blue intensity at the specified pixel location.
 int GetGreen(int x, int y)
          This method returns the green intensity at the specified pixel location.
 Color GetPixelColor(int x, int y)
          This function is used to query the color of the pixel at location (x, y).
 int GetRed(int x, int y)
          This method returns the red intensity at the specified pixel location.
 void SetBlue(int x, int y, int blue)
          This function is used to set the blue intensity at the specified pixel location.
 void SetGreen(int x, int y, int green)
          This function is used to set the green intensity at the specified pixel location.
 void SetPixelColor(int x, int y, Color color)
          This method is used to set the color of a pixel at location (x, y) by passing in a GP.Attributes.Color rather than specifying the red, green, and blue values.
 void SetRed(int x, int y, int red)
          This function is used to set the red intensity at the specified pixel location.
 void SetRGB(int x, int y, int red, int green, int blue)
          This function is used to set all three RGB intensities at a particular pixel location silmultaneously.
 
Methods inherited from class GP.Graphics.Canvas
Copy, GetPixel, Refresh, SetAWTImage, SetPixel
 
Methods inherited from class GP.Graphics.Image
GetAWTImage, GetName, GetSize, Initialized, Scale, SetSize, toString
 
Methods inherited from class GP.Graphics.Shape
Act, AddBehavior, ApplyBehaviors, ApplyInstincts, DeSelect, equals, Fill, Frame, GetApplet, GetBoxBoundedSize, GetColor, GetContainer, GetCurrentTime, GetFillStyle, GetOrientation, GetPivot, GetPosition, Hide, IsPositionInside, IsVisible, Move, Move, Move, MoveBackward, MoveForward, MoveToBack, MoveToFront, Pause, Play, PositionIsOnlyInsideMe, PreferedSize, React, RemoveAllBehaviors, RemoveBehavior, ReplaceAllBehaviors, Scale, Scale, Select, SetColor, SetContainer, SetFillStyle, SetOrientation, SetPivot, SetPosition, Show, Show, Start, Stop, Turn, Turn, Turn, Turn, Turn, Turn
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RGBCanvas

public RGBCanvas(Container container,
                 Image image)
This constructor creates a RGBCanvas based on the given image. The RGBCanvas will have the same size as the image as well as contain the same image data.
Parameters:
container - The container of the RGBCanvas.
image - The image on which to base this RGBCanvas.

RGBCanvas

public RGBCanvas(Container container,
                 Size size)
This is a constructor for a RGBCanvas which takes a container and a size.
Parameters:
container - The container this RGBCanvas will appear within.
size - The size in pixels of the canvas
Method Detail

SetRed

public void SetRed(int x,
                   int y,
                   int red)
This function is used to set the red intensity at the specified pixel location.
Parameters:
x - The x coordinate of the pixel being modified.
y - The y coordinate of the pixel being modified.
red - The new red intensity at that pixel.

SetGreen

public void SetGreen(int x,
                     int y,
                     int green)
This function is used to set the green intensity at the specified pixel location.
Parameters:
x - The x coordinate of the pixel being modified.
y - The y coordinate of the pixel being modified.
green - The new green intensity at that pixel.

SetBlue

public void SetBlue(int x,
                    int y,
                    int blue)
This function is used to set the blue intensity at the specified pixel location.
Parameters:
x - The x coordinate of the pixel being modified.
y - The y coordinate of the pixel being modified.
blue - The new blue intensity at that pixel.

GetRed

public int GetRed(int x,
                  int y)
This method returns the red intensity at the specified pixel location.
Parameters:
x - The x coordinate of the pixel being queried.
y - The y coordinate of the pixel being queried.
Returns:
The red intensity as a value between 0 and 255 inclusive.

GetGreen

public int GetGreen(int x,
                    int y)
This method returns the green intensity at the specified pixel location.
Parameters:
x - The x coordinate of the pixel being queried.
y - The y coordinate of the pixel being queried.
Returns:
The green intensity as a value between 0 and 255 inclusive.

GetBlue

public int GetBlue(int x,
                   int y)
This function is used to set the blue intensity at the specified pixel location.
Parameters:
x - The x coordinate of the pixel being modified.
y - The y coordinate of the pixel being modified.
red - The new blue intensity at that pixel.

SetRGB

public void SetRGB(int x,
                   int y,
                   int red,
                   int green,
                   int blue)
This function is used to set all three RGB intensities at a particular pixel location silmultaneously. If you are setting all three color intensities at a given pixel location, it is considerably faster to use this method rather than calling SetRed, SetGreen and SetBlue separately.
Parameters:
x - The x coordinate of the pixel being modified.
y - The y coordinate of the pixel being modified.
red - The new red intensity at coordinates (x, y)
green - The new green intensity at coordinates (x, y)
blue - The new blue intensity at coordinates (x, y)

SetPixelColor

public void SetPixelColor(int x,
                          int y,
                          Color color)
This method is used to set the color of a pixel at location (x, y) by passing in a GP.Attributes.Color rather than specifying the red, green, and blue values.
Parameters:
x - The x coordinate of the pixel being modified.
y - The y coordinate of the pixel being modified.
color - The new color of the pixel.

GetPixelColor

public Color GetPixelColor(int x,
                           int y)
This function is used to query the color of the pixel at location (x, y).
Parameters:
x - The x coordinate of the pixel being queried.
y - The y coordinate of the pixel being queried.
Returns:
A GP.Attributes.Color with the same red, green, and blue values as the pixel at location (x, y).