    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)

##

clone()
  make a copy of this canvas in an efficient manner
displayImage(Image)
imageUpdate(Image, int, int, int, int, int)
offpaint()
paint(Graphics)
paintMessage(Graphics, String)
preferredSize()
setMode(int)
  Set the display mode for sizing or trimming the viewable image.
setPreferredSize(Dimension)
setPreferredSize(int, int)
tryPaint(Graphics)
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)

offpaint

      public void offpaint()

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.)

paint

      public void paint(Graphics g)

Overrides:
  paint in class Canvas

tryPaint

      public boolean tryPaint(Graphics g)

paintMessage

      protected void paintMessage(Graphics g,
                                  String msg)

imageUpdate

      public boolean imageUpdate(Image img,
                                 int flags,
                                 int x,
                                 int y,
                                 int width,
                                 int height)

Overrides:
  imageUpdate in class Component

clone

      public 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