Drawing translucent shapes without overlapping

痞子三分冷 提交于 2019-12-25 05:16:15

问题


I am drawing several circles with transparency. The number of circles and their positions are not fixed. Currently I am setting the transparent color in a Paint object and drawing the circles in a for loop with the Canvas object. But that causes overlapping.

I have thought of a method: - Render all the circles as opaque on something other than the main canvas. - Set the transparency. - Draw the final object on canvas.

How do i implement that on android?


回答1:


Create a new bitmap with ARGB888, and draw on it's canvas all your shapes with no transparency. Then draw the new bitmap into the main canvas using a Paint on which you called setAlpha earlier



来源:https://stackoverflow.com/questions/10942590/drawing-translucent-shapes-without-overlapping

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!