Merge commit 'f905632b920b130bfe19dd72d81882c10e1db179' into harfbuzz
This commit is contained in:
commit
6082f3dbb2
13 changed files with 189 additions and 17 deletions
|
@ -58,9 +58,23 @@ class marker;
|
|||
class MAPNIK_DECL cairo_renderer_base : private mapnik::noncopyable
|
||||
{
|
||||
protected:
|
||||
cairo_renderer_base(Map const& m, cairo_ptr const& cairo, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m, request const& req, cairo_ptr const& cairo, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m, cairo_ptr const& cairo, boost::shared_ptr<label_collision_detector4> detector, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m,
|
||||
cairo_ptr const& cairo,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m,
|
||||
request const& req,
|
||||
cairo_ptr const& cairo,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer_base(Map const& m,
|
||||
cairo_ptr const& cairo,
|
||||
boost::shared_ptr<label_collision_detector4> detector,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
public:
|
||||
~cairo_renderer_base();
|
||||
void start_map_processing(Map const& map);
|
||||
|
@ -115,10 +129,13 @@ public:
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
void render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & mtx, double opacity=1.0, bool recenter=true);
|
||||
void render_marker(pixel_position const& pos,
|
||||
marker const& marker,
|
||||
agg::trans_affine const& mtx,
|
||||
double opacity=1.0,
|
||||
bool recenter=true);
|
||||
void render_box(box2d<double> const& b);
|
||||
protected:
|
||||
|
||||
Map const& m_;
|
||||
cairo_context context_;
|
||||
unsigned width_;
|
||||
|
@ -139,9 +156,23 @@ class MAPNIK_DECL cairo_renderer : public feature_style_processor<cairo_renderer
|
|||
{
|
||||
public:
|
||||
typedef cairo_renderer_base processor_impl_type;
|
||||
cairo_renderer(Map const& m, T const& obj, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m, request const& req, T const& obj, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m, T const& obj, boost::shared_ptr<label_collision_detector4> detector, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
T const& obj,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
request const& req,
|
||||
T const& obj,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m,
|
||||
T const& obj,
|
||||
boost::shared_ptr<label_collision_detector4> detector,
|
||||
double scale_factor=1.0,
|
||||
unsigned offset_x=0,
|
||||
unsigned offset_y=0);
|
||||
void end_map_processing(Map const& map);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -264,6 +264,7 @@ public:
|
|||
{
|
||||
cur_attr().fill_opacity = op;
|
||||
}
|
||||
|
||||
void stroke_opacity(double op)
|
||||
{
|
||||
cur_attr().stroke_opacity = op;
|
||||
|
@ -271,8 +272,7 @@ public:
|
|||
|
||||
void opacity(double op)
|
||||
{
|
||||
cur_attr().stroke_opacity = op;
|
||||
cur_attr().fill_opacity = op;
|
||||
cur_attr().opacity = op;
|
||||
}
|
||||
|
||||
void line_join(agg::line_join_e join)
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace svg {
|
|||
struct path_attributes
|
||||
{
|
||||
unsigned index;
|
||||
double opacity;
|
||||
agg::rgba8 fill_color;
|
||||
double fill_opacity;
|
||||
agg::rgba8 stroke_color;
|
||||
|
@ -58,6 +59,7 @@ struct path_attributes
|
|||
// Empty constructor
|
||||
path_attributes() :
|
||||
index(0),
|
||||
opacity(1.0),
|
||||
fill_color(agg::rgba(0,0,0)),
|
||||
fill_opacity(1.0),
|
||||
stroke_color(agg::rgba(0,0,0)),
|
||||
|
@ -80,6 +82,7 @@ struct path_attributes
|
|||
// Copy constructor
|
||||
path_attributes(const path_attributes& attr)
|
||||
: index(attr.index),
|
||||
opacity(attr.opacity),
|
||||
fill_color(attr.fill_color),
|
||||
fill_opacity(attr.fill_opacity),
|
||||
stroke_color(attr.stroke_color),
|
||||
|
@ -101,6 +104,7 @@ struct path_attributes
|
|||
// Copy constructor with new index value
|
||||
path_attributes(path_attributes const& attr, unsigned idx)
|
||||
: index(idx),
|
||||
opacity(attr.opacity),
|
||||
fill_color(attr.fill_color),
|
||||
fill_opacity(attr.fill_opacity),
|
||||
stroke_color(attr.stroke_color),
|
||||
|
|
|
@ -290,13 +290,13 @@ public:
|
|||
|
||||
if(attr.fill_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
{
|
||||
render_gradient(ras, sl, ren, attr.fill_gradient, transform, attr.fill_opacity * opacity, symbol_bbox, path_bbox);
|
||||
render_gradient(ras, sl, ren, attr.fill_gradient, transform, attr.fill_opacity * attr.opacity * opacity, symbol_bbox, path_bbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
ras.filling_rule(attr.even_odd_flag ? fill_even_odd : fill_non_zero);
|
||||
color = attr.fill_color;
|
||||
color.opacity(color.opacity() * attr.fill_opacity * opacity);
|
||||
color.opacity(color.opacity() * attr.fill_opacity * attr.opacity * opacity);
|
||||
ScanlineRenderer ren_s(ren);
|
||||
color.premultiply();
|
||||
ren_s.color(color);
|
||||
|
@ -326,13 +326,13 @@ public:
|
|||
|
||||
if(attr.stroke_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
{
|
||||
render_gradient(ras, sl, ren, attr.stroke_gradient, transform, attr.stroke_opacity * opacity, symbol_bbox, path_bbox);
|
||||
render_gradient(ras, sl, ren, attr.stroke_gradient, transform, attr.stroke_opacity * attr.opacity * opacity, symbol_bbox, path_bbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
ras.filling_rule(fill_non_zero);
|
||||
color = attr.stroke_color;
|
||||
color.opacity(color.opacity() * attr.stroke_opacity * opacity);
|
||||
color.opacity(color.opacity() * attr.stroke_opacity * attr.opacity * opacity);
|
||||
ScanlineRenderer ren_s(ren);
|
||||
color.premultiply();
|
||||
ren_s.color(color);
|
||||
|
|
|
@ -613,7 +613,11 @@ void render_vector_marker(cairo_context & context, pixel_position const& pos, ma
|
|||
}
|
||||
|
||||
|
||||
void cairo_renderer_base::render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & tr, double opacity, bool recenter)
|
||||
void cairo_renderer_base::render_marker(pixel_position const& pos,
|
||||
marker const& marker,
|
||||
agg::trans_affine const& tr,
|
||||
double opacity,
|
||||
bool recenter)
|
||||
|
||||
{
|
||||
cairo_save_restore guard(context_);
|
||||
|
|
|
@ -411,8 +411,7 @@ void svg_parser::parse_attr(const xmlChar * name, const xmlChar * value )
|
|||
else if(xmlStrEqual(name, BAD_CAST "opacity"))
|
||||
{
|
||||
double opacity = parse_double((const char*)value);
|
||||
path_.stroke_opacity(opacity);
|
||||
path_.fill_opacity(opacity);
|
||||
path_.opacity(opacity);
|
||||
}
|
||||
else if (xmlStrEqual(name, BAD_CAST "visibility"))
|
||||
{
|
||||
|
|
39
tests/data/svg/rect2.svg
Normal file
39
tests/data/svg/rect2.svg
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="10"
|
||||
height="9.9999971"
|
||||
id="svg6102">
|
||||
<defs
|
||||
id="defs6104" />
|
||||
<metadata
|
||||
id="metadata6107">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-240,-532.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="10"
|
||||
height="9.9999971"
|
||||
x="240"
|
||||
y="532.36218"
|
||||
id="rect6613"
|
||||
style="opacity:.5;color:#000000;fill:red;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"keys": [
|
||||
"",
|
||||
"4",
|
||||
"3",
|
||||
"2",
|
||||
"1"
|
||||
],
|
||||
"data": {},
|
||||
"grid": [
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" !!! ",
|
||||
" !!! ",
|
||||
" !!! ",
|
||||
" ",
|
||||
" ",
|
||||
" ### ",
|
||||
" ### ",
|
||||
" ### ",
|
||||
" ",
|
||||
" ",
|
||||
" $$$ ",
|
||||
" $$$ ",
|
||||
" $$$ ",
|
||||
" ",
|
||||
" ",
|
||||
" %%% ",
|
||||
" %%% ",
|
||||
" %%% ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 229 B |
Binary file not shown.
After Width: | Height: | Size: 228 B |
Binary file not shown.
After Width: | Height: | Size: 261 B |
Binary file not shown.
After Width: | Height: | Size: 318 B |
58
tests/visual_tests/styles/marker-svg-opacity.xml
Normal file
58
tests/visual_tests/styles/marker-svg-opacity.xml
Normal file
|
@ -0,0 +1,58 @@
|
|||
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||
|
||||
<Style name="ellipse">
|
||||
<Rule>
|
||||
<Filter>[id]=1</Filter>
|
||||
<MarkersSymbolizer file="../../data/svg/rect2.svg" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[id]=2</Filter>
|
||||
<MarkersSymbolizer opacity=".5" file="../../data/svg/rect2.svg" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[id]=3</Filter>
|
||||
<MarkersSymbolizer fill-opacity=".5" file="../../data/svg/rect2.svg" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[id]=4</Filter>
|
||||
<MarkersSymbolizer stroke-opacity=".5" file="../../data/svg/rect2.svg" />
|
||||
</Rule>
|
||||
</Style>
|
||||
|
||||
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||
<StyleName>ellipse</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="type">csv</Parameter>
|
||||
<Parameter name="inline">
|
||||
x,y,id
|
||||
1,1,1
|
||||
2,2,2
|
||||
3,3,3
|
||||
4,4,4
|
||||
</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
<!-- points to frame data view -->
|
||||
|
||||
<Style name="frame">
|
||||
<Rule>
|
||||
<PointSymbolizer />
|
||||
</Rule>
|
||||
</Style>
|
||||
|
||||
<Layer name="frame" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||
<StyleName>frame</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="type">csv</Parameter>
|
||||
<Parameter name="inline">
|
||||
x,y
|
||||
0,0
|
||||
5,0
|
||||
0,5
|
||||
5,5
|
||||
</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
</Map>
|
Loading…
Reference in a new issue