Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DM::SVGSink Class Reference

#include <DMSrcSink.h>

Inheritance diagram for DM::SVGSink:
DM::Sink

Public Member Functions

 SVGSink (int pageIndex=0)
 
Result draw (const Src &, SkBitmap *, SkWStream *, SkString *) const override
 
const char * fileExtension () const override
 
SinkFlags flags () const override
 
- Public Member Functions inherited from DM::Sink
virtual ~Sink ()
 
virtual Result draw (const Src &, SkBitmap *, SkWStream *, SkString *log) const =0
 
virtual void setColorSpace (sk_sp< SkColorSpace >)
 
virtual bool serial () const
 
virtual const char * fileExtension () const =0
 
virtual SinkFlags flags () const =0
 
virtual SkColorInfo colorInfo () const
 

Detailed Description

Definition at line 553 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ SVGSink()

DM::SVGSink::SVGSink ( int  pageIndex = 0)

Definition at line 2095 of file DMSrcSink.cpp.

2095: fPageIndex(pageIndex) {}

Member Function Documentation

◆ draw()

Result DM::SVGSink::draw ( const Src src,
SkBitmap ,
SkWStream dst,
SkString  
) const
overridevirtual

Implements DM::Sink.

Definition at line 2097 of file DMSrcSink.cpp.

2097 {
2098#if defined(SK_ENABLE_SVG)
2099 if (src.pageCount() > 1) {
2100 int pageCount = src.pageCount();
2101 if (fPageIndex > pageCount - 1) {
2102 return Result::Fatal("Page index %d too high for document with only %d pages.",
2103 fPageIndex, pageCount);
2104 }
2105 }
2106 return src.draw(fPageIndex,
2108 SkIntToScalar(src.size().height())),
2109 dst)
2110 .get(),
2111 /*GraphiteTestContext=*/nullptr);
2112#else
2113 (void)fPageIndex;
2114 return Result::Fatal("SVG sink is disabled.");
2115#endif // SK_ENABLE_SVG
2116}
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static Result Fatal(const char *fmt,...) SK_PRINTF_LIKE(1
static std::unique_ptr< SkCanvas > Make(const SkRect &bounds, SkWStream *, uint32_t flags=0)
Definition: SkSVGCanvas.cpp:19
dst
Definition: cp.py:12
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ fileExtension()

const char * DM::SVGSink::fileExtension ( ) const
inlineoverridevirtual

Implements DM::Sink.

Definition at line 558 of file DMSrcSink.h.

558{ return "svg"; }

◆ flags()

SinkFlags DM::SVGSink::flags ( ) const
inlineoverridevirtual

Implements DM::Sink.

Definition at line 559 of file DMSrcSink.h.

559{ return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }

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