Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • neopocott

    neopocott

    Member

    368 Points

    82 Posts

    Re: Why is the WriteableBitmap so cumbersome and inefficient?

    May 10, 2009 11:21 AM | LINK

    Hi,

    Actually, you can access either to the WriteableBitmap pixels using bytes or using ints (way faster).

    For example, for a PixelFormats.Bgr32 format, you could write:

    bitmap[width * y + x] = (red << 16) | (green << 8) | blue;

    I recon that WriteableBitmap is not as fast as we could expect but at least it is way faster than the fastest PNG encoder you could write (for example, the one I used in Quake in Silverlight).

    With the above method, I can generate 1280x1024 bitmaps in 50 FPS. With my PNG encoder, this is only 15 FPS.

    Julien Frelat
    Microsoft Client App Dev MVP
    Quake in Silverlight - Twitter - Blog (French)