blit and BufferedPaintDC

Xavier Miller xavier.miller at cauwe.org
Tue Apr 22 00:59:49 PDT 2008


Did you released the DC before you read the bitmap ?
(DC.SelectObject(wxNULL_BITMAP) or free the DC)

Declan McMullen a écrit :
> I'm screenshotting the contents of my own dc. All it had in it is an 
> image and some other graphical elements drawn on top. If I use a 
> BufferedPaintDC only it works fine,
> if I use a GraphiccontextDC the blit fails.
> 
> 
> On Tue, Apr 22, 2008 at 8:14 AM, Xavier Miller <xavier.miller at cauwe.org 
> <mailto:xavier.miller at cauwe.org>> wrote:
> 
>     Hello,
> 
>     What do you screenshot ? If it is a graphic-accelerated application
>     (DVD player, game), it will not work because the drawing is managed
>     by the graphical card and not the OS.
> 
>     Xavier.
> 
>     Declan McMullen a écrit :
> 
>         Ive tried turning off double buffering and I still get an
>         entitrely black bitmap.
>         If i set the bitmap to match another bitmap its fine, so It
>         seems the blit definitely isnt
>         copying the content of the dc to the memory dc
> 
>         Any ideas ?
> 
>         On Sun, Apr 20, 2008 at 4:42 PM, Declan McMullen
>         <declan.mcmullen at gmail.com <mailto:declan.mcmullen at gmail.com>
>         <mailto:declan.mcmullen at gmail.com
>         <mailto:declan.mcmullen at gmail.com>>> wrote:
> 
> 
>            Is it possible to use blit with a double buffered paint dc ?
>            I have the following function
> 
> 
>            wxBitmap WorkspaceView::getScreenShot(wxDC& dc)
> 
>            {
> 
>            wxSize screenSize = dc.GetSize();
> 
>            wxBitmap screenBitmap(screenSize.GetWidth(),
>         screenSize.GetHeight());
> 
>            wxMemoryDC memDC;
> 
>            memDC.SelectObject(screenBitmap);
> 
>            memDC.Blit(0, 0, screenSize.GetWidth(),
>         screenSize.GetHeight(), &dc,
>            0, 0);
> 
>            memDC.SelectObject(wxNullBitmap);
> 
>            return screenBitmap;
> 
>            }
> 
> 
> 
>            What I wanted to do with it was make a bitmap I could use for
>            printing, i.e just put everything
> 
>            thats on the screen into a bitmap, send that image to my printout
>            object and print it.
> 
>            All I'm getting though is a completely black image and I'm
>         thinking
>            its due to my double buffering ?
> 
> 
>            Is it possible for me to get the contents of the buffer
>         itself and
>            use that ?
> 
> 
> 
>            --    http://www.computing.dcu.ie/~dmcmullen
>         <http://www.computing.dcu.ie/%7Edmcmullen>
>            <http://www.computing.dcu.ie/%7Edmcmullen>
> 
>            declan.mcmullen at computing.dcu.ie
>         <mailto:declan.mcmullen at computing.dcu.ie>
>            <mailto:declan.mcmullen at computing.dcu.ie
>         <mailto:declan.mcmullen at computing.dcu.ie>>
> 
>            School of Computing
>            Postgrad Bay A
> 
> 
> 
> 
>         -- 
>         http://www.computing.dcu.ie/~dmcmullen
>         <http://www.computing.dcu.ie/%7Edmcmullen>
>         declan.mcmullen at computing.dcu.ie
>         <mailto:declan.mcmullen at computing.dcu.ie>
>         <mailto:declan.mcmullen at computing.dcu.ie
>         <mailto:declan.mcmullen at computing.dcu.ie>>
> 
>         School of Computing
>         Postgrad Bay A
> 
> 
>         ------------------------------------------------------------------------
> 
>         _______________________________________________
>         wx-users mailing list
>         wx-users at lists.wxwidgets.org <mailto:wx-users at lists.wxwidgets.org>
>         http://lists.wxwidgets.org/mailman/listinfo/wx-users
> 
>     _______________________________________________
>     wx-users mailing list
>     wx-users at lists.wxwidgets.org <mailto:wx-users at lists.wxwidgets.org>
>     http://lists.wxwidgets.org/mailman/listinfo/wx-users
> 
> 
> 
> 
> -- 
> http://www.computing.dcu.ie/~dmcmullen
> declan.mcmullen at computing.dcu.ie <mailto:declan.mcmullen at computing.dcu.ie>
> School of Computing
> Postgrad Bay A
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> wx-users mailing list
> wx-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users


More information about the wx-users mailing list