1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| int normalWidth;
int normalHeight;
public void drawZoom(Graphics graphics, int x, int y, int w, int h, String text) {
Graphics2D g = (Graphics2D) graphics;
double zoomX = w / (double) normalWidth;
double zoomY = h / (double) normalHeight;
g.scale(zoomX, zoomY);
// ici tu dessines ton carré et ton texte sans tenir compte du zoom.
// le carré doit être de taille normalWidth x normalHeight
g.scale(1/zoomX, 1/zoomY);
// ici tu peux dessiner des choses qui ne doivent pas être zoomées
} |
Partager