java.awt

Class Image

Known Direct Subclasses:
BufferedImage, VolatileImage

public abstract class Image
extends Object

The abstract class Image is the superclass of all classes that represent graphical images. The image must be obtained in a platform-specific manner.
Since:
JDK1.0

Field Summary

static int
SCALE_AREA_AVERAGING
Use the Area Averaging image scaling algorithm.
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_REPLICATE
Use the image scaling algorithm embodied in the ReplicateScaleFilter class.
static int
SCALE_SMOOTH
Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.
static Object
UndefinedProperty
The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.
protected float
accelerationPriority
Priority for accelerating this image.

Method Summary

abstract void
flush()
Flushes all resources being used by this Image object.
float
getAccelerationPriority()
Returns the current value of the acceleration priority hint.
ImageCapabilities
getCapabilities(GraphicsConfiguration gc)
Returns an ImageCapabilities object which can be inquired as to the capabilities of this Image on the specified GraphicsConfiguration.
abstract Graphics
getGraphics()
Creates a graphics context for drawing to an off-screen image.
abstract int
getHeight(ImageObserver observer)
Determines the height of the image.
abstract Object
getProperty(String name, ImageObserver observer)
Gets a property of this image by name.
Image
getScaledInstance(int width, int height, int hints)
Creates a scaled version of this image.
abstract ImageProducer
getSource()
Gets the object that produces the pixels for the image.
abstract int
getWidth(ImageObserver observer)
Determines the width of the image.
void
setAccelerationPriority(float priority)
Sets a hint for this image about how important acceleration is.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

SCALE_AREA_AVERAGING

public static final int SCALE_AREA_AVERAGING
Use the Area Averaging image scaling algorithm. The image object is free to substitute a different filter that performs the same algorithm yet integrates more efficiently into the image infrastructure supplied by the toolkit.
Field Value:
16
Since:
JDK1.1
Usages and Demos :

View More Examples of Image.SCALE_AREA_AVERAGING
   1:       result = makeBuffered(scaleAWT(source, width, height,
   2:         Image.SCALE_AREA_AVERAGING), source.getColorModel());
   3:     }
   4:     return padImage(result, finalWidth, finalHeight);
   5:   }

View Full Code Here

SCALE_DEFAULT

public static final int SCALE_DEFAULT
Use the default image-scaling algorithm.
Field Value:
1
Since:
JDK1.1
Usages and Demos :

View More Examples of Image.SCALE_DEFAULT
   1:         DragImage.class.getResource(imageFile));
   2:     image = image.getScaledInstance(imageWidth,imageHeight,Image.SCALE_DEFAULT);
   3:     JFrame frame = new JFrame("DragImage");
   4:     frame.getContentPane().add( new DragImage(image) );
   5:     frame.setSize(300, 300);

View Full Code Here
   1:                         getScaledInstance(90, -1,
   2:                                 Image.SCALE_DEFAULT));
   3:             } else {
   4:                 thumbnail = tmpIcon;
   5:             }

View Full Code Here
   1:                                         getScaledInstance(90, -1,
   2:                   Image.SCALE_DEFAULT));
   3:             }
   4:               thumbnail = tn;
   5:             }

