Package 

Class Texture.PixelBufferDescriptor


  • 
    public class Texture.PixelBufferDescriptor
    
                        

    A descriptor to an image in main memory, typically used to transfer image data from the CPUto the GPU.

    A PixelBufferDescriptor owns the memory buffer it references,therefore PixelBufferDescriptor cannot be copied, but can be moved.

    PixelBufferDescriptor releases ownership of the memory-buffer when it'sdestroyed.
    • Constructor Detail

      • Texture.PixelBufferDescriptor

        Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment, int left, int top, int stride, Object handler, Runnable callback)
        Creates a PixelBufferDescriptor
        Parameters:
        storage - CPU-side buffer containing the image data to upload into the texture
        format - Pixel format of the CPU-side image
        type - Pixel data type of the CPU-side image
        alignment - Row-alignment in bytes of the CPU-side image (1 to 8 bytes)
        left - Left coordinate in pixels of the CPU-side image
        top - Top coordinate in pixels of the CPU-side image
        stride - Stride in pixels of the CPU-side image (i.e.
        handler - An Executor.
        callback - A callback executed by handler when storage is no longer needed.
      • Texture.PixelBufferDescriptor

        Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type)
        Creates a PixelBufferDescriptor with some default values and no callback.
        Parameters:
        storage - CPU-side buffer containing the image data to upload into the texture
        format - Pixel format of the CPU-side image
        type - Pixel data type of the CPU-side image
      • Texture.PixelBufferDescriptor

        Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment)
        Creates a PixelBufferDescriptor with some default values and no callback.
        Parameters:
        storage - CPU-side buffer containing the image data to upload into the texture
        format - Pixel format of the CPU-side image
        type - Pixel data type of the CPU-side image
        alignment - Row-alignment in bytes of the CPU-side image (1 to 8 bytes)
      • Texture.PixelBufferDescriptor

        Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment, int left, int top)
        Creates a PixelBufferDescriptor with some default values and no callback.
        Parameters:
        storage - CPU-side buffer containing the image data to upload into the texture
        format - Pixel format of the CPU-side image
        type - Pixel data type of the CPU-side image
        alignment - Row-alignment in bytes of the CPU-side image (1 to 8 bytes)
        left - Left coordinate in pixels of the CPU-side image
        top - Top coordinate in pixels of the CPU-side image
      • Texture.PixelBufferDescriptor

        Texture.PixelBufferDescriptor(ByteBuffer storage, Texture.CompressedFormat format, int compressedSizeInBytes)
        Parameters:
        storage - CPU-side buffer containing the image data to upload into the texture
        format - Compressed pixel format of the CPU-side image
        compressedSizeInBytes - Size of the compressed data in bytes
    • Method Detail

      • setCallback

         void setCallback(@Nullable() Object handler, @Nullable() Runnable callback)

        Set or replace the callback called when the CPU-side data is no longer needed.

        Parameters:
        handler - An Executor.
        callback - A callback executed by handler when storage is no longer needed.
      • computeDataSize

         static int computeDataSize(@NonNull() Texture.Format format, @NonNull() Texture.Type type, int stride, int height, @IntRange(from = 1, to = 8) int alignment)

        Helper to calculate the buffer size (in byte) needed for given parameters

        Parameters:
        format - Pixel data format.
        type - Pixel data type.
        stride - Stride in pixels.
        height - Height in pixels.
        alignment - Alignment in bytes.