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...]
How to zoom images? [PARTLY SOLVED...] [message #1814] Mon, 20 March 2006 15:25 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
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'?

[Updated on: Sun, 09 April 2006 04:00]

Report message to a moderator

Re: How to zoom images? [message #1816 is a reply to message #1814] Mon, 20 March 2006 15:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
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
Re: How to zoom images? [message #1817 is a reply to message #1816] Mon, 20 March 2006 17:56 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Do you wonder why I insist on improving Ultimate++ before doing big publicity? Smile
Re: How to zoom images? [PARTLY SOLVED...] [message #7701 is a reply to message #1814] Tue, 16 January 2007 04:23 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
Is there already some progress made towards a simpler resizing of a Drawing to fit a Picture Container?
Im drawing tiny to huge pictures here and like to resize them so they all fit into my 500x500 Container. All those Drawings are quadratic in shape, sounds easy eh?

[Updated on: Tue, 16 January 2007 08:06]

Report message to a moderator

Re: How to zoom images? [PARTLY SOLVED...] [message #7704 is a reply to message #7701] Tue, 16 January 2007 12:17 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ordog wrote on Mon, 15 January 2007 22:23

Is there already some progress made towards a simpler resizing of a Drawing to fit a Picture Container?
Im drawing tiny to huge pictures here and like to resize them so they all fit into my 500x500 Container. All those Drawings are quadratic in shape, sounds easy eh?


I am not quite sure what is the problem?

Mirek
Re: How to zoom images? [PARTLY SOLVED...] [message #7722 is a reply to message #1814] Wed, 17 January 2007 08:18 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
i got a drawing which i wish to resize to always fit a canvas.
I read from this thread (rather old one thats why im asking) that there is only a rather complex method available using this api, is (was) that the case?
Re: How to zoom images? [PARTLY SOLVED...] [message #7724 is a reply to message #7722] Wed, 17 January 2007 10:30 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ordog wrote on Wed, 17 January 2007 02:18

i got a drawing which i wish to resize to always fit a canvas.
I read from this thread (rather old one thats why im asking) that there is only a rather complex method available using this api, is (was) that the case?


"drawing" or "Drawing"?

What exactly is "fit a canvas"?

Anyway, for drawing, it is trivial:

Drawing x;

void MyWidget::Paint(Draw& w) {
w.DrawDrawing(GetSize(), x);
}
Previous Topic: Create my own Rect for clipping?
Next Topic: Loading Image (from HttpClient)
Goto Forum:
  


Current Time: Thu Mar 28 17:09:34 CET 2024

Total time taken to generate the page: 0.01640 seconds