当前位置: 首页>>代码示例>>C++>>正文


C++ CColor::fromHSV方法代码示例

本文整理汇总了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);
}
开发者ID:EQ4,项目名称:vstgui,代码行数:30,代码来源:uisearchtextfield.cpp

示例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");
		}
	}
}
开发者ID:DaniM,项目名称:lyngo,代码行数:41,代码来源:ccolor.cpp


注:本文中的CColor::fromHSV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。