blob: 1cc091a55e60e33b1ca47a9baee6a8b52ac8d797 [file] [log] [blame]
fmalita2aafe6f2015-02-06 12:51:10 -08001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkSVGCanvas_DEFINED
9#define SkSVGCanvas_DEFINED
10
11#include "SkCanvas.h"
12
Florin Malita99822ac2017-09-19 16:12:25 -040013class SkWStream;
fmalita2aafe6f2015-02-06 12:51:10 -080014class SkXMLWriter;
15
16class SK_API SkSVGCanvas {
17public:
18 /**
19 * Returns a new canvas that will generate SVG commands from its draw calls, and send
20 * them to the provided xmlwriter. Ownership of the xmlwriter is not transfered to the canvas,
21 * but it must stay valid during the lifetime of the returned canvas.
22 *
23 * The canvas may buffer some drawing calls, so the output is not guaranteed to be valid
24 * or complete until the canvas instance is deleted.
25 *
26 * The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root
27 * SVG element).
28 */
Florin Malita99822ac2017-09-19 16:12:25 -040029 static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*);
30
31 // Internal only.
Mike Reed5df49342016-11-12 08:06:55 -060032 static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkXMLWriter*);
fmalita2aafe6f2015-02-06 12:51:10 -080033};
34
35#endif