commit
b263b7993e
10 changed files with 16 additions and 89 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace mapnik {
|
||||||
// fwd declares
|
// fwd declares
|
||||||
class Map;
|
class Map;
|
||||||
class rgba_palette;
|
class rgba_palette;
|
||||||
class image_32;
|
|
||||||
|
|
||||||
class ImageWriterException : public std::exception
|
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&,
|
extern template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
|
|
|
@ -46,7 +46,6 @@ extern "C"
|
||||||
|
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
#include <mapnik/image_data.hpp>
|
#include <mapnik/image_data.hpp>
|
||||||
#include <mapnik/graphics.hpp>
|
|
||||||
#include <mapnik/memory.hpp>
|
#include <mapnik/memory.hpp>
|
||||||
#include <mapnik/image_view.hpp>
|
#include <mapnik/image_view.hpp>
|
||||||
#include <mapnik/palette.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&,
|
std::string const&,
|
||||||
rgba_palette const& palette);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue