Jazz2::Editor::PngCodec struct

Reads and writes PNG images for the editor.

Images of the editor come from anywhere, so they're read by nCine::PngCodec with the checksums of the chunks checked, and why one can't be read is told in the language of the interface. An image of more than 8192 × 8192 pixels (4096 × 4096 with 32-bit addresses) is refused, that holds the largest tile set.

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 false and 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 false and 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.png next to <name>.png.
static auto Encode(Stream& s, const PngImage& image) -> bool
Writes an image, returns false if 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.