Class ncsa.horizon.awt.ImageCanvas
All Packages Class Hierarchy This Package Previous Next Index
Class ncsa.horizon.awt.ImageCanvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----ncsa.horizon.awt.ImageCanvas
- public class ImageCanvas
- extends Canvas
- implements ImageObserver, Cloneable
A Canvas object for displaying images. Features include
- double-buffer painting
- mode describing how to squeez image into Canvas area
-
doclear
-
-
mode
-
-
msgfont
-
-
offscreen
-
-
size
-
-
SIZE_IMAGE_CENTER
- Trim the image to the Canvas size (centered)
-
SIZE_IMAGE_FIT
- Fit the image to the Canvas size (default)
-
SIZE_IMAGE_FLUSH
- Scale the image to the Canvas size (centered)
-
SIZE_IMAGE_SCALE
- Scale the image to the Canvas size (centered)
-
SIZE_IMAGE_TRUNCATE
- Trim the image to the Canvas size (flush top/left)
-
tracker
-
-
view
-
-
ImageCanvas()
-
-
ImageCanvas(Dimension)
-
-
ImageCanvas(int, int)
-
-
clear()
- clear the canvas.
-
clone()
- make a copy of this canvas in an efficient manner
-
displayImage(Image)
-
-
imageUpdate(Image, int, int, int, int, int)
-
-
isLoading()
- indicate whether there is an image being loaded at this time
-
offpaint(Graphics)
- paint the image with a double-buffering technique.
-
paint(Graphics)
- this calls tryPaint(Graphics)
-
paintMessage(Graphics, String)
- print a message on the canvas.
-
preferredSize()
-
-
setMode(int)
- Set the display mode for sizing or trimming the viewable image.
-
setPreferredSize(Dimension)
-
-
setPreferredSize(int, int)
-
-
tryPaint(Graphics)
- like paint() except that it returns a boolean indicating whether
it was successful in painting the image onto the canvas
-
update(Graphics)
- calls offpaint()
-
viewSize()
- determine the dimesions necessary to fit the current image into
the display canvas (while preserving the aspect ratio.)
-
viewSize(int, int)
- determine the dimesions necessary to fit an image of width wd and
height ht into the display canvas (while preserving the aspect ratio).
SIZE_IMAGE_FIT
public final static int SIZE_IMAGE_FIT
- Fit the image to the Canvas size (default)
SIZE_IMAGE_CENTER
public final static int SIZE_IMAGE_CENTER
- Trim the image to the Canvas size (centered)
SIZE_IMAGE_TRUNCATE
public final static int SIZE_IMAGE_TRUNCATE
- Trim the image to the Canvas size (flush top/left)
SIZE_IMAGE_SCALE
public final static int SIZE_IMAGE_SCALE
- Scale the image to the Canvas size (centered)
SIZE_IMAGE_FLUSH
public final static int SIZE_IMAGE_FLUSH
- Scale the image to the Canvas size (centered)
view
protected Image view
mode
protected int mode
offscreen
protected Image offscreen
tracker
protected MediaTracker tracker
msgfont
protected static Font msgfont
doclear
protected boolean doclear
size
protected Dimension size
ImageCanvas
public ImageCanvas()
ImageCanvas
public ImageCanvas(int w,
int h)
ImageCanvas
public ImageCanvas(Dimension sz)
preferredSize
public Dimension preferredSize()
- Overrides:
- preferredSize in class Component
setPreferredSize
public void setPreferredSize(int w,
int h)
setPreferredSize
public void setPreferredSize(Dimension sz)
displayImage
public void displayImage(Image im)
clear
public synchronized void clear()
- clear the canvas. This method also releases references to images
being displayed
offpaint
protected void offpaint(Graphics g)
- paint the image with a double-buffering technique. This method first
creates an offscreen Image, paints the real image to it (via
tryPaint()), and then paints that copy to the canvas.
paint
public void paint(Graphics g)
- this calls tryPaint(Graphics)
- Overrides:
- paint in class Canvas
paintMessage
protected void paintMessage(Graphics g,
String msg)
- print a message on the canvas. Message is placed over a white
rectangle to that it can be seen.
imageUpdate
public boolean imageUpdate(Image img,
int flags,
int x,
int y,
int width,
int height)
- Overrides:
- imageUpdate in class Component
tryPaint
protected boolean tryPaint(Graphics g)
- like paint() except that it returns a boolean indicating whether
it was successful in painting the image onto the canvas
update
public void update(Graphics g)
- calls offpaint()
- Overrides:
- update in class Component
viewSize
public Dimension viewSize(int wd,
int ht)
- determine the dimesions necessary to fit an image of width wd and
height ht into the display canvas (while preserving the aspect ratio).
An input dimension < 0 means use the corresponding dimension of the
current image being displayed.
viewSize
public Dimension viewSize()
- determine the dimesions necessary to fit the current image into
the display canvas (while preserving the aspect ratio.)
isLoading
public boolean isLoading()
- indicate whether there is an image being loaded at this time
clone
public synchronized Object clone()
- make a copy of this canvas in an efficient manner
- Overrides:
- clone in class Object
setMode
public void setMode(int _mode)
- Set the display mode for sizing or trimming the viewable image.
- Parameters:
- _mode - The mode to use. Valid modes are SIZE_IMAGE_FIT,
SIZE_IMAGE_CENTER, and SIZE_IMAGE_TRUNCATE.
All Packages Class Hierarchy This Package Previous Next Index