need to demultiply to write proper alpha into png

This commit is contained in:
Dane Springmeyer 2012-10-12 17:54:29 -07:00
commit f5227d7f18
7 changed files with 36 additions and 5 deletions

View file

@ -14,7 +14,7 @@ distclean:
if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; fi if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; fi
if test -e ".sconsign.dblite"; then rm ".sconsign.dblite"; fi if test -e ".sconsign.dblite"; then rm ".sconsign.dblite"; fi
if test -e "config.cache"; then rm "config.cache"; fi if test -e "config.cache"; then rm "config.cache"; fi
if test -e "config.py"; then rm "config.py"; fi if test -e "config.py"; then mv "config.py" "config.py.backup"; fi
reset: distclean reset: distclean

View file

@ -38,6 +38,7 @@
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/expression.hpp> #include <mapnik/expression.hpp>
#include <mapnik/expression_string.hpp> #include <mapnik/expression_string.hpp>
#include <mapnik/config.hpp> // MAPNIK_DECL
// boost // boost
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
@ -127,7 +128,7 @@ typedef boost::variant<point_symbolizer,
markers_symbolizer, markers_symbolizer,
debug_symbolizer> symbolizer; debug_symbolizer> symbolizer;
class rule class MAPNIK_DECL rule
{ {
public: public:
typedef std::vector<symbolizer> symbolizers; typedef std::vector<symbolizer> symbolizers;

View file

@ -271,7 +271,10 @@ void agg_renderer<T>::end_style_processing(feature_type_style const& st)
} }
} }
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: End processing style"; MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: End processing style";
mapnik::save_to_file(pixmap_, (boost::format("%02d_style.png") % renderer_pass_).str(),"png"); // copy pixmap so demultiply will not impact main buffer
mapnik::image_32 pix_tmp = pixmap_;
pix_tmp.demultiply();
mapnik::save_to_file(pix_tmp, (boost::format("%02d_style.png") % renderer_pass_).str(),"png");
renderer_pass_++; renderer_pass_++;
} }

View file

@ -392,4 +392,5 @@ else:
env['create_uninstall_target'](env, target1) env['create_uninstall_target'](env, target1)
env['create_uninstall_target'](env, target) env['create_uninstall_target'](env, target)
Depends(mapnik, env.subst('../deps/agg/libagg.a')) if not env['RUNTIME_LINK'] == 'static':
Depends(mapnik, env.subst('../deps/agg/libagg.a'))

View file

@ -670,7 +670,14 @@ void map_parser::parse_layer(Map & map, xml_node const& node)
{ {
std::map<std::string,parameters>::const_iterator base_itr = datasource_templates_.find(*base); std::map<std::string,parameters>::const_iterator base_itr = datasource_templates_.find(*base);
if (base_itr!=datasource_templates_.end()) if (base_itr!=datasource_templates_.end())
{
params = base_itr->second; params = base_itr->second;
}
else
{
MAPNIK_LOG_ERROR(datasource) << "Datasource template '" << *base
<< "' not found for layer '" << name << "'";
}
} }
xml_node::const_iterator paramIter = child->begin(); xml_node::const_iterator paramIter = child->begin();

View file

@ -20,7 +20,8 @@ for cpp_test in glob.glob('*_test.cpp'):
agg_env = Environment(ENV=os.environ) agg_env = Environment(ENV=os.environ)
agg_env['CXX'] = env['CXX'] agg_env['CXX'] = env['CXX']
agg_env['CXXFLAGS'] = env['CXXFLAGS'] agg_env['CXXFLAGS'] = env['CXXFLAGS']
agg_env.AppendUnique(LIBS='agg') if 'agg' in test_env['LIBS']:
agg_env.AppendUnique(LIBS='agg')
agg_env.Append(CPPPATH = '#deps/agg/include') agg_env.Append(CPPPATH = '#deps/agg/include')
agg_env.Append(LIBPATH = '#deps/agg') agg_env.Append(LIBPATH = '#deps/agg')
agg_env['CPPPATH'] = ['#deps/agg/include',env['BOOST_INCLUDES']] agg_env['CPPPATH'] = ['#deps/agg/include',env['BOOST_INCLUDES']]

View file

@ -0,0 +1,18 @@
<Map minimum-version="2.1.0" background-color="white">
<Style name="style">
<Rule>
<LineSymbolizer offset="2"/>
<LineSymbolizer offset="-2"/>
</Rule>
</Style>
<Layer name="lay">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,name
"MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))",line
</Parameter>
</Datasource>
</Layer>
</Map>