0

There is something I am working on in which an image rotates around the circle & I want only overlapping part of the 2nd image... For instance take an example:

enter image description here

The Violet image is rotating around green one & I just want the Green image & violets overlapped part (Sea Green) How Can I do this in Android?

PS: THe violet image is not only rotating around green, its also rotating around its axis, so the intersecting part changes each time interval

4

1 回答 1

0

检查这个:http ://softwyer.wordpress.com/2012/01/21/1009/

使用不同的 PorterDuff.Mode 可以达到不同的效果。以下是如何使位图具有圆角的示例:

        Bitmap bitmap = Bitmap.createBitmap(b.getWidth(), b.getHeight(), b.getConfig());
        Canvas canvas = new Canvas(bitmap);
        Paint p =  new Paint(Paint.ANTI_ALIAS_FLAG);
        p.setColor(Color.BLACK);
        canvas.drawRoundRect(new RectF(0, 0, b.getWidth(), b.getHeight()), borderRadius, borderRadius, p);
        p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(b, 0, 0, p);
于 2013-08-09T14:31:56.290 回答