Android bitmap mask color, remove color

前端 未结 3 466
长情又很酷
长情又很酷 2020-12-05 12:00

I am creating bitmap, next i am drawing second solid color bitmap on top of it. And now i want to change first bitmap, so solid color that i drawed on it will be transparent

3条回答
  •  无人及你
    2020-12-05 12:53

    Pixel by pixel is not a bad option. Just don't call setPixel inside your loop. Fill an array of argb ints with getPixels, modify it in place if you don't need to preserve the original, and then call setPixels at the end. You can do this row-by-row if memory is a concern, or you can just do the whole thing in one shot. You don't need to fill a whole bitmap for your overlay color since you'd just be doing a simple replace (if current pixel is color1, set to color2).

提交回复
热议问题