Making a zoom animation

103 views
Skip to first unread message

Peter

unread,
Dec 16, 2014, 7:41:15 AM12/16/14
to pdfne...@googlegroups.com
Hi,

I'm testing you PDFTron SDK for Android. Is it possible to make an animated zoom into a given rectangle on the page?

Thanks.

Ryan

unread,
Dec 16, 2014, 2:14:47 PM12/16/14
to pdfne...@googlegroups.com
What kind of animation are you talking about? I think on our iOS demo there is an animated zoom on a double tap on text. Is this what you mean? Do you have an example animation you are thinking of?

Peter

unread,
Dec 17, 2014, 3:37:43 AM12/17/14
to pdfne...@googlegroups.com
Hi,

i didn't see the double tap zoom animation on iOS, but i think that's what I'm also interested in on Android. My intention is to draw a rect on the screen and then zoom in to that rect with a smooth animation (kind of scale animation). I tried to scale the canvas on the root layout in which PdfViewCtrl sits, but then i get a blurred text (text isnt sharp anymore). The only possible way i found yet, is to put the PdfViewCtrl.setZoom(...) into a Runnable and increment the zoom value (zoom += 0.1) and post that Runnable with a Handler until the max zoom level is reached. I know that this is not the smartest way to do it...I couldn't find anything in the docs that is referred to zoom and animation.

Support

unread,
Dec 18, 2014, 2:31:43 PM12/18/14
to pdfne...@googlegroups.com

What do you think about using pdftron.PDF.PDFDraw (or pdftron.PDF.PDFRasterizer - see PDFDraw sample ... https://www.pdftron.com/pdfnet/samplecode.html#PDFDraw) to render the destination rectangle (as a bitmap)?

Then you can use Android animation api  (e.g. http://developer.android.com/training/animation/zoom.html ?) to zoom into the image. As soon as bitmap is ready and you are ready to start the animation, call PDFViewCtrl.showRect() which will immediately jump to the given location. However because your animation would be running on top of PDFViewCtrl, this would not be visible.  Once the animation is complete and you can remove the destination bitmap so that underlying control is visible. I suppose the only tricky part may be to make sure that bitmap and target PDFViewCtrl view are identical.

Peter

unread,
Dec 29, 2014, 4:53:39 AM12/29/14
to pdfne...@googlegroups.com
Hi thanks for your answer,

yes I'm using the PDFDraw class for creating a bitmap out of a snipped bounding box. I also took a look at your link for the animations. The animation is running on top of PDFViewCtrl, but I think it's not covering the whole screen. So when I call PDFViewCtrl.showRect() it will jump to given location, but i think it will be seen behind the scale animation...I'm not sure. I have to check it out. Thanks for the hint.


Am Dienstag, 16. Dezember 2014 13:41:15 UTC+1 schrieb Peter:
Reply all
Reply to author
Forward
0 new messages