X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fimage.hpp;h=7dd18c1225e821a0286ea11e0a73989be57acc51;hb=bd6b0c166872c38289375b7acb807ee790e87096;hp=e930512f86473c89352a8990443cd9bbff40d622;hpb=5871eadbe7651f4cf26dd757f7a94997d8d3ab2f;p=apitrace diff --git a/common/image.hpp b/common/image.hpp index e930512..7dd18c1 100644 --- a/common/image.hpp +++ b/common/image.hpp @@ -94,16 +94,21 @@ public: return true; } - bool writePNG(const char *filename) const; + bool + writePNG(std::ostream &os) const; + + inline bool + writePNG(const char *filename) const { + std::ofstream os(filename, std::ofstream::binary); + if (!os) { + return false; + } + return writePNG(os); + } double compare(Image &ref); }; -bool writePixelsToBuffer(unsigned char *pixels, - unsigned w, unsigned h, unsigned numChannels, - bool flipped, - char **buffer, - int *size); Image * readPNG(const char *filename); @@ -111,6 +116,7 @@ readPNG(const char *filename); const char * readPNMHeader(const char *buffer, size_t size, unsigned *channels, unsigned *width, unsigned *height); + } /* namespace image */