A few updates to attempt to fix pixel getting and setting
This commit is contained in:
parent
826e13f911
commit
5a4f9321d0
3 changed files with 22 additions and 12 deletions
|
@ -197,7 +197,7 @@ mapnik::color get_pixel_color(mapnik::image_any const& im, unsigned x, unsigned
|
|||
{
|
||||
if (x < static_cast<unsigned>(im.width()) && y < static_cast<unsigned>(im.height()))
|
||||
{
|
||||
return mapnik::get_pixel<mapnik::image_any, mapnik::color>(im, x, y);
|
||||
return mapnik::get_pixel<mapnik::color>(im, x, y);
|
||||
}
|
||||
PyErr_SetString(PyExc_IndexError, "invalid x,y for image dimensions");
|
||||
boost::python::throw_error_already_set();
|
||||
|
|
|
@ -161,6 +161,9 @@ MAPNIK_DECL bool check_bounds (T const& data, std::size_t x, std::size_t y)
|
|||
template <typename T>
|
||||
MAPNIK_DECL void composite_pixel(T & data, unsigned op, int x, int y, unsigned c, unsigned cover, double opacity );
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_any & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_rgba8 & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
|
@ -173,8 +176,11 @@ MAPNIK_DECL void set_pixel(image_gray16 & data, std::size_t x, std::size_t y, T
|
|||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray32f & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T1, typename T2>
|
||||
MAPNIK_DECL void set_pixel(T1 & data, std::size_t x, std::size_t y, T2 const& val);
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_any const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_any const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_rgba8 const& data, std::size_t x, std::size_t y);
|
||||
|
@ -188,9 +194,6 @@ MAPNIK_DECL T get_pixel(image_gray16 const& data, std::size_t x, std::size_t y);
|
|||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray32f const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T1, typename T2>
|
||||
MAPNIK_DECL T2 get_pixel(T1 const& data, std::size_t x, std::size_t y);
|
||||
|
||||
MAPNIK_DECL void view_to_string (image_view_any const& view, std::ostringstream & ss);
|
||||
|
||||
MAPNIK_DECL image_view_any create_view (image_any const& data, unsigned x, unsigned y, unsigned w, unsigned h);
|
||||
|
|
|
@ -1218,10 +1218,10 @@ struct visitor_set_pixel<color>
|
|||
} // end detail ns
|
||||
|
||||
// For all the generic data types.
|
||||
template <typename T1, typename T2>
|
||||
MAPNIK_DECL void set_pixel (T1 & data, std::size_t x, std::size_t y, T2 const& val)
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel (image_any & data, std::size_t x, std::size_t y, T const& val)
|
||||
{
|
||||
util::apply_visitor(detail::visitor_set_pixel<T2>(x, y, val), data);
|
||||
util::apply_visitor(detail::visitor_set_pixel<T>(x, y, val), data);
|
||||
}
|
||||
|
||||
template MAPNIK_DECL void set_pixel(image_any &, std::size_t, std::size_t, color const&);
|
||||
|
@ -1355,10 +1355,10 @@ struct visitor_get_pixel<color>
|
|||
} // end detail ns
|
||||
|
||||
// For all the generic data types.
|
||||
template <typename T1, typename T2>
|
||||
MAPNIK_DECL T2 get_pixel (T1 const& data, std::size_t x, std::size_t y)
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel (image_any const& data, std::size_t x, std::size_t y)
|
||||
{
|
||||
return util::apply_visitor(detail::visitor_get_pixel<T2>(x, y), data);
|
||||
return util::apply_visitor(detail::visitor_get_pixel<T>(x, y), data);
|
||||
}
|
||||
|
||||
template MAPNIK_DECL color get_pixel(image_any const&, std::size_t, std::size_t);
|
||||
|
@ -1370,6 +1370,13 @@ template MAPNIK_DECL uint8_t get_pixel(image_any const&, std::size_t, std::size_
|
|||
template MAPNIK_DECL int8_t get_pixel(image_any const&, std::size_t, std::size_t);
|
||||
template MAPNIK_DECL float get_pixel(image_any const&, std::size_t, std::size_t);
|
||||
template MAPNIK_DECL double get_pixel(image_any const&, std::size_t, std::size_t);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel (image_view_any const& data, std::size_t x, std::size_t y)
|
||||
{
|
||||
return util::apply_visitor(detail::visitor_get_pixel<T>(x, y), data);
|
||||
}
|
||||
|
||||
template MAPNIK_DECL color get_pixel(image_view_any const&, std::size_t, std::size_t);
|
||||
template MAPNIK_DECL uint32_t get_pixel(image_view_any const&, std::size_t, std::size_t);
|
||||
template MAPNIK_DECL int32_t get_pixel(image_view_any const&, std::size_t, std::size_t);
|
||||
|
|
Loading…
Add table
Reference in a new issue