如何绘制峰,以闭曲线区域 [英] how to draw pic to Closed curve area

查看:152
本文介绍了如何绘制峰,以闭曲线区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

霍洛,我想画一个图像的一部分,以封闭曲线,在OnDraw中(画布油画) 我必须用后续的code画一条封闭的曲线     paint.setColor(Color.RED);     paint.setAlpha(80);     canvas.drawPath(turnpage.mPath3,油漆);   我的问题是,如何绘制图像的封闭式area.In换言之的一部分,我想知道如何使用任何部分的图像来填充的紧密区域。谢谢

hollo,i want to draw a part of a image to a Closed curve,in the onDraw(Canvas canvas) i have use the follow code draw a Closed curve paint.setColor(Color.RED); paint.setAlpha(80); canvas.drawPath(turnpage.mPath3, paint); my question is that how to draw a part of a image to the Closed area.In other words,i want to know how to filling the close area by using a any part of a image. thank you

推荐答案

您需要使用XFER模式。这是我的例子,其中一个圆圈是用来冲不过的图像,你只需要使用一个不同的充XFER模式扭转逻辑:<一href="http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch/5439357#5439357">Make位图的透明触摸的特定区域

You need to use xfer modes. Here is my example where a circle is used to punch though an image, you just need to reverse the logic by using a differnt Xfer mode: Make certain area of bitmap transparent on touch

又如将图像放置到圆角矩形:查找其使用XFER模式答案。 <一href="http://stackoverflow.com/questions/1705239/how-should-i-give-images-rounded-corners-in-android">How我应该给图像圆角的Andr​​oid?

Another example which place an image into a rounded rectangle: Look for the answer which is using Xfer modes. How should I give images rounded corners in Android?

所有XFER模式体现在阿比演示apllication附带的Andr​​oid SDK。在您的Exclipse创建一个新的Andr​​oid项目,然后选择从现有样本项目。选择目标的Andr​​oid版本,然后ApiDemos。运行该应用程序,进入图形然后Xfermodes。

All xfer modes are demonstrated in Api Demos apllication which comes with Android SDK. In your Exclipse create a new Android project and select "Create project from existing sample". Choose target android version and then ApiDemos. Run the app and go to graphics then Xfermodes.

这篇关于如何绘制峰,以闭曲线区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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