2 * Copyright 2016 Xamarin Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "SkPathEffect.h"
9 #include "SkDiscretePathEffect.h"
10 #include "SkCornerPathEffect.h"
11 #include "Sk1DPathEffect.h"
12 #include "Sk2DPathEffect.h"
13 #include "SkDashPathEffect.h"
16 #include "sk_patheffect.h"
18 #include "sk_types_priv.h"
20 void sk_path_effect_unref(sk_path_effect_t* effect)
22 SkSafeUnref(AsPathEffect(effect));
25 sk_path_effect_t* sk_path_effect_create_compose(sk_path_effect_t* outer, sk_path_effect_t* inner)
27 return ToPathEffect(SkComposePathEffect::Make(sk_ref_sp(AsPathEffect(outer)), sk_ref_sp(AsPathEffect(inner))).release());
30 sk_path_effect_t* sk_path_effect_create_sum(sk_path_effect_t* first, sk_path_effect_t* second)
32 return ToPathEffect(SkSumPathEffect::Make(sk_ref_sp(AsPathEffect(first)), sk_ref_sp(AsPathEffect(second))).release());
35 sk_path_effect_t* sk_path_effect_create_discrete(float segLength, float deviation, uint32_t seedAssist /*0*/)
37 return ToPathEffect(SkDiscretePathEffect::Make(segLength, deviation, seedAssist).release());
40 sk_path_effect_t* sk_path_effect_create_corner(float radius)
42 return ToPathEffect(SkCornerPathEffect::Make(radius).release());
45 sk_path_effect_t* sk_path_effect_create_1d_path(const sk_path_t* path, float advance, float phase, sk_path_effect_1d_style_t style)
47 return ToPathEffect(SkPath1DPathEffect::Make(AsPath(*path), advance, phase, (SkPath1DPathEffect::Style)style).release());
50 sk_path_effect_t* sk_path_effect_create_2d_line(float width, const sk_matrix_t* cmatrix)
54 from_c(cmatrix, &matrix);
56 return ToPathEffect(SkLine2DPathEffect::Make(width, matrix).release());
59 sk_path_effect_t* sk_path_effect_create_2d_path(const sk_matrix_t* cmatrix, const sk_path_t* path)
63 from_c(cmatrix, &matrix);
65 return ToPathEffect(SkPath2DPathEffect::Make(matrix, AsPath(*path)).release());
68 sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase)
70 return ToPathEffect(SkDashPathEffect::Make(intervals, count, phase).release());