org.jdrawing.graphics
Class DrawImage

java.lang.Object
  extended byorg.jdrawing.graphics.GraphicsOperation
      extended byorg.jdrawing.graphics.DrawImage
All Implemented Interfaces:
DrawingElement

public class DrawImage
extends GraphicsOperation

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


Constructor Summary
DrawImage(java.awt.Image image, int x, int y, java.awt.Color color, java.awt.image.ImageObserver observer)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, java.awt.Color color, java.awt.image.ImageObserver observer, Style style)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, java.awt.image.ImageObserver observer)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, java.awt.image.ImageObserver observer, Style style)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.Color color, java.awt.image.ImageObserver observer)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.Color color, java.awt.image.ImageObserver observer, Style style)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.image.ImageObserver observer, Style style)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color color, java.awt.image.ImageObserver observer)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color color, java.awt.image.ImageObserver observer, Style style)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
          Returns DrawImage with given image at given location.
DrawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer, Style style)
          Returns DrawImage with given image at given location.
 
Method Summary
 java.awt.Color getColor()
          Returns background color of the image.
 int[] getCoords()
          Returns coordinates of the image.
 java.awt.Image getImage()
          Gets image to be drawn.
 java.awt.image.ImageObserver getObserver()
          Returns the ImageObserver used by this operation.
 java.awt.Shape getShapeOfOperation()
          Returns shape of the area updated by this operation.
 void paintOperation(java.awt.Graphics2D graphics)
          Performs drawing operation.
 void setColor(java.awt.Color color)
          Sets background color of the image.
 void setCoords(int[] coords)
          Sets coordinates of the image.
 void setImage(java.awt.Image image)
          Sets image to be drawn.
 void setObserver(java.awt.image.ImageObserver observer)
          Sets the ImageObserver used by this operation.
 
Methods inherited from class org.jdrawing.graphics.GraphicsOperation
contains, getBounds, getBounds2D, getPosition, getStyle, intersects, paint, setPosition, setStyle
 
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,
                 java.awt.image.ImageObserver observer)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
observer - object to be notified as more of the image is converted

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 java.awt.image.ImageObserver observer,
                 Style style)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
observer - object to be notified as more of the image is converted
style - rendering style for the image

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 java.awt.Color color,
                 java.awt.image.ImageObserver observer)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
color - the background color to paint under the non-opaque portions of the image
observer - object to be notified as more of the image is converted

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 java.awt.Color color,
                 java.awt.image.ImageObserver observer,
                 Style style)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
color - the background color to paint under the non-opaque portions of the image
observer - object to be notified as more of the image is converted
style - rendering style for the image

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 int width,
                 int height,
                 java.awt.image.ImageObserver observer)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
width - the width of the scaled image
height - the height of the scaled image
observer - object to be notified as more of the image is converted

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 int width,
                 int height,
                 java.awt.image.ImageObserver observer,
                 Style style)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
width - the width of the scaled image
height - the height of the scaled image
observer - object to be notified as more of the image is converted
style - rendering style for the image

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 int width,
                 int height,
                 java.awt.Color color,
                 java.awt.image.ImageObserver observer)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
width - the width of the scaled image
height - the height of the scaled image
color - the background color to paint under the non-opaque portions of the image
observer - object to be notified as more of the image is converted

DrawImage

public DrawImage(java.awt.Image image,
                 int x,
                 int y,
                 int width,
                 int height,
                 java.awt.Color color,
                 java.awt.image.ImageObserver observer,
                 Style style)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
x - the x coordinate
y - the y coordinate
width - the width of the scaled image
height - the height of the scaled image
color - the background color to paint under the non-opaque portions of the image
observer - object to be notified as more of the image is converted
style - rendering style for the image

DrawImage

public DrawImage(java.awt.Image image,
                 int dx1,
                 int dy1,
                 int dx2,
                 int dy2,
                 int sx1,
                 int sy1,
                 int sx2,
                 int sy2,
                 java.awt.image.ImageObserver observer)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
