0

I have an image, I can draw an circle over it like the code below:

Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
            R.drawable.girl).copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
paint.setColor(Color.RED);
paint.setStrokeWidth(200);
paint.setStyle(Style.STROKE.FILL);
paint.setAntiAlias(true);
canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, 100,
            paint);

And the circle will be red color! But because of some reason, I want the color of circle same as its under bitmap. Can I do it? and how? Thanks everyone!

Edited: One more question, How I can get all the pixels inside circle?

4

2 回答 2

0

why dont you simply remove the paint.setStyle(Style.STROKE.FILL); or try changing the paint.setColor(Color.RED); to Transparent color, that should be it

于 2012-08-27T07:26:10.200 回答
0

您可以通过本文pixel中的方法获取指定的颜色,然后再设置此颜色,而不是您提到的。 RGB Colorcolor.RED

于 2012-08-27T07:54:59.663 回答