1 module skia.SKPathEffect;
2 
3 import skia.Definitions;
4 import skia.SKMatrix;
5 import skia.SKPath;
6 import skia.SKObject;
7 import skia.Exceptions;
8 import skia.SkiaApi;
9 
10 class SKPathEffect : SKObject // 
11 {
12 	this (void* handle, bool owns)
13 	{
14     super (handle, owns);
15 	}
16 
17 	protected override void Dispose (bool disposing)
18   {
19     return super.Dispose (disposing);
20   }
21 		
22 
23 	static SKPathEffect CreateCompose(SKPathEffect outer, SKPathEffect inner)
24 	{
25 		if (outer is null)
26 			throw new ArgumentNullException("outer");
27 		if (inner is null)
28 			throw new ArgumentNullException("inner");
29 		return GetObject(SkiaApi.sk_path_effect_create_compose(cast(sk_path_effect_t*)outer.Handle, cast(sk_path_effect_t*)inner.Handle));
30 	}
31 
32 	static SKPathEffect CreateSum(SKPathEffect first, SKPathEffect second)
33 	{
34 		if (first is null)
35 			throw new ArgumentNullException("first");
36 		if (second is null)
37 			throw new ArgumentNullException("second");
38 		return GetObject(SkiaApi.sk_path_effect_create_sum(cast(sk_path_effect_t*)first.Handle, cast(sk_path_effect_t*)second.Handle));
39 	}
40 
41 	static SKPathEffect CreateDiscrete(float segLength, float deviation, uint seedAssist = 0)
42 	{
43 		return GetObject(SkiaApi.sk_path_effect_create_discrete(segLength, deviation, seedAssist));
44 	}
45 
46 	static SKPathEffect CreateCorner(float radius)
47 	{
48 		return GetObject(SkiaApi.sk_path_effect_create_corner(radius));
49 	}
50 
51 	static SKPathEffect Create1DPath(SKPath path, float advance, float phase, SKPath1DPathEffectStyle style)
52 	{
53 		if (path is null)
54 			throw new ArgumentNullException("path");
55 		return GetObject(SkiaApi.sk_path_effect_create_1d_path(cast(sk_path_t*)path.Handle, advance, phase, style));
56 	}
57 
58 	static SKPathEffect Create2DLine(float width, SKMatrix matrix)
59 	{
60 		return GetObject(SkiaApi.sk_path_effect_create_2d_line(width, &matrix));
61 	}
62 
63 	static SKPathEffect Create2DPath(SKMatrix matrix, SKPath path)
64 	{
65 		if (path is null)
66 			throw new ArgumentNullException("path");
67 		return GetObject(SkiaApi.sk_path_effect_create_2d_path(cast(SKMatrix*)&matrix, cast(sk_path_t*)path.Handle));
68 	}
69 
70 	static SKPathEffect CreateDash(float[] intervals, float phase)
71 	{
72 		if (intervals is null)
73 			throw new ArgumentNullException("intervals");
74 		if (intervals.length % 2 != 0)
75 			throw new ArgumentException("The intervals must have an even number of entries.", "intervals");
76 		float* i = intervals.ptr;
77 		return GetObject (SkiaApi.sk_path_effect_create_dash (i, cast(int)intervals.length, phase));
78 	}
79 
80 	static SKPathEffect CreateTrim(float start, float stop)
81 	{
82 		return CreateTrim(start, stop, SKTrimPathEffectMode.Normal);
83 	}
84 
85 	static SKPathEffect CreateTrim(float start, float stop, SKTrimPathEffectMode mode)
86 	{
87 		return GetObject(SkiaApi.sk_path_effect_create_trim(start, stop, mode));
88 	}
89 
90 	static SKPathEffect GetObject (void* handle)
91   {
92     return GetOrAddObject!(SKPathEffect) (handle, (h, o) {return new SKPathEffect (h, o);});
93   }
94 		
95 }
96