Drawing a pixmap onto a CgPrinterWindow

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Drawing a pixmap onto a CgPrinterWindow

Carl Gundel-2
I am trying to draw a pixmap onto a CgPrinterWindow using
 
    CgDrawable>>
        copyArea: dest 
        gc: gc 
        srcX: srcX 
        srcY: srcY 
        width: width 
        height: height 
        destX: destX 
        destY: destY
 
The pixmap has a CgScreen as its screen, and the printer window has a CgPrinterScreen.  I get an error "Common Graphics error: BadMatch id: a CgPrinterWindow".
 
The error is thrown here:
 
   (self screen = dest screen and: [self depth = dest depth])
    ifFalse: [
     self display reportError: BadMatch with: dest.
     server endRequest.
     ^self]].
 
The source and destination screens are different.  I'm not sure how to solve that problem.  The graphic exists before I even know what the printer is going to be.  It also expects the depth to be the same, but the display screen depth is 32 and the printer depth is 24.
 
Any ideas?  How can I remap the pixmap to make it compatible with the printer?
 
Thanks.
 
-Carl

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drawing a pixmap onto a CgPrinterWindow

Carl Gundel-2
Okay, I seem to have figured out that the method I am using is only designed to copy around on the same medium, I guess.  So I looked for other methods for copying between different drawing surfaces but I can't find anything.
 
-Carl

On Monday, July 21, 2014 11:23:39 AM UTC-4, Carl Gundel wrote:
I am trying to draw a pixmap onto a CgPrinterWindow using
 
    CgDrawable>>
        copyArea: dest 
        gc: gc 
        srcX: srcX 
        srcY: srcY 
        width: width 
        height: height 
        destX: destX 
        destY: destY
 
The pixmap has a CgScreen as its screen, and the printer window has a CgPrinterScreen.  I get an error "Common Graphics error: BadMatch id: a CgPrinterWindow".
 
The error is thrown here:
 
   (self screen = dest screen and: [self depth = dest depth])
    ifFalse: [
     self display reportError: BadMatch with: dest.
     server endRequest.
     ^self]].
 
The source and destination screens are different.  I'm not sure how to solve that problem.  The graphic exists before I even know what the printer is going to be.  It also expects the depth to be the same, but the display screen depth is 32 and the printer depth is 24.
 
Any ideas?  How can I remap the pixmap to make it compatible with the printer?
 
Thanks.
 
-Carl

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drawing a pixmap onto a CgPrinterWindow

Carl Gundel-2
I kept on poking around until I found the answer.  In the CgPixmap class there is a copyToPrinter method that shows how to do it.
 
 image := pixmap asDeviceIndependentImage.
 printGC := printerShell window createGC: 0 values: nil.
 printerShell window
  putDeviceIndependentImage: printGC
  image: image
  srcRect: (0 @ 0 extent: image extent)
  destRect: (0 @ 0 extent: image extent truncated).
 printGC freeGC.
 
I don't know how well this will scale with lots of large pixmaps, but it solves my problem in the short term.
 
Hopefully this will be helpful to others.
 
-Carl
 
On Monday, July 21, 2014 5:41:51 PM UTC-4, Carl Gundel wrote:
Okay, I seem to have figured out that the method I am using is only designed to copy around on the same medium, I guess.  So I looked for other methods for copying between different drawing surfaces but I can't find anything.
 
-Carl

On Monday, July 21, 2014 11:23:39 AM UTC-4, Carl Gundel wrote:
I am trying to draw a pixmap onto a CgPrinterWindow using
 
    CgDrawable>>
        copyArea: dest 
        gc: gc 
        srcX: srcX 
        srcY: srcY 
        width: width 
        height: height 
        destX: destX 
        destY: destY
 
The pixmap has a CgScreen as its screen, and the printer window has a CgPrinterScreen.  I get an error "Common Graphics error: BadMatch id: a CgPrinterWindow".
 
The error is thrown here:
 
   (self screen = dest screen and: [self depth = dest depth])
    ifFalse: [
     self display reportError: BadMatch with: dest.
     server endRequest.
     ^self]].
 
The source and destination screens are different.  I'm not sure how to solve that problem.  The graphic exists before I even know what the printer is going to be.  It also expects the depth to be the same, but the display screen depth is 32 and the printer depth is 24.
 
Any ideas?  How can I remap the pixmap to make it compatible with the printer?
 
Thanks.
 
-Carl

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.