Class WritableImageBuilder
java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.WritableImageBuilder
The
WritableImageBuilder
class constructs instances of the WritableImage
class
and offers a fluent interface for creating and configuring it.
This class includes a static create
method that accepts the same arguments as the original WritableImage
constructor
and returns an instance of the WritableImageBuilder
.
You can use method chaining to call the builder methods for configuring the WritableImage
.
Finally, invoke the build
method to generate an instance of the WritableImage
class.
Note that intermediate builder methods are not evaluated until the build
method
is called, meaning they are evaluated lazily.
- Author:
- Hidekazu Kubota <hidekazu.kubota@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionapply
(Consumer<WritableImage> func) Applies a function to the WritableImage instance being constructed.build()
Builds and returns an instance of theWritableImage
class.static WritableImageBuilder
create
(int width, int height) Accepts the constructor arguments ofWritableImage(int, int)
and returns an instance ofWritableImageBuilder
.static WritableImageBuilder
create
(PixelBuffer<? extends Buffer> pixelBuffer) Accepts the constructor arguments ofWritableImage(PixelBuffer)
and returns an instance ofWritableImageBuilder
.static WritableImageBuilder
create
(PixelReader reader, int width, int height) Accepts the constructor arguments ofWritableImage(PixelReader, int, int)
and returns an instance ofWritableImageBuilder
.static WritableImageBuilder
create
(PixelReader reader, int x, int y, int width, int height) Accepts the constructor arguments ofWritableImage(PixelReader, int, int, int, int)
and returns an instance ofWritableImageBuilder
.Applies a function to theerrorProperty
of the instance being constructed.Applies a function to theexceptionProperty
of the instance being constructed.Applies a function to theheightProperty
of the instance being constructed.Applies a function to theprogressProperty
of the instance being constructed.Applies a function to thewidthProperty
of the instance being constructed.
-
Method Details
-
create
Accepts the constructor arguments ofWritableImage(int, int)
and returns an instance ofWritableImageBuilder
.- Returns:
- an instance of the
WritableImageBuilder
.
-
create
Accepts the constructor arguments ofWritableImage(PixelBuffer)
and returns an instance ofWritableImageBuilder
.- Returns:
- an instance of the
WritableImageBuilder
.
-
create
Accepts the constructor arguments ofWritableImage(PixelReader, int, int)
and returns an instance ofWritableImageBuilder
.- Returns:
- an instance of the
WritableImageBuilder
.
-
create
Accepts the constructor arguments ofWritableImage(PixelReader, int, int, int, int)
and returns an instance ofWritableImageBuilder
.- Returns:
- an instance of the
WritableImageBuilder
.
-
build
Builds and returns an instance of theWritableImage
class.Intermediate builder methods are not evaluated until the
build
method is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
WritableImage
class
-
apply
Applies a function to the WritableImage instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
errorPropertyApply
Applies a function to theerrorProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.errorProperty().bind(anotherProperty)) // Use shorthand form .errorPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
exceptionPropertyApply
Applies a function to theexceptionProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.exceptionProperty().bind(anotherProperty)) // Use shorthand form .exceptionPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
heightPropertyApply
Applies a function to theheightProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.heightProperty().bind(anotherProperty)) // Use shorthand form .heightPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
progressPropertyApply
Applies a function to theprogressProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.progressProperty().bind(anotherProperty)) // Use shorthand form .progressPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
widthPropertyApply
Applies a function to thewidthProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.widthProperty().bind(anotherProperty)) // Use shorthand form .widthPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-