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


C++ LinearGradientAttributes::y2方法代码示例

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


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

示例1: calculateStartEndPoints

void SVGLinearGradientElement::calculateStartEndPoints(const LinearGradientAttributes& attributes, FloatPoint& startPoint, FloatPoint& endPoint)
{
    // Determine gradient start/end points
    if (attributes.boundingBoxMode()) {
        startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage());
        endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage());
    } else {
        startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this));
        endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this));
    }
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,代码来源:SVGLinearGradientElement.cpp

示例2: buildGradient

void SVGLinearGradientElement::buildGradient() const
{
    LinearGradientAttributes attributes = collectGradientProperties();

    RefPtr<SVGPaintServerLinearGradient> linearGradient = WTF::static_pointer_cast<SVGPaintServerLinearGradient>(m_resource);

    FloatPoint startPoint;
    FloatPoint endPoint;
    if (attributes.boundingBoxMode()) {
        startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage());
        endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage());
    } else {
        startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this));
        endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this));
    }

    RefPtr<Gradient> gradient = Gradient::create(startPoint, endPoint);
    gradient->setSpreadMethod(attributes.spreadMethod());

    Vector<SVGGradientStop> m_stops = attributes.stops();
    float previousOffset = 0.0f;
    for (unsigned i = 0; i < m_stops.size(); ++i) {
        float offset = std::min(std::max(previousOffset, m_stops[i].first), 1.0f);
        previousOffset = offset;
        gradient->addColorStop(offset, m_stops[i].second);
    }

    linearGradient->setGradient(gradient);

    if (attributes.stops().isEmpty())
        return;

    // This code should go away.  PaintServers should go away too.
    // Only this code should care about bounding boxes
    linearGradient->setBoundingBoxMode(attributes.boundingBoxMode());
    linearGradient->setGradientStops(attributes.stops());

    // These should possibly be supported on Gradient
    linearGradient->setGradientTransform(attributes.gradientTransform());
    linearGradient->setGradientStart(startPoint);
    linearGradient->setGradientEnd(endPoint);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:42,代码来源:SVGLinearGradientElement.cpp

示例3: buildGradient

void SVGLinearGradientElement::buildGradient() const
{
    LinearGradientAttributes attributes = collectGradientProperties();

    // If we didn't find any gradient containing stop elements, ignore the request.
    if (attributes.stops().isEmpty())
        return;

    RefPtr<SVGPaintServerLinearGradient> linearGradient = WTF::static_pointer_cast<SVGPaintServerLinearGradient>(m_resource);

    linearGradient->setGradientStops(attributes.stops());
    linearGradient->setBoundingBoxMode(attributes.boundingBoxMode());
    linearGradient->setGradientSpreadMethod(attributes.spreadMethod());
    linearGradient->setGradientTransform(attributes.gradientTransform());
    linearGradient->setGradientStart(FloatPoint::narrowPrecision(attributes.x1(), attributes.y1()));
    linearGradient->setGradientEnd(FloatPoint::narrowPrecision(attributes.x2(), attributes.y2()));
}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:17,代码来源:SVGLinearGradientElement.cpp


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