Added image_view implementation
This commit is contained in:
parent
bf61a033d3
commit
29099ece46
11 changed files with 432 additions and 329 deletions
|
@ -24,60 +24,28 @@
|
|||
#define MAPNIK_IMAGE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/pixel_types.hpp>
|
||||
|
||||
// stl
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct buffer
|
||||
struct MAPNIK_DECL buffer
|
||||
{
|
||||
explicit buffer(std::size_t size)
|
||||
: size_(size),
|
||||
data_(static_cast<unsigned char*>(size_ != 0 ? ::operator new(size_) : nullptr))
|
||||
{}
|
||||
explicit buffer(std::size_t size);
|
||||
buffer(buffer && rhs) noexcept;
|
||||
buffer(buffer const& rhs);
|
||||
~buffer();
|
||||
|
||||
buffer(buffer && rhs) noexcept
|
||||
: size_(std::move(rhs.size_)),
|
||||
data_(std::move(rhs.data_))
|
||||
{
|
||||
rhs.size_ = 0;
|
||||
rhs.data_ = nullptr;
|
||||
}
|
||||
buffer& operator=(buffer rhs);
|
||||
bool operator!() const;
|
||||
|
||||
buffer(buffer const& rhs)
|
||||
: size_(rhs.size_),
|
||||
data_(static_cast<unsigned char*>(size_ != 0 ? ::operator new(size_) : nullptr))
|
||||
{
|
||||
if (data_) std::copy(rhs.data_, rhs.data_ + rhs.size_, data_);
|
||||
}
|
||||
|
||||
buffer& operator=(buffer rhs)
|
||||
{
|
||||
swap(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(buffer & rhs)
|
||||
{
|
||||
std::swap(size_, rhs.size_);
|
||||
std::swap(data_, rhs.data_);
|
||||
}
|
||||
|
||||
inline bool operator!() const { return (data_ == nullptr)? false : true; }
|
||||
~buffer()
|
||||
{
|
||||
::operator delete(data_);
|
||||
}
|
||||
|
||||
inline unsigned char* data() { return data_; }
|
||||
inline unsigned char const* data() const { return data_; }
|
||||
inline std::size_t size() const { return size_; }
|
||||
void swap(buffer & rhs);
|
||||
unsigned char* data();
|
||||
unsigned char const* data() const;
|
||||
std::size_t size() const;
|
||||
private:
|
||||
std::size_t size_;
|
||||
unsigned char* data_;
|
||||
|
||||
|
@ -86,37 +54,20 @@ struct buffer
|
|||
template <std::size_t max_size>
|
||||
struct image_dimensions
|
||||
{
|
||||
image_dimensions(int width, int height)
|
||||
: width_(width),
|
||||
height_(height)
|
||||
{
|
||||
if (width < 0 || static_cast<std::size_t>(width) > max_size) throw std::runtime_error("Invalid width for image dimensions requested");
|
||||
if (height < 0 || static_cast<std::size_t>(height) > max_size) throw std::runtime_error("Invalid height for image dimensions requested");
|
||||
}
|
||||
|
||||
image_dimensions(int width, int height);
|
||||
image_dimensions(image_dimensions const& other) = default;
|
||||
image_dimensions(image_dimensions && other) = default;
|
||||
image_dimensions& operator= (image_dimensions rhs)
|
||||
{
|
||||
std::swap(width_, rhs.width_);
|
||||
std::swap(height_, rhs.height_);
|
||||
return *this;
|
||||
}
|
||||
std::size_t width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
std::size_t height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
image_dimensions& operator= (image_dimensions rhs);
|
||||
std::size_t width() const;
|
||||
std::size_t height() const;
|
||||
private:
|
||||
std::size_t width_;
|
||||
std::size_t height_;
|
||||
};
|
||||
|
||||
} // end ns detail
|
||||
|
||||
template <typename T, std::size_t max_size = 65535>
|
||||
template <typename T>
|
||||
class image
|
||||
{
|
||||
public:
|
||||
|
@ -125,7 +76,7 @@ public:
|
|||
static const image_dtype dtype = T::id;
|
||||
static constexpr std::size_t pixel_size = sizeof(pixel_type);
|
||||
private:
|
||||
detail::image_dimensions<max_size> dimensions_;
|
||||
detail::image_dimensions<65535> dimensions_;
|
||||
detail::buffer buffer_;
|
||||
pixel_type *pData_;
|
||||
double offset_;
|
||||
|
|
|
@ -42,7 +42,7 @@ using image_base = util::variant<image_null,
|
|||
image_gray64f>;
|
||||
|
||||
|
||||
struct image_any : image_base
|
||||
struct MAPNIK_DECL image_any : image_base
|
||||
{
|
||||
image_any() = default;
|
||||
|
||||
|
@ -54,7 +54,8 @@ struct image_any : image_base
|
|||
bool painted = false);
|
||||
|
||||
template <typename T>
|
||||
image_any(T && data) noexcept;
|
||||
image_any(T && data) noexcept
|
||||
: image_base(std::move(data)) {}
|
||||
|
||||
unsigned char const* getBytes() const;
|
||||
unsigned char* getBytes();
|
||||
|
|
|
@ -34,8 +34,43 @@
|
|||
|
||||
namespace mapnik {
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
image<T,max_size>::image()
|
||||
namespace detail {
|
||||
|
||||
// IMAGE_DIMENSIONS
|
||||
template <std::size_t max_size>
|
||||
image_dimensions<max_size>::image_dimensions(int width, int height)
|
||||
: width_(width),
|
||||
height_(height)
|
||||
{
|
||||
if (width < 0 || static_cast<std::size_t>(width) > max_size) throw std::runtime_error("Invalid width for image dimensions requested");
|
||||
if (height < 0 || static_cast<std::size_t>(height) > max_size) throw std::runtime_error("Invalid height for image dimensions requested");
|
||||
}
|
||||
|
||||
template <std::size_t max_size>
|
||||
image_dimensions<max_size>& image_dimensions<max_size>::operator= (image_dimensions rhs)
|
||||
{
|
||||
std::swap(width_, rhs.width_);
|
||||
std::swap(height_, rhs.height_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <std::size_t max_size>
|
||||
std::size_t image_dimensions<max_size>::width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
template <std::size_t max_size>
|
||||
std::size_t image_dimensions<max_size>::height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
} // end detail ns
|
||||
|
||||
// IMAGE
|
||||
template <typename T>
|
||||
image<T>::image()
|
||||
: dimensions_(0,0),
|
||||
buffer_(0),
|
||||
pData_(nullptr),
|
||||
|
@ -45,8 +80,8 @@ image<T,max_size>::image()
|
|||
painted_(false)
|
||||
{}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
image<T,max_size>::image(int width, int height, bool initialize, bool premultiplied, bool painted)
|
||||
template <typename T>
|
||||
image<T>::image(int width, int height, bool initialize, bool premultiplied, bool painted)
|
||||
: dimensions_(width, height),
|
||||
buffer_(dimensions_.width() * dimensions_.height() * pixel_size),
|
||||
pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
|
||||
|
@ -61,8 +96,8 @@ image<T,max_size>::image(int width, int height, bool initialize, bool premultipl
|
|||
}
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
image<T,max_size>::image(image<T> const& rhs)
|
||||
template <typename T>
|
||||
image<T>::image(image<T> const& rhs)
|
||||
: dimensions_(rhs.dimensions_),
|
||||
buffer_(rhs.buffer_),
|
||||
pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
|
||||
|
@ -72,8 +107,8 @@ image<T,max_size>::image(image<T> const& rhs)
|
|||
painted_(rhs.painted_)
|
||||
{}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
image<T,max_size>::image(image<T> && rhs) noexcept
|
||||
template <typename T>
|
||||
image<T>::image(image<T> && rhs) noexcept
|
||||
: dimensions_(std::move(rhs.dimensions_)),
|
||||
buffer_(std::move(rhs.buffer_)),
|
||||
pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
|
||||
|
@ -86,15 +121,15 @@ image<T,max_size>::image(image<T> && rhs) noexcept
|
|||
rhs.pData_ = nullptr;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
image<T>& image<T,max_size>::operator=(image<T> rhs)
|
||||
template <typename T>
|
||||
image<T>& image<T>::operator=(image<T> rhs)
|
||||
{
|
||||
swap(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
void image<T,max_size>::swap(image<T> & rhs)
|
||||
template <typename T>
|
||||
void image<T>::swap(image<T> & rhs)
|
||||
{
|
||||
std::swap(dimensions_, rhs.dimensions_);
|
||||
std::swap(buffer_, rhs.buffer_);
|
||||
|
@ -104,134 +139,134 @@ void image<T,max_size>::swap(image<T> & rhs)
|
|||
std::swap(painted_, rhs.painted_);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline typename image<T,max_size>::pixel_type& image<T,max_size>::operator() (std::size_t i, std::size_t j)
|
||||
template <typename T>
|
||||
inline typename image<T>::pixel_type& image<T>::operator() (std::size_t i, std::size_t j)
|
||||
{
|
||||
assert(i < dimensions_.width() && j < dimensions_.height());
|
||||
return pData_[j * dimensions_.width() + i];
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline const typename image<T,max_size>::pixel_type& image<T,max_size>::operator() (std::size_t i, std::size_t j) const
|
||||
template <typename T>
|
||||
inline const typename image<T>::pixel_type& image<T>::operator() (std::size_t i, std::size_t j) const
|
||||
{
|
||||
assert(i < dimensions_.width() && j < dimensions_.height());
|
||||
return pData_[j * dimensions_.width() + i];
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline std::size_t image<T,max_size>::width() const
|
||||
template <typename T>
|
||||
inline std::size_t image<T>::width() const
|
||||
{
|
||||
return dimensions_.width();
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline std::size_t image<T,max_size>::height() const
|
||||
template <typename T>
|
||||
inline std::size_t image<T>::height() const
|
||||
{
|
||||
return dimensions_.height();
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline unsigned image<T,max_size>::getSize() const
|
||||
template <typename T>
|
||||
inline unsigned image<T>::getSize() const
|
||||
{
|
||||
return dimensions_.height() * dimensions_.width() * pixel_size;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline unsigned image<T,max_size>::getRowSize() const
|
||||
template <typename T>
|
||||
inline unsigned image<T>::getRowSize() const
|
||||
{
|
||||
return dimensions_.width() * pixel_size;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::set(pixel_type const& t)
|
||||
template <typename T>
|
||||
inline void image<T>::set(pixel_type const& t)
|
||||
{
|
||||
std::fill(pData_, pData_ + dimensions_.width() * dimensions_.height(), t);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline const typename image<T,max_size>::pixel_type* image<T,max_size>::getData() const
|
||||
template <typename T>
|
||||
inline const typename image<T>::pixel_type* image<T>::getData() const
|
||||
{
|
||||
return pData_;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline typename image<T,max_size>::pixel_type* image<T,max_size>::getData()
|
||||
template <typename T>
|
||||
inline typename image<T>::pixel_type* image<T>::getData()
|
||||
{
|
||||
return pData_;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline const unsigned char* image<T,max_size>::getBytes() const
|
||||
template <typename T>
|
||||
inline const unsigned char* image<T>::getBytes() const
|
||||
{
|
||||
return buffer_.data();
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline unsigned char* image<T,max_size>::getBytes()
|
||||
template <typename T>
|
||||
inline unsigned char* image<T>::getBytes()
|
||||
{
|
||||
return buffer_.data();
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline const typename image<T,max_size>::pixel_type* image<T,max_size>::getRow(std::size_t row) const
|
||||
template <typename T>
|
||||
inline const typename image<T>::pixel_type* image<T>::getRow(std::size_t row) const
|
||||
{
|
||||
return pData_ + row * dimensions_.width();
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline const typename image<T,max_size>::pixel_type* image<T,max_size>::getRow(std::size_t row, std::size_t x0) const
|
||||
template <typename T>
|
||||
inline const typename image<T>::pixel_type* image<T>::getRow(std::size_t row, std::size_t x0) const
|
||||
{
|
||||
return pData_ + row * dimensions_.width() + x0;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline typename image<T,max_size>::pixel_type* image<T,max_size>::getRow(std::size_t row)
|
||||
template <typename T>
|
||||
inline typename image<T>::pixel_type* image<T>::getRow(std::size_t row)
|
||||
{
|
||||
return pData_ + row * dimensions_.width();
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline typename image<T,max_size>::pixel_type* image<T,max_size>::getRow(std::size_t row, std::size_t x0)
|
||||
template <typename T>
|
||||
inline typename image<T>::pixel_type* image<T>::getRow(std::size_t row, std::size_t x0)
|
||||
{
|
||||
return pData_ + row * dimensions_.width() + x0;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::setRow(std::size_t row, pixel_type const* buf, std::size_t size)
|
||||
template <typename T>
|
||||
inline void image<T>::setRow(std::size_t row, pixel_type const* buf, std::size_t size)
|
||||
{
|
||||
assert(row < dimensions_.height());
|
||||
assert(size <= dimensions_.width());
|
||||
std::copy(buf, buf + size, pData_ + row * dimensions_.width());
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::setRow(std::size_t row, std::size_t x0, std::size_t x1, pixel_type const* buf)
|
||||
template <typename T>
|
||||
inline void image<T>::setRow(std::size_t row, std::size_t x0, std::size_t x1, pixel_type const* buf)
|
||||
{
|
||||
assert(row < dimensions_.height());
|
||||
assert ((x1 - x0) <= dimensions_.width() );
|
||||
std::copy(buf, buf + (x1 - x0), pData_ + row * dimensions_.width() + x0);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline double image<T,max_size>::get_offset() const
|
||||
template <typename T>
|
||||
inline double image<T>::get_offset() const
|
||||
{
|
||||
return offset_;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::set_offset(double set)
|
||||
template <typename T>
|
||||
inline void image<T>::set_offset(double set)
|
||||
{
|
||||
offset_ = set;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline double image<T,max_size>::get_scaling() const
|
||||
template <typename T>
|
||||
inline double image<T>::get_scaling() const
|
||||
{
|
||||
return scaling_;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::set_scaling(double set)
|
||||
template <typename T>
|
||||
inline void image<T>::set_scaling(double set)
|
||||
{
|
||||
if (set != 0.0)
|
||||
{
|
||||
|
@ -241,32 +276,32 @@ inline void image<T,max_size>::set_scaling(double set)
|
|||
std::clog << "Can not set scaling to 0.0, offset not set." << std::endl;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline bool image<T,max_size>::get_premultiplied() const
|
||||
template <typename T>
|
||||
inline bool image<T>::get_premultiplied() const
|
||||
{
|
||||
return premultiplied_alpha_;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::set_premultiplied(bool set)
|
||||
template <typename T>
|
||||
inline void image<T>::set_premultiplied(bool set)
|
||||
{
|
||||
premultiplied_alpha_ = set;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline void image<T,max_size>::painted(bool painted)
|
||||
template <typename T>
|
||||
inline void image<T>::painted(bool painted)
|
||||
{
|
||||
painted_ = painted;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline bool image<T,max_size>::painted() const
|
||||
template <typename T>
|
||||
inline bool image<T>::painted() const
|
||||
{
|
||||
return painted_;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t max_size>
|
||||
inline image_dtype image<T,max_size>::get_dtype() const
|
||||
template <typename T>
|
||||
inline image_dtype image<T>::get_dtype() const
|
||||
{
|
||||
return dtype;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,12 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/image_view_any.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/pixel_types.hpp>
|
||||
//#include <mapnik/image.hpp>
|
||||
//#include <mapnik/image_any.hpp>
|
||||
//#include <mapnik/image_view.hpp>
|
||||
//#include <mapnik/image_view_any.hpp>
|
||||
//#include <mapnik/color.hpp>
|
||||
|
||||
// boost
|
||||
#pragma GCC diagnostic push
|
||||
|
@ -46,6 +47,11 @@ namespace mapnik {
|
|||
|
||||
// fwd declares
|
||||
class rgba_palette;
|
||||
struct image_any;
|
||||
template <typename T> class image;
|
||||
struct image_view_any;
|
||||
template <typename T> class image_view;
|
||||
class color;
|
||||
|
||||
class ImageWriterException : public std::exception
|
||||
{
|
||||
|
@ -162,37 +168,37 @@ template <typename T>
|
|||
MAPNIK_DECL void fill (image_any & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_rgba8 & data, T const&);
|
||||
MAPNIK_DECL void fill (image<rgba8_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray8 & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray8_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray8s & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray8s_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray16 & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray16_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray16s & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray16s_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray32 & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray32_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray32s & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray32s_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray32f & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray32f_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray64 & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray64_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray64s & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray64s_t> & data, T const&);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void fill (image_gray64f & data, T const&);
|
||||
MAPNIK_DECL void fill (image<gray64f_t> & data, T const&);
|
||||
|
||||
// SET RECTANGLE
|
||||
MAPNIK_DECL void set_rectangle (image_any & dst, image_any const& src, int x = 0, int y = 0);
|
||||
|
@ -218,37 +224,37 @@ 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);
|
||||
MAPNIK_DECL void set_pixel(image<rgba8_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray8 & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray8_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray8s & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray8s_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray16 & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray16_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray16s & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray16s_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray32 & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray32_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray32s & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray32s_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray32f & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray32f_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray64 & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray64_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray64s & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray64s_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL void set_pixel(image_gray64f & data, std::size_t x, std::size_t y, T const& val);
|
||||
MAPNIK_DECL void set_pixel(image<gray64f_t> & data, std::size_t x, std::size_t y, T const& val);
|
||||
|
||||
// GET PIXEL
|
||||
template <typename T>
|
||||
|
@ -258,70 +264,70 @@ 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);
|
||||
MAPNIK_DECL T get_pixel(image<rgba8_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray8 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray8_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray8s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray8s_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray16 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray16_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray16s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray16s_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray32 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray32_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray32s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray32s_t> 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);
|
||||
MAPNIK_DECL T get_pixel(image<gray32f_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray64 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray64_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray64s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray64s_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_gray64f const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image<gray64f_t> const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_rgba8 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<rgba8_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray8 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray8_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray8s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray8s_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray16 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray16_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray16s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray16s_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray32 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray32_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray32s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray32s_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray32f const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray32f_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray64 const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray64_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray64s const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray64s_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
template <typename T>
|
||||
MAPNIK_DECL T get_pixel(image_view_gray64f const& data, std::size_t x, std::size_t y);
|
||||
MAPNIK_DECL T get_pixel(image_view<image<gray64f_t> > const& data, std::size_t x, std::size_t y);
|
||||
|
||||
// VIEW TO STRING
|
||||
MAPNIK_DECL void view_to_string (image_view_any const& view, std::ostringstream & ss);
|
||||
|
|
|
@ -36,107 +36,26 @@ public:
|
|||
static const image_dtype dtype = T::dtype;
|
||||
static constexpr std::size_t pixel_size = sizeof(pixel_type);
|
||||
|
||||
image_view(unsigned x, unsigned y, unsigned width, unsigned height, T const& data)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
width_(width),
|
||||
height_(height),
|
||||
data_(data)
|
||||
{
|
||||
if (x_ >= data_.width() && data_.width() > 0) x_ = data_.width() - 1;
|
||||
if (y_ >= data_.height() && data.height() > 0) y_ = data_.height() - 1;
|
||||
if (x_ + width_ > data_.width()) width_ = data_.width() - x_;
|
||||
if (y_ + height_ > data_.height()) height_ = data_.height() - y_;
|
||||
}
|
||||
image_view(unsigned x, unsigned y, unsigned width, unsigned height, T const& data);
|
||||
~image_view();
|
||||
|
||||
~image_view() {}
|
||||
image_view(image_view<T> const& rhs);
|
||||
image_view<T> & operator=(image_view<T> const& rhs);
|
||||
|
||||
image_view(image_view<T> const& rhs)
|
||||
: x_(rhs.x_),
|
||||
y_(rhs.y_),
|
||||
width_(rhs.width_),
|
||||
height_(rhs.height_),
|
||||
data_(rhs.data_) {}
|
||||
|
||||
image_view<T> & operator=(image_view<T> const& rhs)
|
||||
{
|
||||
if (&rhs==this) return *this;
|
||||
x_ = rhs.x_;
|
||||
y_ = rhs.y_;
|
||||
width_ = rhs.width_;
|
||||
height_ = rhs.height_;
|
||||
data_ = rhs.data_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline unsigned x() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
inline unsigned y() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
inline unsigned width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
inline unsigned height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
inline const pixel_type& operator() (std::size_t i, std::size_t j) const
|
||||
{
|
||||
return data_(i,j);
|
||||
}
|
||||
|
||||
inline unsigned getSize() const
|
||||
{
|
||||
return height_ * width_ * pixel_size;
|
||||
}
|
||||
|
||||
inline unsigned getRowSize() const
|
||||
{
|
||||
return width_ * pixel_size;
|
||||
}
|
||||
|
||||
inline const pixel_type* getRow(unsigned row) const
|
||||
{
|
||||
return data_.getRow(row + y_) + x_;
|
||||
}
|
||||
|
||||
inline const pixel_type* getRow(unsigned row, std::size_t x0) const
|
||||
{
|
||||
return data_.getRow(row + y_, x0) + x_;
|
||||
}
|
||||
|
||||
inline T const& data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
inline bool get_premultiplied() const
|
||||
{
|
||||
return data_.get_premultiplied();
|
||||
}
|
||||
|
||||
inline double get_offset() const
|
||||
{
|
||||
return data_.get_offset();
|
||||
}
|
||||
|
||||
inline double get_scaling() const
|
||||
{
|
||||
return data_.get_scaling();
|
||||
}
|
||||
|
||||
inline image_dtype get_dtype() const
|
||||
{
|
||||
return dtype;
|
||||
}
|
||||
unsigned x() const;
|
||||
unsigned y() const;
|
||||
unsigned width() const;
|
||||
unsigned height() const;
|
||||
const pixel_type& operator() (std::size_t i, std::size_t j) const;
|
||||
unsigned getSize() const;
|
||||
unsigned getRowSize() const;
|
||||
const pixel_type* getRow(unsigned row) const;
|
||||
const pixel_type* getRow(unsigned row, std::size_t x0) const;
|
||||
T const& data() const;
|
||||
bool get_premultiplied() const;
|
||||
double get_offset() const;
|
||||
double get_scaling() const;
|
||||
image_dtype get_dtype() const;
|
||||
|
||||
private:
|
||||
unsigned x_;
|
||||
|
|
153
include/mapnik/image_view_impl.hpp
Normal file
153
include/mapnik/image_view_impl.hpp
Normal file
|
@ -0,0 +1,153 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2014 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_IMAGE_VIEW_IMPL_HPP
|
||||
#define MAPNIK_IMAGE_VIEW_IMPL_HPP
|
||||
|
||||
#include <mapnik/image.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
template <typename T>
|
||||
image_view<T>::image_view(unsigned x, unsigned y, unsigned width, unsigned height, T const& data)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
width_(width),
|
||||
height_(height),
|
||||
data_(data)
|
||||
{
|
||||
if (x_ >= data_.width() && data_.width() > 0) x_ = data_.width() - 1;
|
||||
if (y_ >= data_.height() && data.height() > 0) y_ = data_.height() - 1;
|
||||
if (x_ + width_ > data_.width()) width_ = data_.width() - x_;
|
||||
if (y_ + height_ > data_.height()) height_ = data_.height() - y_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
image_view<T>::~image_view() {}
|
||||
|
||||
template <typename T>
|
||||
image_view<T>::image_view(image_view<T> const& rhs)
|
||||
: x_(rhs.x_),
|
||||
y_(rhs.y_),
|
||||
width_(rhs.width_),
|
||||
height_(rhs.height_),
|
||||
data_(rhs.data_) {}
|
||||
|
||||
template <typename T>
|
||||
image_view<T> & image_view<T>::operator=(image_view<T> const& rhs)
|
||||
{
|
||||
if (&rhs==this) return *this;
|
||||
x_ = rhs.x_;
|
||||
y_ = rhs.y_;
|
||||
width_ = rhs.width_;
|
||||
height_ = rhs.height_;
|
||||
data_ = rhs.data_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline unsigned image_view<T>::x() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline unsigned image_view<T>::y() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline unsigned image_view<T>::width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline unsigned image_view<T>::height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const typename image_view<T>::pixel_type& image_view<T>::operator() (std::size_t i, std::size_t j) const
|
||||
{
|
||||
return data_(i,j);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline unsigned image_view<T>::getSize() const
|
||||
{
|
||||
return height_ * width_ * pixel_size;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline unsigned image_view<T>::getRowSize() const
|
||||
{
|
||||
return width_ * pixel_size;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const typename image_view<T>::pixel_type* image_view<T>::getRow(unsigned row) const
|
||||
{
|
||||
return data_.getRow(row + y_) + x_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const typename image_view<T>::pixel_type* image_view<T>::getRow(unsigned row, std::size_t x0) const
|
||||
{
|
||||
return data_.getRow(row + y_, x0) + x_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T const& image_view<T>::data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool image_view<T>::get_premultiplied() const
|
||||
{
|
||||
return data_.get_premultiplied();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline double image_view<T>::get_offset() const
|
||||
{
|
||||
return data_.get_offset();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline double image_view<T>::get_scaling() const
|
||||
{
|
||||
return data_.get_scaling();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline image_dtype image_view<T>::get_dtype() const
|
||||
{
|
||||
return dtype;
|
||||
}
|
||||
|
||||
} // end ns
|
||||
|
||||
#endif // MAPNIK_IMAGE_VIEW_IMPL_HPP
|
|
@ -175,6 +175,7 @@ source = Split(
|
|||
image_reader.cpp
|
||||
cairo_io.cpp
|
||||
image.cpp
|
||||
image_view.cpp
|
||||
image_any.cpp
|
||||
image_null.cpp
|
||||
image_util.cpp
|
||||
|
|
|
@ -29,6 +29,71 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// BUFFER
|
||||
buffer::buffer(std::size_t size)
|
||||
: size_(size),
|
||||
data_(static_cast<unsigned char*>(size_ != 0 ? ::operator new(size_) : nullptr))
|
||||
{}
|
||||
|
||||
buffer::buffer(buffer && rhs) noexcept
|
||||
: size_(std::move(rhs.size_)),
|
||||
data_(std::move(rhs.data_))
|
||||
{
|
||||
rhs.size_ = 0;
|
||||
rhs.data_ = nullptr;
|
||||
}
|
||||
|
||||
buffer::buffer(buffer const& rhs)
|
||||
: size_(rhs.size_),
|
||||
data_(static_cast<unsigned char*>(size_ != 0 ? ::operator new(size_) : nullptr))
|
||||
{
|
||||
if (data_) std::copy(rhs.data_, rhs.data_ + rhs.size_, data_);
|
||||
}
|
||||
|
||||
buffer::~buffer()
|
||||
{
|
||||
::operator delete(data_);
|
||||
}
|
||||
|
||||
buffer& buffer::operator=(buffer rhs)
|
||||
{
|
||||
swap(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void buffer::swap(buffer & rhs)
|
||||
{
|
||||
std::swap(size_, rhs.size_);
|
||||
std::swap(data_, rhs.data_);
|
||||
}
|
||||
|
||||
inline bool buffer::operator!() const
|
||||
{
|
||||
return (data_ == nullptr)? false : true;
|
||||
}
|
||||
|
||||
unsigned char* buffer::data()
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
unsigned char const* buffer::data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::size_t buffer::size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
template struct MAPNIK_DECL image_dimensions<65535>;
|
||||
|
||||
} // end ns detail
|
||||
|
||||
template class MAPNIK_DECL image<null_t>;
|
||||
template class MAPNIK_DECL image<rgba8_t>;
|
||||
template class MAPNIK_DECL image<gray8_t>;
|
||||
|
|
|
@ -153,7 +153,7 @@ struct set_scaling_visitor
|
|||
|
||||
} // namespace detail
|
||||
|
||||
image_any::image_any(int width,
|
||||
MAPNIK_DECL image_any::image_any(int width,
|
||||
int height,
|
||||
image_dtype type,
|
||||
bool initialize,
|
||||
|
@ -161,102 +161,73 @@ image_any::image_any(int width,
|
|||
bool painted)
|
||||
: image_base(std::move(create_image_any(width, height, type, initialize, premultiplied, painted))) {}
|
||||
|
||||
template <typename T>
|
||||
image_any::image_any(T && data) noexcept
|
||||
: image_base(std::move(data)) {}
|
||||
|
||||
template image_any::image_any(image_null && data) noexcept;
|
||||
template image_any::image_any(image_rgba8 && data) noexcept;
|
||||
template image_any::image_any(image_gray8 && data) noexcept;
|
||||
template image_any::image_any(image_gray8s && data) noexcept;
|
||||
template image_any::image_any(image_gray16 && data) noexcept;
|
||||
template image_any::image_any(image_gray16s && data) noexcept;
|
||||
template image_any::image_any(image_gray32 && data) noexcept;
|
||||
template image_any::image_any(image_gray32s && data) noexcept;
|
||||
template image_any::image_any(image_gray32f && data) noexcept;
|
||||
template image_any::image_any(image_gray64 && data) noexcept;
|
||||
template image_any::image_any(image_gray64s && data) noexcept;
|
||||
template image_any::image_any(image_gray64f && data) noexcept;
|
||||
template image_any::image_any(image_null const& data) noexcept;
|
||||
template image_any::image_any(image_rgba8 const& data) noexcept;
|
||||
template image_any::image_any(image_gray8 const& data) noexcept;
|
||||
template image_any::image_any(image_gray8s const& data) noexcept;
|
||||
template image_any::image_any(image_gray16 const& data) noexcept;
|
||||
template image_any::image_any(image_gray16s const& data) noexcept;
|
||||
template image_any::image_any(image_gray32 const& data) noexcept;
|
||||
template image_any::image_any(image_gray32s const& data) noexcept;
|
||||
template image_any::image_any(image_gray32f const& data) noexcept;
|
||||
template image_any::image_any(image_gray64 const& data) noexcept;
|
||||
template image_any::image_any(image_gray64s const& data) noexcept;
|
||||
template image_any::image_any(image_gray64f const& data) noexcept;
|
||||
|
||||
unsigned char const* image_any::getBytes() const
|
||||
MAPNIK_DECL unsigned char const* image_any::getBytes() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_bytes_visitor_const(),*this);
|
||||
}
|
||||
|
||||
unsigned char* image_any::getBytes()
|
||||
MAPNIK_DECL unsigned char* image_any::getBytes()
|
||||
{
|
||||
return util::apply_visitor(detail::get_bytes_visitor(),*this);
|
||||
}
|
||||
|
||||
std::size_t image_any::width() const
|
||||
MAPNIK_DECL std::size_t image_any::width() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_width_visitor(),*this);
|
||||
}
|
||||
|
||||
std::size_t image_any::height() const
|
||||
MAPNIK_DECL std::size_t image_any::height() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_height_visitor(),*this);
|
||||
}
|
||||
|
||||
bool image_any::get_premultiplied() const
|
||||
MAPNIK_DECL bool image_any::get_premultiplied() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_premultiplied_visitor(),*this);
|
||||
}
|
||||
|
||||
bool image_any::painted() const
|
||||
MAPNIK_DECL bool image_any::painted() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_painted_visitor(),*this);
|
||||
}
|
||||
|
||||
unsigned image_any::getSize() const
|
||||
MAPNIK_DECL unsigned image_any::getSize() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_any_size_visitor(),*this);
|
||||
}
|
||||
|
||||
unsigned image_any::getRowSize() const
|
||||
MAPNIK_DECL unsigned image_any::getRowSize() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_any_row_size_visitor(),*this);
|
||||
}
|
||||
|
||||
double image_any::get_offset() const
|
||||
MAPNIK_DECL double image_any::get_offset() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_offset_visitor(),*this);
|
||||
}
|
||||
|
||||
double image_any::get_scaling() const
|
||||
MAPNIK_DECL double image_any::get_scaling() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_scaling_visitor(),*this);
|
||||
}
|
||||
|
||||
image_dtype image_any::get_dtype() const
|
||||
MAPNIK_DECL image_dtype image_any::get_dtype() const
|
||||
{
|
||||
return util::apply_visitor(detail::get_dtype_visitor(),*this);
|
||||
}
|
||||
|
||||
void image_any::set_offset(double val)
|
||||
MAPNIK_DECL void image_any::set_offset(double val)
|
||||
{
|
||||
util::apply_visitor(detail::set_offset_visitor(val),*this);
|
||||
}
|
||||
|
||||
void image_any::set_scaling(double val)
|
||||
MAPNIK_DECL void image_any::set_scaling(double val)
|
||||
{
|
||||
util::apply_visitor(detail::set_scaling_visitor(val),*this);
|
||||
}
|
||||
|
||||
|
||||
image_any create_image_any(int width,
|
||||
MAPNIK_DECL image_any create_image_any(int width,
|
||||
int height,
|
||||
image_dtype type,
|
||||
bool initialize,
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/pixel_types.hpp>
|
||||
|
||||
//stl
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_util_jpeg.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
||||
|
@ -37,7 +36,6 @@
|
|||
|
||||
// stl
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue