1

using the WriteableBitMapExWPhone I have successful create the image with mask effect, however I wonder how can I set that image to be my page background? My code below:

            ImageBrush imageBrush = new ImageBrush();
        ImageBrush imageBrush2 = new ImageBrush();

        ////load the photo
        WriteableBitmap bgImage = LoadBitmap("/Music;component/Images/MainPage/covertart_bg.jpg");
        WriteableBitmap mask = LoadBitmap("/Music;component/Images/MainPage/mask_bg.png");

        //instantiate the empty parts for composition
        Rect cRect = new Rect(0, 0, bgImage.PixelWidth, bgImage.PixelHeight);
        //mask the photo
        bgImage.Blit(cRect, mask, cRect, WriteableBitmapExtensions.BlendMode.Mask);

        //My code is working as I can set the bgImage to BlitImage (this is the image control)
        BlitImage.Source = bgImage;

        //I want to set bgImage as my Panorama background, but the code below doesn't do the trick
        imageBrush2.ImageSource = bgImage;
        mainPanorama.Background = imageBrush2;
Nghia Nguyen
  • 2,585
  • 4
  • 25
  • 38

1 Answers1

3

I solved this by convert WriteableBitmap to BitMapImage and set the BitMapImage as imageBrush.ImageSource

Nghia Nguyen
  • 2,585
  • 4
  • 25
  • 38
  • Convert WriteableBitmap to BitmapImage http://stackoverflow.com/questions/3986638/how-can-i-convert-writeablebitmap-to-bitmapimage – Prince Ashitaka Nov 19 '12 at 17:14