|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Heise
Joined: 13 Feb 2007 Posts: 5
|
Posted: Sun Mar 18, 2007 5:28 am Post subject: COPY_GRAPHICS_REGION@ printer scaling |
|
|
I am attempting to use COPY_GRAPHICS_REGION@ to scale an image from a graphics region to a printer's graphics region, using GET_GRAPHICAL_RESOLUTION@ to determine the proper values to calculate DWIDTH and DHEIGHT. The documentation for COPY_GRAPHICS_REGION@ states that:
"Under Win32 it is possible to stretch a drawing surface when copying from the screen to a printer but not every printer supports this mode."
Is it then inadvisable to use this function for general purpose scaling to the printer? Under what conditions is it reliable?
I have considered the possibility of scaling to another graphics region (independent of the printer) and then copying to the printer's region, but this seems inefficient and also raises issues identified with creating (multiple) large graphics regions (see existing thread for CREATE_GRAPHICS_REGION@).
Thank you in advance for insight.
David Heise |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Mon Mar 19, 2007 10:01 am Post subject: |
|
|
copy_graphics_region@ includes a call to the API function StretchBlt.
StretchBlt does not work for all devices.
An API call to GetDeviceCaps(hdc, RASTERCAPS) returns RC_STRETCHBLT if the device supports StretchBlt.
hdc is the handle to the device context for the printer in question.
Let me know if you want to progress further with this. I am not sure that there is a direct and easy way to get the hdc in ClearWin+.
If this is possible, a simpler appoach would be to run some tests on the printers you want to use. |
|
Back to top |
|
|
Heise
Joined: 13 Feb 2007 Posts: 5
|
Posted: Fri Mar 23, 2007 7:45 pm Post subject: COPY_GRAPHICS_REGION@ printer scaling |
|
|
Paul,
Thanks for your reply.
At this time I am going to use the alternative approach I suggested, as my implementation must work for any printer:
Consider internal graphics region ORIG_GR, SCALED_GR
Consider pritner graphics region PRINT_GR
SCALED_GR has same dimensions as PRINT_GR
1. scale image in ORIG_GR to SCALED_GR using COPY_GRAPHICS_REGION@
2. copy scaled image from SCALED_GR to PRINT_GR using COPY_GRAPHICS_REGION@ with no scaling (because SCALED_GR dimensions are exactly equal to PRINT_GR dimensions)
If SCALED_GR is too large (see issues with CREATE_GRAPHICS_REGION@), divide the PRINT_GR into equally dimensioned partitions. (Divide repeatedly if necessary until each partition is of useful size.) Create SCALED_GR with the dimensions of the partition. Scale each portion of ORIG_GR to SCALED_GR separately, copying each scaled partition from SCALED_GR to PRINT_GR individually. This approach may be particularly desirable when copying to large-format printers or plotters due to the memory consumption of a large graphic.
For my needs, this is a perfectly acceptable solution.
Long term, this might be a reasonable approach to removing the caveat from COPY_GRAPHICS_REGION@ (of some printers not supporting a scaled copy), providing an opportunity to make the library routine more general and portable. Check for RC_STRETCHBLT, and if false, implement something similar to the above pseudocode. Thus, printer driver is used if it supports scaling; otherwise, scaling is still performed transparently for the user.
Kind regards,
David Heise |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|