NWengine 0.9
Loading...
Searching...
No Matches
Image Class Reference

Represents an image asset. More...

#include <Image.h>

Inheritance diagram for Image:
Asset

Public Member Functions

 Image ()=default
 Default constructor for Image.
 
 Image (const std::string &x, uint8 *buf, int ch, int w, int h, bool a)
 Constructor for Image.
 
AssetLoadFromFile (const char *path, void *output) override
 Loads an image from a file.
 
void Clean () override
 Cleans up the image asset.
 
- Public Member Functions inherited from Asset
virtual AssetGetFromCache (void *identifier)
 Get the asset from the cache based on the identifier.
 
virtual AssetLoadFromFileOrGetFromCache (void *identifier, const char *path, void *data)
 Load the asset from file or get it from the cache based on the identifier and file path.
 
virtual AssetLoadFromBuffer (void *buffer, void *data)
 Load the asset from a buffer.
 
virtual AssetLoadFromBufferOrGetFromCache (void *identifier, void *buffer, void *data)
 Load the asset from a buffer or get it from the cache based on the identifier.
 

Public Attributes

std::string path = ""
 
uint8 * pixelBuffer = nullptr
 
int channels = 0
 
int width = 0
 
int height = 0
 
bool alpha = 0
 
- Public Attributes inherited from Asset
int _usageCounter = 0
 

Detailed Description

Represents an image asset.

Constructor & Destructor Documentation

◆ Image()

Image::Image ( const std::string & x,
uint8 * buf,
int ch,
int w,
int h,
bool a )
inline

Constructor for Image.

Parameters
xThe file path of the image.
bufThe pixel buffer of the image.
chThe number of color channels in the image.
wThe width of the image.
hThe height of the image.
aIndicates whether the image has an alpha channel.

Member Function Documentation

◆ Clean()

void Image::Clean ( )
overridevirtual

Cleans up the image asset.

Reimplemented from Asset.

◆ LoadFromFile()

Asset * Image::LoadFromFile ( const char * path,
void * output )
overridevirtual

Loads an image from a file.

Parameters
pathThe file path of the image.
outputThe output buffer.
Returns
A pointer to the loaded image asset.

Reimplemented from Asset.

Member Data Documentation

◆ alpha

bool Image::alpha = 0

Indicates whether the image has an alpha channel.

◆ channels

int Image::channels = 0

The number of color channels in the image.

◆ height

int Image::height = 0

The height of the image.

◆ path

std::string Image::path = ""

The file path of the image.

◆ pixelBuffer

uint8* Image::pixelBuffer = nullptr

The pixel buffer of the image.

◆ width

int Image::width = 0

The width of the image.


The documentation for this class was generated from the following files: