GP.Graphics
Class Canvas
java.lang.Object
|
+--GP.Graphics.Shape
|
+--GP.Graphics.Image
|
+--GP.Graphics.Canvas
- All Implemented Interfaces:
- Behavioral, Colorable, Graphic, Movable, Orientable, Originable, Playable, Positionable, Reactive, Refreshable, Scalable, Selectable, Viewable
- Direct Known Subclasses:
- RGBCanvas
- public class Canvas
- extends Image
Constructor Summary |
Canvas(Canvas canvas)
|
Canvas(Container container,
java.awt.image.ColorModel model,
Image image)
This is a constructor for a Canvas that takes a container and an Image. |
Canvas(Container container,
java.awt.image.ColorModel model,
Size size)
This is a Canvas' constructor which takes a container and a size. |
Method Summary |
Graphic |
Copy()
This method returns a copy of this Canvas |
int |
GetPixel(int x,
int y)
This function returns a 24 bit color value at the specified coordinates. |
void |
Refresh()
This method is called to cause the Canvas to redraw itself in its
container. |
void |
SetAWTImage(java.awt.Image image)
|
void |
SetPixel(int x,
int y,
int color)
This method is used to set the color of a pixel at location (x, y). |
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 |
Canvas
public Canvas(Container container,
java.awt.image.ColorModel model,
Image image)
- This is a constructor for a Canvas that takes a container and an Image. The size of
the Canvas will be the size of the given image and the Canvas' pixel values will
be identical to those of the image.
- Parameters:
container
- The container of the canvas.image
- The image whose pixels to import into the Canvas.
Canvas
public Canvas(Container container,
java.awt.image.ColorModel model,
Size size)
- This is a Canvas' constructor which takes a container and a size.
- Parameters:
container
- The container the Canvas will appear in.size
- The size (in pixels) of the Canvas.
Canvas
public Canvas(Canvas canvas)
SetAWTImage
public void SetAWTImage(java.awt.Image image)
- Overrides:
SetAWTImage
in class Image
SetPixel
public void SetPixel(int x,
int y,
int color)
- This method is used to set the color of a pixel at location (x, y). The color integer
represents a 24 bit color in the format 00000000rrrrrrrrggggggggbbbbbbbb
- Parameters:
x
- The x coordinate of the pixel.y
- The y coordinate of the pixel.color
-
GetPixel
public int GetPixel(int x,
int y)
- This function returns a 24 bit color value at the specified coordinates. The
red, green, and blue bits are in the form: 00000000rrrrrrrrggggggggbbbbbbbb.
- Parameters:
x
- The x coordinate of the pixel.y
- The y coordinate of the pixel.- Returns:
- The color at that pixel, as an integer.
Copy
public Graphic Copy()
- This method returns a copy of this Canvas
- Overrides:
Copy
in class Image
- Returns:
- A new Canvas.
Refresh
public void Refresh()
- This method is called to cause the Canvas to redraw itself in its
container. You should never need to call this, as it is regularly
called by GP. Calling this method exessively will slow down GP.
- Overrides:
Refresh
in class Shape