blob: fb87be6147d79261d9ad9ead6e20eabe8ed3b13b [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkCanvas.h"
fmalita2aafe6f2015-02-06 12:51:10 -080012
Florin Malita99822ac2017-09-19 16:12:25 -040013class SkWStream;
fmalita2aafe6f2015-02-06 12:51:10 -080014
15class SK_API SkSVGCanvas {
16public:
Florin Malitaabc96532019-07-19 09:11:29 -040017 enum {
18 kConvertTextToPaths_Flag = 0x01,
19 };
20
fmalita2aafe6f2015-02-06 12:51:10 -080021 /**
22 * Returns a new canvas that will generate SVG commands from its draw calls, and send
Florin Malita562017b2019-02-14 13:42:15 -050023 * them to the provided stream. Ownership of the stream is not transfered, and it must
24 * remain valid for the lifetime of the returned canvas.
fmalita2aafe6f2015-02-06 12:51:10 -080025 *
26 * The canvas may buffer some drawing calls, so the output is not guaranteed to be valid
27 * or complete until the canvas instance is deleted.
28 *
29 * The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root
30 * SVG element).
31 */
Florin Malitaabc96532019-07-19 09:11:29 -040032 static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*, uint32_t flags = 0);
fmalita2aafe6f2015-02-06 12:51:10 -080033};
34
35#endif