×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    52

    being a bit thick

    I'm trying to load in a png thats added to my project into a WritableBitmap

    currently using
    discBmp1 = BitmapFactory.New(0, 0).FromResource("Assets/disc1.png");

    but its throwing exceptions
    and i've tried about 10 variations from various forums online - with no luck

    HELP!

    mac

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    418

    Re: being a bit thick

    What is BitmapFactory ???

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    52

    Re: being a bit thick

    well quite! it compiles and runs!!

    possibly related to WriteableBitmapEX

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,567

    Re: being a bit thick

    While it seems like an Android API, WritableBitmapEx also has it.

    EDIT: oops, I just noticed #3...

    EDIT2: I am just unable to find how WritableBitmap has FromResource, but it is relatively easy to find similar queries, like http://stackoverflow.com/questions/1...riteablebitmap or http://social.msdn.microsoft.com/For...g-fromresource. Interestingly http://stackoverflow.com/questions/3...-silverlight-4 mentions both approaches as viable ones, but that one is not WP.
    Last edited by wizard_hu_; 2013-11-06 at 16:48.

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    52

    Re: being a bit thick

    Quote Originally Posted by wizard_hu_ View Post
    While it seems like an Android API, WritableBitmapEx also has it.

    EDIT: oops, I just noticed #3...

    EDIT2: I am just unable to find how WritableBitmap has FromResource, but it is relatively easy to find similar queries, like http://stackoverflow.com/questions/1...riteablebitmap or http://social.msdn.microsoft.com/For...g-fromresource. Interestingly http://stackoverflow.com/questions/3...-silverlight-4 mentions both approaches as viable ones, but that one is not WP.

    i think that last one is where i got it from

  6. #6
    Registered User
    Join Date
    Sep 2009
    Posts
    52

    Re: being a bit thick

    I did caveat it with 'im being a bit thick'

    it shouldnt be hard but i cant get any examples to work
    I've added the png (its a small one) to the project set it as content and copy always
    i just cant seem to get it into a bitmap

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    424

    Re: being a bit thick

    When using the "FromResource" method you'd perhaps have to set it as EmbeddedResource instead of content. I don't know the library so it's just a guess but according to the naming it would make sense.

  8. #8
    Registered User
    Join Date
    Sep 2009
    Posts
    52

    Re: being a bit thick

    i think its more complex and a timeing issue
    this works - well its not throwing exceptions lets see if i can actually draw the bitmap!!

    BitmapImage img = new BitmapImage(new Uri("Assets/disc1.png", UriKind.Relative));
    img.CreateOptions = BitmapCreateOptions.None;
    img.ImageOpened += (s, e) =>
    {
    discBmp1 = new WriteableBitmap((BitmapImage)s);
    };

  9. #9
    Registered User
    Join Date
    Sep 2009
    Posts
    52

    Re: being a bit thick

    yep that works

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    919

    Re: being a bit thick

    Please do try to keep subject in context with the question. It makes easier for others to find if there are any questions similar to theirs. No only that but we run a weekly featured post promotion so having a good title is important for the promotion of it

Similar Threads

  1. Thick multi-tier client in a Series 60 handset
    By mpriha in forum Symbian C++
    Replies: 2
    Last Post: 2003-07-08, 07:51
  2. Thick multi-tier client in a Series 60 handset
    By mpriha in forum Mobile Java General
    Replies: 0
    Last Post: 2003-06-09, 16:19
  3. Thick multi-tier client in a Series 60 handset
    By mpriha in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2003-06-09, 16:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •