Circle of light ontop of bitmap - Android

为君一笑 提交于 2019-12-25 16:39:21

问题


I'm trying to create a torch item in my game, that will light bitmaps\bitmap that are behind him in a circle shape (for example torch in terraria), so basically I'm trying to understand how to create a bright circle. example picture made in photoshop: http://puu.sh/evqet/4277f7e2c8.png

anyone has idea how can I do that?


回答1:


There many ways to achieve this. One (fast) is to use the HSL color space and increase the L parameter foe example. I don't know if you are working with RGB if there is an easy way around it.

I guess since you probably wont want to check every pixel in the circle you may need to add a second circle semi-opaque for example which will make the calculation easier for you.




回答2:


You can simply use a transparent PNG sprite and draw it as a bitmap in your canvas at desidered position.

More info about how-to-do can be found here and here.



来源:https://stackoverflow.com/questions/27945076/circle-of-light-ontop-of-bitmap-android

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