hollo,i want to draw a part of a image to a Closed curve,in the onDraw(Canvas canvas) i have use the fo开发者_StackOverflowllow 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
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
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?
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.
精彩评论