本文整理汇总了C++中SVGFilterPrimitiveStandardAttributes类的典型用法代码示例。如果您正苦于以下问题:C++ SVGFilterPrimitiveStandardAttributes类的具体用法?C++ SVGFilterPrimitiveStandardAttributes怎么用?C++ SVGFilterPrimitiveStandardAttributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGFilterPrimitiveStandardAttributes类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter* filter)
{
SVGFilterElement* filterElement = static_cast<SVGFilterElement*>(node());
FloatRect targetBoundingBox = filter->targetBoundingBox();
// Add effects to the builder
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(filter);
for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = static_cast<SVGElement*>(node);
if (!element->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
RefPtr<FilterEffect> effect = effectElement->build(builder.get(), filter);
if (!effect) {
builder->clearEffects();
return 0;
}
builder->appendEffectToEffectReferences(effect, effectElement->renderer());
effectElement->setStandardAttributes(effect.get());
effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits(), targetBoundingBox));
builder->add(effectElement->result(), effect);
}
return builder.release();
}
示例2:
PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(Filter* filter)
{
SVGFilterElement* filterElement = static_cast<SVGFilterElement*>(node());
bool primitiveBoundingBoxMode = filterElement->primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
// Add effects to the builder
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(filter);
for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = static_cast<SVGElement*>(node);
if (!element->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
RefPtr<FilterEffect> effect = effectElement->build(builder.get(), filter);
if (!effect) {
builder->clearEffects();
return 0;
}
builder->appendEffectToEffectReferences(effect);
effectElement->setStandardAttributes(primitiveBoundingBoxMode, effect.get());
builder->add(effectElement->result(), effect);
}
return builder.release();
}
示例3: primitiveAttributeChanged
void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, const QualifiedName& attribute)
{
HashMap<RenderObject*, FilterData*>::iterator it = m_filter.begin();
HashMap<RenderObject*, FilterData*>::iterator end = m_filter.end();
SVGFilterPrimitiveStandardAttributes* primitve = static_cast<SVGFilterPrimitiveStandardAttributes*>(object->node());
for (; it != end; ++it) {
FilterData* filterData = it->second;
if (!filterData->builded)
continue;
SVGFilterBuilder* builder = filterData->builder.get();
FilterEffect* effect = builder->effectByRenderer(object);
if (!effect)
continue;
// Since all effects shares the same attribute value, all
// or none of them will be changed.
if (!primitve->setFilterEffectAttribute(effect, attribute))
return;
builder->clearResultsRecursive(effect);
// Repaint the image on the screen.
markClientForInvalidation(it->first, RepaintInvalidation);
}
}
示例4: ENABLE
PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderObject* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
{
#if ENABLE(SVG)
if (!renderer)
return 0;
Document* document = &renderer->document();
CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation->cachedSVGDocumentReference();
CachedSVGDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : 0;
// If we have an SVG document, this is an external reference. Otherwise
// we look up the referenced node in the current document.
if (cachedSVGDocument)
document = cachedSVGDocument->document();
if (!document)
return 0;
Element* filter = document->getElementById(filterOperation->fragment());
if (!filter) {
// Although we did not find the referenced filter, it might exist later
// in the document
document->accessSVGExtensions()->addPendingResource(filterOperation->fragment(), toElement(renderer->node()));
return 0;
}
RefPtr<FilterEffect> effect;
// FIXME: Figure out what to do with SourceAlpha. Right now, we're
// using the alpha of the original input layer, which is obviously
// wrong. We should probably be extracting the alpha from the
// previousEffect, but this requires some more processing.
// This may need a spec clarification.
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
for (SVGElement* svgElement = Traversal<SVGElement>::firstChild(filter); svgElement; svgElement = Traversal<SVGElement>::nextSibling(svgElement)) {
if (!svgElement->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(svgElement);
effect = effectElement->build(builder.get(), this);
if (!effect)
continue;
effectElement->setStandardAttributes(effect.get());
builder->add(effectElement->result(), effect);
m_effects.append(effect);
}
return effect;
#else
UNUSED_PARAM(renderer);
UNUSED_PARAM(previousEffect);
UNUSED_PARAM(filterOperation);
return 0;
#endif
}
示例5: ENABLE
PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(Document* document, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
{
#if ENABLE(SVG)
CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation->cachedSVGDocumentReference();
CachedSVGDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : 0;
// If we have an SVG document, this is an external reference. Otherwise
// we look up the referenced node in the current document.
if (cachedSVGDocument)
document = cachedSVGDocument->document();
if (!document)
return 0;
Element* filter = document->getElementById(filterOperation->fragment());
if (!filter)
return 0;
RefPtr<FilterEffect> effect;
// FIXME: Figure out what to do with SourceAlpha. Right now, we're
// using the alpha of the original input layer, which is obviously
// wrong. We should probably be extracting the alpha from the
// previousEffect, but this requires some more processing.
// This may need a spec clarification.
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
for (Node* node = filter->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = static_cast<SVGElement*>(node);
if (!element->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
effect = effectElement->build(builder.get(), this);
if (!effect)
continue;
effectElement->setStandardAttributes(effect.get());
builder->add(effectElement->result(), effect);
m_effects.append(effect);
}
return effect;
#else
UNUSED_PARAM(document);
UNUSED_PARAM(previousEffect);
UNUSED_PARAM(filterOperation);
return 0;
#endif
}
示例6: filterUnits
void SVGFilterElement::buildFilter(const FloatRect& targetRect) const
{
bool filterBBoxMode = filterUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
bool primitiveBBoxMode = primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
FloatRect filterBBox;
if (filterBBoxMode)
filterBBox = FloatRect(x().valueAsPercentage(),
y().valueAsPercentage(),
width().valueAsPercentage(),
height().valueAsPercentage());
else
filterBBox = FloatRect(x().value(this),
y().value(this),
width().value(this),
height().value(this));
FloatRect filterRect = filterBBox;
if (filterBBoxMode)
filterRect = FloatRect(targetRect.x() + filterRect.x() * targetRect.width(),
targetRect.y() + filterRect.y() * targetRect.height(),
filterRect.width() * targetRect.width(),
filterRect.height() * targetRect.height());
m_filter->setFilterBoundingBox(filterRect);
m_filter->setFilterRect(filterBBox);
m_filter->setEffectBoundingBoxMode(primitiveBBoxMode);
m_filter->setFilterBoundingBoxMode(filterBBoxMode);
if (hasAttribute(SVGNames::filterResAttr)) {
m_filter->setHasFilterResolution(true);
m_filter->setFilterResolution(FloatSize(filterResX(), filterResY()));
}
// Add effects to the filter
m_filter->builder()->clearEffects();
for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
SVGElement* element = 0;
if (n->isSVGElement()) {
element = static_cast<SVGElement*>(n);
if (element->isFilterEffect()) {
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
if (!effectElement->build(m_filter.get())) {
m_filter->builder()->clearEffects();
break;
}
}
}
}
}
示例7: toSVGFilterElement
PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter* filter)
{
SVGFilterElement* filterElement = toSVGFilterElement(node());
FloatRect targetBoundingBox = filter->targetBoundingBox();
// Add effects to the builder
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(SourceGraphic::create(filter), SourceAlpha::create(filter));
for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = toSVGElement(node);
if (!element->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
RefPtr<FilterEffect> effect = effectElement->build(builder.get(), filter);
if (!effect) {
builder->clearEffects();
return 0;
}
builder->appendEffectToEffectReferences(effect, effectElement->renderer());
effectElement->setStandardAttributes(effect.get());
effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits(), targetBoundingBox));
effect->setOperatingColorSpace(
effectElement->renderer()->style()->svgStyle()->colorInterpolationFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB);
builder->add(effectElement->result(), effect);
}
return builder.release();
}
示例8: primitiveAttributeChanged
void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, const QualifiedName& attribute)
{
SVGFilterPrimitiveStandardAttributes* primitve = static_cast<SVGFilterPrimitiveStandardAttributes*>(object->node());
for (const auto& objectFilterDataPair : m_filter) {
const auto& filterData = objectFilterDataPair.value;
if (filterData->state != FilterData::Built)
continue;
SVGFilterBuilder* builder = filterData->builder.get();
FilterEffect* effect = builder->effectByRenderer(object);
if (!effect)
continue;
// Since all effects shares the same attribute value, all
// or none of them will be changed.
if (!primitve->setFilterEffectAttribute(effect, attribute))
return;
builder->clearResultsRecursive(effect);
// Repaint the image on the screen.
markClientForInvalidation(*objectFilterDataPair.key, RepaintInvalidation);
}
markAllClientLayersForInvalidation();
}
示例9: primitiveAttributeChanged
void LayoutSVGResourceFilter::primitiveAttributeChanged(LayoutObject* object, const QualifiedName& attribute)
{
SVGFilterPrimitiveStandardAttributes* primitive = static_cast<SVGFilterPrimitiveStandardAttributes*>(object->node());
for (auto& filter : m_filter) {
FilterData* filterData = filter.value.get();
if (filterData->m_state != FilterData::ReadyToPaint)
continue;
SVGFilterGraphNodeMap* nodeMap = filterData->nodeMap.get();
FilterEffect* effect = nodeMap->effectByRenderer(object);
if (!effect)
continue;
// Since all effects shares the same attribute value, all
// or none of them will be changed.
if (!primitive->setFilterEffectAttribute(effect, attribute))
return;
nodeMap->invalidateDependentEffects(effect);
// Issue paint invalidations for the image on the screen.
markClientForInvalidation(filter.key, PaintInvalidation);
}
markAllResourceClientsForInvalidation();
}
示例10: toElement
PassRefPtr<FilterEffect> ReferenceFilterBuilder::build(Filter* parentFilter, RenderObject* renderer, FilterEffect* previousEffect, const ReferenceFilterOperation* filterOperation)
{
if (!renderer)
return nullptr;
TreeScope* treeScope = &renderer->node()->treeScope();
if (DocumentResourceReference* documentResourceRef = documentResourceReference(filterOperation)) {
DocumentResource* cachedSVGDocument = documentResourceRef->document();
// If we have an SVG document, this is an external reference. Otherwise
// we look up the referenced node in the current document.
if (cachedSVGDocument)
treeScope = cachedSVGDocument->document();
}
if (!treeScope)
return nullptr;
Element* filter = treeScope->getElementById(filterOperation->fragment());
if (!filter) {
// Although we did not find the referenced filter, it might exist later
// in the document.
treeScope->document().accessSVGExtensions().addPendingResource(filterOperation->fragment(), toElement(renderer->node()));
return nullptr;
}
if (!isSVGFilterElement(*filter))
return nullptr;
SVGFilterElement& filterElement = toSVGFilterElement(*filter);
// FIXME: Figure out what to do with SourceAlpha. Right now, we're
// using the alpha of the original input layer, which is obviously
// wrong. We should probably be extracting the alpha from the
// previousEffect, but this requires some more processing.
// This may need a spec clarification.
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(parentFilter));
ColorSpace filterColorSpace = ColorSpaceDeviceRGB;
bool useFilterColorSpace = getSVGElementColorSpace(&filterElement, filterColorSpace);
for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement); element; element = Traversal<SVGElement>::nextSibling(*element)) {
if (!element->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
RefPtr<FilterEffect> effect = effectElement->build(builder.get(), parentFilter);
if (!effect)
continue;
effectElement->setStandardAttributes(effect.get());
effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->currentValue()->enumValue(), parentFilter->sourceImageRect()));
ColorSpace colorSpace = filterColorSpace;
if (useFilterColorSpace || getSVGElementColorSpace(effectElement, colorSpace))
effect->setOperatingColorSpace(colorSpace);
builder->add(AtomicString(effectElement->result()->currentValue()->value()), effect);
}
return builder->lastEffect();
}
示例11: ASSERT
PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderObject* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
{
if (!renderer)
return 0;
Document* document = renderer->document();
ASSERT(document);
CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation->cachedSVGDocumentReference();
CachedDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : 0;
// If we have an SVG document, this is an external reference. Otherwise
// we look up the referenced node in the current document.
if (cachedSVGDocument)
document = cachedSVGDocument->document();
if (!document)
return 0;
Element* filter = document->getElementById(filterOperation->fragment());
if (!filter) {
// Although we did not find the referenced filter, it might exist later
// in the document
document->accessSVGExtensions()->addPendingResource(filterOperation->fragment(), toElement(renderer->node()));
return 0;
}
if (!filter->isSVGElement() || !filter->hasTagName(SVGNames::filterTag))
return 0;
SVGFilterElement* filterElement = toSVGFilterElement(toSVGElement(filter));
RefPtr<FilterEffect> effect;
// FIXME: Figure out what to do with SourceAlpha. Right now, we're
// using the alpha of the original input layer, which is obviously
// wrong. We should probably be extracting the alpha from the
// previousEffect, but this requires some more processing.
// This may need a spec clarification.
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = toSVGElement(node);
if (!element->isFilterEffect())
continue;
SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
effect = effectElement->build(builder.get(), this);
if (!effect)
continue;
effectElement->setStandardAttributes(effect.get());
effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits(), sourceImageRect()));
builder->add(effectElement->result(), effect);
m_effects.append(effect);
}
return effect;
}