开发者

PNG overlay over active Canvas animations

开发者 https://www.devze.com 2023-02-06 23:09 出处:网络
I am developing a 2d sprite-based game with a bunch of animations. Developed with separate threads and in general everything is great.

I am developing a 2d sprite-based game with a bunch of animations. Developed with separate threads and in general everything is great.

I recently added a level that has a alpha PNG graphic drawn over the Canvas after the rest of the animated bitmaps have been drawn.

There is now a noticeable speed degradation on this level and it seems to sputter etc... to top it off 开发者_运维问答I just added a Multiply Xfermode to the paint for the graphic and it went to a stand-still.

Is there a better way to overlay graphics in this fashion to avoid the hit in performance (I'm assuming it has to calculate the alpha channels and it apply it to the canvas bitmap)? Is there an alternative to drawing the overlay with a drawbitmap/png?


To get better performance you could put your overlay in another window, either by using WindowManager.addView or by using a PoupWindow. The composition will then be done on the GPU.

0

精彩评论

暂无评论...
验证码 换一张
取 消