java.lang.Object
com.example.brickpaint.BrickImage
Handles common image functions for javaFX applications
- Author:
- matde
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.scene.image.WritableImagegetScaledImage(javafx.scene.canvas.Canvas canvas) Gets a writable image of the provided canvas's contentstatic voidInsert(CanvasPanel panel, javafx.scene.image.Image image) Adds an image to an imageView component in javaFX, scales imageView to the size of input imagestatic voidPaste(CanvasPanel panel, javafx.scene.image.Image image) Adds an image to a Canvas component in javaFX at the point (0,0)static voidPaste(CanvasPanel panel, javafx.scene.image.Image image, javafx.geometry.Point2D point) Adds an image to a Canvas component in javaFX at a specified positionstatic voidPasteRotate(CanvasPanel panel, javafx.scene.image.Image image, javafx.geometry.Point2D point) Adds an image to a Canvas component in javaFX at a specified position and rescales the canvas if neededstatic voidrender(javafx.scene.image.WritableImage image, javafx.scene.canvas.Canvas canvas, int sx, int sy, int sw, int sh, int tx, int ty) Will render a writable image to the provided canvas
-
Constructor Details
-
BrickImage
public BrickImage()
-
-
Method Details
-
Insert
Adds an image to an imageView component in javaFX, scales imageView to the size of input image- Parameters:
image- The image to insert into the canvaspanel- The CanvasPanel Class to add the image to
-
Paste
public static void Paste(CanvasPanel panel, javafx.scene.image.Image image, javafx.geometry.Point2D point) Adds an image to a Canvas component in javaFX at a specified position- Parameters:
image- The image to insert into the canvaspanel- The CanvasPanel Class to add the image topoint- the location of the top left of the image
-
Paste
Adds an image to a Canvas component in javaFX at the point (0,0)- Parameters:
image- The image to insert into the canvaspanel- The CanvasPanel Class to add the image to
-
PasteRotate
public static void PasteRotate(CanvasPanel panel, javafx.scene.image.Image image, javafx.geometry.Point2D point) Adds an image to a Canvas component in javaFX at a specified position and rescales the canvas if needed- Parameters:
image- The image to insert into the canvaspanel- The CanvasPanel Class to add the image topoint- the location of the top left of the image
-
render
public static void render(javafx.scene.image.WritableImage image, javafx.scene.canvas.Canvas canvas, int sx, int sy, int sw, int sh, int tx, int ty) Will render a writable image to the provided canvas- Parameters:
image- Image to rendercanvas- Canvas to render the image tosx- Top left source image x positionsy- Top left source image y positionsw- Source image widthsh- Source image heighttx- The x position to draw the image atty- The y position to draw the image at
-
getScaledImage
public static javafx.scene.image.WritableImage getScaledImage(javafx.scene.canvas.Canvas canvas) Gets a writable image of the provided canvas's content- Parameters:
canvas- The canvas to create an image from- Returns:
- WritableImage of the provided canvas
-