summaryrefslogtreecommitdiff
path: root/image.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'image.hpp')
-rw-r--r--image.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/image.hpp b/image.hpp
index e02abed0..44fc4f43 100644
--- a/image.hpp
+++ b/image.hpp
@@ -65,15 +65,35 @@ public:
return flipped ? pixels + (height - 1)*width*channels : pixels;
}
+ inline const unsigned char *start(void) const {
+ return flipped ? pixels + (height - 1)*width*channels : pixels;
+ }
+
inline unsigned char *end(void) {
return flipped ? pixels - width*channels : pixels + height*width*channels;
}
+ inline const unsigned char *end(void) const {
+ return flipped ? pixels - width*channels : pixels + height*width*channels;
+ }
+
inline signed stride(void) const {
return flipped ? -width*channels : width*channels;
}
bool writeBMP(const char *filename) const;
+
+ void writePNM(std::ostream &os) const;
+
+ inline bool writePNM(const char *filename) const {
+ std::ofstream os(filename, std::ofstream::binary);
+ if (!os) {
+ return false;
+ }
+ writePNM(os);
+ return true;
+ }
+
bool writePNG(const char *filename) const;
double compare(Image &ref);