All Packages  This Package  Class Hierarchy  Class Search  Index

Class com.activated.jimi.component.JimiCanvas
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----com.activated.jimi.component.JimiCanvas

  Summary

public class  JimiCanvas
     extends java.awt.Canvas
{
          // Fields 14
     public static final int AREA_AVERAGING;
     public static final int BEST_FIT;
     public static final int CENTER;
     public static final int CROP_AS_NECESSARY;
     public static final int EAST;
     public static final int NORTH;
     public static final int NORTHEAST;
     public static final int NORTHWEST;
     public static final int REPLICATE;
     public static final int SCALE;
     public static final int SOUTH;
     public static final int SOUTHEAST;
     public static final int SOUTHWEST;
     public static final int WEST;

          // Constructors 3
     public JimiCanvas();
     public JimiCanvas(Image);
     public JimiCanvas(URL);

          // Methods 15
     public Image getImage();
     public URL getImageLocation();
     public int getJustificationPolicy();
     public Dimension getPreferredSize();
     public int getResizePolicy();
     public int getScalingPolicy();
     public boolean getWillSizeToFit();
     public synchronized void paint(Graphics);
     public synchronized void setImage(Image);
     public synchronized void setImageLocation(URL);
     public synchronized void setJustificationPolicy(int);
     public synchronized void setResizePolicy(int);
     public synchronized void setScalingPolicy(int);
     public synchronized void setWillSizeToFit(boolean);
     public void update(Graphics);
}

An java.awt.Canvas for easily displaying any image in a J.I.M.I. supported image format, or any java.awt.Image. Subclasses will support using this as a Bean.

The following features exist :




  Fields

· EAST

Summary  |  Top

   public static final int EAST

One of nine possible justification policies.

See Also: setJustificationPolicy


· NORTH

Summary  |  Top
   public static final int NORTH

One of nine possible justification policies.

See Also: setJustificationPolicy


· NORTHEAST

Summary  |  Top
   public static final int NORTHEAST

One of nine possible justification policies.

See Also: setJustificationPolicy


· NORTHWEST

Summary  |  Top
   public static final int NORTHWEST

One of nine possible justification policies.

See Also: setJustificationPolicy


· SOUTH

Summary  |  Top
   public static final int SOUTH

One of nine possible justification policies.

See Also: setJustificationPolicy


· SOUTHEAST

Summary  |  Top
   public static final int SOUTHEAST

One of nine possible justification policies.

See Also: setJustificationPolicy


· SOUTHWEST

Summary  |  Top
   public static final int SOUTHWEST

One of nine possible justification policies.

See Also: setJustificationPolicy


· WEST

Summary  |  Top
   public static final int WEST

One of nine possible justification policies.

See Also: setJustificationPolicy


· CENTER

Summary  |  Top
   public static final int CENTER

One of nine possilbe justification policies.

See Also: setJustificationPolicy


· BEST_FIT

Summary  |  Top
   public static final int BEST_FIT

One of three possible resizing policies. Will scale the image so that one of the axis totally fills the available space, and the other maintains aspect ratio.

See Also: setResizePolicy, CROP_AS_NECESSARY, SCALE


· CROP_AS_NECESSARY

Summary  |  Top
   public static final int CROP_AS_NECESSARY

One of three possible resizing policies. No scaling is done. instead, if the image will not fit within the available space, it is cropped.

See Also: setResizePolicy, BEST_FIT, SCALE


· SCALE

Summary  |  Top
   public static final int SCALE

One of three possible resizing policies. Both axis are independently scaled to totally fill the available space. This may cause distortion.

See Also: setResizePolicy, BEST_FIT, CROP_AS_NECESSARY


· AREA_AVERAGING

Summary  |  Top
   public static final int AREA_AVERAGING

One of two possible scaling mode policies. This policy will cause the JimiCanvas to use java.awt.image.AreaAveragingScaleFilter for rendering the scaled version of the target image. This yields the best looking results, but can be very time consuming.

See Also: setScalingPolicy, REPLICATE


· REPLICATE

Summary  |  Top
   public static final int REPLICATE

One of two possible scaling mode policies. This policy will cause the JimiCanvas to use java.awt.image.ReplicateScaleFilter for rendering the scaled version of the target image. This filter is very fast, but does not gurantee good-looking results.

See Also: setScalingPolicy, AREA_AVERAGING


  Constructors

· JimiCanvas

Summary  |  Top

   public JimiCanvas() 

