Merge commit '542805e4d6eb6672753bae45ac72887be279f9c7' into harfbuzz
Conflicts: tests/visual_tests/test.py
|
@ -392,13 +392,15 @@ struct test8
|
|||
|
||||
bool validate()
|
||||
{
|
||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(transcoder("utf-8"));
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
||||
return mapnik::to_expression_string(*expr) == expr_;
|
||||
transcoder tr("utf-8");
|
||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(tr);
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
||||
return mapnik::to_expression_string(*expr) == expr_;
|
||||
}
|
||||
void operator()()
|
||||
{
|
||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(transcoder("utf-8"));
|
||||
transcoder tr("utf-8");
|
||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(tr);
|
||||
for (unsigned i=0;i<iter_;++i) {
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void export_map()
|
|||
|
||||
class_<style_range>("StyleRange")
|
||||
.def("__iter__",
|
||||
range(&style_range::first, &style_range::second))
|
||||
boost::python::range(&style_range::first, &style_range::second))
|
||||
;
|
||||
|
||||
class_<Map>("Map","The map object.",init<int,int,optional<std::string const&> >(
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
: b_(false) {}
|
||||
boolean(bool b)
|
||||
: b_(b) {}
|
||||
explicit boolean(boolean const& b)
|
||||
boolean(boolean const& b)
|
||||
: b_(b.b_) {}
|
||||
|
||||
operator bool() const
|
||||
|
|
|
@ -120,7 +120,7 @@ private:
|
|||
|
||||
inline bool checkBounds(int x, int y) const
|
||||
{
|
||||
return (x >= 0 && x < width_ && y >= 0 && y < height_);
|
||||
return (x >= 0 && x < static_cast<int>(width_) && y >= 0 && y < static_cast<int>(height_));
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <boost/variant/static_visitor.hpp>
|
||||
#include <boost/gil/gil_all.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_basics.h"
|
||||
|
@ -39,7 +40,7 @@
|
|||
#include "agg_pixfmt_rgba.h"
|
||||
#include "agg_scanline_u.h"
|
||||
#include "agg_blur.h"
|
||||
|
||||
#include "agg_gradient_lut.h"
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
|
@ -404,6 +405,78 @@ void apply_filter(Src & src, agg_stack_blur const& op)
|
|||
agg::stack_blur_rgba32(pixf,op.rx,op.ry);
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
void apply_filter(Src & src, colorize_alpha const& op)
|
||||
{
|
||||
using namespace boost::gil;
|
||||
|
||||
agg::gradient_lut<agg::color_interpolator<agg::rgba8> > grad_lut;
|
||||
grad_lut.remove_all();
|
||||
std::size_t size = op.size();
|
||||
if (size < 2) return;
|
||||
|
||||
double step = 1.0/(size-1);
|
||||
double offset = 0.0;
|
||||
BOOST_FOREACH( mapnik::color const& c, op)
|
||||
{
|
||||
grad_lut.add_color(offset, agg::rgba(c.red()/256.0,
|
||||
c.green()/256.0,
|
||||
c.blue()/256.0,
|
||||
c.alpha()/256.0));
|
||||
offset += step;
|
||||
}
|
||||
grad_lut.build_lut();
|
||||
|
||||
rgba8_view_t src_view = rgba8_view(src);
|
||||
for (int y=0; y<src_view.height(); ++y)
|
||||
{
|
||||
rgba8_view_t::x_iterator src_it = src_view.row_begin(y);
|
||||
for (int x=0; x<src_view.width(); ++x)
|
||||
{
|
||||
uint8_t & r = get_color(src_it[x], red_t());
|
||||
uint8_t & g = get_color(src_it[x], green_t());
|
||||
uint8_t & b = get_color(src_it[x], blue_t());
|
||||
uint8_t & a = get_color(src_it[x], alpha_t());
|
||||
if ( a > 0)
|
||||
{
|
||||
agg::rgba8 c = grad_lut[a];
|
||||
r = (c.r * a + 255) >> 8;
|
||||
g = (c.g * a + 255) >> 8;
|
||||
b = (c.b * a + 255) >> 8;
|
||||
#if 0
|
||||
// rainbow
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
if (a < 64)
|
||||
{
|
||||
g = a * 4;
|
||||
b = 255;
|
||||
}
|
||||
else if (a >= 64 && a < 128)
|
||||
{
|
||||
g = 255;
|
||||
b = 255 - ((a - 64) * 4);
|
||||
}
|
||||
else if (a >= 128 && a < 192)
|
||||
{
|
||||
r = (a - 128) * 4;
|
||||
g = 255;
|
||||
}
|
||||
else // >= 192
|
||||
{
|
||||
r = 255;
|
||||
g = 255 - ((a - 192) * 4);
|
||||
}
|
||||
r = (r * a + 255) >> 8;
|
||||
g = (g * a + 255) >> 8;
|
||||
b = (b * a + 255) >> 8;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
void apply_filter(Src & src, hsla const& transform)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <boost/spirit/include/qi.hpp>
|
||||
// mapnik
|
||||
#include <mapnik/css_color_grammar.hpp>
|
||||
#include <mapnik/image_filter.hpp>
|
||||
// stl
|
||||
#include <vector>
|
||||
|
||||
|
@ -45,7 +46,7 @@ struct image_filter_grammar :
|
|||
qi::rule<Iterator, qi::locals<int,int>, void(ContType&), qi::ascii::space_type> agg_blur_filter;
|
||||
qi::rule<Iterator, qi::locals<double,double,double,double,double,double,double,double>,
|
||||
void(ContType&), qi::ascii::space_type> hsla_filter;
|
||||
qi::rule<Iterator, qi::locals<mapnik::color,mapnik::color>, void(ContType&), qi::ascii::space_type> colorize_alpha_filter;
|
||||
qi::rule<Iterator, qi::locals<mapnik::filter::colorize_alpha>, void(ContType&), qi::ascii::space_type> colorize_alpha_filter;
|
||||
qi::rule<Iterator, qi::ascii::space_type> no_args;
|
||||
qi::uint_parser< unsigned, 10, 1, 3 > radius_;
|
||||
css_color_grammar<Iterator> css_color_;
|
||||
|
|
|
@ -98,11 +98,15 @@ struct hsla
|
|||
double a1;
|
||||
};
|
||||
|
||||
struct colorize_alpha
|
||||
struct colorize_alpha : std::vector<mapnik::color>
|
||||
{
|
||||
colorize_alpha() {}
|
||||
colorize_alpha(mapnik::color const& c0, mapnik::color const& c1)
|
||||
{
|
||||
// TODO: implement me!
|
||||
this->push_back(c0);
|
||||
this->push_back(c1);
|
||||
// TODO: support multiple color-stops
|
||||
// https://developer.mozilla.org/en-US/docs/CSS/linear-gradient
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
|
|||
}
|
||||
else if (layer_by_index)
|
||||
{
|
||||
const unsigned num_layers = dataset_->GetLayerCount();
|
||||
int num_layers = dataset_->GetLayerCount();
|
||||
if (*layer_by_index >= num_layers)
|
||||
{
|
||||
std::ostringstream s("OGR Plugin: only ");
|
||||
|
|
|
@ -136,6 +136,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
|
|||
double half_stroke = (*mark)->width()/2.0;
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
padding *= scale_factor_;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,9 +101,11 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
|||
padding *= half_stroke;
|
||||
if (std::fabs(sym.offset()) > 0)
|
||||
padding *= std::fabs(sym.offset()) * 1.2;
|
||||
padding *= scale_factor_;
|
||||
clipping_extent.pad(padding);
|
||||
// debugging
|
||||
//box2d<double> inverse(x0 + padding, y0 + padding, x1 - padding , y1 - padding);
|
||||
//box2d<double> inverse = query_extent_;
|
||||
//inverse.pad(-padding);
|
||||
//draw_geo_extent(inverse,mapnik::color("red"));
|
||||
}
|
||||
|
||||
|
|
|
@ -480,6 +480,7 @@ void cairo_renderer_base::process(line_symbolizer const& sym,
|
|||
padding *= half_stroke;
|
||||
if (std::fabs(sym.offset()) > 0)
|
||||
padding *= std::fabs(sym.offset()) * 1.2;
|
||||
padding *= scale_factor_;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
vertex_converter<box2d<double>, cairo_context, line_symbolizer,
|
||||
|
|
|
@ -80,6 +80,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
|
|||
padding *= half_stroke;
|
||||
if (std::fabs(sym.offset()) > 0)
|
||||
padding *= std::fabs(sym.offset()) * 1.2;
|
||||
padding *= scale_factor_;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/image_filter_grammar.hpp>
|
||||
#include <mapnik/image_filter.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/version.hpp>
|
||||
|
@ -110,11 +109,11 @@ image_filter_grammar<Iterator,ContType>::image_filter_grammar()
|
|||
[push_back(_r1, construct<mapnik::filter::hsla>(_a,_b,_c,_d,_e,_f,_g,_h))]
|
||||
;
|
||||
|
||||
colorize_alpha_filter = lit("colorize-alpha")
|
||||
colorize_alpha_filter = lit("colorize-alpha")[_a = construct<mapnik::filter::colorize_alpha>()]
|
||||
>> lit('(')
|
||||
>> css_color_[_a = _1] >> lit(',')
|
||||
>> css_color_[_b = _1] >> lit(')')
|
||||
[push_back(_r1,construct<mapnik::filter::colorize_alpha>(_a,_b))]
|
||||
>> css_color_[push_back(_a, _1)]
|
||||
>> +(lit(',') >> css_color_[push_back(_a, _1)])
|
||||
>> lit(')') [push_back(_r1,_a)]
|
||||
;
|
||||
|
||||
no_args = -(lit('(') >> lit(')'));
|
||||
|
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
|
@ -23,7 +23,7 @@ Known values for OPTION are:
|
|||
--includes include paths (-I) for Mapnik headers (new in 2.2.x)
|
||||
--dep-includes include paths (-I) for Mapnik dependencies (new in 2.2.x)
|
||||
--cxxflags c++ compiler flags and pre-processor defines (new in 2.2.x)
|
||||
--cflags c++ compiler flags and pre-processor defines (same as cxxflags, for back-compatibility)
|
||||
--cflags all include paths, compiler flags, and pre-processor defines (for back-compatibility)
|
||||
EOF
|
||||
|
||||
exit $1
|
||||
|
@ -110,7 +110,7 @@ while test $# -gt 0; do
|
|||
;;
|
||||
|
||||
--cflags)
|
||||
echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES}
|
||||
echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES} ${CONFIG_CXXFLAGS}
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|