consistent use of agg::rgba8_pre to construct premultiplied colors - refs #2011

This commit is contained in:
Dane Springmeyer 2013-09-19 19:41:46 -07:00
parent 5b78b6b2dc
commit 9df4deac73
7 changed files with 171 additions and 7 deletions

View file

@ -455,7 +455,7 @@ void agg_renderer<T>::debug_draw_box(R& buf, box2d<double> const& box,
// render the outline
ras_ptr->reset();
ras_ptr->add_path(sbox);
ren.color(agg::rgba8(0x33, 0x33, 0xff, 0xcc)); // blue is fine
ren.color(agg::rgba8_pre(0x33, 0x33, 0xff, 0xcc)); // blue is fine
agg::render_scanlines(*ras_ptr, sl_line, ren);
}

View file

@ -60,18 +60,18 @@ public:
pattern_source(mapnik::image_data_32 const& pattern)
: pattern_(pattern) {}
unsigned int width() const
inline unsigned int width() const
{
return pattern_.width();
}
unsigned int height() const
inline unsigned int height() const
{
return pattern_.height();
}
agg::rgba8 pixel(int x, int y) const
inline agg::rgba8 pixel(int x, int y) const
{
unsigned c = pattern_(x,y);
return agg::rgba8(c & 0xff,
return agg::rgba8_pre(c & 0xff,
(c >> 8) & 0xff,
(c >> 16) & 0xff,
(c >> 24) & 0xff);
@ -107,12 +107,10 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
if (!(*mark)->is_bitmap())
{
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: Only images (not '" << filename << "') are supported in the line_pattern_symbolizer";
return;
}
boost::optional<image_ptr> pat = (*mark)->get_bitmap_data();
if (!pat) return;
agg::rendering_buffer buf(current_buffer_->raw_data(),current_buffer_->width(),current_buffer_->height(), current_buffer_->width() * 4);

View file

@ -0,0 +1,144 @@
{
"keys": [
"",
"4",
"3",
"2",
"1",
"8",
"7",
"6",
"5"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !!!!!!!! ##### ##### $$$$$$$$$$ %%%%%%%%% ",
" !! !! ### ## $$ $$ %% %% ",
" !! ! # # $$ $$ %% %% ",
" !! !! # # $$ $ % % ",
" ! !! # # $ $ % % ",
" ! ! # # $ $ % %",
"! ! # $ $ % ",
"! ! # $ $ % ",
"&&&&&&&&&&&&&&&&&&&&&&&&&& ''''''''''''''''''''''# (((((((((((((((((((((((((( )))))))))))))))))))))))))",
"! ! $ $ % ",
"! ! # # $ $ % %",
" ! ! ## # $ $ %% %",
" !! ! # # $ $ % % ",
" !! !! ## ## $ $ %% % ",
" ! ! ## # $$ $$ %% %% ",
" !!! !!! ### ### $$$ $$ %%% %% ",
" !!!!!!!!!! ##### $$$$$$$$ %%%%%%%% ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1,21 @@
<Map
background-color="green"
background-image="../../data/images/checker.jpg"
background-image-opacity=".5"
background-image-comp-op="soft-light"
srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="file">../data/line-offset.csv</Parameter>
</Datasource>
</Layer>
<Style name="My Style">
<Rule>
<LinePatternSymbolizer file="../../data/raster/white-alpha.png" comp-op="difference"/>
</Rule>
</Style>
</Map>

View file

@ -172,6 +172,7 @@ files = {
'marker-path-expression':{},
'map-background-image-compositing':{'sizes':[(512,512)]},
'building-symbolizer-opacity':{'sizes':[(512,512)]},
'line-pattern-symbolizer-opacity':{'sizes':[(512,512)]}
}
class Reporting: