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++ Library : Other (not classified elsewhere) » PdfDraw, custom DPI request + my fix
Re: PdfDraw, custom DPI request + my fix [message #58827 is a reply to message #58818] Thu, 15 September 2022 10:59 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
OK, that is misunderstanding and the problem is elsewhere.

Image::GetSize returns "pixel size" without taking account of DPI (or any other physical dimension).

Now there is Image::GetDots, which returns the size of image in "dots", where dot which is basically 600DPI pixel. Everything in U++ Draw related code that deals with physical dimensions is in dots, including all dimensions in PdfDraw.

Long story short, if you use GetDots instead of GetSize here, it will work as you needed.

Just for reference, to be sure I have tested with this code:

GUI_APP_MAIN
{
	for(const char *fn : { "C:/upp/MyApps/6x9_300dpi.png", "C:/upp/MyApps/6x9_600dpi.png" }) {
		Image img = StreamRaster::LoadFileAny(fn);
		Size isz = img.GetDots();
		DDUMP(isz);
	
		PdfDraw draw(isz.cx, isz.cy);
	
		draw.DrawImage(0, 0, isz.cx, isz.cy, img);
	
		SaveFile("D:/xxx/" + GetFileTitle(fn) + ".pdf", draw.Finish());
	}
}
 
Read Message icon3.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Windows 11 - Menubar issues
Next Topic: bug in the routine involving the time of the zip file
Goto Forum:
  


Current Time: Thu Aug 21 03:39:46 CEST 2025

Total time taken to generate the page: 0.05017 seconds