View Full Code Here
   1: 
   2:         return rc.getScaledInstance(size, size, Image.SCALE_DEFAULT);
   3:     }
   4: 
   5:     public String getTheme() {

View Full Code Here
   1:         }
   2:         return bestImage.getScaledInstance(size, size, Image.SCALE_DEFAULT);
   3:     }
   4: 
   5:     public String getTheme() {

View Full Code Here

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.
Field Value:
2
Since:
JDK1.1
Usages and Demos :

View More Examples of Image.SCALE_FAST
   1: public class GenericMediaIconImpl extends MediaIconImpl {
   2:     private static final Image ICON = new ImageIcon(GenericMediaIconImpl.class.getResource("images/fileIcon.jpg")).getImage().getScaledInstance(90,90,Image.SCALE_FAST);
   3: 
   4:     private URL mURL;

View Full Code Here
   1:         Image scaleImg = 
   2:             grabImg.getScaledInstance (mySize.width, mySize.height, Image.SCALE_FAST);
   3:         g.drawImage (scaleImg, 0, 0, null);
   4:     }

View Full Code Here
   1:                 public void run() {
   2:                     Image aIcon = new ImageIcon(mURL).getImage().getScaledInstance(90,90,Image.SCALE_FAST);
   3:                     mIcon = aIcon;
   4:                     getControl().repaint();
   5:                 }

View Full Code Here
   1:         if( image != null ) return image;
   2:         else return defaultImage.getScaledInstance( size, size, Image.SCALE_FAST );
   3:     }
   4: 

View Full Code Here

SCALE_REPLICATE

public static final int SCALE_REPLICATE
Use the image scaling algorithm embodied in the ReplicateScaleFilter class. The Image object is free to substitute a different filter that performs the same algorithm yet integrates more efficiently into the imaging infrastructure supplied by the toolkit.
Field Value:
8
Since:
JDK1.1
Usages and Demos :

View More Examples of Image.SCALE_REPLICATE
   1:                 iconImage).getImage().getScaledInstance(12, 12,
   2:                 Image.SCALE_REPLICATE));
   3:         ImageIcon basicCursor = new ImageIcon(SpecifyRoadFeaturesTool.class
   4:                 .getResource("images/basic-cursor.png"));
   5:         BufferedImage image = new BufferedImage(basicCursor.getIconWidth(),

View Full Code Here
   1:         ImageIcon icon = new ImageIcon(iconImage.getScaledInstance(12, 12,
   2:                 Image.SCALE_REPLICATE));
   3:         ImageIcon basicCursor = IconLoader.icon("basic-cursor.png");
   4:         BufferedImage image = new BufferedImage(basicCursor.getIconWidth(),
   5:                 basicCursor.getIconHeight(), BufferedImage.TYPE_INT_ARGB);

View Full Code Here

SCALE_SMOOTH

public static final int SCALE_SMOOTH
Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.
Field Value:
4
Since:
JDK1.1
Usages and Demos :

View More Examples of Image.SCALE_SMOOTH
   1:         } else if (Image.class.isInstance(value)) {
   2:             Image    scaledImage = ((Image)value).getScaledInstance(-1, table.getRowHeight() - 2, Image.SCALE_SMOOTH);
   3:             setIcon(new ImageIcon(scaledImage));
   4:             
   5:             return super.getTableCellRendererComponent(table, "", isSelected, false, row, column);

View Full Code Here
   1:                 image = image.getScaledInstance(size, size, 
   2:                     Image.SCALE_SMOOTH);
   3:                 image.flush();
   4:             }
   5:             images.put(piece, image);

View Full Code Here
   1:         return createImageBuffer().getScaledInstance(bufferWidth, bufferHeight,
   2:                 Image.SCALE_SMOOTH);
   3:     }
   4: 
   5:     public Rectangle getClip() {

View Full Code Here
   1:                     newImage =
   2:                         image.getScaledInstance(w, -1, Image.SCALE_SMOOTH);                    
   3:                 } else {
   4:         ...
   5:                     newImage2 =
   6:                         newImage.getScaledInstance(-1, h, Image.SCALE_SMOOTH);    
   7:                 } else {
   8:                     newImage2 = newImage;
   9:                 }

View Full Code Here
   1:             {
   2:                 image = image.getScaledInstance(dimension.getWidth(), -1, Image.SCALE_SMOOTH);
   3:             }
   4:         ...
   5:             {
   6:                 image = image.getScaledInstance(-1, dimension.getHeight(), Image.SCALE_SMOOTH);
   7:             }
   8:         ...
   9:         {
  10:             image = image.getScaledInstance(dimension.getWidth(), dimension.getHeight(), Image.SCALE_SMOOTH);
  11:         }

