Copies a region of the specified source image to a location within the destination, possibly transforming (rotating and reflecting) the image data using the chosen transform function.
The destination, if it is an image, must not be the same image as the source image. If it is, an exception is thrown. This restriction is present in order to avoid ill-defined behaviors that might occur if overlapped, transformed copies were permitted.
The transform function used must be one of the following, as defined in the {@link javax.microedition.lcdui.game.Sprite Sprite} class:
Sprite.TRANS_NONE
- causes the specified image region to be copied unchanged
Sprite.TRANS_ROT90
- causes the specified image region to be rotated clockwise by 90 degrees.
Sprite.TRANS_ROT180
- causes the specified image region to be rotated clockwise by 180 degrees.
Sprite.TRANS_ROT270
- causes the specified image region to be rotated clockwise by 270 degrees.
Sprite.TRANS_MIRROR
- causes the specified image region to be reflected about its vertical center.
Sprite.TRANS_MIRROR_ROT90
- causes the specified image region to be reflected about its vertical center and then rotated clockwise by 90 degrees.
Sprite.TRANS_MIRROR_ROT180
- causes the specified image region to be reflected about its vertical center and then rotated clockwise by 180 degrees.
Sprite.TRANS_MIRROR_ROT270
- causes the specified image region to be reflected about its vertical center and then rotated clockwise by 270 degrees.
If the source region contains transparent pixels, the corresponding pixels in the destination region must be left untouched. If the source region contains partially transparent pixels, a compositing operation must be performed with the destination pixels, leaving all pixels of the destination region fully opaque.
The (x_src, y_src)
coordinates are relative to the upper left corner of the source image. The x_src
, y_src
, width
, and height
parameters specify a rectangular region of the source image. It is illegal for this region to extend beyond the bounds of the source image. This requires that:
x_src >= 0 y_src >= 0 x_src + width <= source width y_src + height <= source height |
The (x_dest, y_dest)
coordinates are relative to the coordinate system of this Graphics object. It is legal for the destination area to extend beyond the bounds of the Graphics
object. Pixels outside of the bounds of the Graphics
object will not be drawn.
The transform is applied to the image data from the region of the source image, and the result is rendered with its anchor point positioned at location (x_dest, y_dest)
in the destination.
@param src the source image to copy from
@param x_src the x coordinate of the upper left corner of the regionwithin the source image to copy
@param y_src the y coordinate of the upper left corner of the regionwithin the source image to copy
@param width the width of the region to copy
@param height the height of the region to copy
@param transform the desired transformation for the selected regionbeing copied
@param x_dest the x coordinate of the anchor point in thedestination drawing area
@param y_dest the y coordinate of the anchor point in thedestination drawing area
@param anchor the anchor point for positioning the region withinthe destination image
@throws IllegalArgumentException if
src
is thesame image as the destination of this
Graphics
object
@throws NullPointerException if
src
is
null
@throws IllegalArgumentException if
transform
is invalid
@throws IllegalArgumentException if
anchor
is invalid
@throws IllegalArgumentException if the region to be copied exceedsthe bounds of the source image