当前位置: 首页>>代码示例>>C++>>正文


C++ SVGClipPathElement类代码示例

本文整理汇总了C++中SVGClipPathElement的典型用法代码示例。如果您正苦于以下问题:C++ SVGClipPathElement类的具体用法?C++ SVGClipPathElement怎么用?C++ SVGClipPathElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SVGClipPathElement类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hitTestClipContent

bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint)
{
    FloatPoint point = nodeAtPoint;
    if (!SVGRenderSupport::pointInClippingArea(this, point))
        return false;

    SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node());
    if (clipPathElement->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
        AffineTransform transform;
        transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
        transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
        point = transform.inverse().mapPoint(point);
    }

    point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point);

    for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
        RenderObject* renderer = childNode->renderer();
        if (!childNode->isSVGElement() || !toSVGElement(childNode)->isSVGStyledElement() || !renderer)
            continue;
        if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->hasTagName(SVGNames::useTag))
            continue;
        IntPoint hitPoint;
        HitTestResult result(hitPoint);
        if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipContent | HitTestRequest::DisallowShadowContent), result, point, HitTestForeground))
            return true;
    }

    return false;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: xmllangAttrSetter

static void xmllangAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(info.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
    imp->setXmllang(v);
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8SVGClipPathElement.cpp

示例3: AdjustMatrixForUnits

gfxMatrix
nsSVGClipPathFrame::GetClipPathTransform(nsIFrame* aClippedFrame)
{
  SVGClipPathElement *content = static_cast<SVGClipPathElement*>(mContent);

  gfxMatrix tm = content->PrependLocalTransformsTo(gfxMatrix());

  nsSVGEnum* clipPathUnits =
    &content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS];

  return nsSVGUtils::AdjustMatrixForUnits(tm, clipPathUnits, aClippedFrame);
}
开发者ID:leplatrem,项目名称:gecko-dev,代码行数:12,代码来源:nsSVGClipPathFrame.cpp

示例4: AdjustMatrixForUnits

gfxMatrix
nsSVGClipPathFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
{
  SVGClipPathElement *content = static_cast<SVGClipPathElement*>(mContent);

  gfxMatrix tm =
    content->PrependLocalTransformsTo(mClipParentMatrix ?
                                      *mClipParentMatrix : gfxMatrix());

  return nsSVGUtils::AdjustMatrixForUnits(tm,
                                          &content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS],
                                          mClipParent);
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:13,代码来源:nsSVGClipPathFrame.cpp

示例5: getTransformToElementCallback

static v8::Handle<v8::Value> getTransformToElementCallback(const v8::Arguments& args)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH(SVGElement*, element, V8SVGElement::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8SVGElement::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
    SVGMatrix result = imp->getTransformToElement(element, ec);
    if (UNLIKELY(ec))
        goto fail;
    return toV8Fast(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(result)), args, imp);
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:14,代码来源:V8SVGClipPathElement.cpp

示例6: ASSERT

bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData, const FloatRect& objectBoundingBox)
{
    ASSERT(clipperData);
    ASSERT(clipperData->clipMaskImage);

    GraphicsContext* maskContext = clipperData->clipMaskImage->context();
    ASSERT(maskContext);

    AffineTransform maskContentTransformation;
    SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node());
    if (clipPath->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
        maskContentTransformation.translate(objectBoundingBox.x(), objectBoundingBox.y());
        maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
        maskContext->concatCTM(maskContentTransformation);
    }

    // Draw all clipPath children into a global mask.
    for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
        RenderObject* renderer = childNode->renderer();
        if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyled() || !renderer)
            continue;
        RenderStyle* style = renderer->style();
        if (!style || style->display() == NONE || style->visibility() != VISIBLE)
            continue;

        WindRule newClipRule = style->svgStyle()->clipRule();
        bool isUseElement = renderer->isSVGShadowTreeRootContainer();
        if (isUseElement) {
            SVGUseElement* useElement = static_cast<SVGUseElement*>(childNode);
            renderer = useElement->rendererClipChild();
            if (!renderer)
                continue;
            if (!useElement->hasAttribute(SVGNames::clip_ruleAttr))
                newClipRule = renderer->style()->svgStyle()->clipRule();
        }

        // Only shapes, paths and texts are allowed for clipping.
        if (!renderer->isSVGPath() && !renderer->isSVGText())
            continue;

        // Save the old RenderStyle of the current object for restoring after drawing
        // it to the MaskImage. The new intermediate RenderStyle needs to inherit from
        // the old one.
        RefPtr<RenderStyle> oldRenderStyle = renderer->style();
        RefPtr<RenderStyle> newRenderStyle = RenderStyle::clone(oldRenderStyle.get());
        SVGRenderStyle* svgStyle = newRenderStyle.get()->accessSVGStyle();
        svgStyle->setFillPaint(SVGPaint::defaultFill());
        svgStyle->setStrokePaint(SVGPaint::defaultStroke());
        svgStyle->setFillRule(newClipRule);
        newRenderStyle.get()->setOpacity(1.0f);
        svgStyle->setFillOpacity(1.0f);
        svgStyle->setStrokeOpacity(1.0f);
        svgStyle->setFilterResource(String());
        svgStyle->setMaskerResource(String());

        // The setStyle() call results in a styleDidChange() call, which in turn invalidations the resources.
        // As we're mutating the resource on purpose, block updates until we've resetted the style again.
        m_invalidationBlocked = true;
        renderer->setStyle(newRenderStyle.release());

        // In the case of a <use> element, we obtained its renderere above, to retrieve its clipRule.
        // We have to pass the <use> renderer itself to renderSubtreeToImageBuffer() to apply it's x/y/transform/etc. values when rendering.
        // So if isUseElement is true, refetch the childNode->renderer(), as renderer got overriden above.
        SVGImageBufferTools::renderSubtreeToImageBuffer(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer, maskContentTransformation);

        renderer->setStyle(oldRenderStyle.release());
        m_invalidationBlocked = false;
    }

    return true;
}
开发者ID:,项目名称:,代码行数:71,代码来源:

示例7: xmlspaceAttrGetter

static v8::Handle<v8::Value> xmlspaceAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(info.Holder());
    return v8String(imp->xmlspace(), info.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8SVGClipPathElement.cpp

示例8: systemLanguageAttrGetter

static v8::Handle<v8::Value> systemLanguageAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(info.Holder());
    return toV8Fast(WTF::getPtr(SVGStaticListPropertyTearOff<SVGStringList>::create(imp, imp->systemLanguage())), info, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8SVGClipPathElement.cpp

示例9: clipPathUnitsAttrGetter

static v8::Handle<v8::Value> clipPathUnitsAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(info.Holder());
    return toV8Fast(static_pointer_cast<SVGAnimatedEnumeration>(imp->clipPathUnitsAnimated()), info, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8SVGClipPathElement.cpp

示例10: getScreenCTMCallback

static v8::Handle<v8::Value> getScreenCTMCallback(const v8::Arguments& args)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(args.Holder());
    return toV8Fast(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->getScreenCTM())), args, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8SVGClipPathElement.cpp

示例11: getPresentationAttributeCallback

static v8::Handle<v8::Value> getPresentationAttributeCallback(const v8::Arguments& args)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(args.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, name, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    return toV8Fast(imp->getPresentationAttribute(name), args, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:6,代码来源:V8SVGClipPathElement.cpp

示例12: hasExtensionCallback

static v8::Handle<v8::Value> hasExtensionCallback(const v8::Arguments& args)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(args.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, extension, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    return v8Boolean(imp->hasExtension(extension), args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:6,代码来源:V8SVGClipPathElement.cpp

示例13: farthestViewportElementAttrGetter

static v8::Handle<v8::Value> farthestViewportElementAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(info.Holder());
    return toV8Fast(imp->farthestViewportElement(), info, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8SVGClipPathElement.cpp

示例14: transformAttrGetter

static v8::Handle<v8::Value> transformAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    SVGClipPathElement* imp = V8SVGClipPathElement::toNative(info.Holder());
    return toV8Fast(imp->transformAnimated(), info, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8SVGClipPathElement.cpp


注:本文中的SVGClipPathElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。