Using BitBlt to Draw Image
-
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 -
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 lotMaybe 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) -
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 lotWhat 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 )