fix blending semitransparent raster images with background: #589

This commit is contained in:
Marcin Rudowski 2010-08-11 22:06:36 +00:00
parent eba0b6fb45
commit 427f0d0776
2 changed files with 21 additions and 1 deletions

View file

@ -300,6 +300,11 @@ namespace mapnik
#ifdef MAPNIK_BIG_ENDIAN
unsigned a1 = rgba1 & 0xff;
if (a1 == 0) continue;
if (a1 == 0xff)
{
row_to[x] = rgba1;
continue;
}
unsigned r1 = (rgba1 >> 24) & 0xff;
unsigned g1 = (rgba1 >> 16 ) & 0xff;
unsigned b1 = (rgba1 >> 8) & 0xff;
@ -319,6 +324,11 @@ namespace mapnik
#else
unsigned a1 = (rgba1 >> 24) & 0xff;
if (a1 == 0) continue;
if (a1 == 0xff)
{
row_to[x] = rgba1;
continue;
}
unsigned r1 = rgba1 & 0xff;
unsigned g1 = (rgba1 >> 8 ) & 0xff;
unsigned b1 = (rgba1 >> 16) & 0xff;
@ -360,6 +370,11 @@ namespace mapnik
#ifdef MAPNIK_BIG_ENDIAN
unsigned a1 = int( (rgba1 & 0xff) * opacity );
if (a1 == 0) continue;
if (a1 == 0xff)
{
row_to[x] = rgba1;
continue;
}
unsigned r1 = (rgba1 >> 24) & 0xff;
unsigned g1 = (rgba1 >> 16 ) & 0xff;
unsigned b1 = (rgba1 >> 8) & 0xff;
@ -378,6 +393,11 @@ namespace mapnik
#else
unsigned a1 = int( ((rgba1 >> 24) & 0xff) * opacity );
if (a1 == 0) continue;
if (a1 == 0xff)
{
row_to[x] = rgba1;
continue;
}
unsigned r1 = rgba1 & 0xff;
unsigned g1 = (rgba1 >> 8 ) & 0xff;
unsigned b1 = (rgba1 >> 16) & 0xff;

View file

@ -741,7 +741,7 @@ namespace mapnik
if (sym.get_mode() == "normal"){
if (sym.get_opacity() == 1.0) {
pixmap_.set_rectangle(start_x,start_y,target);
pixmap_.set_rectangle_alpha(start_x,start_y,target);
} else {
pixmap_.set_rectangle_alpha2(target,start_x,start_y, sym.get_opacity());
}