[Image-SIG] Problem with StretchBlt
Roach, Mark R.
mrroach@uhg.net
18 Apr 2002 14:05:30 -0500
I am trying to print an image using PIL in win32. If I create a printerDC and
expose() my ImageWin object to it directly it prints fine, but I want to
stretch the image, so I tried creating an intermediate DC and
StretchBlt'ing into my printerDC like this:
...
initialize printerDC, pilImage etc...
...
>>> pilDC = win32ui.CreateDC()
>>> pilImage.expose(pilDC.GetHandleOutput())
>>> printerDC.StretchBlt((0,0), pilImgsize,
... pilDC, (0,0),pilImgsize, 0xCC0020)
>>> printerDC.EndPage()
>>> printerDC.EndDoc()
but I end up with "win32ui: StretchBlt failed". What am I doing wrong?
Do I need to somehow initialize my pilDC before using it? Is there a
better way to stretch my image? Any suggestions (even crazy ones) are
appreciated.
Thanks,
Mark Roach