Moved image_data_rgba8 to image_rgba8. Ref #2633
This commit is contained in:
parent
e4a5424613
commit
22a384ef33
87 changed files with 252 additions and 252 deletions
|
@ -24,8 +24,8 @@ namespace benchmark {
|
||||||
throw mapnik::image_reader_exception("Failed to load: " + src_fn);
|
throw mapnik::image_reader_exception("Failed to load: " + src_fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
image_data_rgba8 const& dest = util::get<image_data_rgba8>(reader1->read(0,0,reader1->width(), reader1->height()));
|
image_rgba8 const& dest = util::get<image_rgba8>(reader1->read(0,0,reader1->width(), reader1->height()));
|
||||||
image_data_rgba8 const& src = util::get<image_data_rgba8>(reader1->read(0,0,reader1->width(), reader1->height()));
|
image_rgba8 const& src = util::get<image_rgba8>(reader1->read(0,0,reader1->width(), reader1->height()));
|
||||||
|
|
||||||
unsigned int width = src.width();
|
unsigned int width = src.width();
|
||||||
unsigned int height = src.height();
|
unsigned int height = src.height();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
class test : public benchmark::test_case
|
class test : public benchmark::test_case
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 im_;
|
mapnik::image_rgba8 im_;
|
||||||
public:
|
public:
|
||||||
test(mapnik::parameters const& params)
|
test(mapnik::parameters const& params)
|
||||||
: test_case(params),
|
: test_case(params),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
class test : public benchmark::test_case
|
class test : public benchmark::test_case
|
||||||
{
|
{
|
||||||
std::shared_ptr<image_data_rgba8> im_;
|
std::shared_ptr<image_rgba8> im_;
|
||||||
public:
|
public:
|
||||||
test(mapnik::parameters const& params)
|
test(mapnik::parameters const& params)
|
||||||
: test_case(params) {
|
: test_case(params) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ void render(mapnik::geometry_type & geom,
|
||||||
using path_type = mapnik::transform_path_adapter<mapnik::view_transform,mapnik::geometry_type>;
|
using path_type = mapnik::transform_path_adapter<mapnik::view_transform,mapnik::geometry_type>;
|
||||||
using ren_base = agg::renderer_base<agg::pixfmt_rgba32_plain>;
|
using ren_base = agg::renderer_base<agg::pixfmt_rgba32_plain>;
|
||||||
using renderer = agg::renderer_scanline_aa_solid<ren_base>;
|
using renderer = agg::renderer_scanline_aa_solid<ren_base>;
|
||||||
mapnik::image_data_rgba8 im(256,256);
|
mapnik::image_rgba8 im(256,256);
|
||||||
mapnik::fill(im, mapnik::color("white"));
|
mapnik::fill(im, mapnik::color("white"));
|
||||||
mapnik::box2d<double> padded_extent = extent;
|
mapnik::box2d<double> padded_extent = extent;
|
||||||
padded_extent.pad(10);
|
padded_extent.pad(10);
|
||||||
|
|
|
@ -21,8 +21,8 @@ public:
|
||||||
mapnik::Map m(256,256);
|
mapnik::Map m(256,256);
|
||||||
mapnik::load_map(m,xml_);
|
mapnik::load_map(m,xml_);
|
||||||
m.zoom_to_box(extent_);
|
m.zoom_to_box(extent_);
|
||||||
mapnik::image_data_rgba8 im(m.width(),m.height());
|
mapnik::image_rgba8 im(m.width(),m.height());
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m,im);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
//mapnik::save_to_file(im.data(),"test.png");
|
//mapnik::save_to_file(im.data(),"test.png");
|
||||||
return true;
|
return true;
|
||||||
|
@ -34,8 +34,8 @@ public:
|
||||||
m.zoom_to_box(extent_);
|
m.zoom_to_box(extent_);
|
||||||
for (unsigned i=0;i<iterations_;++i)
|
for (unsigned i=0;i<iterations_;++i)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 im(m.width(),m.height());
|
mapnik::image_rgba8 im(m.width(),m.height());
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m,im);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -54,8 +54,8 @@ public:
|
||||||
} else {
|
} else {
|
||||||
m.zoom_all();
|
m.zoom_all();
|
||||||
}
|
}
|
||||||
mapnik::image_data_rgba8 im(m.width(),m.height());
|
mapnik::image_rgba8 im(m.width(),m.height());
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m,im,scale_factor_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im,scale_factor_);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
if (!preview_.empty()) {
|
if (!preview_.empty()) {
|
||||||
std::clog << "preview available at " << preview_ << "\n";
|
std::clog << "preview available at " << preview_ << "\n";
|
||||||
|
@ -77,8 +77,8 @@ public:
|
||||||
}
|
}
|
||||||
for (unsigned i=0;i<iterations_;++i)
|
for (unsigned i=0;i<iterations_;++i)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 im(m.width(),m.height());
|
mapnik::image_rgba8 im(m.width(),m.height());
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m,im,scale_factor_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im,scale_factor_);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -49,7 +49,7 @@ class test : public benchmark::test_case
|
||||||
std::shared_ptr<mapnik::Map> m_;
|
std::shared_ptr<mapnik::Map> m_;
|
||||||
double scale_factor_;
|
double scale_factor_;
|
||||||
std::string preview_;
|
std::string preview_;
|
||||||
mutable mapnik::image_data_rgba8 im_;
|
mutable mapnik::image_rgba8 im_;
|
||||||
public:
|
public:
|
||||||
test(mapnik::parameters const& params)
|
test(mapnik::parameters const& params)
|
||||||
: test_case(params),
|
: test_case(params),
|
||||||
|
@ -93,7 +93,7 @@ public:
|
||||||
mapnik::projection map_proj(m_->srs(),true);
|
mapnik::projection map_proj(m_->srs(),true);
|
||||||
double scale_denom = mapnik::scale_denominator(m_req.scale(),map_proj.is_geographic());
|
double scale_denom = mapnik::scale_denominator(m_req.scale(),map_proj.is_geographic());
|
||||||
scale_denom *= scale_factor_;
|
scale_denom *= scale_factor_;
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(*m_,m_req,variables,im_,scale_factor_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(*m_,m_req,variables,im_,scale_factor_);
|
||||||
ren.start_map_processing(*m_);
|
ren.start_map_processing(*m_);
|
||||||
std::vector<mapnik::layer> const& layers = m_->layers();
|
std::vector<mapnik::layer> const& layers = m_->layers();
|
||||||
process_layers(ren,m_req,map_proj,layers,scale_denom);
|
process_layers(ren,m_req,map_proj,layers,scale_denom);
|
||||||
|
@ -113,20 +113,20 @@ public:
|
||||||
for (unsigned i=0;i<iterations_;++i)
|
for (unsigned i=0;i<iterations_;++i)
|
||||||
{
|
{
|
||||||
mapnik::request m_req(width_,height_,extent_);
|
mapnik::request m_req(width_,height_,extent_);
|
||||||
mapnik::image_data_rgba8 im(m_->width(),m_->height());
|
mapnik::image_rgba8 im(m_->width(),m_->height());
|
||||||
mapnik::attributes variables;
|
mapnik::attributes variables;
|
||||||
m_req.set_buffer_size(m_->buffer_size());
|
m_req.set_buffer_size(m_->buffer_size());
|
||||||
mapnik::projection map_proj(m_->srs(),true);
|
mapnik::projection map_proj(m_->srs(),true);
|
||||||
double scale_denom = mapnik::scale_denominator(m_req.scale(),map_proj.is_geographic());
|
double scale_denom = mapnik::scale_denominator(m_req.scale(),map_proj.is_geographic());
|
||||||
scale_denom *= scale_factor_;
|
scale_denom *= scale_factor_;
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(*m_,m_req,variables,im,scale_factor_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(*m_,m_req,variables,im,scale_factor_);
|
||||||
ren.start_map_processing(*m_);
|
ren.start_map_processing(*m_);
|
||||||
std::vector<mapnik::layer> const& layers = m_->layers();
|
std::vector<mapnik::layer> const& layers = m_->layers();
|
||||||
process_layers(ren,m_req,map_proj,layers,scale_denom);
|
process_layers(ren,m_req,map_proj,layers,scale_denom);
|
||||||
ren.end_map_processing(*m_);
|
ren.end_map_processing(*m_);
|
||||||
bool diff = false;
|
bool diff = false;
|
||||||
mapnik::image_data_rgba8 const& dest = im;
|
mapnik::image_rgba8 const& dest = im;
|
||||||
mapnik::image_data_rgba8 const& src = im_;
|
mapnik::image_rgba8 const& src = im_;
|
||||||
for (unsigned int y = 0; y < height_; ++y)
|
for (unsigned int y = 0; y < height_; ++y)
|
||||||
{
|
{
|
||||||
const unsigned int* row_from = src.getRow(y);
|
const unsigned int* row_from = src.getRow(y);
|
||||||
|
|
|
@ -241,7 +241,7 @@ void composite(image_any & dst, image_any & src, mapnik::composite_mode_e mode,
|
||||||
std::shared_ptr<image_any> from_cairo(PycairoSurface* py_surface)
|
std::shared_ptr<image_any> from_cairo(PycairoSurface* py_surface)
|
||||||
{
|
{
|
||||||
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
|
mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer());
|
||||||
mapnik::image_data_rgba8 image = mapnik::image_data_rgba8(cairo_image_surface_get_width(&*surface), cairo_image_surface_get_height(&*surface));
|
mapnik::image_rgba8 image = mapnik::image_rgba8(cairo_image_surface_get_width(&*surface), cairo_image_surface_get_height(&*surface));
|
||||||
cairo_image_to_rgba8(image, surface);
|
cairo_image_to_rgba8(image, surface);
|
||||||
return std::make_shared<image_any>(std::move(image));
|
return std::make_shared<image_any>(std::move(image));
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,9 +208,9 @@ struct agg_renderer_visitor_1
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void agg_renderer_visitor_1::operator()<mapnik::image_data_rgba8> (mapnik::image_data_rgba8 & pixmap)
|
void agg_renderer_visitor_1::operator()<mapnik::image_rgba8> (mapnik::image_rgba8 & pixmap)
|
||||||
{
|
{
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m_,pixmap,scale_factor_,offset_x_, offset_y_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m_,pixmap,scale_factor_,offset_x_, offset_y_);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,9 +235,9 @@ struct agg_renderer_visitor_2
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void agg_renderer_visitor_2::operator()<mapnik::image_data_rgba8> (mapnik::image_data_rgba8 & pixmap)
|
void agg_renderer_visitor_2::operator()<mapnik::image_rgba8> (mapnik::image_rgba8 & pixmap)
|
||||||
{
|
{
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m_,pixmap,detector_, scale_factor_,offset_x_, offset_y_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m_,pixmap,detector_, scale_factor_,offset_x_, offset_y_);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,9 +264,9 @@ struct agg_renderer_visitor_3
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void agg_renderer_visitor_3::operator()<mapnik::image_data_rgba8> (mapnik::image_data_rgba8 & pixmap)
|
void agg_renderer_visitor_3::operator()<mapnik::image_rgba8> (mapnik::image_rgba8 & pixmap)
|
||||||
{
|
{
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m_,req_, vars_, pixmap, scale_factor_, offset_x_, offset_y_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m_,req_, vars_, pixmap, scale_factor_, offset_x_, offset_y_);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,9 +293,9 @@ struct agg_renderer_visitor_4
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void agg_renderer_visitor_4::operator()<mapnik::image_data_rgba8> (mapnik::image_data_rgba8 & pixmap)
|
void agg_renderer_visitor_4::operator()<mapnik::image_rgba8> (mapnik::image_rgba8 & pixmap)
|
||||||
{
|
{
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m_,pixmap,scale_factor_,offset_x_, offset_y_);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m_,pixmap,scale_factor_,offset_x_, offset_y_);
|
||||||
ren.apply(layer_, names_);
|
ren.apply(layer_, names_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,8 +305,8 @@ int main ( int, char** )
|
||||||
|
|
||||||
m.zoom_to_box(box2d<double>(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855));
|
m.zoom_to_box(box2d<double>(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855));
|
||||||
|
|
||||||
image_data_rgba8 buf(m.width(),m.height());
|
image_rgba8 buf(m.width(),m.height());
|
||||||
agg_renderer<image_data_rgba8> ren(m,buf);
|
agg_renderer<image_rgba8> ren(m,buf);
|
||||||
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
|
||||||
|
@ -353,7 +353,7 @@ int main ( int, char** )
|
||||||
cairo_surface_write_to_png(&*image_surface, "cairo-demo.png");
|
cairo_surface_write_to_png(&*image_surface, "cairo-demo.png");
|
||||||
// but we can also benefit from quantization by converting
|
// but we can also benefit from quantization by converting
|
||||||
// to a mapnik image object and then saving that
|
// to a mapnik image object and then saving that
|
||||||
mapnik::image_data_rgba8 im_data(cairo_image_surface_get_width(&*image_surface), cairo_image_surface_get_height(&*image_surface));
|
mapnik::image_rgba8 im_data(cairo_image_surface_get_width(&*image_surface), cairo_image_surface_get_height(&*image_surface));
|
||||||
cairo_image_to_rgba8(im_data, image_surface);
|
cairo_image_to_rgba8(im_data, image_surface);
|
||||||
save_to_file(im_data, "cairo-demo256.png","png8");
|
save_to_file(im_data, "cairo-demo256.png","png8");
|
||||||
cairo_surface_finish(&*image_surface);
|
cairo_surface_finish(&*image_surface);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "mapwidget.hpp"
|
#include "mapwidget.hpp"
|
||||||
#include "info_dialog.hpp"
|
#include "info_dialog.hpp"
|
||||||
|
|
||||||
using mapnik::image_data_rgba8;
|
using mapnik::image_rgba8;
|
||||||
using mapnik::Map;
|
using mapnik::Map;
|
||||||
using mapnik::layer;
|
using mapnik::layer;
|
||||||
using mapnik::box2d;
|
using mapnik::box2d;
|
||||||
|
@ -478,7 +478,7 @@ void MapWidget::zoomToLevel(int level)
|
||||||
|
|
||||||
void MapWidget::export_to_file(unsigned ,unsigned ,std::string const&,std::string const&)
|
void MapWidget::export_to_file(unsigned ,unsigned ,std::string const&,std::string const&)
|
||||||
{
|
{
|
||||||
//image_data_rgba8 image(width,height);
|
//image_rgba8 image(width,height);
|
||||||
//agg_renderer renderer(map,image);
|
//agg_renderer renderer(map,image);
|
||||||
//renderer.apply();
|
//renderer.apply();
|
||||||
//image.saveToFile(filename,type);
|
//image.saveToFile(filename,type);
|
||||||
|
@ -495,8 +495,8 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
|
||||||
unsigned width=map.width();
|
unsigned width=map.width();
|
||||||
unsigned height=map.height();
|
unsigned height=map.height();
|
||||||
|
|
||||||
image_data_rgba8 buf(width,height);
|
image_rgba8 buf(width,height);
|
||||||
mapnik::agg_renderer<image_data_rgba8> ren(map,buf,scaling_factor);
|
mapnik::agg_renderer<image_rgba8> ren(map,buf,scaling_factor);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -539,7 +539,7 @@ void render_cairo(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
|
||||||
mapnik::cairo_renderer<mapnik::cairo_ptr> renderer(map, cairo, scaling_factor);
|
mapnik::cairo_renderer<mapnik::cairo_ptr> renderer(map, cairo, scaling_factor);
|
||||||
renderer.apply();
|
renderer.apply();
|
||||||
}
|
}
|
||||||
mapnik::image_data_rgba8 data(map.width(), map.height());
|
mapnik::image_rgba8 data(map.width(), map.height());
|
||||||
mapnik::cairo_image_to_rgba8(data, image_surface);
|
mapnik::cairo_image_to_rgba8(data, image_surface);
|
||||||
QImage image((uchar*)data.getBytes(),data.width(),data.height(),QImage::Format_ARGB32);
|
QImage image((uchar*)data.getBytes(),data.width(),data.height(),QImage::Format_ARGB32);
|
||||||
pix = QPixmap::fromImage(image.rgbSwapped());
|
pix = QPixmap::fromImage(image.rgbSwapped());
|
||||||
|
|
|
@ -201,7 +201,7 @@ struct symbolizer_icon
|
||||||
{
|
{
|
||||||
// FIXME!
|
// FIXME!
|
||||||
/*
|
/*
|
||||||
std::shared_ptr<mapnik::image_data_rgba8> symbol = sym.get_image();
|
std::shared_ptr<mapnik::image_rgba8> symbol = sym.get_image();
|
||||||
if (symbol)
|
if (symbol)
|
||||||
{
|
{
|
||||||
QImage image(symbol->getBytes(),
|
QImage image(symbol->getBytes(),
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace mapnik
|
||||||
class pattern_source : private util::noncopyable
|
class pattern_source : private util::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pattern_source(image_data_rgba8 const& pattern, double opacity = 1.0)
|
pattern_source(image_rgba8 const& pattern, double opacity = 1.0)
|
||||||
: pattern_(pattern),
|
: pattern_(pattern),
|
||||||
opacity_(opacity) {}
|
opacity_(opacity) {}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
static_cast<unsigned>(((c >> 24) & 0xff) * opacity_));
|
static_cast<unsigned>(((c >> 24) & 0xff) * opacity_));
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
image_data_rgba8 const& pattern_;
|
image_rgba8 const& pattern_;
|
||||||
double opacity_;
|
double opacity_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ void render_vector_marker(SvgRenderer & svg_renderer, RasterizerType & ras, Rend
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename RendererType, typename RasterizerType>
|
template <typename RendererType, typename RasterizerType>
|
||||||
void render_raster_marker(RendererType renb, RasterizerType & ras, image_data_rgba8 const& src,
|
void render_raster_marker(RendererType renb, RasterizerType & ras, image_rgba8 const& src,
|
||||||
agg::trans_affine const& tr, double opacity,
|
agg::trans_affine const& tr, double opacity,
|
||||||
float scale_factor, bool snap_to_pixels)
|
float scale_factor, bool snap_to_pixels)
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,7 +171,7 @@ private:
|
||||||
void setup(Map const& m);
|
void setup(Map const& m);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern template class MAPNIK_DECL agg_renderer<image_data_rgba8>;
|
extern template class MAPNIK_DECL agg_renderer<image_rgba8>;
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ private:
|
||||||
class cairo_pattern : private util::noncopyable
|
class cairo_pattern : private util::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit cairo_pattern(image_data_rgba8 const& data, double opacity = 1.0)
|
explicit cairo_pattern(image_rgba8 const& data, double opacity = 1.0)
|
||||||
{
|
{
|
||||||
int pixels = data.width() * data.height();
|
int pixels = data.width() * data.height();
|
||||||
const unsigned int *in_ptr = data.getData();
|
const unsigned int *in_ptr = data.getData();
|
||||||
|
@ -310,8 +310,8 @@ public:
|
||||||
void set_gradient(cairo_gradient const& pattern, box2d<double> const& bbox);
|
void set_gradient(cairo_gradient const& pattern, box2d<double> const& bbox);
|
||||||
void add_image(double x, double y, image_any & data, double opacity);
|
void add_image(double x, double y, image_any & data, double opacity);
|
||||||
void add_image(agg::trans_affine const& tr, image_any & data, double opacity);
|
void add_image(agg::trans_affine const& tr, image_any & data, double opacity);
|
||||||
void add_image(double x, double y, image_data_rgba8 & data, double opacity = 1.0);
|
void add_image(double x, double y, image_rgba8 & data, double opacity = 1.0);
|
||||||
void add_image(agg::trans_affine const& tr, image_data_rgba8 & data, double opacity = 1.0);
|
void add_image(agg::trans_affine const& tr, image_rgba8 & data, double opacity = 1.0);
|
||||||
void set_font_face(cairo_face_manager & manager, face_ptr face);
|
void set_font_face(cairo_face_manager & manager, face_ptr face);
|
||||||
void set_font_matrix(cairo_matrix_t const& matrix);
|
void set_font_matrix(cairo_matrix_t const& matrix);
|
||||||
void set_matrix(cairo_matrix_t const& matrix);
|
void set_matrix(cairo_matrix_t const& matrix);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
static inline void cairo_image_to_rgba8(mapnik::image_data_rgba8 & data,
|
static inline void cairo_image_to_rgba8(mapnik::image_rgba8 & data,
|
||||||
cairo_surface_ptr const& surface)
|
cairo_surface_ptr const& surface)
|
||||||
{
|
{
|
||||||
if (cairo_image_surface_get_format(&*surface) != CAIRO_FORMAT_ARGB32)
|
if (cairo_image_surface_get_format(&*surface) != CAIRO_FORMAT_ARGB32)
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
return height_;
|
return height_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set_rectangle(value_type id,image_data_rgba8 const& data,int x0,int y0)
|
inline void set_rectangle(value_type id,image_rgba8 const& data,int x0,int y0)
|
||||||
{
|
{
|
||||||
box2d<int> ext0(0,0,width_,height_);
|
box2d<int> ext0(0,0,width_,height_);
|
||||||
box2d<int> ext1(x0,y0,x0+data.width(),y0+data.height());
|
box2d<int> ext1(x0,y0,x0+data.width(),y0+data.height());
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct raster_markers_rasterizer_dispatch_grid : util::noncopyable
|
||||||
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
|
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
|
||||||
using PixMapType = typename std::tuple_element<2,RendererContext>::type;
|
using PixMapType = typename std::tuple_element<2,RendererContext>::type;
|
||||||
|
|
||||||
raster_markers_rasterizer_dispatch_grid(image_data_rgba8 const& src,
|
raster_markers_rasterizer_dispatch_grid(image_rgba8 const& src,
|
||||||
agg::trans_affine const& marker_trans,
|
agg::trans_affine const& marker_trans,
|
||||||
markers_symbolizer const& sym,
|
markers_symbolizer const& sym,
|
||||||
Detector & detector,
|
Detector & detector,
|
||||||
|
@ -130,7 +130,7 @@ private:
|
||||||
pixfmt_type pixf_;
|
pixfmt_type pixf_;
|
||||||
RendererBase renb_;
|
RendererBase renb_;
|
||||||
RasterizerType & ras_;
|
RasterizerType & ras_;
|
||||||
image_data_rgba8 const& src_;
|
image_rgba8 const& src_;
|
||||||
agg::trans_affine const& marker_trans_;
|
agg::trans_affine const& marker_trans_;
|
||||||
markers_symbolizer const& sym_;
|
markers_symbolizer const& sym_;
|
||||||
Detector & detector_;
|
Detector & detector_;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace mapnik {
|
||||||
template <typename RendererType, typename RasterizerType>
|
template <typename RendererType, typename RasterizerType>
|
||||||
void render_raster_marker(RendererType ren,
|
void render_raster_marker(RendererType ren,
|
||||||
RasterizerType & ras,
|
RasterizerType & ras,
|
||||||
image_data_rgba8 & src,
|
image_rgba8 & src,
|
||||||
mapnik::feature_impl const& feature,
|
mapnik::feature_impl const& feature,
|
||||||
agg::trans_affine const& marker_tr,
|
agg::trans_affine const& marker_tr,
|
||||||
double opacity)
|
double opacity)
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct image_data_null
|
||||||
};
|
};
|
||||||
|
|
||||||
using image_data_base = util::variant<image_data_null,
|
using image_data_base = util::variant<image_data_null,
|
||||||
image_data_rgba8,
|
image_rgba8,
|
||||||
image_data_gray8,
|
image_data_gray8,
|
||||||
image_data_gray16,
|
image_data_gray16,
|
||||||
image_data_gray32f>;
|
image_data_gray32f>;
|
||||||
|
@ -217,7 +217,7 @@ inline image_any create_image_any(int width,
|
||||||
return image_any(std::move(image_data_null()));
|
return image_any(std::move(image_data_null()));
|
||||||
case image_dtype_rgba8:
|
case image_dtype_rgba8:
|
||||||
default:
|
default:
|
||||||
return image_any(std::move(image_data_rgba8(width, height, initialize, premultiplied, painted)));
|
return image_any(std::move(image_rgba8(width, height, initialize, premultiplied, painted)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ private:
|
||||||
bool painted_;
|
bool painted_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using image_data_rgba8 = image_data<std::uint32_t>;
|
using image_rgba8 = image_data<std::uint32_t>;
|
||||||
using image_data_gray8 = image_data<std::uint8_t> ;
|
using image_data_gray8 = image_data<std::uint8_t> ;
|
||||||
using image_data_gray16 = image_data<std::int16_t>;
|
using image_data_gray16 = image_data<std::int16_t>;
|
||||||
using image_data_gray32f = image_data<float>;
|
using image_data_gray32f = image_data<float>;
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct MAPNIK_DECL image_reader : private util::noncopyable
|
||||||
virtual unsigned height() const = 0;
|
virtual unsigned height() const = 0;
|
||||||
virtual bool has_alpha() const = 0;
|
virtual bool has_alpha() const = 0;
|
||||||
virtual boost::optional<box2d<double> > bounding_box() const = 0;
|
virtual boost::optional<box2d<double> > bounding_box() const = 0;
|
||||||
virtual void read(unsigned x,unsigned y,image_data_rgba8& image) = 0;
|
virtual void read(unsigned x,unsigned y,image_rgba8& image) = 0;
|
||||||
virtual image_any read(unsigned x, unsigned y, unsigned width, unsigned height) = 0;
|
virtual image_any read(unsigned x, unsigned y, unsigned width, unsigned height) = 0;
|
||||||
virtual ~image_reader() {}
|
virtual ~image_reader() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,7 +38,7 @@ template <typename T>
|
||||||
struct agg_scaling_traits {};
|
struct agg_scaling_traits {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct agg_scaling_traits<image_data_rgba8>
|
struct agg_scaling_traits<image_rgba8>
|
||||||
{
|
{
|
||||||
using pixfmt_pre = agg::pixfmt_rgba32_pre;
|
using pixfmt_pre = agg::pixfmt_rgba32_pre;
|
||||||
using color_type = agg::rgba8;
|
using color_type = agg::rgba8;
|
||||||
|
|
|
@ -233,7 +233,7 @@ void add_border(T & image)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extern template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
extern template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const&);
|
rgba_palette const&);
|
||||||
|
@ -243,7 +243,7 @@ extern template MAPNIK_DECL void save_to_file<image_any>(image_any const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const&);
|
rgba_palette const&);
|
||||||
|
|
||||||
extern template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
extern template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ extern template MAPNIK_DECL void save_to_file<image_any>(image_any const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
extern template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
extern template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const&);
|
rgba_palette const&);
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ extern template MAPNIK_DECL void save_to_file<image_any>(image_any const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const&);
|
rgba_palette const&);
|
||||||
|
|
||||||
extern template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
extern template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
extern template MAPNIK_DECL void save_to_file<image_any>(image_any const&,
|
extern template MAPNIK_DECL void save_to_file<image_any>(image_any const&,
|
||||||
|
@ -281,10 +281,10 @@ extern template MAPNIK_DECL void save_to_file<image_view_any>(image_view_any con
|
||||||
extern template MAPNIK_DECL void save_to_file<image_view_any>(image_view_any const&,
|
extern template MAPNIK_DECL void save_to_file<image_view_any>(image_view_any const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
extern template MAPNIK_DECL std::string save_to_string<image_data_rgba8>(image_data_rgba8 const&,
|
extern template MAPNIK_DECL std::string save_to_string<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
extern template MAPNIK_DECL std::string save_to_string<image_data_rgba8>(image_data_rgba8 const&,
|
extern template MAPNIK_DECL std::string save_to_string<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const&);
|
rgba_palette const&);
|
||||||
|
|
||||||
|
@ -311,15 +311,15 @@ extern template MAPNIK_DECL std::string save_to_string<image_view_any> (image_vi
|
||||||
*/
|
*/
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
template MAPNIK_DECL void save_to_stream<image_data_rgba8>(
|
template MAPNIK_DECL void save_to_stream<image_rgba8>(
|
||||||
image_data_rgba8 const& image,
|
image_rgba8 const& image,
|
||||||
std::ostream & stream,
|
std::ostream & stream,
|
||||||
std::string const& type,
|
std::string const& type,
|
||||||
rgba_palette const& palette
|
rgba_palette const& palette
|
||||||
);
|
);
|
||||||
|
|
||||||
template MAPNIK_DECL void save_to_stream<image_data_rgba8>(
|
template MAPNIK_DECL void save_to_stream<image_rgba8>(
|
||||||
image_data_rgba8 const& image,
|
image_rgba8 const& image,
|
||||||
std::ostream & stream,
|
std::ostream & stream,
|
||||||
std::string const& type
|
std::string const& type
|
||||||
);
|
);
|
||||||
|
|
|
@ -118,7 +118,7 @@ private:
|
||||||
T const& data_;
|
T const& data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using image_view_rgba8 = image_view<image_data_rgba8>;
|
using image_view_rgba8 = image_view<image_rgba8>;
|
||||||
using image_view_gray8 = image_view<image_data_gray8>;
|
using image_view_gray8 = image_view<image_data_gray8>;
|
||||||
using image_view_gray16 = image_view<image_data_gray16>;
|
using image_view_gray16 = image_view<image_data_gray16>;
|
||||||
using image_view_gray32f = image_view<image_data_gray32f>;
|
using image_view_gray32f = image_view<image_data_gray32f>;
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
marker()
|
marker()
|
||||||
{
|
{
|
||||||
// create default OGC 4x4 black pixel
|
// create default OGC 4x4 black pixel
|
||||||
image_data_rgba8 image(4,4,true,true);
|
image_rgba8 image(4,4,true,true);
|
||||||
image.set(0xff000000);
|
image.set(0xff000000);
|
||||||
bitmap_data_ = boost::optional<image_ptr>(std::make_shared<image_any>(std::move(image)));
|
bitmap_data_ = boost::optional<image_ptr>(std::make_shared<image_any>(std::move(image)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,9 +85,9 @@ private:
|
||||||
|
|
||||||
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_data_gray8>(image_data_gray8 const& image);
|
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_data_gray8>(image_data_gray8 const& image);
|
||||||
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_view_gray8>(image_view_gray8 const& image);
|
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_view_gray8>(image_view_gray8 const& image);
|
||||||
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_data_rgba8>(image_data_rgba8 const& image);
|
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_rgba8>(image_rgba8 const& image);
|
||||||
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_view_rgba8>(image_view_rgba8 const& image);
|
extern template MAPNIK_DECL void PNGWriter::writeIDAT<image_view_rgba8>(image_view_rgba8 const& image);
|
||||||
extern template MAPNIK_DECL void PNGWriter::writeIDATStripAlpha<image_data_rgba8>(image_data_rgba8 const& image);
|
extern template MAPNIK_DECL void PNGWriter::writeIDATStripAlpha<image_rgba8>(image_rgba8 const& image);
|
||||||
extern template MAPNIK_DECL void PNGWriter::writeIDATStripAlpha<image_view_rgba8>(image_view_rgba8 const& image);
|
extern template MAPNIK_DECL void PNGWriter::writeIDATStripAlpha<image_view_rgba8>(image_view_rgba8 const& image);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -166,7 +166,7 @@ void reduce_8(T const& in,
|
||||||
}
|
}
|
||||||
for (unsigned y = 0; y < height; ++y)
|
for (unsigned y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8::pixel_type const * row = in.getRow(y);
|
mapnik::image_rgba8::pixel_type const * row = in.getRow(y);
|
||||||
mapnik::image_data_gray8::pixel_type * row_out = out.getRow(y);
|
mapnik::image_data_gray8::pixel_type * row_out = out.getRow(y);
|
||||||
for (unsigned x = 0; x < width; ++x)
|
for (unsigned x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ void reduce_4(T const& in,
|
||||||
}
|
}
|
||||||
for (unsigned y = 0; y < height; ++y)
|
for (unsigned y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8::pixel_type const * row = in.getRow(y);
|
mapnik::image_rgba8::pixel_type const * row = in.getRow(y);
|
||||||
mapnik::image_data_gray8::pixel_type * row_out = out.getRow(y);
|
mapnik::image_data_gray8::pixel_type * row_out = out.getRow(y);
|
||||||
for (unsigned x = 0; x < width; ++x)
|
for (unsigned x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
|
@ -603,7 +603,7 @@ void save_as_png8(T1 & file,
|
||||||
image_data_gray8 reduced_image(width, height);
|
image_data_gray8 reduced_image(width, height);
|
||||||
for (unsigned y = 0; y < height; ++y)
|
for (unsigned y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8::pixel_type const * row = image.getRow(y);
|
mapnik::image_rgba8::pixel_type const * row = image.getRow(y);
|
||||||
mapnik::image_data_gray8::pixel_type * row_out = reduced_image.getRow(y);
|
mapnik::image_data_gray8::pixel_type * row_out = reduced_image.getRow(y);
|
||||||
for (unsigned x = 0; x < width; ++x)
|
for (unsigned x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
|
@ -629,7 +629,7 @@ void save_as_png8(T1 & file,
|
||||||
image_data_gray8 reduced_image(image_width, image_height);
|
image_data_gray8 reduced_image(image_width, image_height);
|
||||||
for (unsigned y = 0; y < height; ++y)
|
for (unsigned y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8::pixel_type const * row = image.getRow(y);
|
mapnik::image_rgba8::pixel_type const * row = image.getRow(y);
|
||||||
mapnik::image_data_gray8::pixel_type * row_out = reduced_image.getRow(y);
|
mapnik::image_data_gray8::pixel_type * row_out = reduced_image.getRow(y);
|
||||||
byte index = 0;
|
byte index = 0;
|
||||||
for (unsigned x = 0; x < width; ++x)
|
for (unsigned x = 0; x < width; ++x)
|
||||||
|
|
|
@ -198,7 +198,7 @@ public:
|
||||||
colorizer_stops const& get_stops() const { return stops_; }
|
colorizer_stops const& get_stops() const { return stops_; }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void colorize(image_data_rgba8 & out, T const& in, boost::optional<double>const& nodata, feature_impl const& f) const;
|
void colorize(image_rgba8 & out, T const& in, boost::optional<double>const& nodata, feature_impl const& f) const;
|
||||||
|
|
||||||
//! \brief Perform the translation of input to output
|
//! \brief Perform the translation of input to output
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -150,7 +150,7 @@ struct raster_marker_render_thunk : util::noncopyable
|
||||||
snap_to_pixels_(std::move(rhs.snap_to_pixels_)) {}
|
snap_to_pixels_(std::move(rhs.snap_to_pixels_)) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template struct raster_marker_render_thunk<image_data_rgba8>;
|
template struct raster_marker_render_thunk<image_rgba8>;
|
||||||
template struct raster_marker_render_thunk<image_data_gray8>;
|
template struct raster_marker_render_thunk<image_data_gray8>;
|
||||||
template struct raster_marker_render_thunk<image_data_gray16>;
|
template struct raster_marker_render_thunk<image_data_gray16>;
|
||||||
template struct raster_marker_render_thunk<image_data_gray32f>;
|
template struct raster_marker_render_thunk<image_data_gray32f>;
|
||||||
|
@ -184,7 +184,7 @@ struct text_render_thunk : util::noncopyable
|
||||||
// via a static visitor later.
|
// via a static visitor later.
|
||||||
|
|
||||||
using render_thunk = util::variant<vector_marker_render_thunk,
|
using render_thunk = util::variant<vector_marker_render_thunk,
|
||||||
raster_marker_render_thunk<image_data_rgba8>,
|
raster_marker_render_thunk<image_rgba8>,
|
||||||
raster_marker_render_thunk<image_data_gray8>,
|
raster_marker_render_thunk<image_data_gray8>,
|
||||||
raster_marker_render_thunk<image_data_gray16>,
|
raster_marker_render_thunk<image_data_gray16>,
|
||||||
raster_marker_render_thunk<image_data_gray32f>,
|
raster_marker_render_thunk<image_data_gray32f>,
|
||||||
|
|
|
@ -70,9 +70,9 @@ struct image_data_dispatcher
|
||||||
nodata_(nodata) {}
|
nodata_(nodata) {}
|
||||||
|
|
||||||
void operator() (image_data_null const& data_in) const {} //no-op
|
void operator() (image_data_null const& data_in) const {} //no-op
|
||||||
void operator() (image_data_rgba8 const& data_in) const
|
void operator() (image_rgba8 const& data_in) const
|
||||||
{
|
{
|
||||||
image_data_rgba8 data_out(width_, height_, true, true);
|
image_rgba8 data_out(width_, height_, true, true);
|
||||||
scale_image_agg(data_out, data_in, method_, scale_x_, scale_y_, 0.0, 0.0, filter_factor_);
|
scale_image_agg(data_out, data_in, method_, scale_x_, scale_y_, 0.0, 0.0, filter_factor_);
|
||||||
composite_(data_out, comp_op_, opacity_, start_x_, start_y_);
|
composite_(data_out, comp_op_, opacity_, start_x_, start_y_);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ struct image_data_dispatcher
|
||||||
using image_data_type = T;
|
using image_data_type = T;
|
||||||
image_data_type data_out(width_, height_);
|
image_data_type data_out(width_, height_);
|
||||||
scale_image_agg(data_out, data_in, method_, scale_x_, scale_y_, 0.0, 0.0, filter_factor_);
|
scale_image_agg(data_out, data_in, method_, scale_x_, scale_y_, 0.0, 0.0, filter_factor_);
|
||||||
image_data_rgba8 dst(width_, height_);
|
image_rgba8 dst(width_, height_);
|
||||||
raster_colorizer_ptr colorizer = get<raster_colorizer_ptr>(sym_, keys::colorizer);
|
raster_colorizer_ptr colorizer = get<raster_colorizer_ptr>(sym_, keys::colorizer);
|
||||||
if (colorizer) colorizer->colorize(dst, data_out, nodata_, feature_);
|
if (colorizer) colorizer->colorize(dst, data_out, nodata_, feature_);
|
||||||
premultiply_alpha(dst);
|
premultiply_alpha(dst);
|
||||||
|
@ -137,9 +137,9 @@ struct image_data_warp_dispatcher
|
||||||
|
|
||||||
void operator() (image_data_null const& data_in) const {} //no-op
|
void operator() (image_data_null const& data_in) const {} //no-op
|
||||||
|
|
||||||
void operator() (image_data_rgba8 const& data_in) const
|
void operator() (image_rgba8 const& data_in) const
|
||||||
{
|
{
|
||||||
image_data_rgba8 data_out(width_, height_, true, true);
|
image_rgba8 data_out(width_, height_, true, true);
|
||||||
warp_image(data_out, data_in, prj_trans_, target_ext_, source_ext_, offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_);
|
warp_image(data_out, data_in, prj_trans_, target_ext_, source_ext_, offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_);
|
||||||
composite_(data_out, comp_op_, opacity_, start_x_, start_y_);
|
composite_(data_out, comp_op_, opacity_, start_x_, start_y_);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ struct image_data_warp_dispatcher
|
||||||
image_data_type data_out(width_, height_);
|
image_data_type data_out(width_, height_);
|
||||||
if (nodata_) data_out.set(*nodata_);
|
if (nodata_) data_out.set(*nodata_);
|
||||||
warp_image(data_out, data_in, prj_trans_, target_ext_, source_ext_, offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_);
|
warp_image(data_out, data_in, prj_trans_, target_ext_, source_ext_, offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_);
|
||||||
image_data_rgba8 dst(width_, height_);
|
image_rgba8 dst(width_, height_);
|
||||||
raster_colorizer_ptr colorizer = get<raster_colorizer_ptr>(sym_, keys::colorizer);
|
raster_colorizer_ptr colorizer = get<raster_colorizer_ptr>(sym_, keys::colorizer);
|
||||||
if (colorizer) colorizer->colorize(dst, data_out, nodata_, feature_);
|
if (colorizer) colorizer->colorize(dst, data_out, nodata_, feature_);
|
||||||
premultiply_alpha(dst);
|
premultiply_alpha(dst);
|
||||||
|
@ -205,7 +205,7 @@ void render_raster_symbolizer(raster_symbolizer const& sym,
|
||||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common.vars_, src_over);
|
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common.vars_, src_over);
|
||||||
double opacity = get<double>(sym,keys::opacity,feature, common.vars_, 1.0);
|
double opacity = get<double>(sym,keys::opacity,feature, common.vars_, 1.0);
|
||||||
// only premultiply rgba8 images
|
// only premultiply rgba8 images
|
||||||
if (source->data_.is<image_data_rgba8>())
|
if (source->data_.is<image_rgba8>())
|
||||||
{
|
{
|
||||||
auto is_premultiplied = get_optional<bool>(sym, keys::premultiplied, feature, common.vars_);
|
auto is_premultiplied = get_optional<bool>(sym, keys::premultiplied, feature, common.vars_);
|
||||||
if (is_premultiplied && *is_premultiplied)
|
if (is_premultiplied && *is_premultiplied)
|
||||||
|
@ -236,9 +236,9 @@ void render_raster_symbolizer(raster_symbolizer const& sym,
|
||||||
(std::abs(start_x) <= eps) &&
|
(std::abs(start_x) <= eps) &&
|
||||||
(std::abs(start_y) <= eps) )
|
(std::abs(start_y) <= eps) )
|
||||||
{
|
{
|
||||||
if (source->data_.is<image_data_rgba8>())
|
if (source->data_.is<image_rgba8>())
|
||||||
{
|
{
|
||||||
composite(util::get<image_data_rgba8>(source->data_), comp_op, opacity, start_x, start_y);
|
composite(util::get<image_rgba8>(source->data_), comp_op, opacity, start_x, start_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -192,7 +192,7 @@ struct tag_setter
|
||||||
throw ImageWriterException("Could not write TIFF - unknown image type provided");
|
throw ImageWriterException("Could not write TIFF - unknown image type provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void operator() (image_data_rgba8 const& data) const
|
inline void operator() (image_rgba8 const& data) const
|
||||||
{
|
{
|
||||||
TIFFSetField(output_, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
TIFFSetField(output_, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||||
TIFFSetField(output_, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
|
TIFFSetField(output_, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
|
||||||
|
|
|
@ -98,11 +98,11 @@ inline int import_image_data(T2 const& image,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// need to copy: https://github.com/mapnik/mapnik/issues/2024
|
// need to copy: https://github.com/mapnik/mapnik/issues/2024
|
||||||
image_data_rgba8 im(image.width(),image.height());
|
image_rgba8 im(image.width(),image.height());
|
||||||
for (unsigned y = 0; y < image.height(); ++y)
|
for (unsigned y = 0; y < image.height(); ++y)
|
||||||
{
|
{
|
||||||
typename T2::pixel_type const * row_from = image.getRow(y);
|
typename T2::pixel_type const * row_from = image.getRow(y);
|
||||||
image_data_rgba8::pixel_type * row_to = im.getRow(y);
|
image_rgba8::pixel_type * row_to = im.getRow(y);
|
||||||
std::copy(row_from, row_from + stride, row_to);
|
std::copy(row_from, row_from + stride, row_to);
|
||||||
}
|
}
|
||||||
if (alpha)
|
if (alpha)
|
||||||
|
@ -121,11 +121,11 @@ inline int import_image_data(T2 const& image,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline int import_image_data(image_data_rgba8 const& im,
|
inline int import_image_data(image_rgba8 const& im,
|
||||||
WebPPicture & pic,
|
WebPPicture & pic,
|
||||||
bool alpha)
|
bool alpha)
|
||||||
{
|
{
|
||||||
int stride = sizeof(image_data_rgba8::pixel_type) * im.width();
|
int stride = sizeof(image_rgba8::pixel_type) * im.width();
|
||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
return WebPPictureImportRGBA(&pic, im.getBytes(), stride);
|
return WebPPictureImportRGBA(&pic, im.getBytes(), stride);
|
||||||
|
|
|
@ -229,7 +229,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
}
|
}
|
||||||
else // working with all bands
|
else // working with all bands
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 image(im_width, im_height);
|
mapnik::image_rgba8 image(im_width, im_height);
|
||||||
image.set(std::numeric_limits<std::uint32_t>::max());
|
image.set(std::numeric_limits<std::uint32_t>::max());
|
||||||
for (int i = 0; i < nbands_; ++i)
|
for (int i = 0; i < nbands_; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -271,7 +271,7 @@ mapnik::raster_ptr read_grayscale_band(mapnik::box2d<double> const& bbox,
|
||||||
uint16_t width, uint16_t height,
|
uint16_t width, uint16_t height,
|
||||||
bool hasnodata, T reader)
|
bool hasnodata, T reader)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 image(width,height, true, true);
|
mapnik::image_rgba8 image(width,height, true, true);
|
||||||
// Start with plain white (ABGR or RGBA depending on endiannes)
|
// Start with plain white (ABGR or RGBA depending on endiannes)
|
||||||
// TODO: set to transparent instead?
|
// TODO: set to transparent instead?
|
||||||
image.set(0xffffffff);
|
image.set(0xffffffff);
|
||||||
|
@ -352,7 +352,7 @@ mapnik::raster_ptr pgraster_wkb_reader::read_grayscale(mapnik::box2d<double> con
|
||||||
mapnik::raster_ptr pgraster_wkb_reader::read_rgba(mapnik::box2d<double> const& bbox,
|
mapnik::raster_ptr pgraster_wkb_reader::read_rgba(mapnik::box2d<double> const& bbox,
|
||||||
uint16_t width, uint16_t height)
|
uint16_t width, uint16_t height)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 image(width, height, true, true);
|
mapnik::image_rgba8 image(width, height, true, true);
|
||||||
// Start with plain white (ABGR or RGBA depending on endiannes)
|
// Start with plain white (ABGR or RGBA depending on endiannes)
|
||||||
image.set(0xffffffff);
|
image.set(0xffffffff);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
using mapnik::query;
|
using mapnik::query;
|
||||||
using mapnik::image_reader;
|
using mapnik::image_reader;
|
||||||
using mapnik::feature_ptr;
|
using mapnik::feature_ptr;
|
||||||
using mapnik::image_data_rgba8;
|
using mapnik::image_rgba8;
|
||||||
using mapnik::raster;
|
using mapnik::raster;
|
||||||
using mapnik::feature_factory;
|
using mapnik::feature_factory;
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
{
|
{
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 image(width,height);
|
mapnik::image_rgba8 image(width,height);
|
||||||
unsigned char* raster_data = static_cast<unsigned char*>(raster);
|
unsigned char* raster_data = static_cast<unsigned char*>(raster);
|
||||||
unsigned char* image_data = image.getBytes();
|
unsigned char* image_data = image.getBytes();
|
||||||
std::memcpy(image_data, raster_data, size);
|
std::memcpy(image_data, raster_data, size);
|
||||||
|
|
|
@ -517,8 +517,8 @@ void agg_renderer<T0,T1>::draw_geo_extent(box2d<double> const& extent, mapnik::c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template class agg_renderer<image_data_rgba8>;
|
template class agg_renderer<image_rgba8>;
|
||||||
template void agg_renderer<image_data_rgba8>::debug_draw_box<agg::rendering_buffer>(
|
template void agg_renderer<image_rgba8>::debug_draw_box<agg::rendering_buffer>(
|
||||||
agg::rendering_buffer& buf,
|
agg::rendering_buffer& buf,
|
||||||
box2d<double> const& box,
|
box2d<double> const& box,
|
||||||
double x, double y, double angle);
|
double x, double y, double angle);
|
||||||
|
|
|
@ -109,7 +109,7 @@ void agg_renderer<T0,T1>::process(building_symbolizer const& sym,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(building_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(building_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ void agg_renderer<T0,T1>::process(debug_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(debug_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(debug_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ void agg_renderer<T0,T1>::process(dot_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(dot_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(dot_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -54,9 +54,9 @@ template <typename T>
|
||||||
struct thunk_renderer;
|
struct thunk_renderer;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct thunk_renderer<image_data_rgba8>
|
struct thunk_renderer<image_rgba8>
|
||||||
{
|
{
|
||||||
using renderer_type = agg_renderer<image_data_rgba8>;
|
using renderer_type = agg_renderer<image_rgba8>;
|
||||||
using buffer_type = renderer_type::buffer_type;
|
using buffer_type = renderer_type::buffer_type;
|
||||||
using text_renderer_type = agg_text_renderer<buffer_type>;
|
using text_renderer_type = agg_text_renderer<buffer_type>;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ struct thunk_renderer<image_data_rgba8>
|
||||||
render_vector_marker(svg_renderer, *ras_ptr_, renb, thunk.src_->bounding_box(), offset_tr, thunk.opacity_, thunk.snap_to_pixels_);
|
render_vector_marker(svg_renderer, *ras_ptr_, renb, thunk.src_->bounding_box(), offset_tr, thunk.opacity_, thunk.snap_to_pixels_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_rgba8> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_rgba8> const &thunk) const
|
||||||
{
|
{
|
||||||
using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>; // comp blender
|
using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>; // comp blender
|
||||||
using buf_type = agg::rendering_buffer;
|
using buf_type = agg::rendering_buffer;
|
||||||
|
@ -114,17 +114,17 @@ struct thunk_renderer<image_data_rgba8>
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_gray8> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_data_gray8> const &thunk) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Rendering of this image_data_gray8 type is not supported currently by the image_data_rgba8 renderer");
|
throw std::runtime_error("Rendering of this image_data_gray8 type is not supported currently by the image_rgba8 renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_gray16> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_data_gray16> const &thunk) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Rendering of this image_data_gray16 type is not supported currently by the image_data_rgba8 renderer");
|
throw std::runtime_error("Rendering of this image_data_gray16 type is not supported currently by the image_rgba8 renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_gray32f> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_data_gray32f> const &thunk) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Rendering of this image_data_gray32f type is not supported currently by the image_data_rgba8 renderer");
|
throw std::runtime_error("Rendering of this image_data_gray32f type is not supported currently by the image_rgba8 renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(text_render_thunk const &thunk) const
|
void operator()(text_render_thunk const &thunk) const
|
||||||
|
@ -179,7 +179,7 @@ void agg_renderer<T0,T1>::process(group_symbolizer const& sym,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(group_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(group_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -78,12 +78,12 @@ void agg_renderer<T0,T1>::process(line_pattern_symbolizer const& sym,
|
||||||
if ((*marker_ptr)->is_bitmap())
|
if ((*marker_ptr)->is_bitmap())
|
||||||
{
|
{
|
||||||
// FIXME: copy is necessary atm to transform a
|
// FIXME: copy is necessary atm to transform a
|
||||||
// shared_ptr<image_any> into shared_ptr<image_data_rgba8>
|
// shared_ptr<image_any> into shared_ptr<image_rgba8>
|
||||||
boost::optional<image_ptr> bitmap = (*marker_ptr)->get_bitmap_data();
|
boost::optional<image_ptr> bitmap = (*marker_ptr)->get_bitmap_data();
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
mapnik::image_any const& im = *(bitmap)->get();
|
mapnik::image_any const& im = *(bitmap)->get();
|
||||||
if (im.is<buffer_type>()) {
|
if (im.is<buffer_type>()) {
|
||||||
// invoke copy ctor of image_data_rgba8
|
// invoke copy ctor of image_rgba8
|
||||||
pat = std::make_shared<buffer_type>(util::get<buffer_type>(im));
|
pat = std::make_shared<buffer_type>(util::get<buffer_type>(im));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ void agg_renderer<T0,T1>::process(line_pattern_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(line_pattern_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(line_pattern_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(line_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(line_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ struct raster_markers_rasterizer_dispatch : public raster_markers_dispatch<Detec
|
||||||
{
|
{
|
||||||
// In the long term this should be a visitor pattern based on the type of render this->src_ provided that converts
|
// In the long term this should be a visitor pattern based on the type of render this->src_ provided that converts
|
||||||
// the destination pixel type required.
|
// the destination pixel type required.
|
||||||
render_raster_marker(renb_, ras_, util::get<image_data_rgba8>(this->src_), marker_tr, opacity, this->scale_factor_, snap_to_pixels_);
|
render_raster_marker(renb_, ras_, util::get<image_rgba8>(this->src_), marker_tr, opacity, this->scale_factor_, snap_to_pixels_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -204,7 +204,7 @@ void agg_renderer<T0,T1>::process(markers_symbolizer const& sym,
|
||||||
sym, feature, prj_trans, common_, clip_box, renderer_context);
|
sym, feature, prj_trans, common_, clip_box, renderer_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(markers_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(markers_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void agg_renderer<T0,T1>::process(point_symbolizer const& sym,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(point_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(point_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,12 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
|
||||||
if ((*marker_ptr)->is_bitmap())
|
if ((*marker_ptr)->is_bitmap())
|
||||||
{
|
{
|
||||||
// FIXME: copy is necessary atm to transform a
|
// FIXME: copy is necessary atm to transform a
|
||||||
// shared_ptr<image_any> into shared_ptr<image_data_rgba8>
|
// shared_ptr<image_any> into shared_ptr<image_rgba8>
|
||||||
boost::optional<image_ptr> bitmap = (*marker_ptr)->get_bitmap_data();
|
boost::optional<image_ptr> bitmap = (*marker_ptr)->get_bitmap_data();
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
mapnik::image_any const& im = *(bitmap)->get();
|
mapnik::image_any const& im = *(bitmap)->get();
|
||||||
if (im.is<buffer_type>()) {
|
if (im.is<buffer_type>()) {
|
||||||
// invoke copy ctor of image_data_rgba8
|
// invoke copy ctor of image_rgba8
|
||||||
pat = std::make_shared<buffer_type>(util::get<buffer_type>(im));
|
pat = std::make_shared<buffer_type>(util::get<buffer_type>(im));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(polygon_pattern_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(polygon_pattern_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void agg_renderer<T0,T1>::process(polygon_symbolizer const& sym,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(polygon_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(polygon_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ void agg_renderer<T0,T1>::process(raster_symbolizer const& sym,
|
||||||
{
|
{
|
||||||
render_raster_symbolizer(
|
render_raster_symbolizer(
|
||||||
sym, feature, prj_trans, common_,
|
sym, feature, prj_trans, common_,
|
||||||
[&](image_data_rgba8 & target, composite_mode_e comp_op, double opacity,
|
[&](image_rgba8 & target, composite_mode_e comp_op, double opacity,
|
||||||
int start_x, int start_y) {
|
int start_x, int start_y) {
|
||||||
composite(*current_buffer_, target,
|
composite(*current_buffer_, target,
|
||||||
comp_op, opacity, start_x, start_y);
|
comp_op, opacity, start_x, start_y);
|
||||||
|
@ -59,7 +59,7 @@ void agg_renderer<T0,T1>::process(raster_symbolizer const& sym,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(raster_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(raster_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ void agg_renderer<T0,T1>::process(shield_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(shield_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(shield_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ void agg_renderer<T0,T1>::process(text_symbolizer const& sym,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template void agg_renderer<image_data_rgba8>::process(text_symbolizer const&,
|
template void agg_renderer<image_rgba8>::process(text_symbolizer const&,
|
||||||
mapnik::feature_impl &,
|
mapnik::feature_impl &,
|
||||||
proj_transform const&);
|
proj_transform const&);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct visitor_context_add_image_1
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_context_add_image_1::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_context_add_image_1::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
context_.add_image(x_, y_, data, opacity_);
|
context_.add_image(x_, y_, data, opacity_);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ struct visitor_context_add_image_2
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_context_add_image_2::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_context_add_image_2::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
context_.add_image(tr_, data, opacity_);
|
context_.add_image(tr_, data, opacity_);
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ void cairo_context::add_image(agg::trans_affine const& tr, image_any & data, dou
|
||||||
util::apply_visitor(detail::visitor_context_add_image_2(*this,tr,opacity), data);
|
util::apply_visitor(detail::visitor_context_add_image_2(*this,tr,opacity), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cairo_context::add_image(double x, double y, image_data_rgba8 & data, double opacity)
|
void cairo_context::add_image(double x, double y, image_rgba8 & data, double opacity)
|
||||||
{
|
{
|
||||||
cairo_pattern pattern(data);
|
cairo_pattern pattern(data);
|
||||||
pattern.set_origin(x, y);
|
pattern.set_origin(x, y);
|
||||||
|
@ -409,7 +409,7 @@ void cairo_context::add_image(double x, double y, image_data_rgba8 & data, doubl
|
||||||
check_object_status_and_throw_exception(*this);
|
check_object_status_and_throw_exception(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cairo_context::add_image(agg::trans_affine const& tr, image_data_rgba8 & data, double opacity)
|
void cairo_context::add_image(agg::trans_affine const& tr, image_rgba8 & data, double opacity)
|
||||||
{
|
{
|
||||||
cairo_pattern pattern(data);
|
cairo_pattern pattern(data);
|
||||||
if (!tr.is_identity())
|
if (!tr.is_identity())
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct thunk_renderer
|
||||||
thunk.opacity_);
|
thunk.opacity_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_rgba8> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_rgba8> const &thunk) const
|
||||||
{
|
{
|
||||||
cairo_save_restore guard(context_);
|
cairo_save_restore guard(context_);
|
||||||
context_.set_operator(thunk.comp_op_);
|
context_.set_operator(thunk.comp_op_);
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct visitor_create_pattern
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
std::shared_ptr<cairo_pattern> visitor_create_pattern::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
std::shared_ptr<cairo_pattern> visitor_create_pattern::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
return std::make_shared<cairo_pattern>(data, opacity_);
|
return std::make_shared<cairo_pattern>(data, opacity_);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
|
||||||
cairo_save_restore guard(context_);
|
cairo_save_restore guard(context_);
|
||||||
context_.set_operator(comp_op);
|
context_.set_operator(comp_op);
|
||||||
std::shared_ptr<cairo_pattern> pattern;
|
std::shared_ptr<cairo_pattern> pattern;
|
||||||
std::shared_ptr<image_data_rgba8> image = nullptr;
|
std::shared_ptr<image_rgba8> image = nullptr;
|
||||||
// TODO - re-implement at renderer level like polygon_pattern symbolizer
|
// TODO - re-implement at renderer level like polygon_pattern symbolizer
|
||||||
double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
|
double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
|
||||||
if ((*marker)->is_bitmap())
|
if ((*marker)->is_bitmap())
|
||||||
|
@ -101,7 +101,7 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
|
||||||
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||||
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
|
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
|
||||||
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
|
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
|
||||||
image = render_pattern<image_data_rgba8>(ras, **marker, image_tr, 1.0);
|
image = render_pattern<image_rgba8>(ras, **marker, image_tr, 1.0);
|
||||||
pattern = std::make_unique<cairo_pattern>(*image, opacity);
|
pattern = std::make_unique<cairo_pattern>(*image, opacity);
|
||||||
width = image->width();
|
width = image->width();
|
||||||
height = image->height();
|
height = image->height();
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct visitor_set_pattern
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_set_pattern::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_set_pattern::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
cairo_pattern pattern(data, opacity_);
|
cairo_pattern pattern(data, opacity_);
|
||||||
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||||
|
@ -119,7 +119,7 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapnik::rasterizer ras;
|
mapnik::rasterizer ras;
|
||||||
std::shared_ptr<image_data_rgba8> image = render_pattern<image_data_rgba8>(ras, **marker, image_tr, 1.0); //
|
std::shared_ptr<image_rgba8> image = render_pattern<image_rgba8>(ras, **marker, image_tr, 1.0); //
|
||||||
cairo_pattern pattern(*image, opacity);
|
cairo_pattern pattern(*image, opacity);
|
||||||
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||||
pattern.set_origin(offset_x, offset_y);
|
pattern.set_origin(offset_x, offset_y);
|
||||||
|
|
|
@ -43,7 +43,7 @@ void cairo_renderer<T>::process(raster_symbolizer const& sym,
|
||||||
cairo_save_restore guard(context_);
|
cairo_save_restore guard(context_);
|
||||||
render_raster_symbolizer(
|
render_raster_symbolizer(
|
||||||
sym, feature, prj_trans, common_,
|
sym, feature, prj_trans, common_,
|
||||||
[&](image_data_rgba8 &target, composite_mode_e comp_op, double opacity,
|
[&](image_rgba8 &target, composite_mode_e comp_op, double opacity,
|
||||||
int start_x, int start_y) {
|
int start_x, int start_y) {
|
||||||
context_.set_operator(comp_op);
|
context_.set_operator(comp_op);
|
||||||
context_.add_image(start_x, start_y, target, opacity);
|
context_.add_image(start_x, start_y, target, opacity);
|
||||||
|
|
|
@ -55,6 +55,6 @@ template class feature_style_processor<svg_renderer<std::ostream_iterator<char>
|
||||||
template class feature_style_processor<grid_renderer<grid> >;
|
template class feature_style_processor<grid_renderer<grid> >;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template class feature_style_processor<agg_renderer<image_data_rgba8> >;
|
template class feature_style_processor<agg_renderer<image_rgba8> >;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_impl const& feature, pixel_
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image_data_rgba8 const& data = util::get<image_data_rgba8>(**marker.get_bitmap_data());
|
image_rgba8 const& data = util::get<image_rgba8>(**marker.get_bitmap_data());
|
||||||
double width = data.width();
|
double width = data.width();
|
||||||
double height = data.height();
|
double height = data.height();
|
||||||
double cx = 0.5 * width;
|
double cx = 0.5 * width;
|
||||||
|
@ -179,7 +179,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_impl const& feature, pixel_
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image_data_rgba8 target(data.width(), data.height());
|
image_rgba8 target(data.width(), data.height());
|
||||||
mapnik::scale_image_agg(target,
|
mapnik::scale_image_agg(target,
|
||||||
data,
|
data,
|
||||||
SCALING_NEAR,
|
SCALING_NEAR,
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct thunk_renderer
|
||||||
pixmap_.add_feature(feature_);
|
pixmap_.add_feature(feature_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_rgba8> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_rgba8> const &thunk) const
|
||||||
{
|
{
|
||||||
using buf_type = grid_rendering_buffer;
|
using buf_type = grid_rendering_buffer;
|
||||||
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
|
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
|
||||||
|
@ -121,17 +121,17 @@ struct thunk_renderer
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_gray8> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_data_gray8> const &thunk) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Rendering of this image_data_gray8 type is not supported currently by the image_data_rgba8 renderer");
|
throw std::runtime_error("Rendering of this image_data_gray8 type is not supported currently by the image_rgba8 renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_gray16> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_data_gray16> const &thunk) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Rendering of this image_data_gray16 type is not supported currently by the image_data_rgba8 renderer");
|
throw std::runtime_error("Rendering of this image_data_gray16 type is not supported currently by the image_rgba8 renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(raster_marker_render_thunk<image_data_gray32f> const &thunk) const
|
void operator()(raster_marker_render_thunk<image_data_gray32f> const &thunk) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Rendering of this image_data_gray32f type is not supported currently by the image_data_rgba8 renderer");
|
throw std::runtime_error("Rendering of this image_data_gray32f type is not supported currently by the image_rgba8 renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(text_render_thunk const &thunk) const
|
void operator()(text_render_thunk const &thunk) const
|
||||||
|
|
|
@ -167,7 +167,7 @@ struct raster_markers_rasterizer_dispatch : public raster_markers_dispatch<Detec
|
||||||
{
|
{
|
||||||
// In the long term this should be a visitor pattern based on the type of render this->src_ provided that converts
|
// In the long term this should be a visitor pattern based on the type of render this->src_ provided that converts
|
||||||
// the destination pixel type required.
|
// the destination pixel type required.
|
||||||
render_raster_marker(RendererType(renb_), ras_, util::get<image_data_rgba8>(this->src_), this->feature_, marker_tr, opacity);
|
render_raster_marker(RendererType(renb_), ras_, util::get<image_rgba8>(this->src_), this->feature_, marker_tr, opacity);
|
||||||
if (!placed_)
|
if (!placed_)
|
||||||
{
|
{
|
||||||
pixmap_.add_feature(this->feature_);
|
pixmap_.add_feature(this->feature_);
|
||||||
|
|
|
@ -149,14 +149,14 @@ struct rendering_buffer
|
||||||
} // end detail ns
|
} // end detail ns
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void composite(image_data_rgba8 & dst, image_data_rgba8 const& src, composite_mode_e mode,
|
MAPNIK_DECL void composite(image_rgba8 & dst, image_rgba8 const& src, composite_mode_e mode,
|
||||||
float opacity,
|
float opacity,
|
||||||
int dx,
|
int dx,
|
||||||
int dy)
|
int dy)
|
||||||
{
|
{
|
||||||
using color = agg::rgba8;
|
using color = agg::rgba8;
|
||||||
using order = agg::order_rgba;
|
using order = agg::order_rgba;
|
||||||
using const_rendering_buffer = detail::rendering_buffer<image_data_rgba8>;
|
using const_rendering_buffer = detail::rendering_buffer<image_rgba8>;
|
||||||
using blender_type = agg::comp_op_adaptor_rgba_pre<color, order>;
|
using blender_type = agg::comp_op_adaptor_rgba_pre<color, order>;
|
||||||
using pixfmt_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
|
using pixfmt_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
|
||||||
using renderer_type = agg::renderer_base<pixfmt_type>;
|
using renderer_type = agg::renderer_base<pixfmt_type>;
|
||||||
|
@ -233,9 +233,9 @@ void composite_visitor::operator() (T & dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void composite_visitor::operator()<image_data_rgba8> (image_data_rgba8 & dst)
|
void composite_visitor::operator()<image_rgba8> (image_rgba8 & dst)
|
||||||
{
|
{
|
||||||
composite(dst, util::get<image_data_rgba8>(src_), mode_, opacity_, dx_, dy_);
|
composite(dst, util::get<image_rgba8>(src_), mode_, opacity_, dx_, dy_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -165,7 +165,7 @@ void scale_image_agg(T & target, T const& source, scaling_method_e scaling_metho
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_data_rgba8 &, image_data_rgba8 const&, scaling_method_e,
|
template MAPNIK_DECL void scale_image_agg(image_rgba8 &, image_rgba8 const&, scaling_method_e,
|
||||||
double, double , double, double , double);
|
double, double , double, double , double);
|
||||||
|
|
||||||
template MAPNIK_DECL void scale_image_agg(image_data_gray8 &, image_data_gray8 const&, scaling_method_e,
|
template MAPNIK_DECL void scale_image_agg(image_data_gray8 &, image_data_gray8 const&, scaling_method_e,
|
||||||
|
|
|
@ -126,7 +126,7 @@ MAPNIK_DECL void save_to_stream(T const& image,
|
||||||
// This can be removed once image_any and image_view_any are the only
|
// This can be removed once image_any and image_view_any are the only
|
||||||
// items using this template
|
// items using this template
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void save_to_stream<image_data_rgba8>(image_data_rgba8 const& image,
|
MAPNIK_DECL void save_to_stream<image_rgba8>(image_rgba8 const& image,
|
||||||
std::ostream & stream,
|
std::ostream & stream,
|
||||||
std::string const& type,
|
std::string const& type,
|
||||||
rgba_palette const& palette)
|
rgba_palette const& palette)
|
||||||
|
@ -222,7 +222,7 @@ MAPNIK_DECL void save_to_stream(T const& image,
|
||||||
// This can be removed once image_any and image_view_any are the only
|
// This can be removed once image_any and image_view_any are the only
|
||||||
// items using this template
|
// items using this template
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void save_to_stream<image_data_rgba8>(image_data_rgba8 const& image,
|
MAPNIK_DECL void save_to_stream<image_rgba8>(image_rgba8 const& image,
|
||||||
std::ostream & stream,
|
std::ostream & stream,
|
||||||
std::string const& type)
|
std::string const& type)
|
||||||
{
|
{
|
||||||
|
@ -321,27 +321,27 @@ MAPNIK_DECL void save_to_file(T const& image, std::string const& filename, rgba_
|
||||||
else throw ImageWriterException("Could not write file to " + filename );
|
else throw ImageWriterException("Could not write file to " + filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
// image_data_rgba8
|
// image_rgba8
|
||||||
template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const& palette);
|
rgba_palette const& palette);
|
||||||
|
|
||||||
template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
template MAPNIK_DECL void save_to_file<image_data_rgba8>(image_data_rgba8 const&,
|
template MAPNIK_DECL void save_to_file<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const& palette);
|
rgba_palette const& palette);
|
||||||
|
|
||||||
template MAPNIK_DECL std::string save_to_string<image_data_rgba8>(image_data_rgba8 const&,
|
template MAPNIK_DECL std::string save_to_string<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&);
|
std::string const&);
|
||||||
|
|
||||||
template MAPNIK_DECL std::string save_to_string<image_data_rgba8>(image_data_rgba8 const&,
|
template MAPNIK_DECL std::string save_to_string<image_rgba8>(image_rgba8 const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
rgba_palette const& palette);
|
rgba_palette const& palette);
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ struct is_solid_visitor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template bool is_solid_visitor::operator()<image_data_rgba8> (image_data_rgba8 const& data);
|
template bool is_solid_visitor::operator()<image_rgba8> (image_rgba8 const& data);
|
||||||
template bool is_solid_visitor::operator()<image_data_gray8> (image_data_gray8 const& data);
|
template bool is_solid_visitor::operator()<image_data_gray8> (image_data_gray8 const& data);
|
||||||
template bool is_solid_visitor::operator()<image_data_gray16> (image_data_gray16 const& data);
|
template bool is_solid_visitor::operator()<image_data_gray16> (image_data_gray16 const& data);
|
||||||
template bool is_solid_visitor::operator()<image_data_gray32f> (image_data_gray32f const& data);
|
template bool is_solid_visitor::operator()<image_data_gray32f> (image_data_gray32f const& data);
|
||||||
|
@ -447,9 +447,9 @@ MAPNIK_DECL bool is_solid(T const& image)
|
||||||
template MAPNIK_DECL bool is_solid<image_any> (image_any const&);
|
template MAPNIK_DECL bool is_solid<image_any> (image_any const&);
|
||||||
template MAPNIK_DECL bool is_solid<image_view_any> (image_view_any const&);
|
template MAPNIK_DECL bool is_solid<image_view_any> (image_view_any const&);
|
||||||
|
|
||||||
// Temporary until image_data_rgba8 is removed from passing
|
// Temporary until image_rgba8 is removed from passing
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL bool is_solid<image_data_rgba8>(image_data_rgba8 const& image)
|
MAPNIK_DECL bool is_solid<image_rgba8>(image_rgba8 const& image)
|
||||||
{
|
{
|
||||||
detail::is_solid_visitor visitor;
|
detail::is_solid_visitor visitor;
|
||||||
return visitor(image);
|
return visitor(image);
|
||||||
|
@ -476,7 +476,7 @@ struct premultiply_visitor
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool premultiply_visitor::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
bool premultiply_visitor::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
if (!data.get_premultiplied())
|
if (!data.get_premultiplied())
|
||||||
{
|
{
|
||||||
|
@ -500,7 +500,7 @@ struct demultiply_visitor
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool demultiply_visitor::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
bool demultiply_visitor::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
if (data.get_premultiplied())
|
if (data.get_premultiplied())
|
||||||
{
|
{
|
||||||
|
@ -539,7 +539,7 @@ template MAPNIK_DECL bool premultiply_alpha<image_any> (image_any &);
|
||||||
|
|
||||||
// Temporary, can be removed once image_view_any and image_any are the only ones passed
|
// Temporary, can be removed once image_view_any and image_any are the only ones passed
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL bool premultiply_alpha<image_data_rgba8>(image_data_rgba8 & image)
|
MAPNIK_DECL bool premultiply_alpha<image_rgba8>(image_rgba8 & image)
|
||||||
{
|
{
|
||||||
detail::premultiply_visitor visit;
|
detail::premultiply_visitor visit;
|
||||||
return visit(image);
|
return visit(image);
|
||||||
|
@ -555,7 +555,7 @@ template MAPNIK_DECL bool demultiply_alpha<image_any> (image_any &);
|
||||||
|
|
||||||
// Temporary, can be removed once image_view_any and image_any are the only ones passed
|
// Temporary, can be removed once image_view_any and image_any are the only ones passed
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL bool demultiply_alpha<image_data_rgba8>(image_data_rgba8 & image)
|
MAPNIK_DECL bool demultiply_alpha<image_rgba8>(image_rgba8 & image)
|
||||||
{
|
{
|
||||||
detail::demultiply_visitor visit;
|
detail::demultiply_visitor visit;
|
||||||
return visit(image);
|
return visit(image);
|
||||||
|
@ -571,7 +571,7 @@ template void set_premultiplied_alpha<image_any> (image_any &, bool);
|
||||||
|
|
||||||
// Temporary, can be removed once image_view_any and image_any are the only ones passed
|
// Temporary, can be removed once image_view_any and image_any are the only ones passed
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void set_premultiplied_alpha<image_data_rgba8>(image_data_rgba8 & image, bool status)
|
MAPNIK_DECL void set_premultiplied_alpha<image_rgba8>(image_rgba8 & image, bool status)
|
||||||
{
|
{
|
||||||
detail::set_premultiplied_visitor visit(status);
|
detail::set_premultiplied_visitor visit(status);
|
||||||
visit(image);
|
visit(image);
|
||||||
|
@ -596,9 +596,9 @@ struct visitor_set_alpha
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_set_alpha::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_set_alpha::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
using pixel_type = typename image_data_rgba8::pixel_type;
|
using pixel_type = typename image_rgba8::pixel_type;
|
||||||
for (unsigned int y = 0; y < data.height(); ++y)
|
for (unsigned int y = 0; y < data.height(); ++y)
|
||||||
{
|
{
|
||||||
pixel_type* row_to = data.getRow(y);
|
pixel_type* row_to = data.getRow(y);
|
||||||
|
@ -635,7 +635,7 @@ MAPNIK_DECL void set_alpha<image_any> (image_any & data, float opacity)
|
||||||
|
|
||||||
// TEMPORARY can be removed once image_any is only way it is being passed.
|
// TEMPORARY can be removed once image_any is only way it is being passed.
|
||||||
template<>
|
template<>
|
||||||
MAPNIK_DECL void set_alpha<image_data_rgba8> (image_data_rgba8 & data, float opacity)
|
MAPNIK_DECL void set_alpha<image_rgba8> (image_rgba8 & data, float opacity)
|
||||||
{
|
{
|
||||||
// Prior to calling the data must not be premultiplied
|
// Prior to calling the data must not be premultiplied
|
||||||
bool remultiply = mapnik::demultiply_alpha(data);
|
bool remultiply = mapnik::demultiply_alpha(data);
|
||||||
|
@ -659,9 +659,9 @@ struct visitor_set_grayscale_to_alpha
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_set_grayscale_to_alpha::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_set_grayscale_to_alpha::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
using pixel_type = typename image_data_rgba8::pixel_type;
|
using pixel_type = typename image_rgba8::pixel_type;
|
||||||
for (unsigned int y = 0; y < data.height(); ++y)
|
for (unsigned int y = 0; y < data.height(); ++y)
|
||||||
{
|
{
|
||||||
pixel_type* row_from = data.getRow(y);
|
pixel_type* row_from = data.getRow(y);
|
||||||
|
@ -696,7 +696,7 @@ MAPNIK_DECL void set_grayscale_to_alpha<image_any> (image_any & data)
|
||||||
|
|
||||||
// TEMPORARY can be removed once image_any is only way it is being passed.
|
// TEMPORARY can be removed once image_any is only way it is being passed.
|
||||||
template<>
|
template<>
|
||||||
MAPNIK_DECL void set_grayscale_to_alpha<image_data_rgba8> (image_data_rgba8 & data)
|
MAPNIK_DECL void set_grayscale_to_alpha<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
// Prior to calling the data must not be premultiplied
|
// Prior to calling the data must not be premultiplied
|
||||||
bool remultiply = mapnik::demultiply_alpha(data);
|
bool remultiply = mapnik::demultiply_alpha(data);
|
||||||
|
@ -727,9 +727,9 @@ struct visitor_set_color_to_alpha
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_set_color_to_alpha::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_set_color_to_alpha::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
using pixel_type = typename image_data_rgba8::pixel_type;
|
using pixel_type = typename image_rgba8::pixel_type;
|
||||||
for (unsigned y = 0; y < data.height(); ++y)
|
for (unsigned y = 0; y < data.height(); ++y)
|
||||||
{
|
{
|
||||||
pixel_type* row_from = data.getRow(y);
|
pixel_type* row_from = data.getRow(y);
|
||||||
|
@ -763,7 +763,7 @@ MAPNIK_DECL void set_color_to_alpha<image_any> (image_any & data, color const& c
|
||||||
|
|
||||||
// TEMPORARY can be removed once image_any is only way it is being passed.
|
// TEMPORARY can be removed once image_any is only way it is being passed.
|
||||||
template<>
|
template<>
|
||||||
MAPNIK_DECL void set_color_to_alpha<image_data_rgba8> (image_data_rgba8 & data, color const& c)
|
MAPNIK_DECL void set_color_to_alpha<image_rgba8> (image_rgba8 & data, color const& c)
|
||||||
{
|
{
|
||||||
// Prior to calling the data must not be premultiplied
|
// Prior to calling the data must not be premultiplied
|
||||||
bool remultiply = mapnik::demultiply_alpha(data);
|
bool remultiply = mapnik::demultiply_alpha(data);
|
||||||
|
@ -835,7 +835,7 @@ template MAPNIK_DECL void fill(image_any &, double const&);
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void fill<image_data_rgba8, color> (image_data_rgba8 & data , color const& val)
|
MAPNIK_DECL void fill<image_rgba8, color> (image_rgba8 & data , color const& val)
|
||||||
{
|
{
|
||||||
detail::visitor_fill<color> visitor(val);
|
detail::visitor_fill<color> visitor(val);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -843,7 +843,7 @@ MAPNIK_DECL void fill<image_data_rgba8, color> (image_data_rgba8 & data , color
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void fill<image_data_rgba8, uint32_t> (image_data_rgba8 & data , uint32_t const& val)
|
MAPNIK_DECL void fill<image_rgba8, uint32_t> (image_rgba8 & data , uint32_t const& val)
|
||||||
{
|
{
|
||||||
detail::visitor_fill<uint32_t> visitor(val);
|
detail::visitor_fill<uint32_t> visitor(val);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -851,7 +851,7 @@ MAPNIK_DECL void fill<image_data_rgba8, uint32_t> (image_data_rgba8 & data , uin
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void fill<image_data_rgba8, int32_t> (image_data_rgba8 & data , int32_t const& val)
|
MAPNIK_DECL void fill<image_rgba8, int32_t> (image_rgba8 & data , int32_t const& val)
|
||||||
{
|
{
|
||||||
detail::visitor_fill<int32_t> visitor(val);
|
detail::visitor_fill<int32_t> visitor(val);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -894,10 +894,10 @@ struct visitor_set_rectangle
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void visitor_set_rectangle::operator()<image_data_rgba8> (image_data_rgba8 & dst)
|
void visitor_set_rectangle::operator()<image_rgba8> (image_rgba8 & dst)
|
||||||
{
|
{
|
||||||
using pixel_type = typename image_data_rgba8::pixel_type;
|
using pixel_type = typename image_rgba8::pixel_type;
|
||||||
image_data_rgba8 src = util::get<image_data_rgba8>(src_);
|
image_rgba8 src = util::get<image_rgba8>(src_);
|
||||||
box2d<int> ext0(0,0,dst.width(),dst.height());
|
box2d<int> ext0(0,0,dst.width(),dst.height());
|
||||||
box2d<int> ext1(x0_,y0_,x0_+src.width(),y0_+src.height());
|
box2d<int> ext1(x0_,y0_,x0_+src.width(),y0_+src.height());
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ struct visitor_composite_pixel
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void visitor_composite_pixel::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
void visitor_composite_pixel::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
using color_type = agg::rgba8;
|
using color_type = agg::rgba8;
|
||||||
using value_type = color_type::value_type;
|
using value_type = color_type::value_type;
|
||||||
|
@ -1002,7 +1002,7 @@ MAPNIK_DECL void composite_pixel(T & data, unsigned op, int x, int y, unsigned c
|
||||||
|
|
||||||
// Temporary delete later
|
// Temporary delete later
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void composite_pixel<image_data_rgba8>(image_data_rgba8 & data, unsigned op, int x, int y, unsigned c, unsigned cover, double opacity )
|
MAPNIK_DECL void composite_pixel<image_rgba8>(image_rgba8 & data, unsigned op, int x, int y, unsigned c, unsigned cover, double opacity )
|
||||||
{
|
{
|
||||||
detail::visitor_composite_pixel visitor(op, x, y, c, cover, opacity);
|
detail::visitor_composite_pixel visitor(op, x, y, c, cover, opacity);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -1078,7 +1078,7 @@ template MAPNIK_DECL void set_pixel(image_any &, std::size_t, std::size_t, doubl
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void set_pixel<image_data_rgba8, color> (image_data_rgba8 & data, std::size_t x, std::size_t y, color const& val)
|
MAPNIK_DECL void set_pixel<image_rgba8, color> (image_rgba8 & data, std::size_t x, std::size_t y, color const& val)
|
||||||
{
|
{
|
||||||
detail::visitor_set_pixel<color> visitor(x, y, val);
|
detail::visitor_set_pixel<color> visitor(x, y, val);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -1086,7 +1086,7 @@ MAPNIK_DECL void set_pixel<image_data_rgba8, color> (image_data_rgba8 & data, st
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void set_pixel<image_data_rgba8, uint32_t> (image_data_rgba8 & data, std::size_t x, std::size_t y, uint32_t const& val)
|
MAPNIK_DECL void set_pixel<image_rgba8, uint32_t> (image_rgba8 & data, std::size_t x, std::size_t y, uint32_t const& val)
|
||||||
{
|
{
|
||||||
detail::visitor_set_pixel<uint32_t> visitor(x, y, val);
|
detail::visitor_set_pixel<uint32_t> visitor(x, y, val);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -1094,7 +1094,7 @@ MAPNIK_DECL void set_pixel<image_data_rgba8, uint32_t> (image_data_rgba8 & data,
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL void set_pixel<image_data_rgba8, int32_t> (image_data_rgba8 & data, std::size_t x, std::size_t y, int32_t const& val)
|
MAPNIK_DECL void set_pixel<image_rgba8, int32_t> (image_rgba8 & data, std::size_t x, std::size_t y, int32_t const& val)
|
||||||
{
|
{
|
||||||
detail::visitor_set_pixel<int32_t> visitor(x, y, val);
|
detail::visitor_set_pixel<int32_t> visitor(x, y, val);
|
||||||
visitor(data);
|
visitor(data);
|
||||||
|
@ -1176,7 +1176,7 @@ template MAPNIK_DECL double get_pixel(image_any const&, std::size_t, std::size_t
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL color get_pixel<image_data_rgba8, color> (image_data_rgba8 const& data, std::size_t x, std::size_t y)
|
MAPNIK_DECL color get_pixel<image_rgba8, color> (image_rgba8 const& data, std::size_t x, std::size_t y)
|
||||||
{
|
{
|
||||||
detail::visitor_get_pixel<color> visitor(x, y);
|
detail::visitor_get_pixel<color> visitor(x, y);
|
||||||
return visitor(data);
|
return visitor(data);
|
||||||
|
@ -1184,7 +1184,7 @@ MAPNIK_DECL color get_pixel<image_data_rgba8, color> (image_data_rgba8 const& da
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL uint32_t get_pixel<image_data_rgba8, uint32_t> (image_data_rgba8 const& data, std::size_t x, std::size_t y)
|
MAPNIK_DECL uint32_t get_pixel<image_rgba8, uint32_t> (image_rgba8 const& data, std::size_t x, std::size_t y)
|
||||||
{
|
{
|
||||||
detail::visitor_get_pixel<uint32_t> visitor(x, y);
|
detail::visitor_get_pixel<uint32_t> visitor(x, y);
|
||||||
return visitor(data);
|
return visitor(data);
|
||||||
|
@ -1192,7 +1192,7 @@ MAPNIK_DECL uint32_t get_pixel<image_data_rgba8, uint32_t> (image_data_rgba8 con
|
||||||
|
|
||||||
// Temporary remove these later!
|
// Temporary remove these later!
|
||||||
template <>
|
template <>
|
||||||
MAPNIK_DECL int32_t get_pixel<image_data_rgba8, int32_t> (image_data_rgba8 const& data, std::size_t x, std::size_t y)
|
MAPNIK_DECL int32_t get_pixel<image_rgba8, int32_t> (image_rgba8 const& data, std::size_t x, std::size_t y)
|
||||||
{
|
{
|
||||||
detail::visitor_get_pixel<int32_t> visitor(x, y);
|
detail::visitor_get_pixel<int32_t> visitor(x, y);
|
||||||
return visitor(data);
|
return visitor(data);
|
||||||
|
|
|
@ -65,7 +65,7 @@ void process_rgba8_jpeg(T const& image, std::string const& t, std::ostream & str
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void jpeg_saver::operator()<image_data_rgba8> (image_data_rgba8 const& image) const
|
void jpeg_saver::operator()<image_rgba8> (image_rgba8 const& image) const
|
||||||
{
|
{
|
||||||
process_rgba8_jpeg(image, t_, stream_);
|
process_rgba8_jpeg(image, t_, stream_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ void process_rgba8_png(T const& image,
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void png_saver_pal::operator()<image_data_rgba8> (image_data_rgba8 const& image) const
|
void png_saver_pal::operator()<image_rgba8> (image_rgba8 const& image) const
|
||||||
{
|
{
|
||||||
process_rgba8_png_pal(image, t_, stream_, pal_);
|
process_rgba8_png_pal(image, t_, stream_, pal_);
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ void png_saver_pal::operator()<image_view_rgba8> (image_view_rgba8 const& image)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void png_saver::operator()<image_data_rgba8> (image_data_rgba8 const& image) const
|
void png_saver::operator()<image_rgba8> (image_rgba8 const& image) const
|
||||||
{
|
{
|
||||||
process_rgba8_png(image, t_, stream_);
|
process_rgba8_png(image, t_, stream_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ void tiff_saver::operator() (T const& image) const
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template void tiff_saver::operator() (image_data_rgba8 const& image) const;
|
template void tiff_saver::operator() (image_rgba8 const& image) const;
|
||||||
template void tiff_saver::operator() (image_data_gray8 const& image) const;
|
template void tiff_saver::operator() (image_data_gray8 const& image) const;
|
||||||
template void tiff_saver::operator() (image_data_gray16 const& image) const;
|
template void tiff_saver::operator() (image_data_gray16 const& image) const;
|
||||||
template void tiff_saver::operator() (image_data_gray32f const& image) const;
|
template void tiff_saver::operator() (image_data_gray32f const& image) const;
|
||||||
|
|
|
@ -360,7 +360,7 @@ void process_rgba8_webp(T const& image, std::string const& t, std::ostream & str
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void webp_saver::operator()<image_data_rgba8> (image_data_rgba8 const& image) const
|
void webp_saver::operator()<image_rgba8> (image_rgba8 const& image) const
|
||||||
{
|
{
|
||||||
process_rgba8_webp(image, t_, stream_);
|
process_rgba8_webp(image, t_, stream_);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ void webp_saver::operator() (T const& image) const
|
||||||
throw ImageWriterException("Mapnik does not support webp grayscale images");
|
throw ImageWriterException("Mapnik does not support webp grayscale images");
|
||||||
}
|
}
|
||||||
|
|
||||||
template void webp_saver::operator()<image_data_rgba8> (image_data_rgba8 const& image) const;
|
template void webp_saver::operator()<image_rgba8> (image_rgba8 const& image) const;
|
||||||
template void webp_saver::operator()<image_data_gray8> (image_data_gray8 const& image) const;
|
template void webp_saver::operator()<image_data_gray8> (image_data_gray8 const& image) const;
|
||||||
template void webp_saver::operator()<image_data_gray16> (image_data_gray16 const& image) const;
|
template void webp_saver::operator()<image_data_gray16> (image_data_gray16 const& image) const;
|
||||||
template void webp_saver::operator()<image_data_gray32f> (image_data_gray32f const& image) const;
|
template void webp_saver::operator()<image_data_gray32f> (image_data_gray32f const& image) const;
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double> > bounding_box() const final;
|
boost::optional<box2d<double> > bounding_box() const final;
|
||||||
inline bool has_alpha() const final { return false; }
|
inline bool has_alpha() const final { return false; }
|
||||||
void read(unsigned x,unsigned y,image_data_rgba8& image) final;
|
void read(unsigned x,unsigned y,image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
@ -265,7 +265,7 @@ boost::optional<box2d<double> > jpeg_reader<T>::bounding_box() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void jpeg_reader<T>::read(unsigned x0, unsigned y0, image_data_rgba8& image)
|
void jpeg_reader<T>::read(unsigned x0, unsigned y0, image_rgba8& image)
|
||||||
{
|
{
|
||||||
stream_.clear();
|
stream_.clear();
|
||||||
stream_.seekg(0, std::ios_base::beg);
|
stream_.seekg(0, std::ios_base::beg);
|
||||||
|
@ -322,7 +322,7 @@ void jpeg_reader<T>::read(unsigned x0, unsigned y0, image_data_rgba8& image)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
image_any jpeg_reader<T>::read(unsigned x, unsigned y, unsigned width, unsigned height)
|
image_any jpeg_reader<T>::read(unsigned x, unsigned y, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
image_data_rgba8 data(width,height, true, true);
|
image_rgba8 data(width,height, true, true);
|
||||||
read(x, y, data);
|
read(x, y, data);
|
||||||
return image_any(std::move(data));
|
return image_any(std::move(data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ marker_cache::marker_cache()
|
||||||
"<svg width='100%' height='100%' version='1.1' xmlns='http://www.w3.org/2000/svg'>"
|
"<svg width='100%' height='100%' version='1.1' xmlns='http://www.w3.org/2000/svg'>"
|
||||||
"<path fill='#0000FF' stroke='black' stroke-width='.5' d='m 31.698405,7.5302648 -8.910967,-6.0263712 0.594993,4.8210971 -18.9822542,0 0,2.4105482 18.9822542,0 -0.594993,4.8210971 z'/>"
|
"<path fill='#0000FF' stroke='black' stroke-width='.5' d='m 31.698405,7.5302648 -8.910967,-6.0263712 0.594993,4.8210971 -18.9822542,0 0,2.4105482 18.9822542,0 -0.594993,4.8210971 z'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
image_data_rgba8 im(4,4,true,true);
|
image_rgba8 im(4,4,true,true);
|
||||||
im.set(0xff000000);
|
im.set(0xff000000);
|
||||||
boost::optional<mapnik::image_ptr> bitmap_data = boost::optional<mapnik::image_ptr>(std::make_shared<image_any>(std::move(im)));
|
boost::optional<mapnik::image_ptr> bitmap_data = boost::optional<mapnik::image_ptr>(std::make_shared<image_any>(std::move(im)));
|
||||||
marker_ptr mark = std::make_shared<mapnik::marker>(bitmap_data);
|
marker_ptr mark = std::make_shared<mapnik::marker>(bitmap_data);
|
||||||
|
@ -135,7 +135,7 @@ struct visitor_create_marker
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
marker_ptr visitor_create_marker::operator()<image_data_rgba8> (image_data_rgba8 & data)
|
marker_ptr visitor_create_marker::operator()<image_rgba8> (image_rgba8 & data)
|
||||||
{
|
{
|
||||||
std::shared_ptr<image_any> image = std::make_shared<image_any>(data);
|
std::shared_ptr<image_any> image = std::make_shared<image_any>(data);
|
||||||
mapnik::premultiply_alpha(*image);
|
mapnik::premultiply_alpha(*image);
|
||||||
|
|
|
@ -363,9 +363,9 @@ const mz_uint8 PNGWriter::IEND_tpl[] = {
|
||||||
|
|
||||||
template void PNGWriter::writeIDAT<image_data_gray8>(image_data_gray8 const& image);
|
template void PNGWriter::writeIDAT<image_data_gray8>(image_data_gray8 const& image);
|
||||||
template void PNGWriter::writeIDAT<image_view_gray8>(image_view_gray8 const& image);
|
template void PNGWriter::writeIDAT<image_view_gray8>(image_view_gray8 const& image);
|
||||||
template void PNGWriter::writeIDAT<image_data_rgba8>(image_data_rgba8 const& image);
|
template void PNGWriter::writeIDAT<image_rgba8>(image_rgba8 const& image);
|
||||||
template void PNGWriter::writeIDAT<image_view_rgba8>(image_view_rgba8 const& image);
|
template void PNGWriter::writeIDAT<image_view_rgba8>(image_view_rgba8 const& image);
|
||||||
template void PNGWriter::writeIDATStripAlpha<image_data_rgba8>(image_data_rgba8 const& image);
|
template void PNGWriter::writeIDATStripAlpha<image_rgba8>(image_rgba8 const& image);
|
||||||
template void PNGWriter::writeIDATStripAlpha<image_view_rgba8>(image_view_rgba8 const& image);
|
template void PNGWriter::writeIDATStripAlpha<image_view_rgba8>(image_view_rgba8 const& image);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double> > bounding_box() const final;
|
boost::optional<box2d<double> > bounding_box() const final;
|
||||||
inline bool has_alpha() const final { return has_alpha_; }
|
inline bool has_alpha() const final { return has_alpha_; }
|
||||||
void read(unsigned x,unsigned y,image_data_rgba8& image) final;
|
void read(unsigned x,unsigned y,image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
@ -226,7 +226,7 @@ boost::optional<box2d<double> > png_reader<T>::bounding_box() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void png_reader<T>::read(unsigned x0, unsigned y0,image_data_rgba8& image)
|
void png_reader<T>::read(unsigned x0, unsigned y0,image_rgba8& image)
|
||||||
{
|
{
|
||||||
stream_.clear();
|
stream_.clear();
|
||||||
stream_.seekg(0, std::ios_base::beg);
|
stream_.seekg(0, std::ios_base::beg);
|
||||||
|
@ -312,7 +312,7 @@ void png_reader<T>::read(unsigned x0, unsigned y0,image_data_rgba8& image)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
image_any png_reader<T>::read(unsigned x, unsigned y, unsigned width, unsigned height)
|
image_any png_reader<T>::read(unsigned x, unsigned y, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
image_data_rgba8 data(width,height);
|
image_rgba8 data(width,height);
|
||||||
read(x, y, data);
|
read(x, y, data);
|
||||||
return image_any(std::move(data));
|
return image_any(std::move(data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool raster_colorizer::add_stop(colorizer_stop const& stop)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void raster_colorizer::colorize(image_data_rgba8 & out, T const& in,
|
void raster_colorizer::colorize(image_rgba8 & out, T const& in,
|
||||||
boost::optional<double> const& nodata,
|
boost::optional<double> const& nodata,
|
||||||
feature_impl const& f) const
|
feature_impl const& f) const
|
||||||
{
|
{
|
||||||
|
@ -286,13 +286,13 @@ unsigned raster_colorizer::get_color(float value) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template void raster_colorizer::colorize(image_data_rgba8 & out, image_data_gray8 const& in,
|
template void raster_colorizer::colorize(image_rgba8 & out, image_data_gray8 const& in,
|
||||||
boost::optional<double>const& nodata,
|
boost::optional<double>const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_data_rgba8 & out, image_data_gray16 const& in,
|
template void raster_colorizer::colorize(image_rgba8 & out, image_data_gray16 const& in,
|
||||||
boost::optional<double>const& nodata,
|
boost::optional<double>const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
template void raster_colorizer::colorize(image_data_rgba8 & out, image_data_gray32f const& in,
|
template void raster_colorizer::colorize(image_rgba8 & out, image_data_gray32f const& in,
|
||||||
boost::optional<double>const& nodata,
|
boost::optional<double>const& nodata,
|
||||||
feature_impl const& f) const;
|
feature_impl const& f) const;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ vector_marker_render_thunk::vector_marker_render_thunk(svg_path_ptr const& src,
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
raster_marker_render_thunk<image_data_rgba8>::raster_marker_render_thunk(image_data_rgba8 & src,
|
raster_marker_render_thunk<image_rgba8>::raster_marker_render_thunk(image_rgba8 & src,
|
||||||
agg::trans_affine const& marker_trans,
|
agg::trans_affine const& marker_trans,
|
||||||
double opacity,
|
double opacity,
|
||||||
composite_mode_e comp_op,
|
composite_mode_e comp_op,
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
std::shared_ptr<image_data_rgba8> render_pattern<image_data_rgba8>(rasterizer & ras,
|
std::shared_ptr<image_rgba8> render_pattern<image_rgba8>(rasterizer & ras,
|
||||||
marker const& marker,
|
marker const& marker,
|
||||||
agg::trans_affine const& tr,
|
agg::trans_affine const& tr,
|
||||||
double opacity)
|
double opacity)
|
||||||
|
@ -54,7 +54,7 @@ std::shared_ptr<image_data_rgba8> render_pattern<image_data_rgba8>(rasterizer &
|
||||||
mtx.translate(0.5 * bbox.width(), 0.5 * bbox.height());
|
mtx.translate(0.5 * bbox.width(), 0.5 * bbox.height());
|
||||||
mtx = tr * mtx;
|
mtx = tr * mtx;
|
||||||
|
|
||||||
std::shared_ptr<mapnik::image_data_rgba8> image = std::make_shared<mapnik::image_data_rgba8>(bbox.width(), bbox.height());
|
std::shared_ptr<mapnik::image_rgba8> image = std::make_shared<mapnik::image_rgba8>(bbox.width(), bbox.height());
|
||||||
agg::rendering_buffer buf(image->getBytes(), image->width(), image->height(), image->width() * 4);
|
agg::rendering_buffer buf(image->getBytes(), image->width(), image->height(), image->width() * 4);
|
||||||
pixfmt pixf(buf);
|
pixfmt pixf(buf);
|
||||||
renderer_base renb(pixf);
|
renderer_base renb(pixf);
|
||||||
|
|
|
@ -358,7 +358,7 @@ grid_text_renderer<T>::grid_text_renderer(pixmap_type &pixmap,
|
||||||
: text_renderer(HALO_RASTERIZER_FAST, comp_op, src_over, scale_factor),
|
: text_renderer(HALO_RASTERIZER_FAST, comp_op, src_over, scale_factor),
|
||||||
pixmap_(pixmap) {}
|
pixmap_(pixmap) {}
|
||||||
|
|
||||||
template class agg_text_renderer<image_data_rgba8>;
|
template class agg_text_renderer<image_rgba8>;
|
||||||
template class grid_text_renderer<grid>;
|
template class grid_text_renderer<grid>;
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -153,7 +153,7 @@ public:
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double> > bounding_box() const final;
|
boost::optional<box2d<double> > bounding_box() const final;
|
||||||
inline bool has_alpha() const final { return has_alpha_; }
|
inline bool has_alpha() const final { return has_alpha_; }
|
||||||
void read(unsigned x,unsigned y,image_data_rgba8& image) final;
|
void read(unsigned x,unsigned y,image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
// methods specific to tiff reader
|
// methods specific to tiff reader
|
||||||
unsigned bits_per_sample() const { return bps_; }
|
unsigned bits_per_sample() const { return bps_; }
|
||||||
|
@ -168,8 +168,8 @@ private:
|
||||||
tiff_reader(const tiff_reader&);
|
tiff_reader(const tiff_reader&);
|
||||||
tiff_reader& operator=(const tiff_reader&);
|
tiff_reader& operator=(const tiff_reader&);
|
||||||
void init();
|
void init();
|
||||||
void read_generic(unsigned x,unsigned y,image_data_rgba8& image);
|
void read_generic(unsigned x,unsigned y,image_rgba8& image);
|
||||||
void read_stripped(unsigned x,unsigned y,image_data_rgba8& image);
|
void read_stripped(unsigned x,unsigned y,image_rgba8& image);
|
||||||
|
|
||||||
template <typename ImageData>
|
template <typename ImageData>
|
||||||
void read_tiled(unsigned x,unsigned y, ImageData & image);
|
void read_tiled(unsigned x,unsigned y, ImageData & image);
|
||||||
|
@ -377,7 +377,7 @@ boost::optional<box2d<double> > tiff_reader<T>::bounding_box() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void tiff_reader<T>::read(unsigned x,unsigned y,image_data_rgba8& image)
|
void tiff_reader<T>::read(unsigned x,unsigned y,image_rgba8& image)
|
||||||
{
|
{
|
||||||
if (read_method_==stripped)
|
if (read_method_==stripped)
|
||||||
{
|
{
|
||||||
|
@ -464,7 +464,7 @@ struct tiff_reader_traits
|
||||||
|
|
||||||
// default specialization that expands into RGBA
|
// default specialization that expands into RGBA
|
||||||
template <>
|
template <>
|
||||||
struct tiff_reader_traits<image_data_rgba8>
|
struct tiff_reader_traits<image_rgba8>
|
||||||
{
|
{
|
||||||
using pixel_type = std::uint32_t;
|
using pixel_type = std::uint32_t;
|
||||||
static bool read_tile(TIFF * tif, unsigned x0, unsigned y0, pixel_type* buf, std::size_t tile_width, std::size_t tile_height)
|
static bool read_tile(TIFF * tif, unsigned x0, unsigned y0, pixel_type* buf, std::size_t tile_width, std::size_t tile_height)
|
||||||
|
@ -518,7 +518,7 @@ image_any tiff_reader<T>::read(unsigned x0, unsigned y0, unsigned width, unsigne
|
||||||
TIFF* tif = open(stream_);
|
TIFF* tif = open(stream_);
|
||||||
if (tif)
|
if (tif)
|
||||||
{
|
{
|
||||||
image_data_rgba8 data(width, height, true, premultiplied_alpha_);
|
image_rgba8 data(width, height, true, premultiplied_alpha_);
|
||||||
std::size_t element_size = sizeof(detail::rgb8);
|
std::size_t element_size = sizeof(detail::rgb8);
|
||||||
std::size_t size_to_allocate = (TIFFScanlineSize(tif) + element_size - 1)/element_size;
|
std::size_t size_to_allocate = (TIFFScanlineSize(tif) + element_size - 1)/element_size;
|
||||||
const std::unique_ptr<detail::rgb8[]> scanline(new detail::rgb8[size_to_allocate]);
|
const std::unique_ptr<detail::rgb8[]> scanline(new detail::rgb8[size_to_allocate]);
|
||||||
|
@ -532,7 +532,7 @@ image_any tiff_reader<T>::read(unsigned x0, unsigned y0, unsigned width, unsigne
|
||||||
{
|
{
|
||||||
if (y >= y0)
|
if (y >= y0)
|
||||||
{
|
{
|
||||||
image_data_rgba8::pixel_type * row = data.getRow(y - y0);
|
image_rgba8::pixel_type * row = data.getRow(y - y0);
|
||||||
std::transform(scanline.get() + start_x, scanline.get() + end_x, row, detail::rgb8_to_rgba8());
|
std::transform(scanline.get() + start_x, scanline.get() + end_x, row, detail::rgb8_to_rgba8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,13 +543,13 @@ image_any tiff_reader<T>::read(unsigned x0, unsigned y0, unsigned width, unsigne
|
||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
image_data_rgba8 data(width,height,true,premultiplied_alpha_);
|
image_rgba8 data(width,height,true,premultiplied_alpha_);
|
||||||
read(x0, y0, data);
|
read(x0, y0, data);
|
||||||
return image_any(std::move(data));
|
return image_any(std::move(data));
|
||||||
}
|
}
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
image_data_rgba8 data(width,height,true,premultiplied_alpha_);
|
image_rgba8 data(width,height,true,premultiplied_alpha_);
|
||||||
read(x0, y0, data);
|
read(x0, y0, data);
|
||||||
return image_any(std::move(data));
|
return image_any(std::move(data));
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ image_any tiff_reader<T>::read(unsigned x0, unsigned y0, unsigned width, unsigne
|
||||||
//PHOTOMETRIC_ITULAB = 10;
|
//PHOTOMETRIC_ITULAB = 10;
|
||||||
//PHOTOMETRIC_LOGL = 32844;
|
//PHOTOMETRIC_LOGL = 32844;
|
||||||
//PHOTOMETRIC_LOGLUV = 32845;
|
//PHOTOMETRIC_LOGLUV = 32845;
|
||||||
image_data_rgba8 data(width,height, true, premultiplied_alpha_);
|
image_rgba8 data(width,height, true, premultiplied_alpha_);
|
||||||
read(x0, y0, data);
|
read(x0, y0, data);
|
||||||
return image_any(std::move(data));
|
return image_any(std::move(data));
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ image_any tiff_reader<T>::read(unsigned x0, unsigned y0, unsigned width, unsigne
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void tiff_reader<T>::read_generic(unsigned, unsigned, image_data_rgba8& image)
|
void tiff_reader<T>::read_generic(unsigned, unsigned, image_rgba8& image)
|
||||||
{
|
{
|
||||||
TIFF* tif = open(stream_);
|
TIFF* tif = open(stream_);
|
||||||
if (tif)
|
if (tif)
|
||||||
|
@ -630,12 +630,12 @@ void tiff_reader<T>::read_tiled(unsigned x0,unsigned y0, ImageData & image)
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void tiff_reader<T>::read_stripped(unsigned x0,unsigned y0,image_data_rgba8& image)
|
void tiff_reader<T>::read_stripped(unsigned x0,unsigned y0,image_rgba8& image)
|
||||||
{
|
{
|
||||||
TIFF* tif = open(stream_);
|
TIFF* tif = open(stream_);
|
||||||
if (tif)
|
if (tif)
|
||||||
{
|
{
|
||||||
image_data_rgba8 strip(width_,rows_per_strip_,false);
|
image_rgba8 strip(width_,rows_per_strip_,false);
|
||||||
int width=image.width();
|
int width=image.width();
|
||||||
int height=image.height();
|
int height=image.height();
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ void reproject_and_scale_raster(raster & target, raster const& source,
|
||||||
util::apply_visitor(warper, source.data_);
|
util::apply_visitor(warper, source.data_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template MAPNIK_DECL void warp_image (image_data_rgba8&, image_data_rgba8 const&, proj_transform const&,
|
template MAPNIK_DECL void warp_image (image_rgba8&, image_rgba8 const&, proj_transform const&,
|
||||||
box2d<double> const&, box2d<double> const&, double, double, unsigned, scaling_method_e, double);
|
box2d<double> const&, box2d<double> const&, double, double, unsigned, scaling_method_e, double);
|
||||||
|
|
||||||
template MAPNIK_DECL void warp_image (image_data_gray8&, image_data_gray8 const&, proj_transform const&,
|
template MAPNIK_DECL void warp_image (image_data_gray8&, image_data_gray8 const&, proj_transform const&,
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double> > bounding_box() const final;
|
boost::optional<box2d<double> > bounding_box() const final;
|
||||||
inline bool has_alpha() const final { return has_alpha_; }
|
inline bool has_alpha() const final { return has_alpha_; }
|
||||||
void read(unsigned x,unsigned y,image_data_rgba8& image) final;
|
void read(unsigned x,unsigned y,image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
@ -236,7 +236,7 @@ boost::optional<box2d<double> > webp_reader<T>::bounding_box() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void webp_reader<T>::read(unsigned x0, unsigned y0,image_data_rgba8& image)
|
void webp_reader<T>::read(unsigned x0, unsigned y0,image_rgba8& image)
|
||||||
{
|
{
|
||||||
WebPDecoderConfig config;
|
WebPDecoderConfig config;
|
||||||
config_guard guard(config);
|
config_guard guard(config);
|
||||||
|
@ -270,7 +270,7 @@ void webp_reader<T>::read(unsigned x0, unsigned y0,image_data_rgba8& image)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
image_any webp_reader<T>::read(unsigned x, unsigned y, unsigned width, unsigned height)
|
image_any webp_reader<T>::read(unsigned x, unsigned y, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
image_data_rgba8 data(width,height);
|
image_rgba8 data(width,height);
|
||||||
read(x, y, data);
|
read(x, y, data);
|
||||||
return image_any(std::move(data));
|
return image_any(std::move(data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ int main(int argc, char** argv)
|
||||||
mapnik::Map m = map;
|
mapnik::Map m = map;
|
||||||
m.add_layer(l);
|
m.add_layer(l);
|
||||||
m.zoom_all();
|
m.zoom_all();
|
||||||
mapnik::image_data_rgba8 im(m.width(),m.height());
|
mapnik::image_rgba8 im(m.width(),m.height());
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m,im);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
||||||
//std::clog << mapnik::save_map_to_string(m) << "\n";
|
//std::clog << mapnik::save_map_to_string(m) << "\n";
|
||||||
BOOST_TEST(true);
|
BOOST_TEST(true);
|
||||||
// should throw here with "CSV Plugin: no attribute 'foo'. Valid attributes are: x,y."
|
// should throw here with "CSV Plugin: no attribute 'foo'. Valid attributes are: x,y."
|
||||||
|
|
|
@ -81,8 +81,8 @@ int main(int argc, char** argv)
|
||||||
m.insert_style("style", std::move(the_style) );
|
m.insert_style("style", std::move(the_style) );
|
||||||
m.zoom_to_box(mapnik::box2d<double>(-256,-256,
|
m.zoom_to_box(mapnik::box2d<double>(-256,-256,
|
||||||
256,256));
|
256,256));
|
||||||
mapnik::image_data_rgba8 buf(m.width(),m.height());
|
mapnik::image_rgba8 buf(m.width(),m.height());
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(m,buf);
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,buf);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
} catch (std::exception const& ex) {
|
} catch (std::exception const& ex) {
|
||||||
BOOST_TEST_EQ(std::string(ex.what()),std::string("Unable to find specified font face 'DejaVu Sans Book' in font set: 'fontset'"));
|
BOOST_TEST_EQ(std::string(ex.what()),std::string("Unable to find specified font face 'DejaVu Sans Book' in font set: 'fontset'"));
|
||||||
|
|
|
@ -45,7 +45,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mapnik::image_data_rgba8 im(-10,-10); // should throw rather than overflow
|
mapnik::image_rgba8 im(-10,-10); // should throw rather than overflow
|
||||||
BOOST_TEST( im.width() < 10 ); // should not get here, but if we did this test should fail
|
BOOST_TEST( im.width() < 10 ); // should not get here, but if we did this test should fail
|
||||||
}
|
}
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
|
@ -57,7 +57,7 @@ int main(int argc, char** argv)
|
||||||
mapnik::cairo_surface_ptr image_surface(
|
mapnik::cairo_surface_ptr image_surface(
|
||||||
cairo_image_surface_create(CAIRO_FORMAT_ARGB32,256,257),
|
cairo_image_surface_create(CAIRO_FORMAT_ARGB32,256,257),
|
||||||
mapnik::cairo_surface_closer());
|
mapnik::cairo_surface_closer());
|
||||||
mapnik::image_data_rgba8 im_data(cairo_image_surface_get_width(&*image_surface), cairo_image_surface_get_height(&*image_surface));
|
mapnik::image_rgba8 im_data(cairo_image_surface_get_width(&*image_surface), cairo_image_surface_get_height(&*image_surface));
|
||||||
im_data.set(1);
|
im_data.set(1);
|
||||||
BOOST_TEST( (unsigned)im_data(0,0) == unsigned(1) );
|
BOOST_TEST( (unsigned)im_data(0,0) == unsigned(1) );
|
||||||
// Should set back to fully transparent
|
// Should set back to fully transparent
|
||||||
|
|
|
@ -59,8 +59,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
m.zoom_all();
|
m.zoom_all();
|
||||||
|
|
||||||
image_data_rgba8 image(m.width(), m.height());
|
image_rgba8 image(m.width(), m.height());
|
||||||
agg_renderer<image_data_rgba8> ren(m, image);
|
agg_renderer<image_rgba8> ren(m, image);
|
||||||
ren.apply();
|
ren.apply();
|
||||||
|
|
||||||
BOOST_TEST_EQ(image.painted(), true);
|
BOOST_TEST_EQ(image.painted(), true);
|
||||||
|
|
|
@ -29,7 +29,7 @@ bool compare_images(std::string const& src_fn,std::string const& dest_fn)
|
||||||
{
|
{
|
||||||
throw mapnik::image_reader_exception("Failed to load: " + dest_fn);
|
throw mapnik::image_reader_exception("Failed to load: " + dest_fn);
|
||||||
}
|
}
|
||||||
std::shared_ptr<image_data_rgba8> image_ptr1 = std::make_shared<image_data_rgba8>(reader1->width(),reader1->height());
|
std::shared_ptr<image_rgba8> image_ptr1 = std::make_shared<image_rgba8>(reader1->width(),reader1->height());
|
||||||
reader1->read(0,0,*image_ptr1);
|
reader1->read(0,0,*image_ptr1);
|
||||||
|
|
||||||
std::unique_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(src_fn,"png"));
|
std::unique_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(src_fn,"png"));
|
||||||
|
@ -37,11 +37,11 @@ bool compare_images(std::string const& src_fn,std::string const& dest_fn)
|
||||||
{
|
{
|
||||||
throw mapnik::image_reader_exception("Failed to load: " + src_fn);
|
throw mapnik::image_reader_exception("Failed to load: " + src_fn);
|
||||||
}
|
}
|
||||||
std::shared_ptr<image_data_rgba8> image_ptr2 = std::make_shared<image_data_rgba8>(reader2->width(),reader2->height());
|
std::shared_ptr<image_rgba8> image_ptr2 = std::make_shared<image_rgba8>(reader2->width(),reader2->height());
|
||||||
reader2->read(0,0,*image_ptr2);
|
reader2->read(0,0,*image_ptr2);
|
||||||
|
|
||||||
image_data_rgba8 const& dest = *image_ptr1;
|
image_rgba8 const& dest = *image_ptr1;
|
||||||
image_data_rgba8 const& src = *image_ptr2;
|
image_rgba8 const& src = *image_ptr2;
|
||||||
|
|
||||||
unsigned int width = src.width();
|
unsigned int width = src.width();
|
||||||
unsigned int height = src.height();
|
unsigned int height = src.height();
|
||||||
|
@ -77,11 +77,11 @@ int main(int argc, char** argv)
|
||||||
mapnik::Map m(256,256);
|
mapnik::Map m(256,256);
|
||||||
mapnik::load_map(m,"./tests/data/good_maps/marker-text-line.xml",false);
|
mapnik::load_map(m,"./tests/data/good_maps/marker-text-line.xml",false);
|
||||||
m.zoom_all();
|
m.zoom_all();
|
||||||
mapnik::image_data_rgba8 im(m.width(),m.height());
|
mapnik::image_rgba8 im(m.width(),m.height());
|
||||||
double scale_factor = 1.2;
|
double scale_factor = 1.2;
|
||||||
|
|
||||||
// render normally with apply() and just map and image
|
// render normally with apply() and just map and image
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> renderer1(m,im,scale_factor);
|
mapnik::agg_renderer<mapnik::image_rgba8> renderer1(m,im,scale_factor);
|
||||||
renderer1.apply();
|
renderer1.apply();
|
||||||
std::string actual1("/tmp/map-request-marker-text-line-actual1.png");
|
std::string actual1("/tmp/map-request-marker-text-line-actual1.png");
|
||||||
//mapnik::save_to_file(im,expected);
|
//mapnik::save_to_file(im,expected);
|
||||||
|
@ -99,7 +99,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// render using apply() and mapnik::request
|
// render using apply() and mapnik::request
|
||||||
mapnik::attributes vars;
|
mapnik::attributes vars;
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> renderer2(m,req,vars,im,scale_factor);
|
mapnik::agg_renderer<mapnik::image_rgba8> renderer2(m,req,vars,im,scale_factor);
|
||||||
renderer2.apply();
|
renderer2.apply();
|
||||||
std::string actual2("/tmp/map-request-marker-text-line-actual2.png");
|
std::string actual2("/tmp/map-request-marker-text-line-actual2.png");
|
||||||
mapnik::save_to_file(im,actual2);
|
mapnik::save_to_file(im,actual2);
|
||||||
|
@ -111,7 +111,7 @@ int main(int argc, char** argv)
|
||||||
mapnik::fill(im, 0);
|
mapnik::fill(im, 0);
|
||||||
|
|
||||||
// render with apply_to_layer api and mapnik::request params passed to apply_to_layer
|
// render with apply_to_layer api and mapnik::request params passed to apply_to_layer
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> renderer3(m,req,vars,im,scale_factor);
|
mapnik::agg_renderer<mapnik::image_rgba8> renderer3(m,req,vars,im,scale_factor);
|
||||||
renderer3.start_map_processing(m);
|
renderer3.start_map_processing(m);
|
||||||
mapnik::projection map_proj(m.srs(),true);
|
mapnik::projection map_proj(m.srs(),true);
|
||||||
double scale_denom = mapnik::scale_denominator(req.scale(),map_proj.is_geographic());
|
double scale_denom = mapnik::scale_denominator(req.scale(),map_proj.is_geographic());
|
||||||
|
|
|
@ -75,7 +75,7 @@ SECTION("scan rgb8 striped") {
|
||||||
REQUIRE( reader2->width() == 512 );
|
REQUIRE( reader2->width() == 512 );
|
||||||
REQUIRE( reader2->height() == 512 );
|
REQUIRE( reader2->height() == 512 );
|
||||||
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
||||||
REQUIRE( data.is<mapnik::image_data_rgba8>() == true );
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
||||||
TIFF_ASSERT_SIZE( data,reader );
|
TIFF_ASSERT_SIZE( data,reader );
|
||||||
TIFF_ASSERT_NO_ALPHA( data );
|
TIFF_ASSERT_NO_ALPHA( data );
|
||||||
TIFF_READ_ONE_PIXEL
|
TIFF_READ_ONE_PIXEL
|
||||||
|
@ -105,7 +105,7 @@ SECTION("scan rgb8 tiled") {
|
||||||
REQUIRE( reader2->width() == 512 );
|
REQUIRE( reader2->width() == 512 );
|
||||||
REQUIRE( reader2->height() == 512 );
|
REQUIRE( reader2->height() == 512 );
|
||||||
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
||||||
REQUIRE( data.is<mapnik::image_data_rgba8>() == true );
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
||||||
TIFF_ASSERT_SIZE( data,reader );
|
TIFF_ASSERT_SIZE( data,reader );
|
||||||
TIFF_ASSERT_NO_ALPHA( data );
|
TIFF_ASSERT_NO_ALPHA( data );
|
||||||
TIFF_READ_ONE_PIXEL
|
TIFF_READ_ONE_PIXEL
|
||||||
|
@ -121,7 +121,7 @@ SECTION("rgba8 striped") {
|
||||||
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
||||||
REQUIRE( tiff_reader.compression() == COMPRESSION_ADOBE_DEFLATE );
|
REQUIRE( tiff_reader.compression() == COMPRESSION_ADOBE_DEFLATE );
|
||||||
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
||||||
REQUIRE( data.is<mapnik::image_data_rgba8>() == true );
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
||||||
TIFF_ASSERT_SIZE( data,reader );
|
TIFF_ASSERT_SIZE( data,reader );
|
||||||
TIFF_ASSERT_ALPHA( data );
|
TIFF_ASSERT_ALPHA( data );
|
||||||
TIFF_READ_ONE_PIXEL
|
TIFF_READ_ONE_PIXEL
|
||||||
|
@ -137,7 +137,7 @@ SECTION("rgba8 tiled") {
|
||||||
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
||||||
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
||||||
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
||||||
REQUIRE( data.is<mapnik::image_data_rgba8>() == true );
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
||||||
TIFF_ASSERT_SIZE( data,reader );
|
TIFF_ASSERT_SIZE( data,reader );
|
||||||
TIFF_ASSERT_ALPHA( data );
|
TIFF_ASSERT_ALPHA( data );
|
||||||
TIFF_READ_ONE_PIXEL
|
TIFF_READ_ONE_PIXEL
|
||||||
|
@ -153,7 +153,7 @@ SECTION("rgb8 striped") {
|
||||||
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
||||||
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
||||||
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
||||||
REQUIRE( data.is<mapnik::image_data_rgba8>() == true );
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
||||||
TIFF_ASSERT_SIZE( data,reader );
|
TIFF_ASSERT_SIZE( data,reader );
|
||||||
TIFF_ASSERT_NO_ALPHA( data );
|
TIFF_ASSERT_NO_ALPHA( data );
|
||||||
TIFF_READ_ONE_PIXEL
|
TIFF_READ_ONE_PIXEL
|
||||||
|
@ -169,7 +169,7 @@ SECTION("rgb8 tiled") {
|
||||||
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
||||||
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
||||||
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
||||||
REQUIRE( data.is<mapnik::image_data_rgba8>() == true );
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
||||||
TIFF_ASSERT_SIZE( data,reader );
|
TIFF_ASSERT_SIZE( data,reader );
|
||||||
TIFF_ASSERT_NO_ALPHA( data );
|
TIFF_ASSERT_NO_ALPHA( data );
|
||||||
TIFF_READ_ONE_PIXEL
|
TIFF_READ_ONE_PIXEL
|
||||||
|
|
|
@ -110,7 +110,7 @@ int main (int argc,char** argv)
|
||||||
mapnik::Map map(600,400);
|
mapnik::Map map(600,400);
|
||||||
mapnik::load_map(map,xml_file,true);
|
mapnik::load_map(map,xml_file,true);
|
||||||
map.zoom_all();
|
map.zoom_all();
|
||||||
mapnik::image_data_rgba8 im(map.width(),map.height());
|
mapnik::image_rgba8 im(map.width(),map.height());
|
||||||
mapnik::request req(map.width(),map.height(),map.get_current_extent());
|
mapnik::request req(map.width(),map.height(),map.get_current_extent());
|
||||||
req.set_buffer_size(map.buffer_size());
|
req.set_buffer_size(map.buffer_size());
|
||||||
mapnik::attributes vars;
|
mapnik::attributes vars;
|
||||||
|
@ -137,7 +137,7 @@ int main (int argc,char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapnik::agg_renderer<mapnik::image_data_rgba8> ren(map,req,vars,im,scale_factor,0,0);
|
mapnik::agg_renderer<mapnik::image_rgba8> 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,img_file);
|
||||||
if (auto_open)
|
if (auto_open)
|
||||||
|
|
|
@ -157,7 +157,7 @@ int main (int argc,char** argv)
|
||||||
std::clog << "found width of '" << w << "' and height of '" << h << "'\n";
|
std::clog << "found width of '" << w << "' and height of '" << h << "'\n";
|
||||||
}
|
}
|
||||||
// 10 pixel buffer to avoid edge clipping of 100% svg's
|
// 10 pixel buffer to avoid edge clipping of 100% svg's
|
||||||
mapnik::image_data_rgba8 im(w+0,h+0);
|
mapnik::image_rgba8 im(w+0,h+0);
|
||||||
agg::rendering_buffer buf(im.getBytes(), im.width(), im.height(), im.width() * 4);
|
agg::rendering_buffer buf(im.getBytes(), im.width(), im.height(), im.width() * 4);
|
||||||
pixfmt pixf(buf);
|
pixfmt pixf(buf);
|
||||||
renderer_base renb(pixf);
|
renderer_base renb(pixf);
|
||||||
|
@ -181,7 +181,7 @@ int main (int argc,char** argv)
|
||||||
|
|
||||||
boost::algorithm::ireplace_last(svg_name,".svg",".png");
|
boost::algorithm::ireplace_last(svg_name,".svg",".png");
|
||||||
demultiply_alpha(im);
|
demultiply_alpha(im);
|
||||||
mapnik::save_to_file<mapnik::image_data_rgba8>(im,svg_name,"png");
|
mapnik::save_to_file<mapnik::image_rgba8>(im,svg_name,"png");
|
||||||
if (auto_open)
|
if (auto_open)
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
|
|
Loading…
Reference in a new issue