edu.uci.ics.jung.visualization.graphics
Class Image

java.lang.Object
  extended by edu.uci.ics.jung.visualization.graphics.Image
Type Parameters:
I -
Direct Known Subclasses:
LayeredImage, SWTImageImpl

public abstract class Image
extends Object

An abstract wrapper image class using generics to wrap a UI specific image. It is the responsibility of the particular rendering engine to know how to draw the underlying image.

Author:
Jason A Wrang

Field Summary
static int SCALE_DEFAULT
          Use the default image-scaling algorithm.
static int SCALE_FAST
          Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.
static int SCALE_SMOOTH
          Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.
 
Constructor Summary
Image()
           
 
Method Summary
 void draw(GraphicsContext graphicsContext, int x, int y)
           
abstract  GraphicsContext getGraphicsContext()
           
abstract  int getHeight()
           
abstract  Image getScaledInstance(int width, int height, int hints)
          Creates a scaled version of this image.
abstract  int getWidth()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCALE_DEFAULT

public static final int SCALE_DEFAULT
Use the default image-scaling algorithm.

See Also:
Constant Field Values

SCALE_FAST

public static final int SCALE_FAST
Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.

See Also:
Constant Field Values

SCALE_SMOOTH

public static final int SCALE_SMOOTH
Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.

Since:
JDK1.1
See Also:
Constant Field Values
Constructor Detail

Image

public Image()
Method Detail

getWidth

public abstract int getWidth()

getHeight

public abstract int getHeight()

getGraphicsContext

public abstract GraphicsContext getGraphicsContext()

getScaledInstance

public abstract Image getScaledInstance(int width,
                                        int height,
                                        int hints)
Creates a scaled version of this image. A new Image object is returned which will render the image at the specified width and height by default. The new Image object may be loaded asynchronously even if the original source image has already been loaded completely.

If either width or height is a negative number then a value is substituted to maintain the aspect ratio of the original image dimensions. If both width and height are negative, then the original image dimensions are used.

Parameters:
width - the width to which to scale the image.
height - the height to which to scale the image.
hints - flags to indicate the type of algorithm to use for image resampling.
Returns:
a scaled version of the image.
Throws:
IllegalArgumentException - if width or height is zero.
Since:
JDK1.1
See Also:
Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_SMOOTH, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING

draw

public void draw(GraphicsContext graphicsContext,
                 int x,
                 int y)


Copyright © 2007. All Rights Reserved.