本文整理汇总了C++中SVGFELightElement类的典型用法代码示例。如果您正苦于以下问题:C++ SVGFELightElement类的具体用法?C++ SVGFELightElement怎么用?C++ SVGFELightElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGFELightElement类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const
{
for (Node* n = firstChild(); n; n = n->nextSibling()) {
if (n->hasTagName(SVGNames::feDistantLightTag) ||
n->hasTagName(SVGNames::fePointLightTag) ||
n->hasTagName(SVGNames::feSpotLightTag)) {
SVGFELightElement* lightNode = static_cast<SVGFELightElement*>(n);
return lightNode->lightSource();
}
}
return 0;
}
示例2: updateLights
void SVGFESpecularLightingElement::updateLights() const
{
if (!m_filterEffect)
return;
KCLightSource *light = 0;
for (Node *n = firstChild(); n; n = n->nextSibling()) {
if (n->hasTagName(SVGNames::feDistantLightTag)||n->hasTagName(SVGNames::fePointLightTag)||n->hasTagName(SVGNames::feSpotLightTag)) {
SVGFELightElement *lightNode = static_cast<SVGFELightElement *>(n);
light = lightNode->lightSource();
break;
}
}
m_filterEffect->setLightSource(light);
}
示例3: ASSERT
PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
{
FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->currentValue()->value()));
if (!input1)
return nullptr;
SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this);
if (!lightNode)
return nullptr;
RenderObject* renderer = this->renderer();
if (!renderer)
return nullptr;
ASSERT(renderer->style());
Color color = renderer->style()->svgStyle()->lightingColor();
RefPtr<LightSource> lightSource = lightNode->lightSource(filter);
RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_surfaceScale->currentValue()->value(), m_specularConstant->currentValue()->value(),
m_specularExponent->currentValue()->value(), kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.release());
effect->inputEffects().append(input1);
return effect.release();
}
示例4: ASSERT
bool SVGFESpecularLightingElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
{
FESpecularLighting* specularLighting = static_cast<FESpecularLighting*>(effect);
if (attrName == SVGNames::lighting_colorAttr) {
RenderObject* renderer = this->renderer();
ASSERT(renderer);
ASSERT(renderer->style());
return specularLighting->setLightingColor(renderer->style()->svgStyle().lightingColor());
}
if (attrName == SVGNames::surfaceScaleAttr)
return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()->value());
if (attrName == SVGNames::specularConstantAttr)
return specularLighting->setSpecularConstant(m_specularConstant->currentValue()->value());
if (attrName == SVGNames::specularExponentAttr)
return specularLighting->setSpecularExponent(m_specularExponent->currentValue()->value());
LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightSource());
SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this);
ASSERT(lightSource);
ASSERT(lightElement);
ASSERT(effect->filter());
if (attrName == SVGNames::azimuthAttr)
return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->value());
if (attrName == SVGNames::elevationAttr)
return lightSource->setElevation(lightElement->elevation()->currentValue()->value());
if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::zAttr)
return lightSource->setPosition(effect->filter()->resolve3dPoint(lightElement->position()));
if (attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr)
return lightSource->setPointsAt(effect->filter()->resolve3dPoint(lightElement->pointsAt()));
if (attrName == SVGNames::specularExponentAttr)
return lightSource->setSpecularExponent(lightElement->specularExponent()->currentValue()->value());
if (attrName == SVGNames::limitingConeAngleAttr)
return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle()->currentValue()->value());
ASSERT_NOT_REACHED();
return false;
}