]> git.cworth.org Git - apitrace/blobdiff - image/image_raw.cpp
image: Move helpers to respective modules.
[apitrace] / image / image_raw.cpp
index dd45d104768a80ec8c722ec8169c133dc0854a70..93946be947659d44d8e5c7146ab5a2c63aad9ddc 100644 (file)
 #include <stdint.h>
 #include <stdio.h>
 
+#include <fstream>
+
 #include "image.hpp"
 
 
 namespace image {
 
+
 void
-Image::writeRAW(std::ostream &os) const {
+Image::writeRAW(std::ostream &os) const
+{
     const unsigned char *row;
 
     for (row = start(); row != end(); row += stride()) {
@@ -44,4 +48,17 @@ Image::writeRAW(std::ostream &os) const {
     }
 }
 
+
+bool
+Image::writeRAW(const char *filename) const
+{
+    std::ofstream os(filename, std::ofstream::binary);
+    if (!os) {
+        return false;
+    }
+    writeRAW(os);
+    return true;
+}
+
+
 } /* namespace image */