Skip to content Skip to sidebar Skip to footer

How To Draw Pic To Closed Curve Area

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.setA

Solution 1:

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.

Post a Comment for "How To Draw Pic To Closed Curve Area"