Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Screen coordinates to Printer coordinates Conversion?
Screen coordinates to Printer coordinates Conversion? [message #14910] |
Wed, 19 March 2008 16:31  |
alex100
Messages: 118 Registered: November 2007
|
Experienced Member |
|
|
Hello,
I have a jpg image loaded in a custom control on a form. The image is a scanning of a A4 paper sheet. On screen image has 1700x2338 size. Now I would like to print the image on an A4 printer but obviously the image is printed very short.
Is there any class or function to translate these coordinates?
I have searched but nothing found...
By the way,
If i try to translate it "blindly" by for instance multiplying size for a factor (i.e. 10) the Rescale() function gives out of memory...
Any advices?
Thanks
Alex
Thanks
Alex
[Updated on: Wed, 19 March 2008 16:41] Report message to a moderator
|
|
|
|
Re: Screen coordinates to Printer coordinates Conversion? [message #14967 is a reply to message #14911] |
Sun, 23 March 2008 08:50  |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
This is not a trivial issue 
First of all, to print it, you perhaps want to know its physical dimensions. If it is loaded from the file, in Raster::Info there is a "dots" member that should be set to exactly this.
Now the next problem is rescaling. Oviously, rescaling the full page results in very big Image. To solve this, you need to get a step deeper and do the rescale by parts ("bands").
The simplest way how to do that is to use:
void DrawRasterData(Draw& w, int x, int y, int cx, int cy, const String& data);
Simply put the image file (.png, .jpg ... anything you have plugin in project) into "data" member and it will do the rest. It will even "RLE compress" the result (will detect uniform color areas and replace sending raster pixels with DrawRect).
Mirek
|
|
|
Goto Forum:
Current Time: Sun Apr 27 19:34:25 CEST 2025
Total time taken to generate the page: 0.00749 seconds
|