Adapter for managing and manipulating a BufferedImage
. This class provides methods for common image processing tasks such as copying, scaling, and transforming.
Value parameters
- buffer
-
The underlying
BufferedImage
instance.
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Value members
Constructors
Creates a JVMBufferAdapter
instance with specified width and height, initializing a new BufferedImage
.
Creates a JVMBufferAdapter
instance with specified width and height, initializing a new BufferedImage
.
Value parameters
- height
-
The height of the image.
- width
-
The width of the image.
Attributes
Concrete methods
Copies a portion of the image defined by a top-left corner and dimensions.
Copies a portion of the image defined by a top-left corner and dimensions.
Value parameters
- height
-
Height of the portion to copy.
- topLeftX
-
X-coordinate of the top-left corner.
- topLeftY
-
Y-coordinate of the top-left corner.
- width
-
Width of the portion to copy.
Attributes
- Returns
-
A new
BufferAdapter
instance containing the copied portion of the image.
Creates a new JVMBufferAdapter
instance that is a transformed version of the current buffer. The transformation is applied using an AffineTransformation
. The canvas can optionally be resized based on the transformation.
Creates a new JVMBufferAdapter
instance that is a transformed version of the current buffer. The transformation is applied using an AffineTransformation
. The canvas can optionally be resized based on the transformation.
Value parameters
- backgroundColor
-
The background color to use when clearing the canvas if resizing is necessary. Defaults to
DefaultBackgroundColor
. - transformation
-
The
AffineTransformation
to apply to the image.
Attributes
- Returns
-
A new
JVMBufferAdapter
instance containing the transformed image.
Creates a deep copy of the current BufferAdapter
instance, drawing the current buffer onto a new one.
Creates a deep copy of the current BufferAdapter
instance, drawing the current buffer onto a new one.
Attributes
- Returns
-
A new
BufferAdapter
instance that is a copy of the current one.
Provides access to the underlying BufferedImage
.
Provides access to the underlying BufferedImage
.
Attributes
- Returns
-
The underlying
BufferedImage
.
Retrieves the color at a specified pixel location in the buffer.
Retrieves the color at a specified pixel location in the buffer.
Value parameters
- x
-
The x-coordinate of the pixel.
- y
-
The y-coordinate of the pixel.
Attributes
- Returns
-
The
Color
of the pixel at the specified coordinates.
Saves a BufferedImage
to a specified path. The image is saved in PNG format.
Saves a BufferedImage
to a specified path. The image is saved in PNG format.
Value parameters
- path
-
The filesystem path where the image should be saved.
Attributes
- Returns
-
true
if the image was saved successfully,false
otherwise.
Scales the image to a target width and height.
Scales the image to a target width and height.
Value parameters
- targetHeight
-
The target height for the scaled image.
- targetWidth
-
The target width for the scaled image.
Attributes
- Returns
-
A new
BufferAdapter
instance containing the scaled image.
Sets the colors of the image from a sequence of Color
objects.
Sets the colors of the image from a sequence of Color
objects.
Value parameters
- colors
-
A sequence of
Color
objects to be applied to the image. The sequence must have exactly width * height items.
Attributes
Sets the color of a pixel at a specified location in the buffer.
Sets the color of a pixel at a specified location in the buffer.
Value parameters
- color
-
The
Color
to set the pixel to. - x
-
The x-coordinate of the pixel.
- y
-
The y-coordinate of the pixel.
Attributes
Converts the buffer into a Swing Icon
.
Converts the buffer into a Swing Icon
.
Attributes
- Returns
-
An
Icon
representing the buffer.
Inherited methods
Copies a portion of the image defined by two corners: top-left and bottom-right.
Copies a portion of the image defined by two corners: top-left and bottom-right.
Value parameters
- bottom
-
Y-coordinate of the bottom-right corner.
- left
-
X-coordinate of the top-left corner.
- right
-
X-coordinate of the bottom-right corner.
- top
-
Y-coordinate of the top-left corner.
Attributes
- Returns
-
A new
BufferAdapter
instance containing the copied portion of the image. - Inherited from:
- BufferAdapter
Merges this Buffer with another Buffer using a specified pixel merging function.
Merges this Buffer with another Buffer using a specified pixel merging function.
Value parameters
- another
-
The other BufferAdapter to merge with.
- pixelMerger
-
A function that takes two colors and returns a merged color.
Attributes
- Returns
-
A new
BufferAdapter
instance representing the merged image. - Inherited from:
- BufferAdapter
Attributes
- Inherited from:
- BufferAdapter
Attributes
- Inherited from:
- BufferAdapter