如何与And​​roid帆布放大 [英] How to zoom with Android Canvas

查看:153
本文介绍了如何与And​​roid帆布放大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vectorgraphics大地图,我表现出我的自定义视图。
我移动地图与canvas.translate()函数,所以我并不需要重新计算的台词全部pathes。

I have a large map in vectorgraphics, that I show in my custom view. I move the map with the canvas.translate() function, so I don't need to recalculate all pathes of my lines again.

有没有类似的机制来实现变焦功能?我想保持我的路径的价值观,并且缩小和,还是我必须重新计算我pathes的所有点从头开始。

Is there any similar mechanism to achieve a zooming function? I would like to keep my paths with the values and zoom out and in, Or do I have to recalculate all points of my pathes from scratch.

问候

推荐答案

<一个href=\"https://developer.android.com/reference/android/graphics/Canvas.html#scale%28float,%20float%29\"相对=nofollow> Canvas.scale()将扩大(在放大/缩小)在画布上。试试你画你的路后进行的规模。如果不工作,你就需要重新计算积分。

Canvas.scale() will scale the canvas (zoom in/out). Try performing the scale after you draw your paths. If it does not work you'll need to recalculate the points.

这篇关于如何与And​​roid帆布放大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