Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Rescale and copy area of source image into an area of dest image
Rescale and copy area of source image into an area of dest image [message #14547] |
Sun, 02 March 2008 20:32  |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
I could not manage to do an apparently simple stuff : copy a rectangular area on source image, rescale it and put in another rectangular area on a destination imagebuffer.
This is my piece of code :
// extract and rescale image area
ImageEncoder t;
Rescale(t, destSize, page, sourceRect);
// copies rescaled image inside cache rectangle
const RGBA *rgba = t;
for(int iLine = 0 ; iLine < t.GetHeight(); iLine++)
{
Copy(imageCache[i+rect.top]+rect.left, rgba, t.GetWidth());
rgba += t.GetWidth();
}
or :
// extract and rescale image area
ImageEncoder t;
Rescale(t, destSize, page, sourceRect);
Image img = Image(t);
// copies rescaled image inside cache rectangle
const RGBA *rgba = img;
for(int iLine = 0 ; iLine < img.GetHeight(); iLine++)
{
memmove(imageCache[i+rect.top]+rect.left, rgba, img.GetWidth()* sizeof(RGBA));
rgba += img.GetWidth();
}
And many other options, but no way, destination stuff doesn't contain the required copy. I know that 't' contains a valid image because painting it directly is ok.
Any hint ?
Ah, last stuff.... ImageDraw class (which could be used for this purpose....) is documented in help with many member functions that it doesn't have in reality, first of them the constructor
Ciao
Max
[Updated on: Sun, 02 March 2008 22:50] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 28 02:37:09 CEST 2025
Total time taken to generate the page: 0.00961 seconds
|