|
From: Declan McMullen on 24 Apr 2008 06:33 Hey all, Is it possible to use a wxGCDC for printing? In my panel I'm using graphics context methods to draw to the screen, so I can do it in floating point. I tried to copy that code for printing and I got a blank screen, some test code suggests the wxDCDC doesnt work. bool Printout::OnPrintPage(int page) { wxDC *dc = GetDC(); wxGCDC gdc (dc); dc->DrawCircle(10,10,10); gdc.DrawCircle(30,30,10); } The first circle draws the second doesnt. I needed the graphics context as the methods im using to draw elements lower in my architecture use wxGraphicsContext functions and so I convert to that context wxGraphicsContext* dc = gdc.GetGraphicsContext(); before calling the functions. -- http://www.computing.dcu.ie/~dmcmullen declan.mcmullen(a)computing.dcu.ie School of Computing Postgrad Bay A
From: Declan McMullen on 24 Apr 2008 06:49 I just came across and old email that said GCDC doesnt support printing is that stil lthe case? I thought I might just make an image of my dc content and pass that to my printerDC but i cant seem to blit the contents of my wxGCDC. So I was thinking, I currently use a BufferePaintDC. If I did my own buffering by creating my own memoryDC bitmap drawing everything on to it and then drawing that on screen, could I then pass that bitmap to my printerDC for display ? Are there any barriers to that approach and would it still allow me to use the graphics context for drawing to the bitmap ? On Thu, Apr 24, 2008 at 11:33 AM, Declan McMullen <declan.mcmullen(a)gmail.com> wrote: > Hey all, > Is it possible to use a wxGCDC for printing? > > In my panel I'm using graphics context methods to draw to the screen, so I > can do it in floating point. > I tried to copy that code for printing and I got a blank screen, some test > code suggests the wxDCDC doesnt work. > > bool Printout::OnPrintPage(int page) > { > wxDC *dc = GetDC(); > wxGCDC gdc (dc); > dc->DrawCircle(10,10,10); > gdc.DrawCircle(30,30,10); > } > > The first circle draws the second doesnt. > > I needed the graphics context as the methods im using to draw elements > lower in my architecture use wxGraphicsContext functions and so I convert > to that context > wxGraphicsContext* dc = gdc.GetGraphicsContext(); before calling the > functions. > > -- > http://www.computing.dcu.ie/~dmcmullen<http://www.computing.dcu.ie/%7Edmcmullen> > declan.mcmullen(a)computing.dcu.ie > School of Computing > Postgrad Bay A -- http://www.computing.dcu.ie/~dmcmullen declan.mcmullen(a)computing.dcu.ie School of Computing Postgrad Bay A
From: Declan McMullen on 24 Apr 2008 07:42 Theory worked, its all good :) On Thu, Apr 24, 2008 at 11:49 AM, Declan McMullen <declan.mcmullen(a)gmail.com> wrote: > I just came across and old email that said GCDC doesnt support printing is > that stil lthe case? > > I thought I might just make an image of my dc content and pass that to my > printerDC but i cant seem to blit > the contents of my wxGCDC. > > So I was thinking, I currently use a BufferePaintDC. If I did my own > buffering by creating my own memoryDC bitmap > drawing everything on to it and then drawing that on screen, could I then > pass that bitmap to my printerDC for display ? > Are there any barriers to that approach and would it still allow me to use > the graphics context for drawing to the bitmap ? > > > > > On Thu, Apr 24, 2008 at 11:33 AM, Declan McMullen < > declan.mcmullen(a)gmail.com> wrote: > > > Hey all, > > Is it possible to use a wxGCDC for printing? > > > > In my panel I'm using graphics context methods to draw to the screen, so > > I can do it in floating point. > > I tried to copy that code for printing and I got a blank screen, some > > test code suggests the wxDCDC doesnt work. > > > > bool Printout::OnPrintPage(int page) > > { > > wxDC *dc = GetDC(); > > wxGCDC gdc (dc); > > dc->DrawCircle(10,10,10); > > gdc.DrawCircle(30,30,10); > > } > > > > The first circle draws the second doesnt. > > > > I needed the graphics context as the methods im using to draw elements > > lower in my architecture use wxGraphicsContext functions and so I > > convert to that context > > wxGraphicsContext* dc = gdc.GetGraphicsContext(); before calling the > > functions. > > > > -- > > http://www.computing.dcu.ie/~dmcmullen<http://www.computing.dcu.ie/%7Edmcmullen> > > declan.mcmullen(a)computing.dcu.ie > > School of Computing > > Postgrad Bay A > > > > > -- > http://www.computing.dcu.ie/~dmcmullen<http://www.computing.dcu.ie/%7Edmcmullen> > declan.mcmullen(a)computing.dcu.ie > School of Computing > Postgrad Bay A > -- http://www.computing.dcu.ie/~dmcmullen declan.mcmullen(a)computing.dcu.ie School of Computing Postgrad Bay A
From: Robert Roebling on 24 Apr 2008 08:38 Declan McMullen wrote: > Hey all, > Is it possible to use a wxGCDC for printing? > > In my panel I'm using graphics context methods to draw to the screen, > so I can do it in floating point. > I tried to copy that code for printing and I got a blank screen, some > test code suggests the wxDCDC doesnt work. It doesn't work yet (unless using a bitmap, as you found out), but it should be "easy" to implement as long as you are using the GtkPrint backend to actually do the printing under and in all cases on MSW and OS X and I plan to add something to wxDC that would return a wxGraphicsContext. It just hasn't been done yet... Robert
From: Declan McMullen on 24 Apr 2008 09:45 Coolo. The image seems to be working nicely. One problem I am having though. I need to print it at a specific size. I'm essentially replicating a template that was written in corel draw using the dc. Everything is working perfectly in terms of drawing. I need to print it out though at size A3 and have it fill the page. I know the width and height it needs to be in pixels at 300 x 300 dpi in order to fit correctly on the A3 page. Is it possible for me to make my memoryDC bitmap at a size that would allow me to draw to it and then it straight to an A3 printer at the right size? I've been a bit confused by the whole PPI stuff in the printer framework. The image its producing is at a dpi of 96 x 96, and im unsure how to get it to 300 x 300 Any help much appreciated On Thu, Apr 24, 2008 at 1:38 PM, Robert Roebling <robert(a)roebling.de> wrote: > > Declan McMullen wrote: > > > Hey all, > > Is it possible to use a wxGCDC for printing? > > > > In my panel I'm using graphics context methods to draw to the screen, > > so I can do it in floating point. > > I tried to copy that code for printing and I got a blank screen, some > > test code suggests the wxDCDC doesnt work. > > It doesn't work yet (unless using a bitmap, as you found out), > but it should be "easy" to implement as long as you are using > the GtkPrint backend to actually do the printing under and in > all cases on MSW and OS X and I plan to add something to wxDC > that would return a wxGraphicsContext. It just hasn't been > done yet... > > Robert > > > _______________________________________________ > wx-users mailing list > wx-users(a)lists.wxwidgets.org > http://lists.wxwidgets.org/mailman/listinfo/wx-users > -- http://www.computing.dcu.ie/~dmcmullen declan.mcmullen(a)computing.dcu.ie School of Computing Postgrad Bay A
|
Pages: 1 Prev: scaling of fonts Next: Re[2]: own tag handlers + wxHtmlSimpleListBox |