View Full Code Here

UndefinedProperty

public static final Object UndefinedProperty
The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.
Usages and Demos :

View More Examples of UndefinedProperty
   1: import java.awt.Graphics;
   2: import java.awt.Image;
   3:         ...
   4: import java.awt.image.ImageObserver;
   5:         ...
   6: import java.awt.image.ImageProducer;
   7: 
   8:         ...
   9:   {
  10:     return Image.UndefinedProperty;

View Full Code Here
   1: 
   2: import java.awt.Image;
   3: import java.io.Serializable;
   4:         ...
   5:             final String value = coverage.getMetadataValue(name);
   6:             return (value!=null) ? value : Image.UndefinedProperty;
   7:         } catch (RemoteException exception) {
   8:             throw new CannotEvaluateException(Resources.format(ResourceKeys.ERROR_RMI_FAILURE, exception));
   9:         }

View Full Code Here
   1: 
   2: import java.awt.Image;
   3: import java.awt.RenderingHints;
   4:         ...
   5: import java.awt.image.ColorModel;
   6:         ...
   7: import java.awt.image.SampleModel;
   8: import java.awt.image.RenderedImage;
   9:         ...
  10:             final Object value = getProperty(name);
  11:             return (value!=null && value!=Image.UndefinedProperty) ? value.toString() : null;

View Full Code Here

accelerationPriority

protected float accelerationPriority
Priority for accelerating this image. Subclasses are free to set different default priorities and applications are free to set the priority for specific images via the setAccelerationPriority(float) method.
Since:
1.5

Method Details

flush

public abstract void flush()
Flushes all resources being used by this Image object. This includes any pixel data that is being cached for rendering to the screen as well as any system resources that are being used to store data or pixels for the image. The image is reset to a state similar to when it was first created so that if it is again rendered, the image data will have to be recreated or fetched again from its source.

This method always leaves the image in a state such that it can be reconstructed. This means the method applies only to cached or other secondary representations of images such as those that have been generated from an ImageProducer (read from a file, for example). It does nothing for off-screen images that have only one copy of their data.

Usages and Demos :

