Skip to content

Image

Represents decoded image data loaded from an asset.

An image holds raw pixel data along with its dimensions. Images are typically created through Image::Create and shared between one or more Texture2D instances via stdshared_ptr.

Construction

Constructors


Image()

Constructs an image from initialization parameters.

Prefer Image::Create over direct construction to obtain a stdshared_ptr<Image> that can be shared between textures.

cpp
Image::Image(Parameters params);
ParameterDescription
paramsInitialization parameters for constructing the image.

Factories preferred


Image::Create() std::shared_ptr<Image>

Creates a shared instance of Image.

cpp
static std::shared_ptr<Image> Image::Create(Parameters params);
ParameterDescription
paramsInitialization parameters for constructing the image.

Types

Image::Parameters struct

Parameters for constructing an Image object.

ParameterDescription
data std::vector<uint8_t>Raw pixel bytes.
width unsignedImage width in pixels.
height unsignedImage height in pixels.

Properties

data std::vector<uint8_t>

Raw pixel data.

cpp
std::vector<uint8_t> data {};

height unsigned

Image height in pixels.

cpp
unsigned height {};

width unsigned

Image width in pixels.

cpp
unsigned width {};

Released under the MIT License.