Albrecht Schlosser schrieb:
> On 21.02.2012 09:34, Domingo Alvarez Duarte wrote:
>> Yor proposed solution doesn't address the resolution problem.
>
> And why do you think so? What if Edzard's "window" has a width of
> 10.000 and a height of 30.000 ?
No, this is not, why I posted the code:
int ww= pWindow->w();
int wh= pWindow->h();
// This is for keeping the aspect ratio
int pw, ph; // Printing area
if (!p->start_job(1))
{ // Printer stuff, don't really know, what I'm doing. ;o)
p->start_page();
if (!p->printable_rect(&pw, &ph))
{ // Now printing area is resolution of the sheet
// Okay, depending on printers DPI, but much larger
// than a screen window. Next part is just for
// fitting printing area to windows aspect ratio.
int left, top, right, bottom;
p->margins (&left, &top, &right, &bottom);
pw-= 2* left;
ph-= 2* top;
left*= 2;
top*= 2;
float sw= float(pw)/float(ww);
float sh= float(ph)/float(wh);
if (sw > sh) sw= sh;
p->scale(sw); // This scales the printing area
p->print_widget(pWindow, left, top);
// This prints content of window to the whole printing area,
// the same as scaling it to resolution of sheet
}
p->end_page();
p->end_job();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk