Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

Commented Unassigned: Blit doesn't work well with transparent PNG images [20713]

$
0
0
Hello

I am trying to apply an transparent image (in png format) over background image. The result is not very good as applied image has too much artifacts over it.
It is known problem?

I am making an application for Windows 8.1 RT.

```
img.Blit(r, talisman, new Rect(0, 0, talisman.PixelWidth, talisman.PixelHeight));
```

Using WriteableBitmapExtensions.BlendMode.Alpha doesn't help at all. When I put both images i XAML one over another, I see no artifacts.
Comments: ** Comment from web user: lachlank **

Have attached a patch for consideration:

```
var outAlpha = ((sa << 8) + ((255 - sa) * da)) >> 8;

destPixel = (outAlpha << 24) +
((((((sr * sa) << 8) + ((255 - sa) * dr * da)) >> 8) /outAlpha) << 16) +
((((((sg * sa) << 8) + ((255 - sa) * dg * da)) >> 8) /outAlpha) << 8) +
(((((sb * sa) << 8) + ((255 - sa) * db * da)) >> 8) / outAlpha);
```


Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>