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 » 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 Go to next message
alex100 is currently offline  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 #14911 is a reply to message #14910] Wed, 19 March 2008 16:35 Go to previous messageGo to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
.

[Updated on: Wed, 19 March 2008 16:49]

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 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This is not a trivial issue Smile

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
Previous Topic: How to hide a TopSeparatorFrame
Next Topic: TheIDE bug in layout designer?
Goto Forum:
  


Current Time: Mon Apr 29 09:40:05 CEST 2024

Total time taken to generate the page: 0.02667 seconds