feat: début environnement graphique, dessin fonctionnel, sauvegarde et chargement temporaire possible

This commit is contained in:
Emi Boucly 2025-03-17 11:14:27 +01:00
parent 8af801e4fd
commit 70e583a380
6 changed files with 195 additions and 19 deletions

View file

@ -0,0 +1,39 @@
package fr.emiko.graphicsElement;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.shape.Path;
import java.awt.*;
public class Stroke {
private final double fromX;
private final double fromY;
private final double toX;
private final double toY;
public Stroke (double fromX, double fromY, double toX, double toY) {
this.fromX = fromX;
this.fromY = fromY;
this.toX = toX;
this.toY = toY;
}
public void draw (GraphicsContext g) {
// g.setStroke(javafx.scene.paint.Color.BLACK);
// g.setLineWidth(1);
// g.beginPath();
// g.moveTo(fromX, fromY);
// g.lineTo(toX, toY);
// g.closePath();
// g.stroke();
// g.fill();
g.setFill(javafx.scene.paint.Color.BLACK);
g.fillOval(toX-5, toY-5, 10, 10);
}
@Override
public String toString () {
return "Stroke{fromX=%f, fromY=%f, toX=%f, toY=%f}".formatted(fromX, fromY, toX, toY);
}
}