Zooming an image

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Zooming an image

JohnRodey
I have a component in my GUI that I want to use to display an image and support the following features.  

I want to support:
Fit to width/height
Custom zoom in/out
Setting image back to original image size

Is there any examples dealing with zooming? If not can you point me in the right direction. Do I need to get the graphics and redraw it myself?  Or is there some utility method?

I imagine changing the size will only clip the image?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

gk_brown@verizon.net
If you set the "fill" style to true, resizing the ImageView will scale the image.

On Feb 18, 2011, at 12:41 PM, JohnRodey wrote:

>
> I have a component in my GUI that I want to use to display an image and
> support the following features.  
>
> I want to support:
> Fit to width/height
> Custom zoom in/out
> Setting image back to original image size
>
> Is there any examples dealing with zooming? If not can you point me in the
> right direction. Do I need to get the graphics and redraw it myself?  Or is
> there some utility method?
>
> I imagine changing the size will only clip the image?
>
> Thanks
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Zooming-an-image-tp2528274p2528274.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

JohnRodey
So I can set fill:true and preserveAspectRation:true to get a best fit, but what about implementing a user zooming in/out?

Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

gk_brown@verizon.net
Your app could programmatically resize the ImageView to get the correct zoom. For example you could put it in a BoxPane with horizontal and vertical alignment set to "center".
G

On Feb 18, 2011, at 1:48 PM, JohnRodey wrote:

>
> So I can set fill:true and preserveAspectRation:true to get a best fit, but
> what about implementing a user zooming in/out?
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Zooming-an-image-tp2528274p2528820.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

JohnRodey
Ah, ya that would work.  Thanks greg!
Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

JLEIngenieros
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

Sandro Martini
Hi,
sorry but none of your messages has been accepted because you are not a subscriber of our mailing lists ... take a look here to subscribe:

http://pivot.apache.org/lists.html

and then repost here.
Otherwise only Nabble users can see them.


Bye,
Sandro
Reply | Threaded
Open this post in threaded view
|

Re: Zooming an image

JLEIngenieros
In reply to this post by JohnRodey
Hello, my name is Javier

At first, i think is a good idea to resize the container BoxPane, in order to execute zoom, with image setted to fill.

But here is a problem: the zoom only sets after mousemove or similar (panel is a BoxPane containing an image):

                int newWidth=(int)((float) panel.getWidth() * zoomXY);
                int newHeight=(int)((float) panelgetHeight() * zoomXY);
                               
                panel.setPreferredWidth(newWidth);
                panel.setPreferredHeight(newHeight);

Now, the zoom only ends when moving the mouse or keyboard click.

¿Any idea?

Thanks
Reply | Threaded
Open this post in threaded view
|

RE: Zooming an image

Roger Whitcomb-2
Could you post more code?  Where are you calling the code you have shown us?  It sounds to me like you would need a flag set on key down or mouse down, and cleared on key up or mouse up, and then only do the zoom as you have shown while the flag is set.  But, without a bit more of an idea of how you have structured things, it is a little hard to tell.

Thanks,
~Roger

-----Original Message-----
From: JLEIngenieros [mailto:[hidden email]]
Sent: Monday, December 23, 2013 4:48 PM
To: [hidden email]
Subject: Re: Zooming an image

Hello, my name is Javier

At first, i think is a good idea to resize the container BoxPane, in order to execute zoom, with image setted to fill.

But here is a problem: the zoom only sets after mousemove or similar (panel is a BoxPane containing an image):

                int newWidth=(int)((float) panel.getWidth() * zoomXY);
                int newHeight=(int)((float) panelgetHeight() * zoomXY);
                               
                panel.setPreferredWidth(newWidth);
                panel.setPreferredHeight(newHeight);

Now, the zoom only ends when moving the mouse or keyboard click.

¿Any idea?

Thanks



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Zooming-an-image-tp2528274p4022812.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.