The Bitmap represents an image resource for 2D rendering via Graphics.
sealed class
|
Bitmap
|
extends
|
Disposable
|
||
implements
|
IResource
|
public
property
|
Height
{
get
}
|
||
type
|
int32
|
||
value
|
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. | |
implements
|
IMemoryConsumption.MemoryConsumption
|
Returns the image size.
public
property
|
Size
{
get
}
|
||
type
|
Vec2I
|
||
value
|
The image size (width, height). |
public
property
|
Texture
{
get
}
|
||
type
|
ITexture2D
|
||
value
|
public
property
|
Width
{
get
}
|
||
type
|
int32
|
||
value
|
Creates a new bitmap handle for the image file.
public
static
method
|
HandleFile
(Path path,
BitmapFlags flags = BitmapFlags.Default)
|
||
type
|
IResourceHandle
|
||
params
|
path
|
[not-null]
|
Path to image file. |
flags
|
The bitmap flags. Defaults to Default. | ||
returns
|
|
The bitmap handle. |
Creates a new bitmap handle for the given image descriptor.
public
static
method
|
HandleImage
(IImage image,
BitmapFlags flags = BitmapFlags.Default)
|
||
type
|
IResourceHandle
|
||
params
|
image
|
[not-null]
|
The image descriptor. |
flags
|
The bitmap flags. Defaults to Default. | ||
returns
|
|
The bitmap handle. |
Creates a new bitmap handle for the given image pixels.
public
static
method
|
HandlePixels
(ColorBuffer pixels,
BitmapFlags flags = BitmapFlags.Default)
|
||
type
|
IResourceHandle
|
||
params
|
pixels
|
[not-null]
|
The image pixels. |
flags
|
The bitmap flags. Defaults to Default. | ||
returns
|
|
The bitmap handle. |
Wraps the given ITexture2D object in a Bitmap.
[OwnerReturn]
|
||||
public
static
method
|
Wrap
(ITexture2D texture)
|
|||
type
|
Bitmap
|
|||
params
|
texture
|
[not-null]
|
The texture to wrap. | |
returns
|
|
The Bitmap. |
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.
Returns a subrectangle of this bitmap.
[OwnerReturn]
|
||||
public
method
|
Clip
(int32 x,
int32 y,
int32 width,
int32 height)
|
|||
type
|
Bitmap
|
|||
params
|
x
|
[0..Width-1]
|
Pixel X-coordinate of top-left corner of subrectangle. | |
y
|
[0..Height-1]
|
Pixel Y-coordinate of top-left corner of subrectangle. | ||
width
|
[1..Width-x]
|
Width of subrectangle. | ||
height
|
[1..Height-y]
|
Width of subrectangle. | ||
returns
|
|
The subrectangle bitmap. |
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.
Returns
the
U
and
V
texture
coordinates
of
given
bitmap
coordinates.
pixel.
[Pure]
|
||||
public
method
|
GetUV
(float32 x,
float32 y)
|
|||
type
|
Vec2F
|
|||
params
|
x
|
Bitmap X-coordinate. | ||
y
|
Bitmap Y-coordinate. | |||
returns
|
The texture coordinates. |
Remarks:
The
bitmap
coordinates
(0|0)
refer
to
the
top-left
corner
of
the
top-left
bitmap
pixel.
The
lower-right
corner
of
the
lower-right
pixel
is
at
(Width|Height)
.
Sets the pixels of this image.
public
method
|
SetPixels
(ColorBuffer buffer)
|
||
params
|
buffer
|
[not-null]
|
The pixel buffer. |