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 » Draw, Display, Images, Bitmaps, Icons » I propose to include function PropRescale.
Re: I propose to include function PropRescale. [message #24044 is a reply to message #24043] Tue, 22 December 2009 15:57 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3451
Registered: August 2008
Senior Veteran
Hello Sergey

I think your proposal is similar to this in Functions4U:

template <class T>
Rect_<T> FitInFrame(const Size_<T> &frame, const Size_<T> &object)
{
	double frameAspect  = frame.cx/(double)frame.cy; 
	double objectAspect = object.cx/(double)object.cy;	
	
	if (frameAspect > objectAspect) {
		double x = (frame.cx - objectAspect*frame.cy)/2.;
		return Rect_<T>((T)x, 0, (T)(x + objectAspect*frame.cy), frame.cy);
	} else {
		double y = (frame.cy - frame.cx/objectAspect)/2.;
		return Rect_<T>(0, (T)y, frame.cx, (T)(y + frame.cx/objectAspect));
	}
}


From Functions4U documentation:

index.php?t=getfile&id=2055&private=0

Best regards
Koldo
  • Attachment: Screen.PNG
    (Size: 142.43KB, Downloaded 836 times)


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IMAGECLASS::Iml() crashes
Next Topic: Variable pitch fonts
Goto Forum:
  


Current Time: Wed Oct 22 00:20:05 CEST 2025

Total time taken to generate the page: 0.06944 seconds