本文整理汇总了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());
}
}