markus / MarkupToPDF / Controls / Common / HatchMake.cs @ b8435edd
이력 | 보기 | 이력해설 | 다운로드 (1.36 KB)
1 | 787a4489 | KangIngu | using System; |
---|---|---|---|
2 | using System.Net; |
||
3 | using System.Windows; |
||
4 | using System.Windows.Controls; |
||
5 | using System.Windows.Documents; |
||
6 | using System.Windows.Ink; |
||
7 | using System.Windows.Input; |
||
8 | using System.Windows.Media; |
||
9 | using System.Windows.Media.Animation; |
||
10 | using System.Windows.Shapes; |
||
11 | |||
12 | |||
13 | namespace MarkupToPDF.Controls.Common |
||
14 | { |
||
15 | public static class HatchMake |
||
16 | { |
||
17 | public static Brush CreateHatchBrush(SolidColorBrush color, double offSet = 0.3) |
||
18 | { |
||
19 | Color c = (color as SolidColorBrush).Color; |
||
20 | LinearGradientBrush brush = new LinearGradientBrush(); |
||
21 | brush.MappingMode = BrushMappingMode.Absolute; |
||
22 | brush.SpreadMethod = GradientSpreadMethod.Repeat; |
||
23 | brush.StartPoint = new Point(0, 0); |
||
24 | brush.EndPoint = new Point(8.0, 8.0); |
||
25 | GradientStop gs = new GradientStop(); |
||
26 | gs.Color = c; |
||
27 | brush.GradientStops.Add(gs); |
||
28 | gs = new GradientStop(); |
||
29 | gs.Color = c; |
||
30 | gs.Offset = offSet; |
||
31 | brush.GradientStops.Add(gs); |
||
32 | gs = new GradientStop(); |
||
33 | gs.Color = Colors.Transparent; |
||
34 | gs.Offset = offSet; |
||
35 | brush.GradientStops.Add(gs); |
||
36 | gs = new GradientStop(); |
||
37 | gs.Color = Colors.Transparent; |
||
38 | gs.Offset = 1; |
||
39 | brush.GradientStops.Add(gs); |
||
40 | return brush; |
||
41 | } |
||
42 | } |
||
43 | } |