Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
SkSVGDOM Class Reference

#include <SkSVGDOM.h>

Inheritance diagram for SkSVGDOM:
SkRefCnt SkRefCntBase

Classes

class  Builder
 

Public Member Functions

SkSVGSVGgetRoot () const
 
void setContainerSize (const SkSize &)
 
const SkSizecontainerSize () const
 
sk_sp< SkSVGNode > * findNodeById (const char *id)
 
void render (SkCanvas *) const
 
void renderNode (SkCanvas *, SkSVGPresentationContext &, const char *id) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< SkSVGDOMMakeFromStream (SkStream &str)
 

Detailed Description

Definition at line 26 of file SkSVGDOM.h.

Member Function Documentation

◆ containerSize()

const SkSize & SkSVGDOM::containerSize ( ) const

DEPRECATED: use getRoot()->intrinsicSize() to query the root element intrinsic size.

Returns the SVG dom container size.

If the client specified a container size via setContainerSize(), then the same size is returned.

When unspecified by clients, this returns the intrinsic size of the root element, as defined by its width/height attributes. If either width or height is specified in relative units (e.g. "100%"), then the corresponding intrinsic size dimension is zero.

Definition at line 484 of file SkSVGDOM.cpp.

484 {
485 return fContainerSize;
486}

◆ findNodeById()

sk_sp< SkSVGNode > * SkSVGDOM::findNodeById ( const char *  id)

Definition at line 493 of file SkSVGDOM.cpp.

493 {
494 SkString idStr(id);
495 return this->fIDMapper.find(idStr);
496}
V * find(const K &key) const
Definition SkTHash.h:479

◆ getRoot()

SkSVGSVG * SkSVGDOM::getRoot ( ) const
inline

Returns the root (outermost) SVG element.

Definition at line 64 of file SkSVGDOM.h.

64{ return fRoot.get(); }

◆ MakeFromStream()

static sk_sp< SkSVGDOM > SkSVGDOM::MakeFromStream ( SkStream str)
inlinestatic

Definition at line 57 of file SkSVGDOM.h.

57 {
58 return Builder().make(str);
59 }
DlVertices::Builder Builder

◆ render()

void SkSVGDOM::render ( SkCanvas canvas) const

Definition at line 451 of file SkSVGDOM.cpp.

451 {
452 TRACE_EVENT0("skia", TRACE_FUNC);
453 if (fRoot) {
454 SkSVGLengthContext lctx(fContainerSize);
456 fRoot->render(SkSVGRenderContext(canvas,
457 fFontMgr,
458 fResourceProvider,
459 fIDMapper,
460 lctx,
461 pctx,
462 {nullptr, nullptr},
463 fTextShapingFactory));
464 }
465}
#define TRACE_FUNC
#define TRACE_EVENT0(category_group, name)

◆ renderNode()

void SkSVGDOM::renderNode ( SkCanvas canvas,
SkSVGPresentationContext pctx,
const char *  id 
) const

Render the node with the given id as if it were the only child of the root.

Definition at line 467 of file SkSVGDOM.cpp.

467 {
468 TRACE_EVENT0("skia", TRACE_FUNC);
469
470 if (fRoot) {
471 SkSVGLengthContext lctx(fContainerSize);
472 fRoot->renderNode(SkSVGRenderContext(canvas,
473 fFontMgr,
474 fResourceProvider,
475 fIDMapper,
476 lctx,
477 pctx,
478 {nullptr, nullptr},
479 fTextShapingFactory),
481 }
482}
SkString SkSVGStringType
Definition SkSVGTypes.h:28

◆ setContainerSize()

void SkSVGDOM::setContainerSize ( const SkSize containerSize)

Specify a "container size" for the SVG dom.

This is used to resolve the initial viewport when the root SVG width/height are specified in relative units.

If the root dimensions are in absolute units, then the container size has no effect since the initial viewport is fixed.

Definition at line 488 of file SkSVGDOM.cpp.

488 {
489 // TODO: inval
490 fContainerSize = containerSize;
491}
const SkSize & containerSize() const
Definition SkSVGDOM.cpp:484

The documentation for this class was generated from the following files: