In this section, you will studied how to show a clip of image.
To show the image clip, we have used Ellipse2D class to show the oval shape in an image. To give the path with straight line, we have used the class GeneralPath. The AffineTransform class allows translation, shearing, scaling, rotation etc. To give the stylistic and impressive outline of the specified shape, class BasicStroke is used.
The method setToIdentity() sets the color-adjustment of a specified category. The paint() method calls the drawImage() method. The drawImage() method describes the rotation of image.
The method thread.start() starts the thread to begin execution. The method currentThread() returns a reference to the currently executing thread object. The method thread.yield() pauses temporarily the currently executing thread and allows other threads to execute.
Following code draws the image:
|g.drawImage(bufferedImg, 0, 0, this)|
Here is the code of ClipImageExample.java
Output will be displayed as:
Liked it! Share this Tutorial