PngCodec struct
#include <Jazz2/Editor/Imaging/PngCodec.h>
Reads and writes PNG images for the editor.
Images of the editor come from anywhere, so they're read by nCine::
Public static variables
-
static std::
int64_t MaxPixels constexpr - Most pixels of an image the editor reads.
Public static functions
- static auto Decode(Stream& s, PngImage& image, String* error = nullptr) -> bool
- Reads an image, returns
falseand why, translated, if it isn't a PNG image it can read, the image is empty then. - static auto Load(StringView path, PngImage& image, String* error = nullptr) -> bool
- Reads an image from a file, returns
falseand why, translated, if it can't be read. - static auto LoadWithMasks(StringView path, PngImage& image, PngImage& masks, bool& hasMasks, String* error = nullptr) -> bool
- Reads an image from a file and the collision masks next to it,
<name>.mask.png, as the editor exports them. - static auto GetMasksPath(StringView path) -> String
- Returns the file of the collision masks of an image,
<name>.mask.pngnext to<name>.png. - static auto Encode(Stream& s, const PngImage& image) -> bool
- Writes an image, returns
falseif it couldn't, or any write to the stream failed. -
static auto GetErrorMessage(nCine::
PngError error) -> String - Returns what an error of nCine::
PngCodec means, translated.
Function documentation
static bool Jazz2:: Editor:: PngCodec:: LoadWithMasks(StringView path,
PngImage& image,
PngImage& masks,
bool& hasMasks,
String* error = nullptr)
Reads an image from a file and the collision masks next to it, <name>.mask.png, as the editor exports them.
Returns false and why only if the image itself can't be read. hasMasks tells whether the masks were there and could be read, they're optional.