1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2015 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#ifndef SkSVGCanvas_DEFINED
9cb93a386Sopenharmony_ci#define SkSVGCanvas_DEFINED
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ci#include "include/core/SkCanvas.h"
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ciclass SkWStream;
14cb93a386Sopenharmony_ci
15cb93a386Sopenharmony_ciclass SK_API SkSVGCanvas {
16cb93a386Sopenharmony_cipublic:
17cb93a386Sopenharmony_ci    enum {
18cb93a386Sopenharmony_ci        kConvertTextToPaths_Flag   = 0x01, // emit text as <path>s
19cb93a386Sopenharmony_ci        kNoPrettyXML_Flag          = 0x02, // suppress newlines and tabs in output
20cb93a386Sopenharmony_ci        kRelativePathEncoding_Flag = 0x04, // use relative commands for path encoding
21cb93a386Sopenharmony_ci    };
22cb93a386Sopenharmony_ci
23cb93a386Sopenharmony_ci    /**
24cb93a386Sopenharmony_ci     *  Returns a new canvas that will generate SVG commands from its draw calls, and send
25cb93a386Sopenharmony_ci     *  them to the provided stream. Ownership of the stream is not transfered, and it must
26cb93a386Sopenharmony_ci     *  remain valid for the lifetime of the returned canvas.
27cb93a386Sopenharmony_ci     *
28cb93a386Sopenharmony_ci     *  The canvas may buffer some drawing calls, so the output is not guaranteed to be valid
29cb93a386Sopenharmony_ci     *  or complete until the canvas instance is deleted.
30cb93a386Sopenharmony_ci     *
31cb93a386Sopenharmony_ci     *  The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root
32cb93a386Sopenharmony_ci     *  SVG element).
33cb93a386Sopenharmony_ci     */
34cb93a386Sopenharmony_ci    static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*, uint32_t flags = 0);
35cb93a386Sopenharmony_ci};
36cb93a386Sopenharmony_ci
37cb93a386Sopenharmony_ci#endif
38