Example #1
0
COLORREF CPaletteLinear::Color(_double v)
{
  color_map::iterator it;
  triplet q;

  assert(items.size());

  //
  it = (items.size() > 1) ? items.lower_bound(v) : items.begin();

  if (it == items.begin())
  {
    q = items.begin()->second;
  }
  else
  if (it == items.end())
  {
    q = it->second;
  }
  else
  {
    _double    v1   = it->first;
    triplet & more = it->second; it--;
    _double    v0   = it->first;
    triplet & less = it->second;
  
    _double f = (v - v0)/(v1 - v0);
    q.a = less.a + f * (more.a - less.a);
    q.b = less.b + f * (more.b - less.b);
    q.c = less.c + f * (more.c - less.c);
  }

  return hsv ? FromHSV(q.a,q.b,q.c) : FromRGB(q.a,q.b,q.c);
}
Example #2
0
Color::Color(HSV newColor) {
	FromHSV(newColor);
}
Example #3
0
void Color::FromHSV(HSV newColor) {
	FromHSV(newColor.h, newColor.s, newColor.v);
}
Example #4
0
Color::Color(float h, float s, float v) {
	FromHSV(h, s, v);
}