Overlay WriteableBitmap with color
Posted
by rajenk
on Stack Overflow
See other posts from Stack Overflow
or by rajenk
Published on 2010-03-09T10:45:11Z
Indexed on
2010/03/09
10:51 UTC
Read the original article
Hit count: 775
I'm trying to overlay a WriteableBitmap with a certain color in Silverlight. I have a black and white base image, which I'm using to create smaller WriteableBitmap images for a new composite image and I want to overlay either the black or white part of the source image cut-out with a certain color before adding it to the composite image.
What I'm doing now is:
var cutOut = new WriteableBitmap(8, 14);
/*
cut out the image here
*/
cutOut.Render(sourceImage, transform); // sourceImage is the base image
cutOutImage.Source = cutOut; // cutOutImage is an Image element in XAML
compositeImage.Render(cutOutImage, transform2); // compositeImage is the final WriteableBitmap that is shown on screen
I tried the methods on http://blogs.silverarcade.com/silverlight-games-101/15/silverlight-blitting-and-blending-with-silverlights-writeablebitmap/ and using the extension methods from hxxp://writeablebitmapex.codeplex.com/, but I cannot seem to get a color overlay on the cutOut image before rendering it to the compositeImage.
Does anyone know of a good method to do this?
Thanks in advance.
© Stack Overflow or respective owner