dx1 - the x coordinate of the first corner of the destination rectangle.
dy1 - the y coordinate of the first corner of the destination rectangle.
dx2 - the x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - the x coordinate of the first corner of the source rectangle.
sy1 - the y coordinate of the first corner of the source rectangle.
sx2 - the x coordinate of the second corner of the source rectangle.
sy2 - the y coordinate of the second corner of the source rectangle.
observer - object to be notified as more of the image is converted

DrawImage

public DrawImage(java.awt.Image image,
                 int dx1,
                 int dy1,
                 int dx2,
                 int dy2,
                 int sx1,
                 int sy1,
                 int sx2,
                 int sy2,
                 java.awt.image.ImageObserver observer,
                 Style style)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
dx1 - the x coordinate of the first corner of the destination rectangle.
dy1 - the y coordinate of the first corner of the destination rectangle.
dx2 - the x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - the x coordinate of the first corner of the source rectangle.
sy1 - the y coordinate of the first corner of the source rectangle.
sx2 - the x coordinate of the second corner of the source rectangle.
sy2 - the y coordinate of the second corner of the source rectangle.
observer - object to be notified as more of the image is converted
style - rendering style for the image

DrawImage

public DrawImage(java.awt.Image image,
                 int dx1,
                 int dy1,
                 int dx2,
                 int dy2,
                 int sx1,
                 int sy1,
                 int sx2,
                 int sy2,
                 java.awt.Color color,
                 java.awt.image.ImageObserver observer)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
dx1 - the x coordinate of the first corner of the destination rectangle.
dy1 - the y coordinate of the first corner of the destination rectangle.
dx2 - the x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - the x coordinate of the first corner of the source rectangle.
sy1 - the y coordinate of the first corner of the source rectangle.
sx2 - the x coordinate of the second corner of the source rectangle.
sy2 - the y coordinate of the second corner of the source rectangle.
color - the background color to paint under the non-opaque portions of the image
observer - object to be notified as more of the image is converted

DrawImage

public DrawImage(java.awt.Image image,
                 int dx1,
                 int dy1,
                 int dx2,
                 int dy2,
                 int sx1,
                 int sy1,
                 int sx2,
                 int sy2,
                 java.awt.Color color,
                 java.awt.image.ImageObserver observer,
                 Style style)
Returns DrawImage with given image at given location.

Parameters:
image - the specified image to be drawn
dx1 - the x coordinate of the first corner of the destination rectangle.
dy1 - the y coordinate of the first corner of the destination rectangle.
dx2 - the x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - the x coordinate of the first corner of the source rectangle.
sy1 - the y coordinate of the first corner of the source rectangle.
sx2 - the x coordinate of the second corner of the source rectangle.
sy2 - the y coordinate of the second corner of the source rectangle.
color - the background color to paint under the non-opaque portions of the image
observer - object to be notified as more of the image is converted
style - rendering style for the image
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

setCoords

public void setCoords(int[] coords)
Sets coordinates of the image.

Parameters:
coords - the array of 2, 4 or 8 coordinates

getCoords

public int[] getCoords()
Returns coordinates of the image.

Returns:
the array of 2, 4 or 8 coordinates

setColor

public void setColor(java.awt.Color color)
Sets background color of the image.

Parameters:
color - the background color

getColor

public java.awt.Color getColor()
Returns background color of the image.

Returns:
the background color of the image

setObserver

public void setObserver(java.awt.image.ImageObserver observer)
Sets the ImageObserver used by this operation.

Parameters:
observer - an ImageObserver object

getObserver

public java.awt.image.ImageObserver getObserver()
Returns the ImageObserver used by this operation.

Returns:
an ImageObserver object

paintOperation

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

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

getShapeOfOperation

public java.awt.Shape getShapeOfOperation()
Returns shape of the area updated by this operation.

Specified by:
getShapeOfOperation in class GraphicsOperation
Returns:
the shape of updated area