Posted By:
Abey_Mullassery
Posted On:
Tuesday, August 21, 2001 02:48 AM
Solved the problem to an extent.
I maintain a shape and an AffineTransform object. All transform are done onthe affineTransform object. The shape is then updated accordingly.
This shape is used to override the contains method for catching the mouse clicks and to set a new clip area while painting.
public void paintComponent(java.awt.Graphics graphics) {
Graphics2D g2d = (Graphics2D) graphics;
//imageBounds is the rectangle representing the image
s = affineTransform.createTransformedShape(imageBounds);
g2d.setClip(s);
if(img!=null) g2d.drawImage(img,affineTransform,this);
}
public void rotate(double theta, double x, double y){
affineTransform.rotate(theta, x, y);
}
I also planning to "group" these components such that transformation can be done to the component based on Group co-ordinates.
Any design or code related suggestions??