always pass image_data to save_to_string/file

This commit is contained in:
Dane Springmeyer 2015-01-08 13:54:43 -08:00
parent 96cff81f57
commit fbecd5ff33
8 changed files with 16 additions and 16 deletions

View file

@ -54,7 +54,7 @@ void render(mapnik::geometry_type & geom,
ras.add_path(path); ras.add_path(path);
agg::scanline_u8 sl; agg::scanline_u8 sl;
agg::render_scanlines(ras, sl, ren); agg::render_scanlines(ras, sl, ren);
mapnik::save_to_file(im,name); mapnik::save_to_file(im.data(),name);
geom.rewind(0); geom.rewind(0);
} }

View file

@ -25,7 +25,7 @@ public:
mapnik::image_32 im(m.width(),m.height()); mapnik::image_32 im(m.width(),m.height());
mapnik::agg_renderer<mapnik::image_32> ren(m,im); mapnik::agg_renderer<mapnik::image_32> ren(m,im);
ren.apply(); ren.apply();
//mapnik::save_to_file(im,"test.png"); //mapnik::save_to_file(im.data(),"test.png");
return true; return true;
} }
bool operator()() const bool operator()() const

View file

@ -60,7 +60,7 @@ public:
ren.apply(); ren.apply();
if (!preview_.empty()) { if (!preview_.empty()) {
std::clog << "preview available at " << preview_ << "\n"; std::clog << "preview available at " << preview_ << "\n";
mapnik::save_to_file(im,preview_); mapnik::save_to_file(im.data(),preview_);
} }
return true; return true;
} }

View file

@ -101,7 +101,7 @@ public:
ren.end_map_processing(*m_); ren.end_map_processing(*m_);
if (!preview_.empty()) { if (!preview_.empty()) {
std::clog << "preview available at " << preview_ << "\n"; std::clog << "preview available at " << preview_ << "\n";
mapnik::save_to_file(im_,preview_); mapnik::save_to_file(im_.data(),preview_);
} }
return true; return true;
} }

View file

@ -99,17 +99,17 @@ PyObject* tostring3(image_32 const & im, std::string const& format, mapnik::rgba
void save_to_file1(mapnik::image_32 const& im, std::string const& filename) void save_to_file1(mapnik::image_32 const& im, std::string const& filename)
{ {
save_to_file(im,filename); save_to_file(im.data(),filename);
} }
void save_to_file2(mapnik::image_32 const& im, std::string const& filename, std::string const& type) void save_to_file2(mapnik::image_32 const& im, std::string const& filename, std::string const& type)
{ {
save_to_file(im,filename,type); save_to_file(im.data(),filename,type);
} }
void save_to_file3(mapnik::image_32 const& im, std::string const& filename, std::string const& type, mapnik::rgba_palette const& pal) void save_to_file3(mapnik::image_32 const& im, std::string const& filename, std::string const& type, mapnik::rgba_palette const& pal)
{ {
save_to_file(im,filename,type,pal); save_to_file(im.data(),filename,type,pal);
} }
bool painted(mapnik::image_32 const& im) bool painted(mapnik::image_32 const& im)

View file

@ -387,7 +387,7 @@ void render_to_file1(mapnik::Map const& map,
{ {
mapnik::image_32 image(map.width(),map.height()); mapnik::image_32 image(map.width(),map.height());
render(map,image,1.0,0,0); render(map,image,1.0,0,0);
mapnik::save_to_file(image,filename,format); mapnik::save_to_file(image.data(),filename,format);
} }
} }
@ -406,7 +406,7 @@ void render_to_file2(mapnik::Map const& map,std::string const& filename)
{ {
mapnik::image_32 image(map.width(),map.height()); mapnik::image_32 image(map.width(),map.height());
render(map,image,1.0,0,0); render(map,image,1.0,0,0);
mapnik::save_to_file(image,filename); mapnik::save_to_file(image.data(),filename);
} }
} }
@ -444,7 +444,7 @@ void render_to_file3(mapnik::Map const& map,
{ {
mapnik::image_32 image(map.width(),map.height()); mapnik::image_32 image(map.width(),map.height());
render(map,image,scale_factor,0,0); render(map,image,scale_factor,0,0);
mapnik::save_to_file(image,filename,format); mapnik::save_to_file(image.data(),filename,format);
} }
} }

View file

@ -310,21 +310,21 @@ int main ( int, char** )
ren.apply(); ren.apply();
std::string msg("These maps have been rendered using AGG in the current directory:\n"); std::string msg("These maps have been rendered using AGG in the current directory:\n");
#ifdef HAVE_JPEG #ifdef HAVE_JPEG
save_to_file(buf,"demo.jpg","jpeg"); save_to_file(buf.data(),"demo.jpg","jpeg");
msg += "- demo.jpg\n"; msg += "- demo.jpg\n";
#endif #endif
#ifdef HAVE_PNG #ifdef HAVE_PNG
save_to_file(buf,"demo.png","png"); save_to_file(buf.data(),"demo.png","png");
save_to_file(buf,"demo256.png","png8"); save_to_file(buf.data(),"demo256.png","png8");
msg += "- demo.png\n"; msg += "- demo.png\n";
msg += "- demo256.png\n"; msg += "- demo256.png\n";
#endif #endif
#ifdef HAVE_TIFF #ifdef HAVE_TIFF
save_to_file(buf,"demo.tif","tiff"); save_to_file(buf.data(),"demo.tif","tiff");
msg += "- demo.tif\n"; msg += "- demo.tif\n";
#endif #endif
#ifdef HAVE_WEBP #ifdef HAVE_WEBP
save_to_file(buf,"demo.webp","webp"); save_to_file(buf.data(),"demo.webp","webp");
msg += "- demo.webp\n"; msg += "- demo.webp\n";
#endif #endif
msg += "Have a look!\n"; msg += "Have a look!\n";

View file

@ -140,7 +140,7 @@ int main (int argc,char** argv)
} }
mapnik::agg_renderer<mapnik::image_32> ren(map,req,vars,im,scale_factor,0,0); mapnik::agg_renderer<mapnik::image_32> ren(map,req,vars,im,scale_factor,0,0);
ren.apply(); ren.apply();
mapnik::save_to_file(im,img_file); mapnik::save_to_file(im.data(),img_file);
if (auto_open) if (auto_open)
{ {
std::ostringstream s; std::ostringstream s;