Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » I propose to include function PropRescale.
I propose to include function PropRescale. [message #24043] |
Tue, 22 December 2009 15:06  |
|
I propose to include in the base package in addition to the functions Rescale function propRescale.
commonfucnc.h:
Image PropRescale(const Image& im, const Size res_size);
Image PropRescale(const Image& im, const int cx, const int cy);
Image PropRescale(const Image& im, const ImageCtrl& imc);
void PropRescale(const Image& im, ImageCtrl& imc ,const bool setimage);
commonfunc.cpp:
Image PropRescale(const Image& im, const Size res_size){
Size imsize,ressize=res_size;
imsize = im.GetSize();
if (imsize.cx > 0 && imsize.cy > 0) {
double ixy = double(imsize.cx)/imsize.cy;
double rxy = double(ressize.cx)/ressize.cy;
if (rxy>ixy) {
ressize.cx = ressize.cy*imsize.cx/imsize.cy;
} else {
ressize.cy = ressize.cx*imsize.cy/imsize.cx;
}
return Rescale(im,ressize);
}
}
Image PropRescale(const Image& im,const int cx,const int cy) {
Size ressize;
ressize.cx = cx;
ressize.cy = cy;
return PropRescale(im,ressize);
}
Image PropRescale(const Image& im, const ImageCtrl& imc) {
Image i = PropRescale(im,imc.GetSize());
return i;
}
void PropRescale(const Image& im, ImageCtrl& imc ,const bool setimage) {
Image i = PropRescale(im,imc.GetSize());
if (setimage) imc.SetImage(i);
return;
}
I use it to display images in ImageCtrl, therefore, as a parameter to some of the call option is ImageCtrl.
The function uses real arithmetic. I was going to transfer all of integer arithmetic, but so far not done so.
Another point. I do not quite understand CacheRescale, so long and did not interface to CacheRescale.
PS.
Perhaps there is a solution makes it unnecessary to my exercises. If so, could you tell. And then I may be wrong, to reinvent the wheel?
SergeyNikitin<U++>( linux, wine )
{
under( Ubuntu || Debian || Raspbian );
}
|
|
|
 |
|
I propose to include function PropRescale.
|
 |
|
Re: I propose to include function PropRescale.
By: koldo on Tue, 22 December 2009 15:57
|
 |
|
Re: I propose to include function PropRescale.
|
 |
|
Re: I propose to include function PropRescale.
By: koldo on Tue, 22 December 2009 21:33
|
 |
|
Re: I propose to include function PropRescale.
|
 |
|
Re: I propose to include function PropRescale.
|
 |
|
Re: I propose to include function PropRescale.
By: koldo on Tue, 22 December 2009 22:09
|
 |
|
Re: I propose to include function PropRescale.
By: Didier on Wed, 23 December 2009 18:44
|
 |
|
Re: I propose to include function PropRescale.
By: koldo on Wed, 23 December 2009 21:11
|
 |
|
Re: I propose to include function PropRescale.
By: Didier on Wed, 23 December 2009 23:52
|
 |
|
Re: I propose to include function PropRescale.
By: mirek on Thu, 24 December 2009 11:06
|
 |
|
Re: I propose to include function PropRescale.
By: koldo on Thu, 24 December 2009 16:55
|
 |
|
Re: I propose to include function PropRescale.
By: mirek on Fri, 25 December 2009 11:54
|
 |
|
Re: I propose to include function PropRescale.
|
 |
|
Re: I propose to include function PropRescale.
By: mirek on Fri, 25 December 2009 11:55
|
Goto Forum:
Current Time: Tue May 13 02:00:31 CEST 2025
Total time taken to generate the page: 0.02716 seconds
|