fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 1 | /* |
| 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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkCanvas.h" |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 12 | |
Florin Malita | 99822ac | 2017-09-19 16:12:25 -0400 | [diff] [blame] | 13 | class SkWStream; |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 14 | |
| 15 | class SK_API SkSVGCanvas { |
| 16 | public: |
Florin Malita | abc9653 | 2019-07-19 09:11:29 -0400 | [diff] [blame] | 17 | enum { |
Florin Malita | 49d140d | 2019-08-21 15:40:46 -0400 | [diff] [blame] | 18 | kConvertTextToPaths_Flag = 0x01, // emit text as <path>s |
| 19 | kNoPrettyXML_Flag = 0x02, // suppress newlines and tabs in output |
Florin Malita | abc9653 | 2019-07-19 09:11:29 -0400 | [diff] [blame] | 20 | }; |
| 21 | |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 22 | /** |
| 23 | * Returns a new canvas that will generate SVG commands from its draw calls, and send |
Florin Malita | 562017b | 2019-02-14 13:42:15 -0500 | [diff] [blame] | 24 | * them to the provided stream. Ownership of the stream is not transfered, and it must |
| 25 | * remain valid for the lifetime of the returned canvas. |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 26 | * |
| 27 | * The canvas may buffer some drawing calls, so the output is not guaranteed to be valid |
| 28 | * or complete until the canvas instance is deleted. |
| 29 | * |
| 30 | * The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root |
| 31 | * SVG element). |
| 32 | */ |
Florin Malita | abc9653 | 2019-07-19 09:11:29 -0400 | [diff] [blame] | 33 | static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*, uint32_t flags = 0); |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | #endif |