]> git.cworth.org Git - apitrace/blobdiff - common/image.hpp
image: Make PNG writing an Image method.
[apitrace] / common / image.hpp
index e930512f86473c89352a8990443cd9bbff40d622..7dd18c1225e821a0286ea11e0a73989be57acc51 100644 (file)
@@ -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 */