Merge pull request #2629 from mapnik/less_image_32

Less image_32
This commit is contained in:
Dane Springmeyer 2015-01-08 14:49:45 -08:00
commit b263b7993e
10 changed files with 16 additions and 89 deletions

View file

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

View file

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

View file

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

View file

@ -101,7 +101,7 @@ public:
ren.end_map_processing(*m_);
if (!preview_.empty()) {
std::clog << "preview available at " << preview_ << "\n";
mapnik::save_to_file(im_,preview_);
mapnik::save_to_file(im_.data(),preview_);
}
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)
{
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)
{
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)
{
save_to_file(im,filename,type,pal);
save_to_file(im.data(),filename,type,pal);
}
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());
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());
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());
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();
std::string msg("These maps have been rendered using AGG in the current directory:\n");
#ifdef HAVE_JPEG
save_to_file(buf,"demo.jpg","jpeg");
save_to_file(buf.data(),"demo.jpg","jpeg");
msg += "- demo.jpg\n";
#endif
#ifdef HAVE_PNG
save_to_file(buf,"demo.png","png");
save_to_file(buf,"demo256.png","png8");
save_to_file(buf.data(),"demo.png","png");
save_to_file(buf.data(),"demo256.png","png8");
msg += "- demo.png\n";
msg += "- demo256.png\n";
#endif
#ifdef HAVE_TIFF
save_to_file(buf,"demo.tif","tiff");
save_to_file(buf.data(),"demo.tif","tiff");
msg += "- demo.tif\n";
#endif
#ifdef HAVE_WEBP
save_to_file(buf,"demo.webp","webp");
save_to_file(buf.data(),"demo.webp","webp");
msg += "- demo.webp\n";
#endif
msg += "Have a look!\n";

View file

@ -45,7 +45,6 @@ namespace mapnik {
// fwd declares
class Map;
class rgba_palette;
class image_32;
class ImageWriterException : public std::exception
{
@ -211,44 +210,6 @@ void add_border(T & image)
}
/////////// save_to_file //////////////////////////////////////////////////
MAPNIK_DECL void save_to_file(image_32 const& image,
std::string const& file);
MAPNIK_DECL void save_to_file (image_32 const& image,
std::string const& file,
std::string const& type);
MAPNIK_DECL void save_to_file (image_32 const& image,
std::string const& file,
std::string const& type,
rgba_palette const& palette);
///////////////////////////////////////////////////////////////////////////
MAPNIK_DECL std::string save_to_string(image_32 const& image,
std::string const& type);
MAPNIK_DECL std::string save_to_string(image_32 const& image,
std::string const& type,
rgba_palette const& palette);
///////////////////////////////////////////////////////////////////////////
MAPNIK_DECL void save_to_stream(image_32 const& image,
std::ostream & stream,
std::string const& type,
rgba_palette const& palette);
MAPNIK_DECL void save_to_stream(image_32 const& image,
std::ostream & stream,
std::string const& type);
///////////////////////////////////////////////////////////////////////////
extern template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
std::string const&,
std::string const&,

View file

@ -46,7 +46,6 @@ extern "C"
#include <mapnik/image_util.hpp>
#include <mapnik/image_data.hpp>
#include <mapnik/graphics.hpp>
#include <mapnik/memory.hpp>
#include <mapnik/image_view.hpp>
#include <mapnik/palette.hpp>
@ -938,37 +937,4 @@ template std::string save_to_string<image_view<image_data_rgba8> > (image_view<i
std::string const&,
rgba_palette const& palette);
void save_to_file(image_32 const& image,std::string const& file)
{
save_to_file<image_data_rgba8>(image.data(), file);
}
void save_to_file (image_32 const& image,
std::string const& file,
std::string const& type)
{
save_to_file<image_data_rgba8>(image.data(), file, type);
}
void save_to_file (image_32 const& image,
std::string const& file,
std::string const& type,
rgba_palette const& palette)
{
save_to_file<image_data_rgba8>(image.data(), file, type, palette);
}
std::string save_to_string(image_32 const& image,
std::string const& type)
{
return save_to_string<image_data_rgba8>(image.data(), type);
}
std::string save_to_string(image_32 const& image,
std::string const& type,
rgba_palette const& palette)
{
return save_to_string<image_data_rgba8>(image.data(), type, palette);
}
}

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);
ren.apply();
mapnik::save_to_file(im,img_file);
mapnik::save_to_file(im.data(),img_file);
if (auto_open)
{
std::ostringstream s;