Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android color picker - updating color array

Tags:

java

android

I'm trying to create a color picker for Android that looks like a minimalistic version of Gimp's. So, it has a hue slider and a rectangle with saturation/value variants of a color chosen in hue slider.

Question: what is the best way to create the rectangle?

Right now, I'm creating an 200x200 array of pixels, but it takes ~5sec to create and display rectangle with that array. And I need colors in rectangle to change whenever I change the value in hue slider...

Rectangle is bitmap, btw. Can I use color matrices on that and how? Any examples?

Thanks in advance!

like image 732
zorglub76 Avatar asked Oct 09 '09 09:10

zorglub76


1 Answers

You can create the rectangle with saturation/value variants that change according to the selected hue, by drawing the rectangle with LinearGradients.

You can incorporate the code here: http://code.google.com/p/android-color-picker/ into your application. Seems that this is what you want.

like image 110
Randy Sugianto 'Yuku' Avatar answered Oct 05 '22 23:10

Randy Sugianto 'Yuku'