No argument constructor for use in beanboxes.



· JimiCanvas

Summary  |  Top
   public JimiCanvas(Image anImage) 

Create me

Parameter Description
anImage The image to display

See Also: setImage



· JimiCanvas

Summary  |  Top
   public JimiCanvas(URL aLocation) 

Create me

Parameter Description
aLocation Where to load the image using J.I.M.I. from

See Also: setImageLocation



  Methods

· setJustificationPolicy

Summary  |  Top
   public synchronized void setJustificationPolicy(int newPolicy) 

Which of the nine justification policies we use to place the image on the canvas

Parameter Description
newPolicy The new justification policy

See Also: CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST



· getJustificationPolicy

Summary  |  Top
   public int getJustificationPolicy() 

Which of the nine justification policies we use to place the image on the canvas return One of nine justification policies

See Also: CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST



· setResizePolicy

Summary  |  Top
   public synchronized void setResizePolicy(int newPolicy) 

Do we crop the image, scale it, or scale it so that it fits best?

Parameter Description
newPolicy One of three policies which specify how to fit the image into the canvas

See Also: CROP_AS_NECESSARY, SCALE, BEST_FIT



· getResizePolicy

Summary  |  Top
   public int getResizePolicy() 

Do we crop the image, scale it, or scale it so that it fits best?

See Also: CROP_AS_NECESSARY, SCALE, BEST_FIT



· setScalingPolicy

Summary  |  Top
   public synchronized void setScalingPolicy(int newPolicy) 

Set the scaling mode for this canvas. There are currently two possibilities: AreaAveraging and Replicate. Each derived from a corresponding standard ImageFilter. The AreaAveraging mode will yield the best looking results, but it takes significantly longer to execute than the Replicate mode.

Parameter Description
newPolicy One of two policies which specify how to scale the image into the canvas

See Also: AREA_AVERAGING, REPLICATE



· getScalingPolicy

Summary  |  Top
   public int getScalingPolicy() 

Retrieve the scaling mode currently in effect. There are currently two possibilities: AreaAveraging and Replicate. Each derived from a corresponding standard ImageFilter. The AreaAveraging mode will yield the best looking results, but it takes significantly longer to execute than the Replicate mode does.

See Also: AREA_AVERAGING, REPLICATE



· setWillSizeToFit

Summary  |  Top
   public synchronized void setWillSizeToFit(boolean newPolicy) 

If true, the canvas will resize itself so that it exactly fits the the canvas.

Parameter Description
newPolicy If true, will resize the canvas to fit the new image

See Also: setImage, setImageLocation



· getWillSizeToFit

Summary  |  Top
   public boolean getWillSizeToFit() 

If true, the canvas will resize itself so that it exactly fits the canvas.

Returns:
True if the canvas will be automatically sized to fit the image


· setImageLocation

Summary  |  Top
   public synchronized void setImageLocation(URL newLocation) 

Where should J.I.M.I. look to find the image?
This value need not be set, and is mutually exclusive with setImage. setImagetakes precedence.

Parameter Description
newLocation Where J.I.M.I. should go to find the image

See Also: getImageLocation, setImage, getImage



· getImageLocation

Summary  |  Top
   public URL getImageLocation() 

Where J.I.M.I. should look to find the image.
If the image was set with setImage this value may be null

Returns:
The URL location of the image

See Also: setImageLocation, setImage, getImage



· setImage

Summary  |  Top
   public synchronized void setImage(Image anImage) 

We can explicitly set an Image instead of relying upon J.I.M.I. to load it. The two ways of specifying the image location are mutually exclusive. setImage takes precedence over setImageLocation

Parameter Description
anImage The java.awt.Image that we wish to display

See Also: setImageLocation, getImageLocation, getImage



· getImage

Summary  |  Top
   public Image getImage() 

The image that this canvas is currently displaying. This is not the cropped nor resized image, but the base image that is being used to create the cropped or scaled image.

Returns:
Image The base image that we're displaying currently

See Also: setImage, setImageLocation, getImageLocation



· getPreferredSize

Summary  |  Top
   public Dimension getPreferredSize() 

If 'willSizeToFit', ask for the size of the image.

Overrides:
getPreferredSize in class Component


· update

Summary  |  Top
   public void update(Graphics g) 
Overrides:
update in class Component


· paint

Summary  |  Top
   public synchronized void paint(Graphics g) 
Overrides:
paint in class Canvas


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7