Class WritableImageBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.WritableImageBuilder

public class WritableImageBuilder extends Object
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 Details

    • create

      public static WritableImageBuilder create(int width, int height)
      Accepts the constructor arguments of WritableImage(int, int) and returns an instance of WritableImageBuilder.
      Returns:
      an instance of the WritableImageBuilder.
    • create

      public static WritableImageBuilder create(PixelBuffer<? extends Buffer> pixelBuffer)
      Accepts the constructor arguments of WritableImage(PixelBuffer) and returns an instance of WritableImageBuilder.
      Returns:
      an instance of the WritableImageBuilder.
    • create

      public static WritableImageBuilder create(PixelReader reader, int width, int height)
      Accepts the constructor arguments of WritableImage(PixelReader, int, int) and returns an instance of WritableImageBuilder.
      Returns:
      an instance of the WritableImageBuilder.
    • create

      public static WritableImageBuilder create(PixelReader reader, int x, int y, int width, int height)
      Accepts the constructor arguments of WritableImage(PixelReader, int, int, int, int) and returns an instance of WritableImageBuilder.
      Returns:
      an instance of the WritableImageBuilder.
    • build

      public WritableImage build()
      Builds and returns an instance of the WritableImage 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

      public WritableImageBuilder errorPropertyApply(Consumer<ReadOnlyBooleanProperty> op)
      Applies a function to the errorProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.errorProperty().bind(anotherProperty))
      
      // Use shorthand form
      .errorPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • exceptionPropertyApply

      public WritableImageBuilder exceptionPropertyApply(Consumer<ReadOnlyObjectProperty<Exception>> op)
      Applies a function to the exceptionProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.exceptionProperty().bind(anotherProperty))
      
      // Use shorthand form
      .exceptionPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • heightPropertyApply

      public WritableImageBuilder heightPropertyApply(Consumer<ReadOnlyDoubleProperty> op)
      Applies a function to the heightProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.heightProperty().bind(anotherProperty))
      
      // Use shorthand form
      .heightPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • progressPropertyApply

      public WritableImageBuilder progressPropertyApply(Consumer<ReadOnlyDoubleProperty> op)
      Applies a function to the progressProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.progressProperty().bind(anotherProperty))
      
      // Use shorthand form
      .progressPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • widthPropertyApply

      public WritableImageBuilder widthPropertyApply(Consumer<ReadOnlyDoubleProperty> op)
      Applies a function to the widthProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.widthProperty().bind(anotherProperty))
      
      // Use shorthand form
      .widthPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance