#include <PngFile.h>
Classes | |
struct | LoadSettings |
struct | SaveSettings |
Public Types | |
enum class | Format { Unknown , RGB , RGBA } |
using | ErrorHandler = AZStd::function<void(const char*)> |
Public Member Functions | |
bool | Save (const char *path, SaveSettings saveSettings={}) |
bool | IsValid () const |
operator bool () const | |
uint32_t | GetWidth () const |
uint32_t | GetHeight () const |
Format | GetBufferFormat () const |
const AZStd::vector< uint8_t > & | GetBuffer () const |
AZStd::vector< uint8_t > && | TakeBuffer () |
Returns a r-value reference that can be moved. This will invalidate the PngFile. | |
Static Public Member Functions | |
static PngFile | Load (const char *path, LoadSettings loadSettings={}) |
static PngFile | LoadFromBuffer (AZStd::span< const uint8_t > data, LoadSettings loadSettings={}) |
static PngFile | Create (const RHI::Size &size, RHI::Format format, AZStd::span< const uint8_t > data, ErrorHandler errorHandler={}) |
static PngFile | Create (const RHI::Size &size, RHI::Format format, AZStd::vector< uint8_t > &&data, ErrorHandler errorHandler={}) |
This is a light wrapper class for libpng, to load and save .png files. Functionality is limited, feel free to add more features as needed.
|
static |
Create a PngFile from an RHI data buffer.
size | the dimensions of the image (m_depth is not used, assumed to be 1) |
format | indicates the pixel format represented by @data. Only a limited set of formats are supported, see implementation. |
data | the buffer of image data. The size of the buffer must match the @size and @format parameters. |
errorHandler | optional callback function describing any errors that are encountered |
|
static |
|
static |
bool AZ::Utils::PngFile::Save | ( | const char * | path, |
SaveSettings | saveSettings = {} ) |