本文整理汇总了C++中CColor::fromHSV方法的典型用法代码示例。如果您正苦于以下问题:C++ CColor::fromHSV方法的具体用法?C++ CColor::fromHSV怎么用?C++ CColor::fromHSV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColor
的用法示例。
在下文中一共展示了CColor::fromHSV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawClearMark
//----------------------------------------------------------------------------------------------------
void UISearchTextField::drawClearMark (CDrawContext* context) const
{
if (getText ().empty ())
return;
SharedPointer<CGraphicsPath> path = owned (context->createGraphicsPath ());
if (path == 0)
return;
CRect r = getClearMarkRect ();
CColor color (fontColor);
color.alpha /= 2;
context->setFillColor (color);
context->setDrawMode (kAntiAliasing);
context->drawEllipse (r, kDrawFilled);
double h,s,v;
color.toHSV (h, s, v);
v = 1. - v;
color.fromHSV (h, s, v);
context->setFrameColor (color);
context->setLineWidth (2.);
r.inset (r.getWidth () / (M_PI * 2.) + 1, r.getHeight () / (M_PI * 2.) + 1);
path->beginSubpath (r.getTopLeft ());
path->addLine (r.getBottomRight ());
path->beginSubpath (r.getBottomLeft ());
path->addLine (r.getTopRight ());
context->setDrawMode (kAntiAliasing|kNonIntegralMode);
context->drawGraphicsPath (path, CDrawContext::kPathStroked);
}
示例2: color
__attribute__((__constructor__)) void testHSVtoRGBAndBack ()
{
CColor color (10, 10, 255, 255);
CColor color2 = color;
double h,s,v;
color.toHSV (h,s,v);
double th,ts,tv;
for (double i = 0; i < 360; i+= 0.01)
{
color.fromHSV (i, s, v);
color.toHSV (th, ts, tv);
color2.fromHSV (th, ts, tv);
if (color != color2)
{
DebugPrint ("issue\n");
}
color.toHSL (th, ts, tv);
color2.fromHSL (th, ts, tv);
if (color != color2)
{
DebugPrint ("issue\n");
}
}
for (double i = 0.; i < 1.; i += 0.0001)
{
color.fromHSV (h, i, v);
color.toHSV (th, ts, tv);
color2.fromHSV (th, ts, tv);
if (color != color2)
{
DebugPrint ("issue\n");
}
color.fromHSV (h, s, i);
color.toHSV (th, ts, tv);
color2.fromHSV (th, ts, tv);
if (color != color2)
{
DebugPrint ("issue\n");
}
}
}