您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ toSVGElement函数代码示例

51自学网 2021-06-03 08:53:31
  C++
这篇教程C++ toSVGElement函数代码示例写得很实用,希望能帮到您。

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

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

示例1: filterPrimitiveSubregion

sk_sp<SkImageFilter> FEImage::createImageFilterForLayoutObject(const LayoutObject& layoutObject){    FloatRect dstRect = filterPrimitiveSubregion();    AffineTransform transform;    SVGElement* contextNode = toSVGElement(layoutObject.node());    if (contextNode->hasRelativeLengths()) {        SVGLengthContext lengthContext(contextNode);        FloatSize viewportSize;        // If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport.        // Build up a transformation that maps from the viewport space to the filter primitive subregion.        if (lengthContext.determineViewport(viewportSize))            transform = makeMapBetweenRects(FloatRect(FloatPoint(), viewportSize), dstRect);    } else {        transform.translate(dstRect.x(), dstRect.y());    }    SkPictureBuilder filterPicture(dstRect);    {        TransformRecorder transformRecorder(filterPicture.context(), layoutObject, transform);        SVGPaintContext::paintSubtree(filterPicture.context(), &layoutObject);    }    return SkPictureImageFilter::Make(toSkSp(filterPicture.endRecording()), dstRect);}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:27,


示例2: targetElement

inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition){    Element* eventBase = condition.baseID().isEmpty() ? targetElement() : treeScope().getElementById(AtomicString(condition.baseID()));    if (eventBase && eventBase->isSVGElement())        return toSVGElement(eventBase);    return nullptr;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,


示例3: ASSERT

void KeyframeEffect::applyEffects(){    ASSERT(isInEffect());    ASSERT(animation());    if (!m_target || !m_model)        return;    // Cancel composited animation of transform if a motion path has been introduced on the element.    if (m_target->computedStyle()        && m_target->computedStyle()->hasMotionPath()        && animation()->hasActiveAnimationsOnCompositor()        && animation()->affects(*m_target, CSSPropertyTransform)) {        animation()->cancelAnimationOnCompositor();    }    double iteration = currentIteration();    ASSERT(iteration >= 0);    OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> interpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullptr;    // FIXME: Handle iteration values which overflow int.    m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDuration(), interpolations);    if (m_sampledEffect) {        m_sampledEffect->setInterpolations(interpolations.release());    } else if (interpolations && !interpolations->isEmpty()) {        OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create(this, interpolations.release());        m_sampledEffect = sampledEffect.get();        ensureAnimationStack(m_target).add(sampledEffect.release());    } else {        return;    }    m_target->setNeedsAnimationStyleRecalc();    if (m_target->isSVGElement())        m_sampledEffect->applySVGUpdate(toSVGElement(*m_target));}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:34,


示例4: document

AffineTransform SVGGraphicsElement::computeCTM(SVGElement::CTMScope mode,    SVGGraphicsElement::StyleUpdateStrategy styleUpdateStrategy, const SVGGraphicsElement* ancestor) const{    if (styleUpdateStrategy == AllowStyleUpdate)        document().updateStyleAndLayoutIgnorePendingStylesheets();    AffineTransform ctm;    bool done = false;    for (const Element* currentElement = this; currentElement && !done;        currentElement = currentElement->parentOrShadowHostElement()) {        if (!currentElement->isSVGElement())            break;        ctm = toSVGElement(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm);        switch (mode) {        case NearestViewportScope:            // Stop at the nearest viewport ancestor.            done = currentElement != this && isViewportElement(*currentElement);            break;        case AncestorScope:            // Stop at the designated ancestor.            done = currentElement == ancestor;            break;        default:            ASSERT(mode == ScreenScope);            break;        }    }    return ctm;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:33,


示例5: ASSERT

void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object){    ASSERT(context);    ASSERT(style);    ASSERT(object);    ASSERT(object->node());    ASSERT(object->node()->isSVGElement());    const SVGRenderStyle* svgStyle = style->svgStyle();    ASSERT(svgStyle);    SVGLengthContext lengthContext(toSVGElement(object->node()));    context->setStrokeThickness(svgStyle->strokeWidth()->value(lengthContext));    context->setLineCap(svgStyle->capStyle());    context->setLineJoin(svgStyle->joinStyle());    context->setMiterLimit(svgStyle->strokeMiterLimit());    RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();    if (dashes->isEmpty())        return;    DashArray dashArray;    SVGLengthList::ConstIterator it = dashes->begin();    SVGLengthList::ConstIterator itEnd = dashes->end();    for (; it != itEnd; ++it)        dashArray.append(it->value(lengthContext));    context->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengthContext));}
开发者ID:jeremyroman,项目名称:blink,代码行数:29,


示例6: toCSSImageValue

bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element){    if (!element || !element->isSVGElement())        return false;    if (!isSVGCursor())        return false;    String url = toCSSImageValue(m_imageValue.get())->url();    if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->treeScope())) {        // FIXME: This will override hot spot specified in CSS, which is probably incorrect.        SVGLengthContext lengthContext(0);        m_hotSpotSpecified = true;        float x = roundf(cursorElement->x()->currentValue()->value(lengthContext));        m_hotSpot.setX(static_cast<int>(x));        float y = roundf(cursorElement->y()->currentValue()->value(lengthContext));        m_hotSpot.setY(static_cast<int>(y));        if (cachedImageURL() != element->document().completeURL(cursorElement->href()->currentValue()->value()))            clearImageResource();        SVGElement* svgElement = toSVGElement(element);#if !ENABLE(OILPAN)        m_referencedElements.add(svgElement);#endif        svgElement->setCursorImageValue(this);        cursorElement->addClient(svgElement);        return true;    }    return false;}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:33,


示例7: cloneNodeAndAssociate

static PassRefPtrWillBeRawPtr<Node> cloneNodeAndAssociate(Node& toClone){    RefPtrWillBeRawPtr<Node> clone = toClone.cloneNode(false);    if (!clone->isSVGElement())        return clone.release();    SVGElement& svgElement = toSVGElement(toClone);    ASSERT(!svgElement.correspondingElement());    toSVGElement(clone.get())->setCorrespondingElement(&svgElement);    if (EventTargetData* data = toClone.eventTargetData())        data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(clone.get());    TrackExceptionState exceptionState;    for (RefPtrWillBeRawPtr<Node> node = toClone.firstChild(); node && !exceptionState.hadException(); node = node->nextSibling())        clone->appendChild(cloneNodeAndAssociate(*node), exceptionState);    return clone.release();}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:16,


示例8: createRenderer

RenderObject* SVGAElement::createRenderer(RenderStyle*){    if (parentNode() && parentNode()->isSVGElement() && toSVGElement(parentNode())->isTextContent())        return new RenderSVGInline(this);    return new RenderSVGTransformableContainer(this);}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:7,


示例9: filterPrimitiveSubregion

PassRefPtr<SkImageFilter> FEImage::createImageFilterForRenderer(RenderObject* renderer, SkiaImageFilterBuilder* builder){    FloatRect dstRect = filterPrimitiveSubregion();    AffineTransform transform;    SVGElement* contextNode = toSVGElement(renderer->node());    if (contextNode->hasRelativeLengths()) {        SVGLengthContext lengthContext(contextNode);        FloatSize viewportSize;        // If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport.        // Build up a transformation that maps from the viewport space to the filter primitive subregion.        if (lengthContext.determineViewport(viewportSize))            transform = makeMapBetweenRects(FloatRect(FloatPoint(), viewportSize), dstRect);    } else {        transform.translate(dstRect.x(), dstRect.y());    }    GraphicsContext* context = builder->context();    if (!context)        return adoptRef(SkBitmapSource::Create(SkBitmap()));    AffineTransform contentTransformation;    context->save();    context->beginRecording(FloatRect(FloatPoint(), dstRect.size()));    context->concatCTM(transform);    SVGRenderingContext::renderSubtree(context, renderer, contentTransformation);    RefPtr<DisplayList> displayList = context->endRecording();    context->restore();    RefPtr<SkImageFilter> result = adoptRef(SkPictureImageFilter::Create(displayList->picture(), dstRect));    return result.release();}
开发者ID:jeremyroman,项目名称:blink,代码行数:32,


示例10:

RenderPtr<RenderElement> SVGAElement::createElementRenderer(PassRef<RenderStyle> style){    if (parentNode() && parentNode()->isSVGElement() && toSVGElement(parentNode())->isTextContent())        return createRenderer<RenderSVGInline>(*this, WTF::move(style));    return createRenderer<RenderSVGTransformableContainer>(*this, WTF::move(style));}
开发者ID:sinoory,项目名称:webv8,代码行数:7,


示例11: clearResourceReferences

void SVGMPathElement::buildPendingResource(){    clearResourceReferences();    if (!inDocument())        return;    String id;    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);    if (!target) {        // Do not register as pending if we are already pending this resource.        if (document().accessSVGExtensions()->isPendingResource(this, id))            return;        if (!id.isEmpty()) {            document().accessSVGExtensions()->addPendingResource(id, this);            ASSERT(hasPendingResources());        }    } else if (target->isSVGElement()) {        // Register us with the target in the dependencies map. Any change of hrefElement        // that leads to relayout/repainting now informs us, so we can react to it.        document().accessSVGExtensions()->addElementReferencingTarget(this, toSVGElement(target));    }    targetPathChanged();}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:25,


示例12: ASSERT

void KeyframeEffect::applyEffects(){    ASSERT(isInEffect());    ASSERT(animation());    if (!m_target || !m_model)        return;    if (hasIncompatibleStyle())        animation()->cancelAnimationOnCompositor();    double iteration = currentIteration();    ASSERT(iteration >= 0);    bool changed = false;    if (m_sampledEffect) {        changed = m_model->sample(clampTo<int>(iteration, 0), timeFraction(), iterationDuration(), m_sampledEffect->mutableInterpolations());    } else {        Vector<RefPtr<Interpolation>> interpolations;        m_model->sample(clampTo<int>(iteration, 0), timeFraction(), iterationDuration(), interpolations);        if (!interpolations.isEmpty()) {            SampledEffect* sampledEffect = SampledEffect::create(this);            sampledEffect->mutableInterpolations().swap(interpolations);            m_sampledEffect = sampledEffect;            ensureAnimationStack(m_target).add(sampledEffect);            changed = true;        } else {            return;        }    }    if (changed) {        m_target->setNeedsAnimationStyleRecalc();        if (RuntimeEnabledFeatures::webAnimationsSVGEnabled() && m_target->isSVGElement())            toSVGElement(*m_target).setWebAnimationsPending();    }}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:35,


示例13: ASSERT

void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle& style, const RenderElement& renderer){    ASSERT(context);    ASSERT(renderer.element());    ASSERT(renderer.element()->isSVGElement());    const SVGRenderStyle& svgStyle = style.svgStyle();    SVGLengthContext lengthContext(toSVGElement(renderer.element()));    context->setStrokeThickness(svgStyle.strokeWidth().value(lengthContext));    context->setLineCap(svgStyle.capStyle());    context->setLineJoin(svgStyle.joinStyle());    if (svgStyle.joinStyle() == MiterJoin)        context->setMiterLimit(svgStyle.strokeMiterLimit());    const Vector<SVGLength>& dashes = svgStyle.strokeDashArray();    if (dashes.isEmpty())        context->setStrokeStyle(SolidStroke);    else {        DashArray dashArray;        dashArray.reserveInitialCapacity(dashes.size());        for (unsigned i = 0, size = dashes.size(); i < size; ++i)            dashArray.uncheckedAppend(dashes[i].value(lengthContext));        context->setLineDash(dashArray, svgStyle.strokeDashOffset().value(lengthContext));    }}
开发者ID:jeremysjones,项目名称:webkit,代码行数:27,


示例14: 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();}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:30,


示例15: clearShadowTree

void SVGUseElement::buildPendingResource(){    if (inUseShadowTree())        return;    clearShadowTree();    cancelShadowTreeRecreation();    if (!referencedScope() || !inDocument())        return;    AtomicString id;    Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), treeScope(), &id, externalDocument());    if (!target || !target->inDocument()) {        // If we can't find the target of an external element, just give up.        // We can't observe if the target somewhen enters the external document, nor should we do it.        if (externalDocument())            return;        if (id.isEmpty())            return;        referencedScope()->document().accessSVGExtensions().addPendingResource(id, this);        ASSERT(hasPendingResources());        return;    }    if (target->isSVGElement()) {        buildShadowAndInstanceTree(toSVGElement(target));        invalidateDependentShadowTrees();    }    ASSERT(!m_needsShadowTreeRecreation);}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:31,


示例16: linkAttribute

static inline const AtomicString& linkAttribute(const Element& element){    DCHECK(element.isLink());    if (element.isHTMLElement())        return element.fastGetAttribute(HTMLNames::hrefAttr);    DCHECK(element.isSVGElement());    return SVGURIReference::legacyHrefString(toSVGElement(element));}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:8,


示例17: writeStyle

static void writeStyle(TextStream& ts, const RenderObject& object){    const RenderStyle* style = object.style();    const SVGRenderStyle* svgStyle = style->svgStyle();    if (!object.localTransform().isIdentity())        writeNameValuePair(ts, "transform", object.localTransform());    writeIfNotDefault(ts, "image rendering", style->imageRendering(), RenderStyle::initialImageRendering());    writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpacity());    if (object.isSVGShape()) {        const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object);        ASSERT(shape.node());        ASSERT(shape.node()->isSVGElement());        Color fallbackColor;        if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackColor)) {            TextStreamSeparator s(" ");            ts << " [stroke={" << s;            writeSVGPaintingResource(ts, strokePaintingResource);            SVGLengthContext lengthContext(toSVGElement(shape.node()));            double dashOffset = svgStyle->strokeDashOffset().value(lengthContext);            double strokeWidth = svgStyle->strokeWidth().value(lengthContext);            const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();            DashArray dashArray;            const Vector<SVGLength>::const_iterator end = dashes.end();            for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)                dashArray.append((*it).value(lengthContext));            writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);            writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);            writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4.0f);            writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap);            writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin);            writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);            if (!dashArray.isEmpty())                writeNameValuePair(ts, "dash array", dashArray);            ts << "}]";        }        if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackColor)) {            TextStreamSeparator s(" ");            ts << " [fill={" << s;            writeSVGPaintingResource(ts, fillPaintingResource);            writeIfNotDefault(ts, "opacity", svgStyle->fillOpacity(), 1.0f);            writeIfNotDefault(ts, "fill rule", svgStyle->fillRule(), RULE_NONZERO);            ts << "}]";        }        writeIfNotDefault(ts, "clip rule", svgStyle->clipRule(), RULE_NONZERO);    }    writeIfNotEmpty(ts, "start marker", svgStyle->markerStartResource());    writeIfNotEmpty(ts, "middle marker", svgStyle->markerMidResource());    writeIfNotEmpty(ts, "end marker", svgStyle->markerEndResource());}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:58,


