|
6 | 6 |
|
7 | 7 | namespace SVGImage.SVG |
8 | 8 | { |
9 | | - public class Fill |
10 | | - { |
11 | | - public enum eFillRule |
12 | | - { |
13 | | - nonzero, |
14 | | - evenodd |
15 | | - } |
| 9 | + public class Fill |
| 10 | + { |
| 11 | + public enum eFillRule |
| 12 | + { |
| 13 | + nonzero, |
| 14 | + evenodd |
| 15 | + } |
16 | 16 |
|
17 | | - public eFillRule FillRule { get; set;} |
| 17 | + public eFillRule FillRule { get; set;} |
18 | 18 |
|
19 | | - public string PaintServerKey {get; set;} |
| 19 | + public string PaintServerKey {get; set;} |
20 | 20 |
|
21 | | - public double Opacity {get; set;} |
| 21 | + public double Opacity {get; set;} |
22 | 22 |
|
23 | | - public Fill(SVG svg) |
24 | | - { |
25 | | - this.FillRule = eFillRule.nonzero; |
26 | | - this.Opacity = 100; |
27 | | - } |
| 23 | + public Fill(SVG svg) |
| 24 | + { |
| 25 | + this.FillRule = eFillRule.nonzero; |
| 26 | + this.Opacity = 100; |
| 27 | + } |
28 | 28 |
|
29 | | - public Brush FillBrush(SVG svg, SVGRender svgRender, Shape shape, double elementOpacity, Rect bounds) |
30 | | - { |
31 | | - var paintServer = svg.PaintServers.GetServer(PaintServerKey); |
32 | | - if(paintServer != null) |
| 29 | + public Brush FillBrush(SVG svg, SVGRender svgRender, Shape shape, double elementOpacity, Rect bounds) |
| 30 | + { |
| 31 | + var paintServer = svg.PaintServers.GetServer(PaintServerKey); |
| 32 | + if(paintServer != null) |
33 | 33 | { |
34 | | - if(paintServer is CurrentColorPaintServer) |
| 34 | + if(paintServer is CurrentColorPaintServer) |
35 | 35 | { |
36 | | - var shapePaintServer = svg.PaintServers.GetServer(shape.PaintServerKey); |
37 | | - if(shapePaintServer != null) |
| 36 | + var shapePaintServer = svg.PaintServers.GetServer(shape.PaintServerKey); |
| 37 | + if(shapePaintServer != null) |
38 | 38 | { |
39 | | - return shapePaintServer.GetBrush(this.Opacity * elementOpacity, svg, svgRender, bounds); |
| 39 | + return shapePaintServer.GetBrush(this.Opacity * elementOpacity, svg, svgRender, bounds); |
40 | 40 |
|
41 | | - } |
42 | | - } |
43 | | - if (paintServer is InheritPaintServer) |
44 | | - { |
45 | | - var p = shape.RealParent ?? shape.Parent; |
46 | | - while (p != null) |
47 | | - { |
48 | | - if(p.Fill != null) |
| 41 | + } |
| 42 | + } |
| 43 | + if (paintServer is InheritPaintServer) |
| 44 | + { |
| 45 | + var p = shape.RealParent ?? shape.Parent; |
| 46 | + while (p != null) |
| 47 | + { |
| 48 | + if(p.Fill != null) |
49 | 49 | { |
50 | | - var checkPaintServer = svg.PaintServers.GetServer(p.Fill.PaintServerKey); |
51 | | - if(!(checkPaintServer is InheritPaintServer)) |
| 50 | + var checkPaintServer = svg.PaintServers.GetServer(p.Fill.PaintServerKey); |
| 51 | + if(!(checkPaintServer is InheritPaintServer)) |
52 | 52 | { |
53 | | - return checkPaintServer.GetBrush(this.Opacity * elementOpacity, svg, svgRender, bounds); |
54 | | - } |
55 | | - } |
56 | | - p = p.RealParent ?? p.Parent; |
57 | | - } |
58 | | - return null; |
59 | | - } |
60 | | - return paintServer.GetBrush(this.Opacity * elementOpacity, svg, svgRender, bounds); |
61 | | - } |
62 | | - return null; |
63 | | - } |
64 | | - } |
| 53 | + return checkPaintServer.GetBrush(this.Opacity * elementOpacity, svg, svgRender, bounds); |
| 54 | + } |
| 55 | + } |
| 56 | + p = p.RealParent ?? p.Parent; |
| 57 | + } |
| 58 | + return null; |
| 59 | + } |
| 60 | + return paintServer.GetBrush(this.Opacity * elementOpacity, svg, svgRender, bounds); |
| 61 | + } |
| 62 | + return null; |
| 63 | + } |
| 64 | + } |
65 | 65 | } |
0 commit comments