Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:50+00:00 2026-06-05T20:16:50+00:00

I downloaded WriteableBitmapEx for winrt (win 8 metro). I added a reference to the

  • 0

I downloaded WriteableBitmapEx for winrt (win 8 metro).
I added a reference to the dll with the extension methods , used them in my code , every thing compiles ok.

The problem is that the extension methods have no effect.
Here is part of my code:

WriteableBitmap wb = new WriteableBitmap((int)pictureSize.Width,   (int)pictureSize.Height);
wb.SetSource(fileStream);
var newWB = wb.Flip(FlipMode.Vertical);
ImageControl.Source = newWB;     
newWB.Invalidate(); 

The image does not appear on the screen.
But if I try to draw something on the image , like a line, the image appears on the screen unchanged.

thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:16:51+00:00Added an answer on June 5, 2026 at 8:16 pm

    I guess the image wasn’t loaded fully when you use wb.Flip. IIRC wb.SetSource runs async.

    There’s another method available in the WriteableBitmapEx library called FromContent. With that you can load an image from the content of the app and the method handles everything for you in the background.

    The below snippet just loads the logo.png, flips it and assigns the WriteableBitmap to an image control.

    var wb = await BitmapFactory.New(1, 1).FromContent(new Uri(BaseUri, @"///assets/logo.png"));
    wb = wb.Flip(WriteableBitmapExtensions.FlipMode.Vertical);
    Viewport.Source = wb;  
    

    If you look into the source code of the WinRT version of the WriteableBitmapEx.FromContent method you will see how a stream is transformed into the WriteableBitmap. Use the below snippet to decode any image format IRandomAccessStream into a WriteableBitmap:

    // Decode image format
    var decoder = await BitmapDecoder.CreateAsync(fileStream);
    var transform = new BitmapTransform();
    var pixelData = await decoder.GetPixelDataAsync(decoder.BitmapPixelFormat, decoder.BitmapAlphaMode, transform, ExifOrientationMode.RespectExifOrientation, ColorManagementMode.ColorManageToSRgb);
    
    // Swap R and B channels since it's reversed
    var pixels = pixelData.DetachPixelData();
    for (var i = 0; i < pixels.Length; i += 4)
    {
        var r = pixels[i];
        var b = pixels[i + 2];
        pixels[i] = b;
        pixels[i + 2] = r;
    }
    
    // Copy pixels to WriteableBitmap
    var wb = new WriteableBitmap((int)decoder.PixelWidth, (int)decoder.PixelHeight);
    using (var bmpStream = wb.PixelBuffer.AsStream())
    {
        bmpStream.Seek(0, SeekOrigin.Begin);
        bmpStream.Write(pixels, 0, (int)bmpStream.Length);
    }
    
    
    // Your original code
    var newWB = wb.Flip(FlipMode.Vertical);
    ImageControl.Source = newWB; 
    

    Yes, that’s way more code than one would except, esp. if you did this in Silverlight or WPF before.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I downloaded and edited a code that from internet, basically what I want to
I downloaded example code of an Android project featuring AdMob ads from here .
I downloaded Firebird-1.5.6.5026-0_embed_win32.zip and copy the file fbembed.dll and firebird.msg and ib_util.dll near my
Recently downloaded some code for a minor open-source project related to a small webgame
I downloaded a few source codes containing C# code that uses windows forms. Is
I downloaded the latest source of mod_wsgi from https://code.google.com/p/modwsgi/source/checkout , but I can’t compile
I downloaded sample android carousel demo source code in below link carousel demo source
As i see the codeplex site for WriteableBitmapEx :- http://writeablebitmapex.codeplex.com/ I can see methods
I downloaded the Market Billing sample, unzipped it and used Create project from existing
I downloaded some code and in it was the following fragment: function GetCommentBySessionIDWCF_JSON() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.