MCPcopy Create free account
hub / github.com/EasyRPG/Player / WritePNG

Method WritePNG

src/bitmap.cpp:175–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175bool Bitmap::WritePNG(std::ostream& os) const {
176 size_t const width = GetWidth(), height = GetHeight();
177 size_t const stride = width * 4;
178
179 std::vector<uint32_t> data(width * height);
180
181#ifdef WORDS_BIGENDIAN
182 auto format = PIXMAN_r8g8b8;
183#else
184 auto format = PIXMAN_b8g8r8;
185#endif
186
187 auto dst = PixmanImagePtr{pixman_image_create_bits(format, width, height, &data.front(), stride)};
188 pixman_image_composite32(PIXMAN_OP_SRC, bitmap.get(), NULL, dst.get(),
189 0, 0, 0, 0, 0, 0, width, height);
190
191 return ImagePNG::Write(os, width, height, &data.front());
192}
193
194size_t Bitmap::GetSize() const {
195 if (!bitmap) {

Callers 1

TakeScreenshotMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected