expose blend pixel methods for grid renderer

This commit is contained in:
Dane Springmeyer 2011-08-30 22:26:59 +00:00
parent 25a1a6b416
commit 00d059b39c

View file

@ -262,6 +262,30 @@ public:
return height_; return height_;
} }
inline void blendPixel(value_type feature_id,int x,int y,unsigned int rgba1,int t)
{
blendPixel2(x,y,rgba1,t,1.0); // do not change opacity
}
inline void blendPixel2(value_type feature_id,int x,int y,unsigned int rgba1,int t,double opacity)
{
if (checkBounds(x,y))
{
#ifdef MAPNIK_BIG_ENDIAN
unsigned a1 = (int)((rgba1 & 0xff) * opacity) & 0xff; // adjust for desired opacity
#else
unsigned a = (int)(((rgba1 >> 24) & 0xff) * opacity) & 0xff; // adjust for desired opacity
#endif
// if the pixel is more than a tenth
// opaque then burn in the feature id
if (a >= 25)
{
data_(x,y) = feature_id;
}
}
}
inline void set_rectangle(value_type id,image_data_32 const& data,int x0,int y0) inline void set_rectangle(value_type id,image_data_32 const& data,int x0,int y0)
{ {
box2d<int> ext0(0,0,width_,height_); box2d<int> ext0(0,0,width_,height_);