PassRefPtrWillBeRawPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
{
    FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->currentValue()->value()));

    if (!input1)
        return nullptr;

    if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->currentValue()->value() < 0)
        return nullptr;

    RefPtrWillBeRawPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX()->currentValue()->value(), stdDeviationY()->currentValue()->value());
    effect->inputEffects().append(input1);
    return effect.release();
}
Exemplo n.º 2
0
PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder)
{
    FilterEffect* input1 = filterBuilder->getEffectById(in1());

    if (!input1)
        return 0;

    return FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
}
Exemplo n.º 3
0
bool SVGFEGaussianBlurElement::build(FilterBuilder* builder)
{
    FilterEffect* input1 = builder->getEffectById(in1());

    if(!input1)
        return false;

    builder->add(result(), FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY()));

    return true;
}
bool SVGFEGaussianBlurElement::build(SVGResourceFilter* filterResource)
{
    FilterEffect* input1 = filterResource->builder()->getEffectById(in1());

    if (!input1)
        return false;

    RefPtr<FilterEffect> effect = FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
    filterResource->addFilterEffect(this, effect.release());

    return true;
}
PassRefPtrWillBeRawPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
{
    FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->currentValue()->value()));
    ASSERT(input1);

    // "A negative value or a value of zero disables the effect of the given
    // filter primitive (i.e., the result is the filter input image)."
    // (https://drafts.fxtf.org/filters/#element-attrdef-fegaussianblur-stddeviation)
    //
    // => Clamp to non-negative.
    float stdDevX = std::max(0.0f, stdDeviationX()->currentValue()->value());
    float stdDevY = std::max(0.0f, stdDeviationY()->currentValue()->value());
    RefPtrWillBeRawPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDevX, stdDevY);
    effect->inputEffects().append(input1);
    return effect.release();
}
PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
{
    LayoutObject* layoutObject = this->layoutObject();
    if (!layoutObject)
        return nullptr;

    ASSERT(layoutObject->style());
    const SVGComputedStyle& svgStyle = layoutObject->style()->svgStyle();

    Color color = svgStyle.floodColor();
    float opacity = svgStyle.floodOpacity();

    FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->currentValue()->value()));
    ASSERT(input1);

    // Clamp std.dev. to non-negative. (See SVGFEGaussianBlurElement::build)
    float stdDevX = std::max(0.0f, stdDeviationX()->currentValue()->value());
    float stdDevY = std::max(0.0f, stdDeviationY()->currentValue()->value());
    RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDevX, stdDevY, m_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity);
    effect->inputEffects().append(input1);
    return effect.release();
}