Abstract base class for TexelBuffer s that encode one texel in one machine word (8, 16 or 32 bits) using up to four channels (e.g. red, green, blue and alpha).
abstract class
|
TexelBufferBitPattern
|
extends
|
TexelBuffer
|
||
base of
|
TexelBufferBitPattern16
|
||||
TexelBufferBitPattern32
|
The number of bits per texture pixel.
public
property
|
BitsPerTexel
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of bits per pixel. | |
inherited
|
TexelBuffer.BitsPerTexel
|
Returns the size in bytes of the uncompressed samples in this buffer.
public
property
|
BufferSize
{
get
}
|
||
type
|
int32
|
||
value
|
|
The uncompressed buffer size, in bytes. | |
inherited
|
TexelBuffer.BufferSize
|
The texture format of this texel buffer.
public
property
|
Format
{
get
}
|
||
type
|
TextureFormat
|
||
value
|
The texture format. | ||
inherited
|
TexelBuffer.Format
|
Returns if texture pixels carry transparency data.
public
property
|
HasAlpha
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
texture
pixels
can
be
transparent,
false
if
all
texture
pixels
will
always
be
fully
opaque.
|
||
inherited
|
TexelBuffer.HasAlpha
|
The texel buffer height.
public
property
|
Height
{
get
}
|
||
type
|
int32
|
||
value
|
|
The buffer height, in texels. | |
inherited
|
TexelBuffer.Height
|
Returns the lifecycle state of this object.
public
virtual
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
Returns the estimated memory consumption of this object.
public
property
|
MemoryConsumption
{
get
}
|
||
type
|
int64
|
||
value
|
|
The estimated memory consumption, in bytes. | |
inherited
|
TexelBuffer.MemoryConsumption
|
Returns the next smaller mipmap level of this texel buffer.
public
property
|
Mipmap
{
get
}
|
||
type
|
TexelBuffer
|
||
value
|
The
next
smaller
mipmap
level
buffer
or
null
if
this
texel
buffer
is
the
last
one
in
the
mipmap
chain.
|
||
inherited
|
TexelBuffer.Mipmap
|
The number of mipmap levels.
public
property
|
MipmapCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The mipmap level count. | |
inherited
|
TexelBuffer.MipmapCount
|
Returns a pointer to the first texel.
public
property
|
RawTexels
{
get
}
|
||
type
|
IntPtr
|
||
value
|
Pointer to first texel. | ||
inherited
|
TexelBuffer.RawTexels
|
Returns the stride of RawTexels.
public
property
|
RawTexelsStride
{
get
}
|
||
type
|
int32
|
||
value
|
|
The stride, in bytes. | |
inherited
|
TexelBuffer.RawTexelsStride
|
Remarks:
The stride is the byte size of one row of texel blocks (see BlockSize.
Does this object store or process compressed sRGB pixel channel values?
public
property
|
Srgb
{
get
set
}
|
||
type
|
bool
|
||
value
|
true
if
the
pixel
channel
values
are
compressed
false
if
pixel
channel
values
are
linear.
|
||
inherited
|
TexelBuffer.Srgb
|
Remarks:
This
flag
is
taken
into
account
when
pixels
are
encoded
resp.
decoded
from
resp.
to
a
ColorBuffer,
which
always
stores
linear
sRGB
pixels:
This
object
will
only
perform
sRGB
conversion
if
this
flag
is
set
to
true
.
The
default
value
is
true
.
See also:
ColorF.ToSrgbFThe texel buffer width.
public
property
|
Width
{
get
}
|
||
type
|
int32
|
||
value
|
|
The buffer width, in texels. | |
inherited
|
TexelBuffer.Width
|
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
public
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
Disposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Decodes a block of samples in this buffer.
public
method
|
BufferDecode
(ByteBuffer input,
int32 x,
int32 y)
|
||
params
|
input
|
[not-null]
|
The input buffer. |
x
|
[0..Width]
|
X-coordinate of top-left sample of block to decode. | |
y
|
[0..Height]
|
Y-coordinate of top-left sample of block to decode. | |
inherited
|
TexelBuffer.BufferDecode
|
Encodes a block of samples in this buffer as a sequence of bytes, using lossless compression.
public
method
|
BufferEncode
(ByteBuffer output,
int32 x,
int32 y,
int32 width,
int32 height)
|
||
type
|
int32
|
||
params
|
output
|
[not-null]
|
The output buffer. |
x
|
[0..Width]
|
X-coordinate of top-left sample of block to encode. | |
y
|
[0..Height]
|
Y-coordinate of top-left sample of block to encode. | |
width
|
[0..Width-x]
|
Width of pixel block. | |
height
|
[0..Height-y]
|
Height of pixel block. | |
returns
|
>0 :
The
number
of
bytes
that
have
been
written
to
output.
<0 :
The
output
buffer
is
too
small,
at
least
-1-n
bytes
are
required,
where
n
is
the
return
value.
|
||
inherited
|
TexelBuffer.BufferEncode
|
Converts this texel buffer to the given format.
[OwnerReturn, OwnerThis]
|
||||
public
method
|
Convert
(TextureFormat format)
|
|||
type
|
TexelBuffer
|
|||
params
|
format
|
[not-null]
|
The target format. | |
returns
|
|
The converted texel buffer. | ||
inherited
|
TexelBuffer.Convert
|
Copies texel data to the given buffer.
public
method
|
CopyBytes
(ByteBuffer target,
int32 targetBlockStride,
int32 targetX = 0,
int32 targetY = 0)
|
||
params
|
target
|
[not-null]
|
The target buffer. |
targetBlockStride
|
[>0]
|
The target buffer stride, in bytes. This value gives the distance between two adjacent texel block rows. | |
targetX
|
[>=0]
|
X-coordinate
of
top-left
texel
in
target
buffer.
Defaults
to
0 .
|
|
targetY
|
[>=0]
|
Y-coordinate
of
top-left
texel
in
target
buffer.
Defaults
to
0 .
|
|
inherited
|
TexelBuffer.CopyBytes
|
Remarks:
The given target X- and Y-coordinates must be a multiple of the texture format block size (see BlockSize).
Copies all samples from this buffer to the given one.
public
method
|
CopyTexels
(TexelBuffer target,
int32 targetX = 0,
int32 targetY = 0)
|
||
params
|
target
|
[not-null]
|
The target buffer. |
targetX
|
[0..target.Width-Width]
|
X-coordinate
to
top-left
corner
of
target
region.
Defaults
to
0 .
|
|
targetY
|
[0..target.Height-Height]
|
Y-coordinate
to
top-left
corner
of
target
region.
Defaults
to
0 .
|
|
returns
|
|
The target buffer. | |
inherited
|
TexelBuffer.CopyTexels
|
Remarks:
The given target X- and Y-coordinates must be a multiple of the texture format block size (see BlockSize).
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Compares this object with the given one.
[Pure]
|
||||
public
method
|
Equals
(TexelBuffer other)
|
|||
type
|
bool
|
|||
params
|
other
|
The object to compare to. | ||
returns
|
true
if
this
object
is
equal
to
other,
false
if
not.
|
|||
inherited
|
TexelBuffer.Equals
|
Decodes the texels in this buffer into the given pixel buffer.
public
abstract
method
|
PixelDecode
(ColorBuffer target,
int32 targetX = 0,
int32 targetY = 0)
|
||
params
|
target
|
[not-null]
|
The color buffer that holds the decoded pixels. |
targetX
|
[0..target.Width-Width]
|
X-coordinate
of
top-left
target
pixel.
Defaults
to
0 .
|
|
targetY
|
[0..target.Height-Height]
|
Y-coordinate
of
top-left
target
pixel.
Defaults
to
0 .
|
|
inherited
|
TexelBuffer.PixelDecode
|
See also:
TexelBuffer.SrgbEncodes a block of pixels into this texel buffer.
public
abstract
method
|
PixelEncode
(ColorBuffer source,
int32 sourceX = 0,
int32 sourceY = 0)
|
||
params
|
source
|
[not-null]
|
The color buffer that holds the source pixels. |
sourceX
|
[0..source.Width-Width]
|
X-coordinate
of
top-left
source
pixel.
Defaults
to
0 .
|
|
sourceY
|
[0..source.Height-Height]
|
Y-coordinate
of
top-left
source
pixel.
Defaults
to
0 .
|
|
inherited
|
TexelBuffer.PixelEncode
|
See also:
TexelBuffer.SrgbEncodes the given pixels and fills all texels in all mipmap levels.
public
method
|
PixelEncodeMipmaps
(ColorBuffer pixels,
DownsampleFilter filter = DownsampleFilter.Average)
|
||
params
|
pixels
|
[not-null]
|
The pixel buffer. |
filter
|
The filter to use for downsampling. Defaults to Average. | ||
inherited
|
TexelBuffer.PixelEncodeMipmaps
|
See also:
TexelBuffer.SrgbWrites
the
texel
data
in
this
buffer
to
the
given
file,
using
the
TXB
file
format.
public
method
|
WriteTXB
(Path file)
|
||
params
|
file
|
[not-null]
|
The output file. |
inherited
|
TexelBuffer.WriteTXB
|
Writes
the
texel
data
in
this
buffer
to
the
given
data
stream,
using
the
TXB
file
format.
public
method
|
WriteTXB
([Owner]
IDataStream stream)
|
||
params
|
stream
|
[not-null]
|
The output data stream. |
inherited
|
TexelBuffer.WriteTXB
|
Writes
the
texel
data
in
this
buffer
to
the
given
binary
writer,
using
the
TXB
file
format.
public
method
|
WriteTXB
(IBinaryWriter writer)
|
||
params
|
writer
|
[not-null]
|
The output data stream. |
inherited
|
TexelBuffer.WriteTXB
|
Number of bits per texel.
protected
readonly
field
|
bitsPerTexel
|
||
type
|
int32
|
||
inherited
|
TexelBuffer.bitsPerTexel
|
The number of channels.
protected
readonly
field
|
channels
|
||
type
|
int32
|
The texture format.
protected
field
|
format
|
||
type
|
TextureFormat
|
||
inherited
|
TexelBuffer.format
|
The buffer height, in texels.
protected
readonly
field
|
height
|
||
type
|
int32
|
||
inherited
|
TexelBuffer.height
|
Bitmask for extracting channel bit from texel machine word.
protected
field
|
mask
|
||
type
|
int32[]
|
The number of mipmap levels (including this).
protected
readonly
field
|
mipmaps
|
||
type
|
int32
|
||
inherited
|
TexelBuffer.mipmaps
|
Number
of
left
shifts
from
1
to
least
significant
bit
of
channel.
protected
field
|
shift
|
||
type
|
int32[]
|
Does this texel buffer store compressed sRGB pixel channel values?
protected
field
|
srgb
|
||
type
|
bool
|
||
inherited
|
TexelBuffer.srgb
|
Distance between scanlines, in bytes.
protected
readonly
field
|
stride
|
||
type
|
int32
|
||
inherited
|
TexelBuffer.stride
|
Remarks:
This
value
is
computed
as
follows:
width*bitsPerTexel/
8
The texel buffer.
[Owner]
|
||||
protected
field
|
texels
|
|||
type
|
ByteBuffer
|
|||
inherited
|
TexelBuffer.texels
|
The buffer width, in texels.
protected
readonly
field
|
width
|
||
type
|
int32
|
||
inherited
|
TexelBuffer.width
|
Creates a new instance of TexelBufferBitPattern.
protected
constructor
|
TexelBufferBitPattern
(int32 width,
int32 height,
TextureFormat format,
[Owner]
TexelBuffer mipmap,
int32 channel0Bits,
int32 channel1Bits = 0,
int32 channel2Bits = 0,
int32 channel3Bits = 0)
|
||
params
|
width
|
[>0]
|
The buffer width, in texels. |
height
|
[>0]
|
The buffer height, in texels. | |
format
|
[not-null]
|
The texture format. | |
mipmap
|
Texel
buffer
of
next
mipmap
or
null . |
||
channel0Bits
|
[1..8]
|
Bit count of first channel (starting from least significant bit). | |
channel1Bits
|
[0..8]
|
Bit
count
of
second
channel
or
0
if
not
used.
Defaults
to
0 .
|
|
channel2Bits
|
[0..8]
|
Bit
count
of
third
channel
or
0
if
not
used.
Defaults
to
0 .
|
|
channel3Bits
|
[0..8]
|
Bit
count
of
fourth
channel
or
0
if
not
used.
Defaults
to
0 .
|
[OwnerReturn]
|
||||
protected
method
|
BufferCreateTemp
()
|
|||
type
|
ByteBuffer
|
|||
inherited
|
TexelBuffer.BufferCreateTemp
|
protected
abstract
method
|
BufferDecodeInternal
(ByteBuffer input,
int32 x,
int32 y,
int32 width,
int32 height,
ByteBuffer temp)
|
||
params
|
input
|
||
x
|
|||
y
|
|||
width
|
|||
height
|
|||
temp
|
|||
inherited
|
TexelBuffer.BufferDecodeInternal
|
protected
abstract
method
|
BufferEncodeInternal
(ByteBuffer output,
int32 x,
int32 y,
int32 width,
int32 height,
ByteBuffer temp)
|
||
type
|
int32
|
||
params
|
output
|
||
x
|
|||
y
|
|||
width
|
|||
height
|
|||
temp
|
|||
inherited
|
TexelBuffer.BufferEncodeInternal
|
Disposes the managed resources held by a concrete subclass. This method will be called at most once per subclass.
protected
override
method
|
DisposeManaged
()
|
||
overrides
|
TexelBuffer.DisposeManaged
|
Remarks:
This method will only be called when a disposable object is explicitly destroyed by user code calling the Dispose method. It will not be called when the object is collected as garbage by the system.
Overriding methods must call the DisposeManaged method of their base class. The base call should be the last statement.
The DisposeManaged method is called before the DisposeUnmanaged method.
Disposes the unmanaged resources held by a concrete subclass. This method will be called exactly once per subclass.
protected
virtual
method
|
DisposeUnmanaged
()
|
||
inherited
|
Disposable.DisposeUnmanaged
|
Remarks:
Overriding methods must call the DisposeUnmanaged method of their base class. The base call should be the last statement.
The DisposeUnmanaged method is called after the DisposeManaged method.