I was looking for something like this:

static int blend(int color1, int color2, float frac)
{
 int r1 = Color.red(color1);
int g1 = Color.green(color1);
int b1 = Color.blue(color1);
 int r2 = Color.red(color2);
int g2 = Color.green(color2);
int b2 = Color.blue(color2);
 int r3 = (int) (r1*(1.0f-frac) + r2*frac);
int g3 = (int) (g1*(1.0f-frac) + g2*frac);
int b3 = (int) (b1*(1.0f-frac) + b2*frac);
 return Color.rgb(r3, g3, b3);

}

Also…  Anyone know why you would ever instantiate the Color class?


On Tuesday, July 24, 2012 3:05:19 PM UTC-5, James Black wrote:
>
> How do you want the blend to work?
> On Jul 24, 2012 3:38 PM, "bob" <b...@coolfone.comze.com> wrote:
>
>> Is there an Android function for blending two colors?
>>
>>
>> It would look like this:
>>
>>
>> Color blend(Color color1, Color color2, float frac);
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to