xref: /aosp_15_r20/external/skia/include/core/SkPathUtils.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2022 Google LLC
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 #ifndef SkPathUtils_DEFINED
8 #define SkPathUtils_DEFINED
9 
10 #include "include/core/SkScalar.h"
11 #include "include/core/SkTypes.h"
12 
13 class SkMatrix;
14 class SkPaint;
15 class SkPath;
16 struct SkRect;
17 
18 namespace skpathutils {
19 
20 /** Returns the filled equivalent of the stroked path.
21 
22     @param src       SkPath read to create a filled version
23     @param paint     SkPaint, from which attributes such as stroke cap, width, miter, and join,
24                      as well as pathEffect will be used.
25     @param dst       resulting SkPath; may be the same as src, but may not be nullptr
26     @param cullRect  optional limit passed to SkPathEffect
27     @param resScale  if > 1, increase precision, else if (0 < resScale < 1) reduce precision
28                      to favor speed and size
29     @return          true if the dst path was updated, false if it was not (e.g. if the path
30                      represents hairline and cannot be filled).
31 */
32 SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst,
33                               const SkRect *cullRect, SkScalar resScale = 1);
34 
35 SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst,
36                               const SkRect *cullRect, const SkMatrix &ctm);
37 
38 SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst);
39 
40 }
41 
42 #endif
43