Class Java2DExamples
java.lang.Object
net.jrodolfo.java_evolution.java02.java2d.Java2DExamples
Demonstrates Java 2D rendering to an in-memory image.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblankImage(int width, int height) Creates a blank image that can be drawn without opening a GUI window.Draws a filled rectangle into an in-memory image.Draws an outlined ellipse using Java 2D shape and stroke APIs.pixelColor(BufferedImage image, int x, int y) Reads the color written to a pixel.
-
Constructor Details
-
Java2DExamples
public Java2DExamples()
-
-
Method Details
-
blankImage
Creates a blank image that can be drawn without opening a GUI window.- Parameters:
width- image widthheight- image height- Returns:
- blank image
-
drawFilledRectangle
Draws a filled rectangle into an in-memory image.- Returns:
- image with a red rectangle
-
drawOutlinedEllipse
Draws an outlined ellipse using Java 2D shape and stroke APIs.- Returns:
- image with a blue ellipse outline
-
pixelColor
Reads the color written to a pixel.- Parameters:
image- image to inspectx- x coordinatey- y coordinate- Returns:
- pixel color including alpha
-