alpha value in rgba not working in RasterColorizer
trustmiao opened this issue · comments
Hi, we noticed that color rgba doesn't work in rastercolorizer as it should be.
we created the following rule in xml
`
<RasterSymbolizer opacity="0.5">
<RasterColorizer default-mode="discrete" >
<stop color="red" value = "1" />
<stop color="orange" value = "500" />
<stop color="yellow" value = "1000" />
<stop color="rgba(255,255,200,0.1)" value = "2000" />
<stop color="transparent" value = "4000" />
</RasterColorizer>
</RasterSymbolizer>
`
and it rendered as alpha is rendered as 1, unless it is set to 0, so only full or no opacity.
we marked the value 2000 stop color in red line, this area supposed to be mostly transparent, with a black background color.
Incredible. mapnik::color is rgba-enabled.
Source code is in include/mapnik/color.hpp
class MAPNIK_DECL color : boost::equality_comparable<color>
{
public:
std::uint8_t red_;
std::uint8_t green_;
std::uint8_t blue_;
std::uint8_t alpha_;
bool premultiplied_;
// default ctor
color()
: red_(0xff)
, green_(0xff)
, blue_(0xff)
, alpha_(0xff)
, premultiplied_(false)
{}
}
with further test, we hereby verified, it is working. The mistake we made is alpha is input as 150, not 0.5, while we report issue, we are looking at different xml for render input. Great work mapnik!