本文整理汇总了C++中SVGFilterElement类的典型用法代码示例。如果您正苦于以下问题:C++ SVGFilterElement类的具体用法?C++ SVGFilterElement怎么用?C++ SVGFilterElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGFilterElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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();
}
示例2: 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();
}
示例3: jsSVGFilterElementClassName
JSValue jsSVGFilterElementClassName(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(static_cast<JSSVGFilterElement*>(asObject(slot.slotBase()))->impl());
RefPtr<SVGAnimatedString> obj = imp->classNameAnimated();
return toJS(exec, obj.get(), imp);
}
示例4: jsSVGFilterElementExternalResourcesRequired
JSValue jsSVGFilterElementExternalResourcesRequired(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(static_cast<JSSVGFilterElement*>(asObject(slot.slotBase()))->impl());
RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
return toJS(exec, obj.get(), imp);
}
示例5: throwError
JSValue* JSSVGFilterElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSSVGFilterElement::info))
return throwError(exec, TypeError);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(static_cast<JSSVGFilterElement*>(thisObj)->impl());
switch (id) {
case JSSVGFilterElement::SetFilterResFuncNum: {
bool filterResXOk;
unsigned filterResX = args[0]->toInt32(exec, filterResXOk);
if (!filterResXOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
}
bool filterResYOk;
unsigned filterResY = args[1]->toInt32(exec, filterResYOk);
if (!filterResYOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
}
imp->setFilterRes(filterResX, filterResY);
return jsUndefined();
}
}
return 0;
}
示例6:
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();
}
示例7: jsSVGFilterElementXmlspace
JSValue jsSVGFilterElementXmlspace(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSSVGFilterElement* castedThis = static_cast<JSSVGFilterElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThis->impl());
JSValue result = jsString(exec, imp->xmlspace());
return result;
}
示例8: jsSVGFilterElementStyle
JSValue jsSVGFilterElementStyle(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSSVGFilterElement* castedThis = static_cast<JSSVGFilterElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->style()));
return result;
}
示例9: jsSVGFilterElementPrimitiveUnits
JSValue jsSVGFilterElementPrimitiveUnits(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSSVGFilterElement* castedThis = static_cast<JSSVGFilterElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThis->impl());
RefPtr<SVGAnimatedEnumeration> obj = imp->primitiveUnitsAnimated();
JSValue result = toJS(exec, castedThis->globalObject(), obj.get());
return result;
}
示例10: jsSVGFilterElementExternalResourcesRequired
JSValue jsSVGFilterElementExternalResourcesRequired(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSSVGFilterElement* castedThis = static_cast<JSSVGFilterElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThis->impl());
RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
JSValue result = toJS(exec, castedThis->globalObject(), obj.get());
return result;
}
示例11: jsSVGFilterElementClassName
JSValue jsSVGFilterElementClassName(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSSVGFilterElement* castedThis = static_cast<JSSVGFilterElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThis->impl());
RefPtr<SVGAnimatedString> obj = imp->classNameAnimated();
JSValue result = toJS(exec, castedThis->globalObject(), obj.get());
return result;
}
示例12: ASSERT
GraphicsContext* SVGFilterPainter::prepareEffect(const LayoutObject& object, SVGFilterRecordingContext& recordingContext)
{
ASSERT(recordingContext.paintingContext());
m_filter.clearInvalidationMask();
if (FilterData* filterData = m_filter.getFilterDataForLayoutObject(&object)) {
// If the filterData already exists we do not need to record the content
// to be filtered. This can occur if the content was previously recorded
// or we are in a cycle.
if (filterData->m_state == FilterData::PaintingFilter)
filterData->m_state = FilterData::PaintingFilterCycleDetected;
if (filterData->m_state == FilterData::RecordingContent)
filterData->m_state = FilterData::RecordingContentCycleDetected;
return nullptr;
}
OwnPtrWillBeRawPtr<FilterData> filterData = FilterData::create();
FloatRect referenceBox = object.objectBoundingBox();
SVGFilterElement* filterElement = toSVGFilterElement(m_filter.element());
FloatRect filterRegion = SVGLengthContext::resolveRectangle<SVGFilterElement>(filterElement, filterElement->filterUnits()->currentValue()->enumValue(), referenceBox);
if (filterRegion.isEmpty())
return nullptr;
// Create the SVGFilter object.
bool primitiveBoundingBoxMode = filterElement->primitiveUnits()->currentValue()->enumValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
Filter::UnitScaling unitScaling = primitiveBoundingBoxMode ? Filter::BoundingBox : Filter::UserSpace;
filterData->filter = Filter::create(referenceBox, filterRegion, 1, unitScaling);
filterData->nodeMap = SVGFilterGraphNodeMap::create();
IntRect sourceRegion = enclosingIntRect(intersection(filterRegion, object.strokeBoundingBox()));
filterData->filter->sourceGraphic()->setSourceRect(sourceRegion);
// Create all relevant filter primitives.
SVGFilterBuilder builder(filterData->filter->sourceGraphic(), filterData->nodeMap.get());
builder.buildGraph(filterData->filter.get(), *filterElement, referenceBox);
FilterEffect* lastEffect = builder.lastEffect();
if (!lastEffect)
return nullptr;
lastEffect->determineFilterPrimitiveSubregion(ClipToFilterRegion);
filterData->filter->setLastEffect(lastEffect);
FilterData* data = filterData.get();
// TODO(pdr): Can this be moved out of painter?
m_filter.setFilterDataForLayoutObject(const_cast<LayoutObject*>(&object), filterData.release());
return recordingContext.beginContent(data);
}
示例13: jsSVGFilterElementPrototypeFunctionGetPresentationAttribute
JSValue JSC_HOST_CALL jsSVGFilterElementPrototypeFunctionGetPresentationAttribute(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGFilterElement::s_info))
return throwError(exec, TypeError);
JSSVGFilterElement* castedThisObj = static_cast<JSSVGFilterElement*>(asObject(thisValue));
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThisObj->impl());
const UString& name = args.at(0).toString(exec);
JSC::JSValue result = toJS(exec, WTF::getPtr(imp->getPresentationAttribute(name)));
return result;
}
示例14: jsSVGFilterElementPrototypeFunctionSetFilterRes
JSValue JSC_HOST_CALL jsSVGFilterElementPrototypeFunctionSetFilterRes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGFilterElement::s_info))
return throwError(exec, TypeError);
JSSVGFilterElement* castedThisObj = static_cast<JSSVGFilterElement*>(asObject(thisValue));
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThisObj->impl());
unsigned filterResX = args.at(0).toInt32(exec);
unsigned filterResY = args.at(1).toInt32(exec);
imp->setFilterRes(filterResX, filterResY);
return jsUndefined();
}
示例15: jsSVGFilterElementPrototypeFunctionGetPresentationAttribute
EncodedJSValue JSC_HOST_CALL jsSVGFilterElementPrototypeFunctionGetPresentationAttribute(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSSVGFilterElement::s_info))
return throwVMTypeError(exec);
JSSVGFilterElement* castedThis = static_cast<JSSVGFilterElement*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGFilterElement::s_info);
SVGFilterElement* imp = static_cast<SVGFilterElement*>(castedThis->impl());
const String& name(ustringToString(exec->argument(0).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getPresentationAttribute(name)));
return JSValue::encode(result);
}