I want to implement a keyboard visualisation like in this picture:
The gradients I use make the fps drop from 60 fps (if i only use simple black and white colours) to about 15 fps or less on my Android device.
My implementation right now is to create a new ColourGradient for each of the black keys, so I know I could go with only creating two gradients and then painting but I tried that already with no success in performance.
So right now I have 2 strategies in mind:
- Creating the keys as a png and painting them.
- I wasn’t able to really try this yet because I seem to fail to load PNG’s
- Would this even be faster than my current solution?
- Creating a lookuptable from the gradient once and then split my black keys in smaller rectangles (-> draw about 20 rectangles for each black key)
- Ugly solution IMO
- Would this even be faster?
Do you have smarter solutions to my problem and what do you think of my 2 proposed strategies?
Thanks for your help