Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Rendering Image bits

Rendering Image bits

Scheduled Pinned Locked Moved C#
questiongraphics
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shree
    wrote on last edited by
    #1

    What is the fastest way to render raw image bits to a Bitmap Object? I am not allowed to use unsafe code.

    H 1 Reply Last reply
    0
    • S Shree

      What is the fastest way to render raw image bits to a Bitmap Object? I am not allowed to use unsafe code.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You mean basically what you'd pass to CreateDIBSection in Windows GDI? Well, you must know a few things about the bitmap data, like the width and height, or even just the stride (how many bytes in a line). You also need to know the pixel format, such as whether the data represents a 32-bit bitmap, 24-bit, etc. Fortunately, with this information GDI+ (and System.Graphics) makes this easy. Use the Bitmap(int, int, int, PixelFormat, IntPtr) constructor, which takes the width, height, stride, pixel format, and a pointer to the raw data, respectively. Read more about that constructor in the .NET Framework SDK for more information.

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups