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()
Re: DrawWin32.cpp: PrintDraw::InitPrinter() [message #19323 is a reply to message #19318] Wed, 26 November 2008 11:31 Go to previous messageGo to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior 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
 
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: Sun Apr 28 19:09:17 CEST 2024

Total time taken to generate the page: 0.06620 seconds