void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData, SVGGradientElement* gradientElement) const
{
    SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradientElement);
    RadialGradientAttributes attributes = radialGradientElement->collectGradientProperties();

    // Determine gradient focal/center points and radius
    FloatPoint focalPoint;
    FloatPoint centerPoint;
    float radius;
    radialGradientElement->calculateFocalCenterPointsAndRadius(attributes, focalPoint, centerPoint, radius);

    gradientData->gradient = Gradient::create(focalPoint,
                                              0.0f, // SVG does not support a "focus radius"
                                              centerPoint,
                                              radius);

    gradientData->gradient->setSpreadMethod(attributes.spreadMethod());

    // Record current gradient transform
    gradientData->transform = attributes.gradientTransform();
    gradientData->boundingBoxMode = attributes.boundingBoxMode();

    // Add stops
    addStops(gradientData, attributes.stops());
}
Example #2
0
void LayoutSVGResourceLinearGradient::buildGradient(GradientData* gradientData) const
{
    const LinearGradientAttributes& attributes = this->attributes();
    gradientData->gradient = Gradient::create(startPoint(attributes), endPoint(attributes));
    gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(attributes.spreadMethod()));
    addStops(gradientData, attributes.stops());
}
void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData) const
{
    gradientData->gradient = Gradient::create(this->focalPoint(m_attributes),
        this->focalRadius(m_attributes),
        this->centerPoint(m_attributes),
        this->radius(m_attributes));

    gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(m_attributes.spreadMethod()));

    addStops(gradientData, m_attributes.stops());
}
void LayoutSVGResourceRadialGradient::buildGradient(GradientData* gradientData) const
{
    const RadialGradientAttributes& attributes = this->attributes();
    gradientData->gradient = Gradient::create(this->focalPoint(attributes),
        this->focalRadius(attributes),
        this->centerPoint(attributes),
        this->radius(attributes));

    gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(attributes.spreadMethod()));

    addStops(gradientData, attributes.stops());
}
void RenderSVGResourceLinearGradient::buildGradient(GradientData* gradientData, SVGGradientElement* gradientElement) const
{
    SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradientElement);

    // Determine gradient start/end points
    FloatPoint startPoint;
    FloatPoint endPoint;
    linearGradientElement->calculateStartEndPoints(m_attributes, startPoint, endPoint);

    gradientData->gradient = Gradient::create(startPoint, endPoint);
    gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(m_attributes.spreadMethod()));

    // Add stops
    addStops(gradientData, m_attributes.stops());
}