Class Pixbuf.Builder<B extends Pixbuf.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
Pixbuf

public static class Pixbuf.Builder<B extends Pixbuf.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Pixbuf build()
      Finish building the Pixbuf object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Pixbuf.
      Overrides:
      build in class GObject.Builder<B extends Pixbuf.Builder<B>>
      Returns:
      a new instance of Pixbuf with the properties that were set in the Builder object.
    • setBitsPerSample

      public B setBitsPerSample(int bitsPerSample)

      The number of bits per sample.

      Currently only 8 bit per sample are supported.

      Parameters:
      bitsPerSample - the value for the bits-per-sample property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setColorspace

      public B setColorspace(Colorspace colorspace)

      The color space of the pixbuf.

      Currently, only GDK_COLORSPACE_RGB is supported.

      Parameters:
      colorspace - the value for the colorspace property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setHasAlpha

      public B setHasAlpha(boolean hasAlpha)
      Whether the pixbuf has an alpha channel.
      Parameters:
      hasAlpha - the value for the has-alpha property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setHeight

      public B setHeight(int height)
      The number of rows of the pixbuf.
      Parameters:
      height - the value for the height property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setNChannels

      public B setNChannels(int nChannels)

      The number of samples per pixel.

      Currently, only 3 or 4 samples per pixel are supported.

      Parameters:
      nChannels - the value for the n-channels property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPixelBytes

      public B setPixelBytes(byte[] pixelBytes)
    • setPixels

      public B setPixels(MemorySegment pixels)
      A pointer to the pixel data of the pixbuf.
      Parameters:
      pixels - the value for the pixels property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setRowstride

      public B setRowstride(int rowstride)

      The number of bytes between the start of a row and the start of the next row.

      This number must (obviously) be at least as large as the width of the pixbuf.

      Parameters:
      rowstride - the value for the rowstride property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setWidth

      public B setWidth(int width)
      The number of columns of the pixbuf.
      Parameters:
      width - the value for the width property
      Returns:
      the Builder instance is returned, to allow method chaining