Android 如何绘制位图?

发布于 2024-11-17 21:31:39 字数 308 浏览 3 评论 0原文

我有一个应用程序可以处理相机图像并在位图上放置鱼眼效果。它工作正常,但一开始非常慢,直到效果出现在位图上,然后随后调用添加更多失真并更新图像就相当快了。我首先将相机图像绘制为背景位图。然后,我根据屏幕上的触摸事件创建该图像的 2 个子集。然后,这 2 个子集位图通过处理方法,然后使用原始 xy 线作为叠加层放置在背景图像上。我已经做了一些记录,因为位图是在 onDraw 方法中绘制的,并记录了图像处理循环的开始/结束时间。似乎在扭曲方法的循环完成之前就完成了drawBitmap()方法的执行?图像循环完成后,屏幕将重新绘制。我本以为在执行drawBitmap方法后屏幕会更新。有什么想法吗?谢谢。

I've an app that processes a camera image and places a fisheye effect on a Bitmap. it works fine but is very slow at first until the effect is on the bitmap then subsequent calls to add more distortion and update the image are then quite fast. I first of all paint the camera image as a backgraound bitmap. I then create 2 subsets of that image from touchevents on the screen. these 2 subset bitmaps are then passed through a processing method then placed as overlays using the original xy cords over the background image. i've done some logging as the bitmaps are painted in the onDraw method and logged the start/end time of the image processing loop. it seems to finish executing the drawBitmap() method before the looping through the distortion method has finished? the screen is then repainted once the image looping has finished. i would have thought the screen would update after the drawBitmap method has executed. any ideas anyone? thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文