vendredi 20 mars 2015

How to detect mouse over on drawn image with awt.Graphics.drawImage() when transformed

In a Java Swing panel I draw an image with arbitrary transfomation e.g.:



public void paintComponent(Graphics g){
AffineTransform transform = AffineTransform.getTranslateInstance(x, y);
AffineTransform rotateInstance AffineTransform.getRotateInstance(rotX, rotY);
transform.concatenate(rotateInstance);

g.setTransform(transform);
g.drawImage(image, 0, 0 , null);
}


What is the best way to detect mouse over on such an image?


Even better: the best way to detect mouse over only on non-transparent pixels?


Aucun commentaire:

Enregistrer un commentaire