Package icyllis.arc3d.core
Class Pixels
java.lang.Object
icyllis.arc3d.core.RefCnt
icyllis.arc3d.core.Pixels
- All Implemented Interfaces:
RefCounted
This class is the smart container for pixel memory.
This class may be shared/accessed between multiple threads.
This class may be shared/accessed between multiple threads.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final long
protected final Object
protected final LongConsumer
protected final int
protected boolean
protected final int
protected final int
-
Constructor Summary
ConstructorDescriptionPixels
(int width, int height, Object base, long address, int rowBytes, LongConsumer freeFn) CreatesPixels
from width, height. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Override this method to invoke de-allocation of the underlying resource.long
The address if native buffer, or array base offset; may be NULL.getBase()
The array if heap buffer; may be null.int
int
The size, in bytes, between the start of one pixel row/scanline and the next in buffer, including any unused padding between them.int
getWidth()
boolean
Returns true if this container is marked as immutable, meaning that the contents of its pixels will not change for the lifetime of the container.void
Marks this container is immutable, meaning that the contents of its pixels will not change for the lifetime of the container.toString()
-
Field Details
-
mWidth
protected final int mWidth -
mHeight
protected final int mHeight -
mBase
-
mAddress
protected final long mAddress -
mRowBytes
protected final int mRowBytes -
mFreeFn
-
mImmutable
protected boolean mImmutable
-
-
Constructor Details
-
Pixels
public Pixels(int width, int height, @Nullable Object base, long address, int rowBytes, @Nullable LongConsumer freeFn) CreatesPixels
from width, height. rowBytes should be width times bpp, or larger. freeFn is used to free the address.- Parameters:
base
- array if heap buffer; may be nulladdress
- address if native buffer, or array base offset; may be NULLrowBytes
- size of one row of buffer; width times bpp, or largerfreeFn
- free function for native buffer; may be null
-
-
Method Details
-
deallocate
protected void deallocate()Description copied from class:RefCnt
Override this method to invoke de-allocation of the underlying resource.- Specified by:
deallocate
in classRefCnt
-
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getBase
The array if heap buffer; may be null. -
getAddress
public long getAddress()The address if native buffer, or array base offset; may be NULL. -
getRowBytes
public int getRowBytes()The size, in bytes, between the start of one pixel row/scanline and the next in buffer, including any unused padding between them. This value must be at least the width multiplied by the bytes-per-pixel, where the bytes-per-pixel depends on the color type. -
isImmutable
public boolean isImmutable()Returns true if this container is marked as immutable, meaning that the contents of its pixels will not change for the lifetime of the container. -
setImmutable
public void setImmutable()Marks this container is immutable, meaning that the contents of its pixels will not change for the lifetime of the container. This state can be set on a container, but it cannot be cleared once it is set. -
toString
-