added save_to_file method that works with Image object.
This commit is contained in:
parent
8010d5433f
commit
ab149257ad
3 changed files with 20 additions and 12 deletions
|
@ -25,9 +25,11 @@
|
|||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <mapnik/graphics.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
|
||||
using mapnik::Image32;
|
||||
using namespace boost::python;
|
||||
using mapnik::save_to_file;
|
||||
|
||||
PyObject* rawdata( Image32 const& im)
|
||||
{
|
||||
|
@ -35,6 +37,7 @@ PyObject* rawdata( Image32 const& im)
|
|||
return ::PyString_FromStringAndSize((const char*)im.raw_data(),size);
|
||||
}
|
||||
|
||||
void (*save_to_file2)(std::string const&,std::string const&, mapnik::Image32 const&) = mapnik::save_to_file;
|
||||
void export_image()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -46,5 +49,6 @@ void export_image()
|
|||
(&Image32::getBackground,return_value_policy<copy_const_reference>()),
|
||||
&Image32::setBackground, "The background color of the image.")
|
||||
;
|
||||
def("rawdata",&rawdata);
|
||||
def("rawdata",&rawdata); // FIXME : I dont think we need this one
|
||||
def("save_to_file", save_to_file2);
|
||||
}
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
|
||||
//#include <boost/python/module.hpp>
|
||||
//#include <boost/python/def.hpp>
|
||||
//#include <mapnik/graphics.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
|
||||
|
|
|
@ -218,10 +218,18 @@ namespace mapnik {
|
|||
}
|
||||
}
|
||||
|
||||
inline MAPNIK_DECL void save_to_file (std::string const& file,
|
||||
std::string const& type,
|
||||
Image32 const& image)
|
||||
{
|
||||
save_to_file<ImageData32>(file,type,image.data());
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
template MAPNIK_DECL void save_to_file<ImageData32>(std::string const&,
|
||||
std::string const& ,
|
||||
ImageData32 const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_view<ImageData32> > (std::string const&,
|
||||
std::string const& ,
|
||||
image_view<ImageData32> const&);
|
||||
|
|
Loading…
Reference in a new issue