mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add canvas:encode method
This commit is contained in:
parent
dda823ac24
commit
d714e6943a
5 changed files with 108 additions and 0 deletions
|
|
@ -53,3 +53,14 @@ void imageio::write(const io::path& file, const ImageData* image) {
|
|||
}
|
||||
return found->second(io::resolve(file).u8string(), image);
|
||||
}
|
||||
|
||||
util::Buffer<unsigned char> imageio::encode(
|
||||
ImageFileFormat format, const ImageData& image
|
||||
) {
|
||||
switch (format) {
|
||||
case ImageFileFormat::PNG:
|
||||
return png::encode_image(image);
|
||||
default:
|
||||
throw std::runtime_error("file format is not supported for encoding");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue