public class Drawer
extends java.lang.Object
implements javafx.event.EventHandler<javafx.scene.input.MouseEvent>
Modifier and Type | Class and Description |
---|---|
static class |
Drawer.Shapes
The available shapes
|
static class |
Drawer.Tools
The available tools
|
Modifier and Type | Field and Description |
---|---|
private javafx.scene.input.Clipboard |
clipboard
The system clipboard
|
private PaintController |
controller
The program's controller
|
private Drawer.Tools |
currentTool
The current tool
|
private static int |
DOWN |
private boolean |
fillShapesSec
Whether shapes should be filled with the primary color (false) or the secondary color (true)
|
private static int |
LEFT
Crops the image to the portion selected by the move tool
|
private NDialog |
nDialog |
private Paint |
paint |
private static int |
RIGHT |
private ShapeDialog |
shapeDialog |
private static int |
UP |
Constructor and Description |
---|
Drawer(Paint paint,
PaintController controller) |
Modifier and Type | Method and Description |
---|---|
void |
clearDrawCanvas()
Clears the draw canvas
|
void |
cut()
Removes the section of the image selected by the move tool and copies it to the system clipboard
|
void |
drawToLayer()
Copies the draw canvas contents onto the current layer
|
void |
fill(int to,
int x,
int y)
Begin a bucket fill
|
private void |
fill(int from,
int to,
int x,
int y,
int w,
int h,
javafx.scene.image.PixelReader reader,
javafx.scene.image.PixelWriter writer,
int dirFrom) |
Drawer.Tools |
getCurrentTool()
Returns the current tool
|
boolean |
getFillShapesWithSecondary() |
void |
handle(javafx.scene.input.MouseEvent event) |
void |
paste()
Gets the image from the system clipboard (if present) and allows it to be placed
|
void |
setFillShapes(boolean fill) |
void |
setFillShapesWithSecondary(boolean fill) |
void |
setTool(Drawer.Tools tool)
Set the current tool
|
void |
setWidth(int width) |
private Paint paint
private PaintController controller
private ShapeDialog shapeDialog
private NDialog nDialog
private Drawer.Tools currentTool
private boolean fillShapesSec
private javafx.scene.input.Clipboard clipboard
private static final int LEFT
private static final int UP
private static final int RIGHT
private static final int DOWN
public Drawer(Paint paint, PaintController controller)
public Drawer.Tools getCurrentTool()
public void setTool(Drawer.Tools tool)
tool
- the new toolpublic void setWidth(int width)
width
- the new stroke widthpublic void setFillShapes(boolean fill)
fill
- whether to fill drawn shapespublic void setFillShapesWithSecondary(boolean fill)
fill
- whether to fill drawn shapes with the secondary color rather than primary colorpublic boolean getFillShapesWithSecondary()
public void handle(javafx.scene.input.MouseEvent event)
handle
in interface javafx.event.EventHandler<javafx.scene.input.MouseEvent>
public void cut()
public void paste()
public void fill(int to, int x, int y)
to
- the color to fill with (ARGB)x
- the x-coordinate to begin filly
- the y-coordinate to begin fillprivate void fill(int from, int to, int x, int y, int w, int h, javafx.scene.image.PixelReader reader, javafx.scene.image.PixelWriter writer, int dirFrom)
public void clearDrawCanvas()
public void drawToLayer()