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 11 #include "include/core/SkCanvas.h" 12 13 class SkWStream; 14 15 class SK_API SkSVGCanvas { 16 public: 17 enum { 18 kConvertTextToPaths_Flag = 0x01, // emit text as <path>s 19 kNoPrettyXML_Flag = 0x02, // suppress newlines and tabs in output 20 kRelativePathEncoding_Flag = 0x04, // use relative commands for path encoding 21 }; 22 23 /** 24 * Returns a new canvas that will generate SVG commands from its draw calls, and send 25 * them to the provided stream. Ownership of the stream is not transfered, and it must 26 * remain valid for the lifetime of the returned canvas. 27 * 28 * The canvas may buffer some drawing calls, so the output is not guaranteed to be valid 29 * or complete until the canvas instance is deleted. 30 * 31 * The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root 32 * SVG element). 33 */ 34 static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*, uint32_t flags = 0); 35 }; 36 37 #endif 38