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?

Kara
  • 6,115
  • 16
  • 50
  • 57
Kingfisher Phuoc
  • 8,052
  • 9
  • 46
  • 86

2 Answers2

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

Anuj
  • 2,065
  • 22
  • 23
0

you can get the color of a specified pixel by the method in this article and then make a RGB Color then set this color instead of the color.RED you mentioned.

Community
  • 1
  • 1
SAbbasizadeh
  • 730
  • 10
  • 25