View More Examples of flush()
   1: 
   2: import java.awt.Image;
   3: import java.awt.Toolkit;
   4:         ...
   5:     private static HashMap imageCache = new HashMap();
   6:     private static Image loadImage(InputStream input) {
   7:         try {
   8:         ...
   9:     }
  10:     public static Image getImage(String path) {
  11:         if (path == null) {
  12:         ...
  13:             Image image = (Image) i.next();
  14:             image.flush();

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.ImageObserver;
   3:         ...
   4: import java.awt.image.ImageProducer;
   5: 
   6:         ...
   7: public class DoubleBufferImage extends java.awt.Image {
   8: 
   9:         ...
  10:     public void flush() {
  11:         real.flush();

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: 
   4:         ...
   5: {
   6:   protected Image enabled;
   7: 
   8:         ...
   9:   protected Image unselected_enabled;
  10: 
  11:         ...
  12:     {
  13:       unselected_enabled.flush();

View Full Code Here
   1: import java.awt.Graphics;
   2: import java.awt.Image;
   3: import java.net.URL;
   4:         ...
   5:         }else{
   6:             Image image = ImageIO.read(url);
   7:             if(image.getHeight(null) != size) {
   8:         ...
   9:                     Image.SCALE_SMOOTH);
  10:                 image.flush();
  11:             }

View Full Code Here
   1:     private transient Tlt content;
   2:     private transient Image doublebuffer;
   3:     
   4:         ...
   5:         if (doublebuffer != null) {
   6:             doublebuffer.flush();
   7:             doublebuffer = null;
   8:         ...
   9:         if (doublebuffer != null) {
  10:             doublebuffer.flush();
  11:             doublebuffer = null;

View Full Code Here

getAccelerationPriority

public float getAccelerationPriority()
Returns the current value of the acceleration priority hint.
Returns:
value between 0 and 1, inclusive, which represents the current priority value
Since:
1.5
See Also:
setAccelerationPriority

getCapabilities

public ImageCapabilities getCapabilities(GraphicsConfiguration gc)
Returns an ImageCapabilities object which can be inquired as to the capabilities of this Image on the specified GraphicsConfiguration. This allows programmers to find out more runtime information on the specific Image object that they have created. For example, the user might create a BufferedImage but the system may have no video memory left for creating an image of that size on the given GraphicsConfiguration, so although the object may be acceleratable in general, it is does not have that capability on this GraphicsConfiguration.
Parameters:
gc - a GraphicsConfiguration object. A value of null for this parameter will result in getting the image capabilities for the default GraphicsConfiguration.
Returns:
an ImageCapabilities object that contains the capabilities of this Image on the specified GraphicsConfiguration.
Since:
1.5
See Also:
VolatileImage.getCapabilities()

getGraphics

public abstract Graphics getGraphics()
Creates a graphics context for drawing to an off-screen image. This method can only be called for off-screen images.
Returns:
a graphics context to draw to the off-screen image.
Throws:
UnsupportedOperationException - if called for a non-off-screen image.
Usages and Demos :

View More Examples of getGraphics()
   1:     if (f.isDirectory()) { return "Folder"; }
   2:     if (name.endsWith(".jpg")) { return "JPG Image"; }
   3:         ...
   4:     if (name.endsWith(".gif")) { return "GIF Image"; }
   5:     return "Generic File";
   6:         ...
   7:       super(f);
   8:       Image i = observer.createImage(16, 16);
   9:         ...
  10:       i.getGraphics().drawImage(getImage(), 0, 0, 16, 16, observer);

View Full Code Here
   1:      
   2:         myImage.getGraphics().clearRect(0, 0, getSize().width, getSize().height);
   3:         ...
   4:         ((JawaaHash)o).touchAll(myImage.getGraphics());
   5:         repaint();
   6:         ...
   7:     {
   8:         return myImage.getGraphics().getFontMetrics();
   9:     }
  10:         ...
  11: 
  12:     private Image myImage;

View Full Code Here
   1:     Thread mainThread ;
   2:     Image offScreen, gAlc[] ;
   3:     Random rand ;
   4:         ...
   5:         mt = new MediaTracker(this);
   6:         gAlc = new Image[1];
   7:         gAlc[0] = getImage(getDocumentBase(), 
   8:         ...
   9: 
  10:         offScreen.getGraphics().setColor(Color.black);
  11:         ...
  12:         offScreen.getGraphics().fillRect(0, 0, dim.width, 

View Full Code Here
   1:     This ths;
   2:     Image imageBuffer;
   3: 
   4:         ...
   5:         imageBuffer = createImage( dim.width, dim.height );
   6:         return imageBuffer.getGraphics();
   7:     }
   8: 
   9:     public void setBounds( int x, int y, int width, int height ) {

View Full Code Here
   1: import java.awt.Graphics;
   2: import java.awt.Image;
   3:         ...
   4: import java.awt.image.ImageObserver;
   5:         ...
   6: import java.awt.image.ImageProducer;
   7: import java.util.ArrayList;
   8:         ...
   9:         if (delegate != null)
  10:             return delegate.getGraphics();

View Full Code Here

getHeight

public abstract int getHeight(ImageObserver observer)
Determines the height of the image. If the height is not yet known, this method returns -1 and the specified ImageObserver object is notified later.
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the height of this image, or -1 if the height is not yet known.
Usages and Demos :

View More Examples of getHeight(ImageObserver observer)
   1: import java.awt.Graphics2D;
   2: import java.awt.Image;
   3: 
   4:         ...
   5:     
   6:     private Image _image;
   7:     
   8:         ...
   9:             g2d.drawImage( _image, (d.width - _image.getWidth(null)) / 2,
  10:                          (d.height - _image.getHeight(null)) / 2,
  11:                          null );
  12:         ...
  13: 
  14:     public void setImage(Image image){

View Full Code Here
   1:    {  fileName = f;
   2:       image = Toolkit.getDefaultToolkit().getImage(fileName);
   3:       MediaTracker tracker = new MediaTracker(this);
   4:         ...
   5:       tracker.addImage(image, 0);
   6:       try { tracker.waitForID(0); }
   7:         ...
   8:    public void paint(Graphics g)
   9:    {  if (image == null)
  10:       {  g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
  11:         ...
  12:       return new Dimension(image.getWidth(null),
  13:          image.getHeight(null));

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: 
   4:         ...
   5: 
   6:     public static boolean waitForImage(Image image){
   7:         int id;
   8:         ...
   9:         BufferedImage bim = new BufferedImage(image.getWidth(null),
  10:                                               image.getHeight(null),
  11:                                               type);

View Full Code Here
   1: 
   2: import java.awt.Image;
   3: import java.awt.Toolkit;
   4:         ...
   5: import java.awt.image.ImageObserver;
   6: import java.io.File;
   7:         ...
   8: {
   9:     Image img;
  10:     boolean plain;
  11:         ...
  12:         if ( obs != null )
  13:             img.getHeight( obs);

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.ImageObserver;
   3:         ...
   4: import java.awt.image.ImageProducer;
   5: 
   6:         ...
   7: public class DoubleBufferImage extends java.awt.Image {
   8: 
   9:         ...
  10:     public int getHeight(ImageObserver observer) {
  11:         return real.getHeight(observer);

View Full Code Here

getProperty

public abstract Object getProperty(String name,
                                   ImageObserver observer)
Gets a property of this image by name.

Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object.

If the properties for this image are not yet known, this method returns null, and the ImageObserver object is notified later.

The property name "comment" should be used to store an optional comment which can be presented to the application as a description of the image, its source, or its author.

Parameters:
name - a property name.
observer - an object waiting for this image to be loaded.
Returns:
the value of the named property.
Usages and Demos :

View More Examples of getProperty(String name,ImageObserver observer)
   1: import java.awt.*;
   2: import java.awt.image.ImageObserver;
   3:         ...
   4: import java.awt.image.ImageProducer;
   5: 
   6:         ...
   7: public class DoubleBufferImage extends java.awt.Image {
   8: 
   9:         ...
  10:     public Object getProperty(String name, ImageObserver observer) {
  11:         return real.getProperty(name, observer);

View Full Code Here
   1: import java.awt.Graphics;
   2: import java.awt.Image;
   3:         ...
   4: import java.awt.image.ImageObserver;
   5:         ...
   6: import java.awt.image.ImageProducer;
   7: import java.util.ArrayList;
   8:         ...
   9:         if (delegate != null)
  10:             return delegate.getProperty(name, observer);

View Full Code Here
   1: import java.util.*;
   2: import java.awt.image.*;
   3: import javax.swing.plaf.*;
   4:         ...
   5: {
   6:   public static final Insets getInsets(Image _image)
   7:   {
   8:         ...
   9:     {
  10:       Object comment = _image.getProperty("comment", null);
  11: 
  12:         ...
  13: 
  14:   public static final Rectangle[] getSlices(Image _image)

View Full Code Here

getScaledInstance

public 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
Usages and Demos :

View More Examples of getScaledInstance(int width,int height,int hints)
   1: import java.awt.*;
   2: import java.awt.image.ImageObserver;
   3:         ...
   4: import java.awt.image.ImageProducer;
   5: 
   6:         ...
   7: public class DoubleBufferImage extends java.awt.Image {
   8: 
   9:         ...
  10:     public Image getScaledInstance(int width, int height, int hints) {
  11:         return real.getScaledInstance(width, height, hints);

View Full Code Here
   1: 
   2: import java.awt.Image;
   3: import java.awt.Toolkit;
   4:         ...
   5: 
   6:     public Image getIcon(String name, int size, Toolkit toolkit) {
   7:         File f= theme.getIcon(name, size);
   8:         ...
   9: 
  10:         Image rc= toolkit.createImage(f.getAbsolutePath());
  11:         try {
  12:         ...
  13: 
  14:         return rc.getScaledInstance(size, size, Image.SCALE_DEFAULT);

View Full Code Here
   1: 
   2: import java.awt.Image;
   3: import java.awt.Toolkit;
   4:         ...
   5: import java.awt.image.ImageProducer;
   6: 
   7:         ...
   8: 
   9:     public Image getIcon(String name, int size, Toolkit toolkit) {
  10:         final ImageProducer[] producers= WinIconWrapper.getIconsFromSpecification(name);
  11:         ...
  12:         }
  13:         return bestImage.getScaledInstance(size, size, Image.SCALE_DEFAULT);

View Full Code Here
   1: import java.awt.Graphics;
   2: import java.awt.Image;
   3: 
   4:         ...
   5:     private JSlider    slider;
   6:     private Image      image;
   7:     private int width, height;
   8:         ...
   9:         }
  10:         return img.getScaledInstance(nw,nh,Image.SCALE_SMOOTH);
  11:     
  12:         ...
  13:             Image img = (scale == 1.0 ? image : 
  14:                 image.getScaledInstance(w,h,Image.SCALE_DEFAULT));

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.MemoryImageSource;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public static Image defaultImage() { return defaultImage; }
   7: 
   8:         ...
   9: 
  10:         private static final Image defaultImage = Toolkit.getDefaultToolkit().createImage
  11:         (
  12:         ...
  13:         if( image != null ) return image;
  14:         else return defaultImage.getScaledInstance( size, size, Image.SCALE_FAST );

View Full Code Here

getSource

public abstract ImageProducer getSource()
Gets the object that produces the pixels for the image. This method is called by the image filtering classes and by methods that perform image conversion and scaling.
Returns:
the image producer that produces the pixels for this image.
See Also:
ImageProducer
Usages and Demos :

View More Examples of getSource()
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: public class CropImage extends Applet {
   4:         ...
   5:   Image im1,im2;
   6:   public void init() {
   7:         ...
   8:     ImageFilter filt=new CropImageFilter(10,5,150,150);
   9:     ImageProducer pro=new FilteredImageSource(im1.getSource(),filt);
  10:     im2=createImage(pro);

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: 
   4:         ...
   5: {
   6:      private Image im;
   7:         ...
   8:     private Image cropped;
   9: 
  10:         ...
  11:         ImageFilter filter = new CropImageFilter(110,5,100,100);
  12:         FilteredImageSource fis = new FilteredImageSource(im.getSource(), filter);

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: import java.awt.event.*;
   4:         ...
   5: {
   6:   Image image;
   7:   Image filterImage;
   8:         ...
   9: 
  10:     producer = new FilteredImageSource( image.getSource(), filter );
  11:     filterImage = createImage( producer );

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: import java.io.*;
   4:         ...
   5:                                throws ServletException, IOException {
   6:     res.setContentType("image/gif");
   7:     ServletOutputStream out = res.getOutputStream();
   8:         ...
   9:       res.sendError(res.SC_NOT_FOUND,
  10:               "Extra path information must point to an image");
  11:       return;
  12:         ...
  13:     Image filtered = frame.createImage(
  14:       new FilteredImageSource(image.getSource(),

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: import javax.swing.*;
   4:         ...
   5:   }
   6:   private final static BuIcon attenue0(Image _image) {
   7:     return new BuIcon(
   8:         ...
   9:       Toolkit.getDefaultToolkit().createImage(
  10:         new FilteredImageSource(_image.getSource(), INSTANCE)));
  11:   }
  12:         ...
  13:   public final static Image attenueImage(Image _image) {

View Full Code Here

getWidth

public abstract int getWidth(ImageObserver observer)
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the width of this image, or -1 if the width is not yet known.
Usages and Demos :

View More Examples of getWidth(ImageObserver observer)
   1: import java.awt.Graphics2D;
   2: import java.awt.Image;
   3: 
   4:         ...
   5:     
   6:     private Image _image;
   7:     
   8:         ...
   9:         if (_image != null)
  10:             g2d.drawImage( _image, (d.width - _image.getWidth(null)) / 2,
  11:                          (d.height - _image.getHeight(null)) / 2,
  12:         ...
  13: 
  14:     public void setImage(Image image){

View Full Code Here
   1: 
   2: import java.awt.Image;
   3: import java.awt.Toolkit;
   4:         ...
   5: import java.awt.image.ImageObserver;
   6: import java.io.File;
   7:         ...
   8: {
   9:     Image img;
  10:     boolean plain;
  11:         ...
  12:         if (obs != null)
  13:             img.getWidth( obs);

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.ImageObserver;
   3:         ...
   4: import java.awt.image.ImageProducer;
   5: 
   6:         ...
   7: public class DoubleBufferImage extends java.awt.Image {
   8: 
   9:         ...
  10:     public int getWidth(ImageObserver observer) {
  11:         return real.getWidth(observer);

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.image.*;
   3: import java.io.File;
   4:         ...
   5: 
   6:   public static Image loadPng(String pathToImage) throws Exception {
   7:     ImageIcon icon = new ImageIcon(new File(pathToImage).toURL());
   8:         ...
   9: 
  10:   public static void savePng(Image image, String pathToImage) throws Exception {
  11:     Jimi.putImage(image, pathToImage);
  12:         ...
  13:           image = grab(image, 0, partHeight*index, 
  14:                        image.getWidth(bitmapCreator), partHeight);

View Full Code Here
   1: 
   2:     public Image loadImage(String name) {
   3:         String filename = "images/" + name;
   4:         ...
   5: 
   6:     public Image getMirrorImage(Image image) {
   7:         return getScaledImage(image, -1, 1);
   8:         ...
   9:         transform.translate(
  10:             (x-1) * image.getWidth(null) / 2,
  11:             (y-1) * image.getHeight(null) / 2);
  12:         ...
  13:         Image newImage = gc.createCompatibleImage(
  14:             image.getWidth(null),

View Full Code Here

setAccelerationPriority

public void setAccelerationPriority(float priority)
Sets a hint for this image about how important acceleration is. This priority hint is used to compare to the priorities of other Image objects when determining how to use scarce acceleration resources such as video memory. When and if it is possible to accelerate this Image, if there are not enough resources available to provide that acceleration but enough can be freed up by de-acceleration some other image of lower priority, then that other Image may be de-accelerated in deference to this one. Images that have the same priority take up resources on a first-come, first-served basis.
Parameters:
priority - a value between 0 and 1, inclusive, where higher values indicate more importance for acceleration. A value of 0 means that this Image should never be accelerated. Other values are used simply to determine acceleration priority relative to other Images.
Throws:
IllegalArgumentException - if priority is less than zero or greater than 1.
Since:
1.5
Usages and Demos :

View More Examples of setAccelerationPriority(float priority)
   1: import java.awt.Graphics2D;
   2: import java.awt.Image;
   3: import java.awt.Panel;
   4:         ...
   5: import java.awt.event.WindowEvent;
   6: import java.awt.image.BufferedImage;
   7:         ...
   8: import java.awt.image.VolatileImage;
   9: import java.io.File;
  10:         ...
  11:                     .createCompatibleVolatileImage(w, h, 2);
  12:             image.setAccelerationPriority(1.0f);

View Full Code Here