diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-24 05:05:15 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-24 05:05:15 (GMT) |
commit | e80d847e3d9249d22bf70f257df7b2130487b211 (patch) | |
tree | b9a17f3f8b66da2c303907833ead5116f55300d4 /src/imageutils-lodepng.cc | |
parent | d847039c96641f564d805c57824bad422d68ec0d (diff) |
stubs to enable passing ostream to png-writing functions
Diffstat (limited to 'src/imageutils-lodepng.cc')
-rw-r--r-- | src/imageutils-lodepng.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/imageutils-lodepng.cc b/src/imageutils-lodepng.cc index c89ed7c..a74f107 100644 --- a/src/imageutils-lodepng.cc +++ b/src/imageutils-lodepng.cc @@ -2,6 +2,16 @@ #include <stdio.h> #include <stdlib.h> +bool write_png(std::ostream &output, unsigned char *pixels, int width, int height) +{ + size_t dataout_size = -1; + unsigned char *dataout = (unsigned char *)malloc(width*height*4); + LodePNG_encode(&dataout, &dataout_size, pixels, width, height, LCT_RGBA, 8); + output.write( dataout, dataout_size );; + free( dataout ); + return true; +} + bool write_png(const char *filename, unsigned char *pixels, int width, int height) { //encoder.settings.zlibsettings.windowSize = 2048; |