本文整理汇总了C++中Gradient::SetInterpolation方法的典型用法代码示例。如果您正苦于以下问题:C++ Gradient::SetInterpolation方法的具体用法?C++ Gradient::SetInterpolation怎么用?C++ Gradient::SetInterpolation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gradient
的用法示例。
在下文中一共展示了Gradient::SetInterpolation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transform
// MakeGradient
Gradient*
SVGRadialGradient::MakeGradient() const
{
//printf("SVGRadialGradient::MakeGradient()\n");
// TODO: handle userSpaceOnUse/objectBoundingBox
Gradient* gradient = new Gradient(true);
gradient->SetType(GRADIENT_CIRCULAR);
gradient->SetInterpolation(INTERPOLATION_LINEAR);
double cx = 0.0;
double cy = 0.0;
double r = 100.0;
BString value;
if (FindString("cx", &value) >= B_OK)
cx = atof(value.String());
if (FindString("cy", &value) >= B_OK)
cy = atof(value.String());
if (FindString("r", &value) >= B_OK)
r = atof(value.String());
// the transformed parallelogram
double parl[6];
parl[0] = cx - r;
parl[1] = cy - r;
parl[2] = cx + r;
parl[3] = cy - r;
parl[4] = cx + r;
parl[5] = cy + r;
trans_affine transform(-64.0, -64.0, 64.0, 64.0, parl);
gradient->multiply(transform);
return gradient;
}
示例2: start
// MakeGradient
Gradient*
SVGLinearGradient::MakeGradient() const
{
//printf("SVGLinearGradient::MakeGradient()\n");
//PrintToStream();
Gradient* gradient = new Gradient(true);
gradient->SetType(GRADIENT_LINEAR);
gradient->SetInterpolation(INTERPOLATION_LINEAR);
// setup the gradient transform
BPoint start(-64.0, -64.0);
BPoint end(64.0, -64.0);
BString coordinate;
if (FindString("x1", &coordinate) >= B_OK)
start.x = atof(coordinate.String());
if (FindString("y1", &coordinate) >= B_OK)
start.y = atof(coordinate.String());
if (FindString("x2", &coordinate) >= B_OK)
end.x = atof(coordinate.String());
if (FindString("y2", &coordinate) >= B_OK)
end.y = atof(coordinate.String());
// the transformed parallelogram
double parl[6];
parl[0] = start.x;
parl[1] = start.y;
parl[2] = end.x;
parl[3] = end.y;
parl[4] = end.x - (end.y - start.y);
parl[5] = end.y + (end.x - start.x);
trans_affine transform(-64.0, -64.0, 64.0, 64.0, parl);
gradient->multiply(transform);
return gradient;
}