windows needs binary-mode set for exporting png

felipesanches-svg
don bright 2013-01-26 22:43:06 +01:00
parent d4c15a8fc4
commit fc72c86185
7 changed files with 7 additions and 8 deletions

View File

@ -5,7 +5,6 @@
// Objective-C with C++, it is a bit different than what's found in a textbook.
#include <iostream>
#include <fstream>
#include <string>
#include "fbo.h"

View File

@ -1,5 +1,5 @@
// Functions shared by OffscreenContext[platform].cc (or .mm)
// #include directly after definition of struct OffscreenContext.
// Functions shared by OffscreenContext[platform].cc
// #include this directly after definition of struct OffscreenContext.
void bind_offscreen_context(OffscreenContext *ctx)
{
@ -11,7 +11,7 @@ void bind_offscreen_context(OffscreenContext *ctx)
*/
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
{
std::ofstream fstream(filename);
std::ofstream fstream(filename,std::ios::out|std::ios::binary);
if (!fstream.is_open()) {
std::cerr << "Can't open file " << filename << " for writing";
return false;

View File

@ -113,7 +113,7 @@ bool teardown_offscreen_context(OffscreenContext *ctx)
*/
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
{
std::ofstream fstream(filename);
std::ofstream fstream(filename,std::ios::out|std::ios::binary);
if (!fstream.is_open()) {
PRINTB("Can't open file \"%s\" for writing", filename);
return false;

View File

@ -45,7 +45,6 @@ See Also
#include <GL/glx.h>
#include <assert.h>
#include <fstream>
#include <sstream>
#include <sys/utsname.h> // for uname

View File

@ -1,6 +1,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <CGDataConsumer.h>
#include "imageutils.h"
#include <assert.h>
CGDataConsumerCallbacks dc_callbacks;

View File

@ -11,7 +11,7 @@ void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize,
}
bool write_png(const char *filename, unsigned char *pixels, int width, int height) {
std::ofstream fstream( filename );
std::ofstream fstream( filename, std::ios::binary );
if (fstream.is_open()) {
write_png( fstream, pixels, width, height );
fstream.close();

View File

@ -386,7 +386,7 @@ int main(int argc, char **argv)
}
if (png_output_file) {
std::ofstream fstream(png_output_file);
std::ofstream fstream(png_output_file,std::ios::out|std::ios::binary);
if (!fstream.is_open()) {
PRINTB("Can't open file \"%s\" for export", png_output_file);
}