-
public class Texture.PixelBufferDescriptorA descriptor to an image in main memory, typically used to transfer image data from the CPUto the GPU.
A
PixelBufferDescriptorowns the memory buffer it references,thereforePixelBufferDescriptorcannot be copied, but can be moved.PixelBufferDescriptorreleases ownership of the memory-buffer when it'sdestroyed.
-
-
Field Summary
Fields Modifier and Type Field Description public Bufferstoragepublic Texture.Typetypepublic intalignmentpublic intleftpublic inttoppublic intstridepublic Texture.Formatformatpublic intcompressedSizeInBytespublic Texture.CompressedFormatcompressedFormatpublic Objecthandlerpublic Runnablecallback
-
Constructor Summary
Constructors Constructor Description Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment, int left, int top, int stride, Object handler, Runnable callback)Creates a PixelBufferDescriptorTexture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type)Creates a PixelBufferDescriptorwith some default values and no callback.Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment)Creates a PixelBufferDescriptorwith some default values and no callback.Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment, int left, int top)Creates a PixelBufferDescriptorwith some default values and no callback.Texture.PixelBufferDescriptor(ByteBuffer storage, Texture.CompressedFormat format, int compressedSizeInBytes)
-
Method Summary
Modifier and Type Method Description voidsetCallback(@Nullable() Object handler, @Nullable() Runnable callback)Set or replace the callback called when the CPU-side data is no longer needed. static intcomputeDataSize(@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 -
-
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 aPixelBufferDescriptor- Parameters:
storage- CPU-side buffer containing the image data to upload into the textureformat- Pixel format of the CPU-side imagetype- Pixel data type of the CPU-side imagealignment- Row-alignment in bytes of the CPU-side image (1 to 8 bytes)left- Left coordinate in pixels of the CPU-side imagetop- Top coordinate in pixels of the CPU-side imagestride- Stride in pixels of the CPU-side image (i.e.handler- An Executor.callback- A callback executed byhandlerwhenstorageis no longer needed.
-
Texture.PixelBufferDescriptor
Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type)
Creates aPixelBufferDescriptorwith some default values and no callback.
-
Texture.PixelBufferDescriptor
Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment)
Creates aPixelBufferDescriptorwith some default values and no callback.
-
Texture.PixelBufferDescriptor
Texture.PixelBufferDescriptor(Buffer storage, Texture.Format format, Texture.Type type, int alignment, int left, int top)
Creates aPixelBufferDescriptorwith some default values and no callback.- Parameters:
storage- CPU-side buffer containing the image data to upload into the textureformat- Pixel format of the CPU-side imagetype- Pixel data type of the CPU-side imagealignment- Row-alignment in bytes of the CPU-side image (1 to 8 bytes)left- Left coordinate in pixels of the CPU-side imagetop- 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 textureformat- Compressed pixel format of the CPU-side imagecompressedSizeInBytes- 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 byhandlerwhenstorageis 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.
-
-
-
-