U++ framework
Do not panic. Ask here before giving up.

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: 14290
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: Wed Apr 29 12:41:25 GMT+2 2026

Total time taken to generate the page: 0.00647 seconds