I have objects in my game that explode into coloured shrapnel. It would be nice if the colours of the shrapnel match the colours of the sprite, e.g. a mostly green object would explode into mostly green pieces.
Any suggestions on how to implement this? There are libraries such as
برای دیدن لینک ها باید ثبت نام کنید
that extract the dominant colours from a bitmap, but how do I get the bitmap for a game object? I could presumably use BodyWrapper.GraphicName to find the name of the graphic and GraphicCache.GetGraphic to get that graphic as a CompressedBC. But how do I then turn a CompressedBC into a B4XBitmap?
There are quite a variety of objects so manually setting up a colour palette for each type fo exploding object would be tedious.