implement export/import ppbr

This commit is contained in:
2019-09-03 11:56:34 +02:00
parent 568f20e5c9
commit 0353d323a4
11 changed files with 390 additions and 135 deletions

View File

@@ -197,9 +197,9 @@ Image Image::resize_squared(const glm::u8vec4& bg) const
bool Image::read(BinaryStreamReader& r)
{
Serializer::Descriptor d;
r >> d;
if (d.class_id != "image_png")
return false;
r >> d;
d.value<Serializer::Integer>("width", width);
d.value<Serializer::Integer>("height", height);
d.value<Serializer::Integer>("comp", comp);
@@ -230,7 +230,7 @@ void Image::write(BinaryStreamWriter& w) const
stbi_write_png_to_func([](void* context, void* data, int size) {
Serializer::Descriptor& d = *static_cast<Serializer::Descriptor*>(context);
d.props["data"] = std::make_shared<Serializer::RawData>(std::vector<uint8_t>((uint8_t*)data, (uint8_t*)data + size));
}, &d, width, height, comp, m_data.get(), 0);
}, &d, width, height, comp, m_data.get(), 0);
w << d;
}