Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » DrawWin32.cpp: PrintDraw::InitPrinter()
DrawWin32.cpp: PrintDraw::InitPrinter() [message #19187] Tue, 18 November 2008 16:09 Go to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

May I (?) suggest changing the code for DrawWin32.cpp: PrintDraw::InitPrinter() as follows:

Current:
::SetMapMode(handle, MM_ANISOTROPIC);
::SetViewportExtEx(handle, inchPixels.cx, inchPixels.cy, NULL);
::SetViewportOrgEx(handle, 0, 0, NULL);
::SetWindowExtEx(handle, 600, 600 , NULL);
::SetWindowOrgEx(handle, 0, 0, NULL);

Modified:
::SetMapMode(handle, MM_ANISOTROPIC);
::SetWindowExtEx(handle,pagePixels.cx,inchPixels.cx*pagePixels.cy/inchPixels.cy,NULL);
::SetWindowOrgEx(handle, 0, 0, NULL);
::SetViewportExtEx(handle, pagePixels.cx, pagePixels.cy, NULL); 
::SetViewportOrgEx(handle, 0, 0, NULL);
pagePixels.cy=inchPixels.cx*pagePixels.cy/inchPixels.cy; 

I ended up changing this because I faced multiple problems while printing on an Epson Stylus Photo 1290. The raster and vector coordinate spaces were different since the printer's native 360x360 or 720x720 dpi resolution did not nicely map to the default 600x600 dpi resolution. Also, when printing large images, the image was trashed for some reason. (I made a custom ::SetDIBitsToDevice() based "DrawImage" replacement to circumvent that, but that's another story.)

The modification attempts to present a device context with native pixels, if possible, and also tries to adjust non-square device pixels to square device context pixels.

Also, the Draw::GetPagePixels now returns the corrected value. (This was not the case before and it was a part of the problem.)

NOTE: If somebody has a printer (device context) with non-square pixels, it would be good to test if this change breaks anything on printing of vectors and/or rasters. (The Epson's printer pixel is not square, but the device context pixel from the printer driver is luckily square.)

If someone really relies on the fixed 600x600 dpi resolution of a upp generic printer device, they may possibly not like my suggestion.


// Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to use non integer coordinates (like OpenGL) with Draw?
Next Topic: Extensions to Draw...Ops
Goto Forum:
  


Current Time: Thu Mar 28 18:08:00 CET 2024

Total time taken to generate the page: 0.01290 seconds