Class NkImage

    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • HANDLE, W, H, REGION

        The struct member offsets.
    • Constructor Detail

      • NkImage

        public NkImage​(java.nio.ByteBuffer container)
        Creates a NkImage 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 Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • handle

        public NkHandle handle()
        Returns a NkHandle view of the handle field.
      • handle

        public NkImage handle​(java.util.function.Consumer<NkHandle> consumer)
        Passes the handle field to the specified Consumer.
      • w

        public short w()
        Returns the value of the w field.
      • h

        public short h()
        Returns the value of the h field.
      • region

        public java.nio.ShortBuffer region()
        Returns a ShortBuffer view of the region field.
      • region

        public short region​(int index)
        Returns the value at the specified index of the region field.
      • w

        public NkImage w​(short value)
        Sets the specified value to the w field.
      • h

        public NkImage h​(short value)
        Sets the specified value to the h field.
      • region

        public NkImage region​(java.nio.ShortBuffer value)
        Copies the specified ShortBuffer to the region field.
      • region

        public NkImage region​(int index,
                              short value)
        Sets the specified value at the specified index of the region field.
      • set

        public NkImage set​(NkHandle handle,
                           short w,
                           short h,
                           java.nio.ShortBuffer region)
        Initializes this struct with the specified values.
      • set

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

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

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

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

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

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

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

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

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

        public static NkImage mallocStack()
        Returns a new NkImage instance allocated on the thread-local MemoryStack.
      • callocStack

        public static NkImage callocStack()
        Returns a new NkImage instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static NkImage mallocStack​(MemoryStack stack)
        Returns a new NkImage instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

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

        public static NkImage.Buffer mallocStack​(int capacity)
        Returns a new NkImage.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static NkImage.Buffer callocStack​(int capacity)
        Returns a new NkImage.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

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

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

        public static NkHandle nhandle​(long struct)
        Unsafe version of handle().
      • nw

        public static short nw​(long struct)
        Unsafe version of w().
      • nh

        public static short nh​(long struct)
        Unsafe version of h().
      • nregion

        public static java.nio.ShortBuffer nregion​(long struct)
        Unsafe version of region().
      • nregion

        public static short nregion​(long struct,
                                    int index)
        Unsafe version of region.
      • nhandle

        public static void nhandle​(long struct,
                                   NkHandle value)
        Unsafe version of handle.
      • nw

        public static void nw​(long struct,
                              short value)
        Unsafe version of w.
      • nh

        public static void nh​(long struct,
                              short value)
        Unsafe version of h.
      • nregion

        public static void nregion​(long struct,
                                   java.nio.ShortBuffer value)
        Unsafe version of region.
      • nregion

        public static void nregion​(long struct,
                                   int index,
                                   short value)
        Unsafe version of region.