com.mebigfatguy.polycasso
Class ImageSizer

java.lang.Object
  extended by com.mebigfatguy.polycasso.ImageSizer
All Implemented Interfaces:
java.awt.image.ImageObserver

public class ImageSizer
extends java.lang.Object
implements java.awt.image.ImageObserver

ensures that the fetching of the width or height of an image will always return a non negative number


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageSizer(java.awt.Image loadedImage)
          constructs an image sizer for the specified image
 
Method Summary
 int getHeight()
          get the height of the image, waiting if necessary
 int getWidth()
          get the width of the image, waiting if necessary
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
          implements the callback to collect the width and height of the image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageSizer

public ImageSizer(java.awt.Image loadedImage)
constructs an image sizer for the specified image

Parameters:
loadedImage - the image to get the width and height of
Method Detail

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
implements the callback to collect the width and height of the image

Specified by:
imageUpdate in interface java.awt.image.ImageObserver
Parameters:
img - the image that is being loaded
infoflags - flags specifying what has changed
x - the horizontal position
y - the vertical position
width - the width of the image
height - the height of the image
Returns:
whether further processing is desired

getWidth

public int getWidth()
get the width of the image, waiting if necessary

Returns:
the width of the image

getHeight

public int getHeight()
get the height of the image, waiting if necessary

Returns:
the height of the image


Copyright © 2009-2010 MeBigFatGuy.com. All Rights Reserved.