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 » How to zoom images? [PARTLY SOLVED...]
Re: How to zoom images? [message #1816 is a reply to message #1814] Mon, 20 March 2006 15:57 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14160
Registered: November 2005
Ultimate Member
fudadmin wrote on Mon, 20 March 2006 09:25

How to zoom images?
I've tried
img1.RatioSize(Size(10,10)); //no effect
img1.FitSize(Size(10,10)); //no effect

and img1.SetSize(Size(10,10)); //not a member of 'Image'?


Actually, current API is going away, I am working on new Image right now (and it will be a simple function).

Anyway, if you need to display zoomed image, the simple way right now is to use the DrawImage with target size. You can also use ImageDraw to draw zoomed image to new one.

Current high quality zooming goes like this (excerpt from the real code):

Quote:


PixelArray x = PngEncoder().LoadArray(data).pixel;
Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight()));
if(w.IsDrawing())
w.DrawImage(Rect(sz), PixelArrayToImage(x));
else {
Size scale = min(outsz, sz << 2);
PixelArray dest(scale);
PixelCopyAntiAlias(dest, scale, x, x.GetSize());
if(w.IsSystem() && !w.IsDrawing())
dest.Paint(w, Rect(sz));
else
w.DrawImage(Rect(sz), PixelArrayToImage(dest));
}



(Do you wonder why I insist on refactoring this API? Smile

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Create my own Rect for clipping?
Next Topic: Loading Image (from HttpClient)
Goto Forum:
  


Current Time: Sat Dec 07 22:42:43 CET 2024

Total time taken to generate the page: 0.02054 seconds