org.jdrawing.graphics
Class DrawImage

java.lang.Object
  extended byorg.jdrawing.graphics.GraphicsElement
      extended byorg.jdrawing.graphics.GraphicsOperation
          extended byorg.jdrawing.graphics.DrawImage
All Implemented Interfaces:
DrawingElement, java.awt.image.ImageObserver

public class DrawImage
extends GraphicsOperation
implements java.awt.image.ImageObserver

Graphics element which corresponds to Graphics.drawImage(Image, int, int, ImageObserver). This element supports asynchronous image loading.


Field Summary
 
Fields inherited from class org.jdrawing.graphics.GraphicsElement
BACKGROUND, COLOR, COMPOSITE, FONT, PAINT, parent, position, STROKE, TRANSFORM
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DrawImage(java.awt.Image image, int x, int y)
          Returns Fill with given image at given location.
 
Method Summary
 boolean contains(java.awt.geom.Point2D point)
          Tests if the element containes given point.
 java.awt.Rectangle getBounds()
          Returns bounding box of the element.
 java.awt.geom.Rectangle2D getBounds2D()
          Returns high precision bounding box of the element.
 java.awt.Image getImage()
          Gets image to be drawn.
 int getX()
          Returns X coordinate of the image.
 int getY()
          Returns X coordinate of the image.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
          This method is called when information about an image which was previously requested using an asynchronous interface becomes available.
 boolean intersects(java.awt.geom.Rectangle2D rectangle)
          Tests if the element intersects with the given rectangle.
 void paintOperation(java.awt.Graphics2D graphics)
          Performs grawing operation.
 void setImage(java.awt.Image image)
          Sets image to be drawn.
 void setX(int x)
          Sets X coordinate of the image.
 void setY(int y)
          Sets Y coordinate of the image.
 
Methods inherited from class org.jdrawing.graphics.GraphicsOperation
paint, update
 
Methods inherited from class org.jdrawing.graphics.GraphicsElement
addStyle, getParent, getStyle, getStyles, getTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y)
Returns Fill with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
Method Detail

setImage

public void setImage(java.awt.Image image)
Sets image to be drawn.

Parameters:
image - the specified image to be drawn

getImage

public java.awt.Image getImage()
Gets image to be drawn.

Returns:
image to be drawn

setX

public void setX(int x)
Sets X coordinate of the image.

Parameters:
x - the x coordinate

getX

public int getX()
Returns X coordinate of the image.

Returns:
the x coordinate of the image

setY

public void setY(int y)
Sets Y coordinate of the image.

Parameters:
y - the y coordinate

getY

public int getY()
Returns X coordinate of the image.

Returns:
the x coordinate of the image

paintOperation

public void paintOperation(java.awt.Graphics2D graphics)
Performs grawing operation. This implementation invokes graphics.fill ().

Specified by:
paintOperation in class GraphicsOperation
Parameters:
graphics - graphics context to use for painting

getBounds

public java.awt.Rectangle getBounds()
Returns bounding box of the element. If the element is unbounded then this method returns null.

Specified by:
getBounds in interface DrawingElement
Returns:
bounding box of the element or null is the element is unbounded

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Returns high precision bounding box of the element. If the element is unbounded then this method returns null.

Specified by:
getBounds2D in interface DrawingElement
Returns:
high precision bounding box of the element or null of the element is unbounded

intersects

public boolean intersects(java.awt.geom.Rectangle2D rectangle)
Tests if the element intersects with the given rectangle.

Specified by:
intersects in interface DrawingElement
Parameters:
rectangle - rectangle to be cheched for intersection
Returns:
true if the element intersects with the given rectangle; false otherwase

contains

public boolean contains(java.awt.geom.Point2D point)
Tests if the element containes given point.

Specified by:
contains in interface DrawingElement
Parameters:
point - to be checked
Returns:
true if the element contains given point; false otherwise

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
This method is called when information about an image which was previously requested using an asynchronous interface becomes available.

Specified by:
imageUpdate in interface java.awt.image.ImageObserver
Parameters:
img - the image being observed
Returns:
false if the infoflags indicate that the image is completely loaded; true otherwise