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. Using BitBlt to Draw Image

Using BitBlt to Draw Image

Scheduled Pinned Locked Moved C#
graphicsperformancequestion
3 Posts 3 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.
  • B Offline
    B Offline
    beatles1692
    wrote on last edited by
    #1

    Hi I want to draw an image on the screen and because I want to do it as fast as possible I decide to use BitBlt instead of DrawImage method. When I use BitBlt to draw the content of the screen on itself everything works fine but when I try to draw an image that is loaded into memory nothing happens. here's what I do: Image image=Image.FromFile(myfilepath); Graphics imageGraphics=Graphics.FromImage(image); IntPtr imageHdc=imageGraphics.GetHdc(); BitBlt(screenHdc,screen.Left,screen.Top,screen.Width,screen.Height,imageHdc,0,0,SRCCOPY); imageGraphics.ReleaseHdc(imageHdc); Please tell me what should I do? Thanks a lot

    A C 2 Replies Last reply
    0
    • B beatles1692

      Hi I want to draw an image on the screen and because I want to do it as fast as possible I decide to use BitBlt instead of DrawImage method. When I use BitBlt to draw the content of the screen on itself everything works fine but when I try to draw an image that is loaded into memory nothing happens. here's what I do: Image image=Image.FromFile(myfilepath); Graphics imageGraphics=Graphics.FromImage(image); IntPtr imageHdc=imageGraphics.GetHdc(); BitBlt(screenHdc,screen.Left,screen.Top,screen.Width,screen.Height,imageHdc,0,0,SRCCOPY); imageGraphics.ReleaseHdc(imageHdc); Please tell me what should I do? Thanks a lot

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      Maybe this link will help http://www.pinvoke.net/default.aspx/gdi32/BitBlt.html[^]

      Ant. I'm hard, yet soft.
      I'm coloured, yet clear.
      I'm fruity and sweet.
      I'm jelly, what am I? Muse on it further, I shall return!
      - David Walliams (Little Britain)

      1 Reply Last reply
      0
      • B beatles1692

        Hi I want to draw an image on the screen and because I want to do it as fast as possible I decide to use BitBlt instead of DrawImage method. When I use BitBlt to draw the content of the screen on itself everything works fine but when I try to draw an image that is loaded into memory nothing happens. here's what I do: Image image=Image.FromFile(myfilepath); Graphics imageGraphics=Graphics.FromImage(image); IntPtr imageHdc=imageGraphics.GetHdc(); BitBlt(screenHdc,screen.Left,screen.Top,screen.Width,screen.Height,imageHdc,0,0,SRCCOPY); imageGraphics.ReleaseHdc(imageHdc); Please tell me what should I do? Thanks a lot

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        What do you think calling DrawImageUnscaled is going to do, under the hood ? I suspect it does nothing more than this.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        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