Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions lab-03/README.md

This file was deleted.

42 changes: 42 additions & 0 deletions lab-03/by/aadeglmmy/paint/DrawingData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package by.aadeglmmy.paint;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class DrawingData implements Serializable {

private final List<LineData> lines;
private final List<OvalData> ovals;
private final List<RectangleData> rectangles;

public DrawingData() {
lines = new ArrayList<>();
ovals = new ArrayList<>();
rectangles = new ArrayList<>();
}

public void addLine(LineData lineData) {
lines.add(lineData);
}

public void addOval(OvalData ovalData) {
ovals.add(ovalData);
}

public void addRectangle(RectangleData rectangleData) {
rectangles.add(rectangleData);
}

public List<LineData> getLines() {
return lines;
}

public List<OvalData> getOvals() {
return ovals;
}

public List<RectangleData> getRectangles() {
return rectangles;
}
}
53 changes: 53 additions & 0 deletions lab-03/by/aadeglmmy/paint/LineData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package by.aadeglmmy.paint;

import java.io.Serializable;
import javafx.scene.paint.Color;

public class LineData implements Serializable {

private final double startX;
private final double startY;
private final double endX;
private final double endY;
private final int colorRed;
private final int colorGreen;
private final int colorBlue;
private final double width;

public LineData(double startX, double startY, double endX, double endY, Color color, double width,
DrawingData drawing) {
this.startX = startX;
this.startY = startY;
this.endX = endX;
this.endY = endY;
this.colorRed = (int) (color.getRed() * 255);
this.colorGreen = (int) (color.getGreen() * 255);
this.colorBlue = (int) (color.getBlue() * 255);
this.width = width;
drawing.addLine(this);
}

public double getStartX() {
return startX;
}

public double getStartY() {
return startY;
}

public double getEndX() {
return endX;
}

public double getEndY() {
return endY;
}

public Color getColor() {
return Color.rgb(colorRed, colorGreen, colorBlue);
}

public double getWidth() {
return width;
}
}
53 changes: 53 additions & 0 deletions lab-03/by/aadeglmmy/paint/OvalData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package by.aadeglmmy.paint;

import java.io.Serializable;
import javafx.scene.paint.Color;

public class OvalData implements Serializable {

private final double x;
private final double y;
private final double width;
private final double height;
private final int colorRed;
private final int colorGreen;
private final int colorBlue;
private final double brushWidth;

public OvalData(double x, double y, double width, double height, Color color, double brushWidth,
DrawingData drawing) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.colorRed = (int) (color.getRed() * 255);
this.colorGreen = (int) (color.getGreen() * 255);
this.colorBlue = (int) (color.getBlue() * 255);
this.brushWidth = brushWidth;
drawing.addOval(this);
}

public double getX() {
return x;
}

public double getY() {
return y;
}

public double getWidth() {
return width;
}

public double getHeight() {
return height;
}

public Color getColor() {
return Color.rgb(colorRed, colorGreen, colorBlue);
}

public double getBrushWidth() {
return brushWidth;
}
}
53 changes: 53 additions & 0 deletions lab-03/by/aadeglmmy/paint/RectangleData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package by.aadeglmmy.paint;

import java.io.Serializable;
import javafx.scene.paint.Color;

public class RectangleData implements Serializable {

private final double x;
private final double y;
private final double width;
private final double height;
private final int colorRed;
private final int colorGreen;
private final int colorBlue;
private final double brushWidth;

public RectangleData(double x, double y, double width, double height, Color color, double brushWidth,
DrawingData drawing) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.colorRed = (int) (color.getRed() * 255);
this.colorGreen = (int) (color.getGreen() * 255);
this.colorBlue = (int) (color.getBlue() * 255);
this.brushWidth = brushWidth;
drawing.addRectangle(this);
}

public double getX() {
return x;
}

public double getY() {
return y;
}

public double getWidth() {
return width;
}

public double getHeight() {
return height;
}

public Color getColor() {
return Color.rgb(colorRed, colorGreen, colorBlue);
}

public double getBrushWidth() {
return brushWidth;
}
}
Loading