예제 #1
0
void nuiColorSelector::SetCurrentColor(const nuiColor& rColor)
{
  mCurrentColor = rColor;
  mpColorPaneDeco->SetFillColor(rColor);
  
  nuiSize red = rColor.Red();
  nuiSize green = rColor.Green();
  nuiSize blue = rColor.Blue();
  nuiSize alpha = rColor.Alpha();
  FormatColor(red, mpRedSliderLabel);
  FormatColor(green, mpGreenSliderLabel);
  FormatColor(blue, mpBlueSliderLabel);
  FormatColor(alpha, mpRGBAlphaSliderLabel);
  
  float h, s, v;
  h = mpHueSlider->GetRange().GetValue();
  s = mpSaturationSlider->GetRange().GetValue();
  v = mpValueSlider->GetRange().GetValue();
  FormatColor(h, mpHueSliderLabel, 100, false);
  FormatColor(s, mpSaturationSliderLabel, 100, false);
  FormatColor(v, mpValueSliderLabel, 100, false);
  FormatColor(alpha, mpHSVAlphaSliderLabel, 100, false);
  
  mpColorPane->Invalidate();
  
  uint tabIndex = mpTabView->GetSelectedTab();
  if (tabIndex != 0)
    Tab_RGB_Update();
  if (tabIndex != 1)
    Tab_HSV_Update();
  
  // send event
  ColorChanged(); 
}
예제 #2
0
void nuiUniformDesc::Set(const nuiColor& rColor, bool apply)
{
  float v[] = { rColor.Red(), rColor.Green(), rColor.Blue(), rColor.Alpha() };
  switch (mType)
  {
    case GL_FLOAT:      Set((v[0] + v[1] + v[2]) / 3.0f, apply); break;
    case GL_FLOAT_VEC2: Set((v[0] + v[1] + v[2]) / 3.0f, v[3], apply); break;
    case GL_FLOAT_VEC3: Set(v, 3, apply); break;
    case GL_FLOAT_VEC4: Set(v, 4, apply); break;
    default:            NGL_ASSERT(0); break;
  }
}