Base interface for two-dimensional texture resources for rendering.
interface
|
ITexture2D
|
extends
|
ITexture
|
||
base of
|
Texture2D
|
The number of bits per texture pixel.
property
|
BitsPerTexel
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of bits per pixel. | |
inherited
|
IBitsPerTexel.BitsPerTexel
|
Is this a texture data object, to be used to update the content of another texture object?
property
|
CanCopyTexels
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
a
texture
data
object.
false
if
this
is
a
regular
texture
object.
|
Remarks:
Texture data objects cannot be used for rendering.
See also:
CopyTexelsCan the content of this texture be updated?
property
|
CanSetTexels
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
texture
is
dynamic
and
its
content
can
be
updated.
false
if
this
texture
is
static
and
its
content
cannot
be
updated.
|
See also:
SetTexelsThe texture format.
property
|
Format
{
get
}
|
||
type
|
TextureFormat
|
||
value
|
|
The texture format. | |
inherited
|
ITexture.Format
|
Returns if texture pixels carry transparency data.
property
|
HasAlpha
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
texture
pixels
can
be
transparent,
false
if
all
texture
pixels
will
always
be
fully
opaque.
|
||
inherited
|
IBitsPerTexel.HasAlpha
|
The texture height, in texels.
property
|
Height
{
get
}
|
||
type
|
int32
|
||
value
|
The texture height, in texels. |
The sRGB behaviour of this texture.
property
|
IsSrgb
{
get
}
|
||
type
|
bool
|
||
value
|
The sRGB behaviour flag. | ||
inherited
|
ITexture.IsSrgb
|
Remarks:
When
true
,
the
GPU
is
supposed
to
do
on-the-fly
sRGB
decompression
for
the
texture
object
(e.g.
in
Direct3D
10+
by
using
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
),
so
that
the
GPU
shader
receives
linear
color
values.
Depending
on
the
underlying
graphics
API,
it
may
be
necessary
to
specify
this
sRGB
behaviour
in
the
shader
effect
source
code
(e.g.
in
a
Direct3D
9
'.fx'
file
via
SRGBTexture=true;
,
to
enable
the
D3DSAMP_SRGBTEXTURE
sampler
state).
Returns the lifecycle state of this object.
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
ILifecycleState.LifecycleState
|
Returns the estimated memory consumption of this object.
property
|
MemoryConsumption
{
get
}
|
||
type
|
int64
|
||
value
|
|
The estimated memory consumption, in bytes. | |
inherited
|
IMemoryConsumption.MemoryConsumption
|
The number of mipmap levels.
property
|
Mipmaps
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of mipmap levels. | |
inherited
|
ITexture.Mipmaps
|
Returns the raw handle value of the native resource that is contained in this object.
property
|
NativeHandle
{
get
}
|
||
type
|
IntPtr
|
||
value
|
The raw handle value. | ||
inherited
|
INativeHandle.NativeHandle
|
Remarks:
The documentation of the implementing class will contain information on how to interpret the raw handle value.
The texture width, in texels.
property
|
Width
{
get
}
|
||
type
|
int32
|
||
value
|
The texture width, in texels. |
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
IDisposable.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.
Copies a rectangular subset of texels from this texture data object to the given texture object.
method
|
CopyTexels
(ITexture2D target,
int32 sourceX = 0,
int32 sourceY = 0,
int32 targetX = 0,
int32 targetY = 0,
int32 width = 0,
int32 height = 0)
|
||
params
|
target
|
[not-null]
|
The target texture object. |
sourceX
|
[0..Width-width]
|
X-coordinate
of
top-left
corner
of
source
rectangle.
Defaults
to
0 .
|
|
sourceY
|
[0..Height-height]
|
Y-coordinate
of
top-left
corner
of
source
rectangle.
Defaults
to
0 .
|
|
targetX
|
[0..target.Width-width]
|
X-coordinate
of
top-left
corner
of
target
rectangle.
Defaults
to
0 .
|
|
targetY
|
[0..target.Height-height]
|
Y-coordinate
of
top-left
corner
of
target
rectangle.
Defaults
to
0 .
|
|
width
|
[>=0]
|
Width
of
rectangle,
in
texels.
If
0
the
maximum
valid
width
will
be
used.
Defaults
to
0 .
|
|
height
|
[>=0]
|
Height
of
rectangle,
in
texels.
If
0
the
maximum
valid
height
will
be
used.
Defaults
to
0 .
|
Remarks:
The
following
parameters
must
be
a
multiple
of
the
texture
format
block
size
(see
BlockSize),
to
make
sure
the
copy
operation
can
be
performed
on
whole
texel
blocks:
sourceX,
sourceY,
targetX,
targetY,
width,
height.
Exceptions:
false
)
or
is
a
texture
data
object
itself
(i.e.
CanCopyTexels
returns
true
).
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]
|
||||
method
|
Dispose
()
|
|||
inherited
|
IDisposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Copies a region of texels from the given buffer to this texture data object.
method
|
SetTexels
(TexelBuffer source,
int32 targetX = 0,
int32 targetY = 0)
|
||
params
|
source
|
[not-null]
|
The source buffer that holds the texel data. |
targetX
|
[0..Width-source.Width]
|
X-coordinate
of
top-left
target
texel.
Defaults
to
0 .
|
|
targetY
|
[0..Height-source.Height]
|
Y-coordinate
of
top-left
target
texel.
Defaults
to
0 .
|
Remarks:
If
CanCopyTexels
of
this
texture
object
returns
false
,
a
temporary
texture
data
object
is
created,
the
SetTexels
method
is
called
on
that
texture
object
and
finally
CopyTexels
is
used
to
update
this
texture
object.
Otherwise,
the
content
of
this
texture
data
object
is
updated
directly.
Exceptions:
false
.
Copies a region of pixels from the given buffer to this texture data object, encoding them as necessary.
method
|
SetTexels
(ColorBuffer source,
int32 targetX = 0,
int32 targetY = 0)
|
||
params
|
source
|
[not-null]
|
The source buffer that holds the texel data. |
targetX
|
[>=0]
|
X-coordinate
of
top-left
target
texel.
Defaults
to
0 .
|
|
targetY
|
[>=0]
|
Y-coordinate
of
top-left
target
texel.
Defaults
to
0 .
|
Remarks:
This method encodes the pixels and then sets the texel data.