Class spng_sbit

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class spng_sbit extends Struct<spng_sbit> implements NativeResource

 struct spng_sbit {
     uint8_t grayscale_bits;
     uint8_t red_bits;
     uint8_t green_bits;
     uint8_t blue_bits;
     uint8_t alpha_bits;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • GRAYSCALE_BITS

      public static final int GRAYSCALE_BITS
      The struct member offsets.
    • RED_BITS

      public static final int RED_BITS
      The struct member offsets.
    • GREEN_BITS

      public static final int GREEN_BITS
      The struct member offsets.
    • BLUE_BITS

      public static final int BLUE_BITS
      The struct member offsets.
    • ALPHA_BITS

      public static final int ALPHA_BITS
      The struct member offsets.
  • Constructor Details

    • spng_sbit

      public spng_sbit(ByteBuffer container)
      Creates a spng_sbit instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<spng_sbit>
    • grayscale_bits

      public byte grayscale_bits()
      Returns:
      the value of the grayscale_bits field.
    • red_bits

      public byte red_bits()
      Returns:
      the value of the red_bits field.
    • green_bits

      public byte green_bits()
      Returns:
      the value of the green_bits field.
    • blue_bits

      public byte blue_bits()
      Returns:
      the value of the blue_bits field.
    • alpha_bits

      public byte alpha_bits()
      Returns:
      the value of the alpha_bits field.
    • grayscale_bits

      public spng_sbit grayscale_bits(byte value)
      Sets the specified value to the grayscale_bits field.
    • red_bits

      public spng_sbit red_bits(byte value)
      Sets the specified value to the red_bits field.
    • green_bits

      public spng_sbit green_bits(byte value)
      Sets the specified value to the green_bits field.
    • blue_bits

      public spng_sbit blue_bits(byte value)
      Sets the specified value to the blue_bits field.
    • alpha_bits

      public spng_sbit alpha_bits(byte value)
      Sets the specified value to the alpha_bits field.
    • set

      public spng_sbit set(byte grayscale_bits, byte red_bits, byte green_bits, byte blue_bits, byte alpha_bits)
      Initializes this struct with the specified values.
    • set

      public spng_sbit set(spng_sbit src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static spng_sbit malloc()
      Returns a new spng_sbit instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static spng_sbit calloc()
      Returns a new spng_sbit instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static spng_sbit create()
      Returns a new spng_sbit instance allocated with BufferUtils.
    • create

      public static spng_sbit create(long address)
      Returns a new spng_sbit instance for the specified memory address.
    • createSafe

      public static @Nullable spng_sbit createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static spng_sbit.Buffer malloc(int capacity)
      Returns a new spng_sbit.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static spng_sbit.Buffer calloc(int capacity)
      Returns a new spng_sbit.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static spng_sbit.Buffer create(int capacity)
      Returns a new spng_sbit.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static spng_sbit.Buffer create(long address, int capacity)
      Create a spng_sbit.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable spng_sbit.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static spng_sbit malloc(MemoryStack stack)
      Returns a new spng_sbit instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static spng_sbit calloc(MemoryStack stack)
      Returns a new spng_sbit instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static spng_sbit.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new spng_sbit.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static spng_sbit.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new spng_sbit.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • ngrayscale_bits

      public static byte ngrayscale_bits(long struct)
      Unsafe version of grayscale_bits().
    • nred_bits

      public static byte nred_bits(long struct)
      Unsafe version of red_bits().
    • ngreen_bits

      public static byte ngreen_bits(long struct)
      Unsafe version of green_bits().
    • nblue_bits

      public static byte nblue_bits(long struct)
      Unsafe version of blue_bits().
    • nalpha_bits

      public static byte nalpha_bits(long struct)
      Unsafe version of alpha_bits().
    • ngrayscale_bits

      public static void ngrayscale_bits(long struct, byte value)
      Unsafe version of grayscale_bits.
    • nred_bits

      public static void nred_bits(long struct, byte value)
      Unsafe version of red_bits.
    • ngreen_bits

      public static void ngreen_bits(long struct, byte value)
      Unsafe version of green_bits.
    • nblue_bits

      public static void nblue_bits(long struct, byte value)
      Unsafe version of blue_bits.
    • nalpha_bits

      public static void nalpha_bits(long struct, byte value)
      Unsafe version of alpha_bits.