|
|
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 );
}
|
|
|
|
Re: I propose to include function PropRescale. [message #24045 is a reply to message #24044] |
Tue, 22 December 2009 18:49   |
|
Could you give an example of use this template?
I still think that the task to display the picture in any Control, and while it fit in the Control are standard, and would be better off just when you display a control would have been just any flag.
Finally, I have these functions in a separate package. But the task of manipulating the images so often and that you want to include the output function as standard. I just tried to make calls to these functions as possible similar to the original functions.
By the way, I think that is proportional to output images is used much more often than not proportional, and should at least include it in the base system. Better yet, make a proportional output images - by default.
SergeyNikitin<U++>( linux, wine )
{
under( Ubuntu || Debian || Raspbian );
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Tue May 13 07:47:49 CEST 2025
Total time taken to generate the page: 0.03575 seconds
|
|
|