Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » DrawWin32.cpp: PrintDraw::InitPrinter()
Re: DrawWin32.cpp: PrintDraw::InitPrinter() [message #19323 is a reply to message #19318] |
Wed, 26 November 2008 11:31   |
Tom1
Messages: 1303 Registered: March 2007
|
Ultimate Contributor |
|
|
Mirek,
You do not need to waste your money on an Epson ink-jet. Just install the latest driver on XP and check the preview option to verify the results. (I don't have such printer either, but my client unfortunately does.)
--
Here's a minimal fix for ImageWin32/Image::Data::Paint() that gets things working with the 600 dpi default resolution:
if(GetKind() == IMAGE_OPAQUE && paintcount == 0 && sr == Rect(sz) && !w.IsMetaFile() && IsWinNT()) {//TODO !IsWinNT
Becomes:
if(GetKind() == IMAGE_OPAQUE && paintcount == 0 && sr == Rect(sz) && !w.IsMetaFile() && IsWinNT() && !w.IsPrinter()) {//TODO !IsWinNT
For printer jobs, this effectively passes the image rendering work from ::SetDIBitsToDevice based SetSurface implementation to another existing image rendering mechanism that works OK.
Additionally, to keep Draw::GetPagePixels() and Draw::GetPixelsPerInch working on the remapped printing context, the following needs to be added into the end of PrintDraw::InitPrinter():
pagePixels.cx=600*pagePixels.cx/inchPixels.cx;
pagePixels.cy=600*pagePixels.cy/inchPixels.cy;
inchPixels.cx=600;
inchPixels.cy=600;
--
However, I would still strongly suggest on supporting the printer's native resolution for best printing quality and future flexibility -- even if it's an optional flag for PrintDraw::PrintDraw. The code for PrintDraw::InitPrinter then becomes:
int dpi=flagNativeDPI?min(inchPixels.cx,inchPixels.cy):600;
::SetMapMode(handle, MM_ANISOTROPIC);
::SetWindowExtEx(handle, dpi*pagePixels.cx/inchPixels.cx, dpi*pagePixels.cy/inchPixels.cy, NULL);
::SetWindowOrgEx(handle, 0, 0, NULL);
::SetViewportExtEx(handle, pagePixels.cx, pagePixels.cy, NULL);
::SetViewportOrgEx(handle, 0, 0, NULL);
pagePixels.cx=dpi*pagePixels.cx/inchPixels.cx;
pagePixels.cy=dpi*pagePixels.cy/inchPixels.cy;
inchPixels.cx=dpi;
inchPixels.cy=dpi;
// Tom
|
|
|
Goto Forum:
Current Time: Tue May 13 04:38:59 CEST 2025
Total time taken to generate the page: 0.01001 seconds
|