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


C++ Gradient::SetTransform方法代码示例

本文整理汇总了C++中Gradient::SetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Gradient::SetTransform方法的具体用法?C++ Gradient::SetTransform怎么用?C++ Gradient::SetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gradient的用法示例。


在下文中一共展示了Gradient::SetTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetGradientCommand

void
StyleView::ObjectChanged(const Observable* object)
{
	if (!fStyle)
		return;

	Gradient* controlGradient = fGradientControl->Gradient();

	// NOTE: it is important to compare the gradients
	// before assignment, or we will get into an endless loop
	if (object == controlGradient) {
		if (!fGradient)
			return;
		if (fIgnoreControlGradientNotifications)
			return;
		fIgnoreControlGradientNotifications = true;

		if (!fGradient->ColorStepsAreEqual(*controlGradient)) {
			// Make sure we never apply the transformation from the control
			// gradient to the style gradient. Setting this here would cause to
			// re-enter ObjectChanged(), which is prevented to cause harm via
			// fIgnoreControlGradientNotifications.
			controlGradient->SetTransform(*fGradient);
			if (fCommandStack) {
				fCommandStack->Perform(
					new (nothrow) SetGradientCommand(
						fStyle, controlGradient));
			} else {
				*fGradient = *controlGradient;
			}
			// transfer the current gradient color to the current color
			_TransferGradientStopColor();
		}

		fIgnoreControlGradientNotifications = false;
	} else if (object == fGradient) {
		if (!fGradient->ColorStepsAreEqual(*controlGradient)) {
			fGradientControl->SetGradient(fGradient);
			_MarkType(fGradientType->Menu(), fGradient->Type());
			// transfer the current gradient color to the current color
			_TransferGradientStopColor();
		}
	} else if (object == fStyle) {
		// maybe the gradient was added or removed
		// or the color changed
		_SetGradient(fStyle->Gradient(), false, true);
		if (fCurrentColor && !fStyle->Gradient())
			fCurrentColor->SetColor(fStyle->Color());
	} else if (object == fCurrentColor) {
		// NOTE: because of imprecisions in converting
		// RGB<->HSV, the current color can be different
		// even if we just set it to the current
		// gradient stop color, that's why we ignore
		// notifications caused by this situation
		if (!fIgnoreCurrentColorNotifications)
			_AdoptCurrentColor(fCurrentColor->Color());
	}
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:58,代码来源:StyleView.cpp


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