Class NVGPaint

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class NVGPaint
    extends Struct
    implements NativeResource
    A NanoVG paint.

    Member documentation

    • xform – the transformation matrix
    • extent – the extent
    • radius – the radius
    • feather – the feather amount
    • innerColor – the inner color
    • outerColor – the outer color
    • image – the image handle

    Layout

    
     struct NVGpaint {
         float xform[6];
         float extent[2];
         float radius;
         float feather;
         NVGcolor innerColor;
         NVGcolor outerColor;
         int image;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • XFORM, EXTENT, RADIUS, FEATHER, INNERCOLOR, OUTERCOLOR, IMAGE

        The struct member offsets.
    • Constructor Detail

      • NVGPaint

        public NVGPaint​(java.nio.ByteBuffer container)
        Creates a NVGPaint 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
      • xform

        public java.nio.FloatBuffer xform()
        Returns a FloatBuffer view of the xform field.
      • xform

        public float xform​(int index)
        Returns the value at the specified index of the xform field.
      • extent

        public java.nio.FloatBuffer extent()
        Returns a FloatBuffer view of the extent field.
      • extent

        public float extent​(int index)
        Returns the value at the specified index of the extent field.
      • radius

        public float radius()
        Returns the value of the radius field.
      • feather

        public float feather()
        Returns the value of the feather field.
      • innerColor

        public NVGColor innerColor()
        Returns a NVGColor view of the innerColor field.
      • innerColor

        public NVGPaint innerColor​(java.util.function.Consumer<NVGColor> consumer)
        Passes the innerColor field to the specified Consumer.
      • outerColor

        public NVGColor outerColor()
        Returns a NVGColor view of the outerColor field.
      • outerColor

        public NVGPaint outerColor​(java.util.function.Consumer<NVGColor> consumer)
        Passes the outerColor field to the specified Consumer.
      • image

        public int image()
        Returns the value of the image field.
      • xform

        public NVGPaint xform​(java.nio.FloatBuffer value)
        Copies the specified FloatBuffer to the xform field.
      • xform

        public NVGPaint xform​(int index,
                              float value)
        Sets the specified value at the specified index of the xform field.
      • extent

        public NVGPaint extent​(java.nio.FloatBuffer value)
        Copies the specified FloatBuffer to the extent field.
      • extent

        public NVGPaint extent​(int index,
                               float value)
        Sets the specified value at the specified index of the extent field.
      • radius

        public NVGPaint radius​(float value)
        Sets the specified value to the radius field.
      • feather

        public NVGPaint feather​(float value)
        Sets the specified value to the feather field.
      • image

        public NVGPaint image​(int value)
        Sets the specified value to the image field.
      • set

        public NVGPaint set​(java.nio.FloatBuffer xform,
                            java.nio.FloatBuffer extent,
                            float radius,
                            float feather,
                            NVGColor innerColor,
                            NVGColor outerColor,
                            int image)
        Initializes this struct with the specified values.
      • set

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

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

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

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

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

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

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

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

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

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

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

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

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

        public static NVGPaint.Buffer callocStack​(int capacity,
                                                  MemoryStack stack)
        Returns a new NVGPaint.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
      • nxform

        public static java.nio.FloatBuffer nxform​(long struct)
        Unsafe version of xform().
      • nxform

        public static float nxform​(long struct,
                                   int index)
        Unsafe version of xform.
      • nextent

        public static java.nio.FloatBuffer nextent​(long struct)
        Unsafe version of extent().
      • nextent

        public static float nextent​(long struct,
                                    int index)
        Unsafe version of extent.
      • nradius

        public static float nradius​(long struct)
        Unsafe version of radius().
      • nfeather

        public static float nfeather​(long struct)
        Unsafe version of feather().
      • nimage

        public static int nimage​(long struct)
        Unsafe version of image().
      • nxform

        public static void nxform​(long struct,
                                  java.nio.FloatBuffer value)
        Unsafe version of xform.
      • nxform

        public static void nxform​(long struct,
                                  int index,
                                  float value)
        Unsafe version of xform.
      • nextent

        public static void nextent​(long struct,
                                   java.nio.FloatBuffer value)
        Unsafe version of extent.
      • nextent

        public static void nextent​(long struct,
                                   int index,
                                   float value)
        Unsafe version of extent.
      • nradius

        public static void nradius​(long struct,
                                   float value)
        Unsafe version of radius.
      • nfeather

        public static void nfeather​(long struct,
                                    float value)
        Unsafe version of feather.
      • ninnerColor

        public static void ninnerColor​(long struct,
                                       NVGColor value)
        Unsafe version of innerColor.
      • nouterColor

        public static void nouterColor​(long struct,
                                       NVGColor value)
        Unsafe version of outerColor.
      • nimage

        public static void nimage​(long struct,
                                  int value)
        Unsafe version of image.