示例18: writeSVGGradientStop

void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, int indent){    writeStandardPrefix(ts, stop, indent);    SVGStopElement* stopElement = toSVGStopElement(toSVGElement(stop.element()));    ASSERT(stopElement);    ts << " [offset=" << stopElement->offset() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]/n";}
开发者ID:jeremysjones,项目名称:webkit,代码行数:9,


示例19: toSVGElement

SVGElement* SVGGraphicsElement::nearestViewportElement() const{    for (Element* current = parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) {        if (isViewportElement(*current))            return toSVGElement(current);    }    return nullptr;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:9,


示例20: hasValidPredecessor

static bool hasValidPredecessor(const Node* node){    ASSERT(node);    for (node = node->previousSibling(); node; node = node->previousSibling()) {        if (node->isSVGElement() && toSVGElement(node)->isValid())            return true;    }    return false;}
开发者ID:335969568,项目名称:Blink-1,代码行数:9,


示例21: toSVGElement

SVGElement* SVGViewSpec::viewTarget() const{    if (!m_contextElement)        return 0;    Element* element = m_contextElement->treeScope().getElementById(m_viewTargetString);    if (!element || !element->isSVGElement())        return 0;    return toSVGElement(element);}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:9,


示例22: toSVGElement

void KeyframeEffectReadOnly::attach(Animation* animation) {  if (m_target) {    m_target->ensureElementAnimations().animations().add(animation);    m_target->setNeedsAnimationStyleRecalc();    if (RuntimeEnabledFeatures::webAnimationsSVGEnabled() &&        m_target->isSVGElement())      toSVGElement(m_target)->setWebAnimationsPending();  }  AnimationEffectReadOnly::attach(animation);}
开发者ID:mirror,项目名称:chromium,代码行数:10,



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


C++ toSVGSVGElement函数代码示例
C++ toRenderText函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。