-
Notifications
You must be signed in to change notification settings - Fork 7
/
MaskButton.xaml
231 lines (198 loc) · 18.6 KB
/
MaskButton.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<UserControl
x:Class="修图.Control.MaskButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:修图.Control"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Button x:Name="button" x:Uid="/Main/Mask" Foreground="{Binding SignForeground,Mode=OneWay}" Background="{Binding ButtonColor,Mode=OneWay}" BorderBrush="{Binding LineColor,Mode=OneWay}" Style="{StaticResource Button}">
<Button.Flyout>
<Flyout x:Name="flyout" Placement="Bottom" Opened="flyout_Opened" FlyoutPresenterStyle="{StaticResource FlyoutPresenterBottom }">
<Grid Width="300" Padding="4" CacheMode="BitmapCache"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!--左-->
<StackPanel Grid.Column="0">
<!--Cut:剪切-->
<Button x:Name="EditCutButton" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditCutButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<FontIcon Glyph="✂" FontSize="32" FontFamily="Segoe UI Symbol" />
<TextBlock x:Uid="/Mask/Cut" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Copy:复制-->
<Button x:Name="EditCopyButton" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditCopyButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Border Canvas.Left="6" Canvas.Top="8" Width="24" Height="24" CornerRadius="1" BorderThickness="2,0,0,2" BorderBrush="{Binding Foreground,Mode=OneWay}" />
<Rectangle Canvas.Left="10" Canvas.Top="4" Width="24" Height="24" RadiusX="1" RadiusY="1" Fill="{StaticResource Blue}" />
</Canvas>
<TextBlock x:Uid="/Mask/Copy" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Paste:粘贴-->
<Button x:Name="EditPasteButton" IsEnabled="{Binding isClipboard,Mode=OneWay}" Height="44" Style="{StaticResource RectangleButton}" Tapped="EditPasteButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40">
<Rectangle Canvas.Left="10" Canvas.Top="8" Width="24" Height="24" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Rectangle Canvas.Left="6" Canvas.Top="4" Width="24" Height="24" RadiusX="1" RadiusY="1" Fill="{StaticResource Blue}" />
</Canvas>
<TextBlock x:Uid="/Mask/Paste" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Clear:清除-->
<Button x:Name="EditClearButton" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditClearButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Viewbox Canvas.Left="4" Width="38" Height="38" >
<Path Fill="{StaticResource RedGradientBrush}" Data="M571.666,490.032l60.64,-7.345c0,0 44.433,64.388 56.733,79.581c4.327,5.343 11.614,9.295 17.071,11.575c-23.238,12.906 -121.96,46.901 -164.423,49.458c-11.554,-21.23 -31.423,-81.115 -31.423,-81.115c0,0 7.258,56.759 12.57,82.285c-82.626,23.944 -283.977,5.807 -356.615,-18.416c6.902,-21.785 26.015,-79.215 26.015,-79.215l-42.823,72.054c0,0 -30.32,-7.26 -49.692,-17.393c13.885,-1.011 74.373,-98.935 74.373,-98.935l67.972,11.729l14.704,-10.404c0,0 -59.944,-17.211 -77.192,-26.175c-5.164,-2.683 -6.643,-14.639 -1.516,-17.392c29.801,-27.667 123.045,-70.963 186.832,-80.808c7.519,-3.625 15.849,-7.128 16.817,-13.657c1.794,-12.104 -0.247,-22.314 -0.247,-22.314l-18.198,-173.771c0,0 -5.438,-15.189 14.767,-22.094c16.858,0.116 38.479,-2.92 49.34,-0.259c13.25,2.696 15.627,16.901 15.827,21.088c-0.456,34.709 -16.538,152.881 -18.561,187.168c-0.386,6.534 0.612,15.543 6.423,18.555c34.314,17.781 126.623,25.002 198.527,89.631c5.812,7.453 -1.174,12.822 -6.077,15.256c-15.544,7.72 -60.979,24.976 -60.979,24.976"/>
</Viewbox>
</Canvas>
<TextBlock x:Uid="/Mask/Clear" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<Border Margin="12,0" Height="1" HorizontalAlignment="Stretch" Background="{Binding LineColor,Mode=OneWay}" />
<!--Extract:提取-->
<Button x:Name="EditExtractButton" IsEnabled="{Binding isAnimated,Mode=OneWay}" Height="44" Style="{StaticResource RectangleButton}" Tapped="EditExtractButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Rectangle Canvas.Left="4" Canvas.Top="2" Width="32" Height="32" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeDashOffset="2" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Rectangle Canvas.Left="12" Canvas.Top="10" Width="16" Height="16" RadiusX="1" RadiusY="1" Fill="{StaticResource Blue}" />
</Canvas>
<TextBlock x:Uid="/Mask/Extract" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Merge:复制合并-->
<Button x:Name="EditMergeButton" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditMergeButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Border Canvas.Left="10" Canvas.Top="8" Width="24" Height="24" CornerRadius="1" BorderThickness="0,0,2,2" BorderBrush="{Binding Foreground,Mode=OneWay}" />
<Rectangle Canvas.Left="6" Canvas.Top="4" Width="24" Height="24" RadiusX="1" RadiusY="1" Fill="{StaticResource Blue}" />
</Canvas>
<TextBlock x:Uid="/Mask/Merge" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
</StackPanel>
<Border Grid.Column="1" Margin="0,4" Width="1" VerticalAlignment="Stretch" Background="{Binding LineColor,Mode=OneWay}" />
<!--右-->
<StackPanel Grid.Column="2">
<!--All:全选-->
<Button x:Name="EditAllButton" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditAllButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Rectangle Width="32" Height="32" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeDashOffset="2" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<TextBlock x:Uid="/Mask/All" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Deselect:取消选择-->
<Button x:Name="EditDeselectButton" IsEnabled="{Binding isAnimated,Mode=OneWay}" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditDeselectButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Rectangle Canvas.Left="4" Canvas.Top="4" Width="32" Height="32" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeDashOffset="2" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Line X1="5" Y1="4" X2="38" Y2="36" StrokeThickness="1" Stroke="{StaticResource Red}" />
<TextBlock x:Uid="/Mask/Deselect" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Pixel:像素选择-->
<Button x:Name="EditPixelButton" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditPixelButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Rectangle Canvas.Left="4" Canvas.Top="4" Width="32" Height="32" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeDashOffset="2" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Rectangle Canvas.Left="10" Canvas.Top="10" Width="20" Height="20" RadiusX="1" RadiusY="1" Fill="{StaticResource Yellow}" />
<TextBlock x:Uid="/Mask/Pixel" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Invert:反选-->
<Button x:Name="EditInvertButton" IsEnabled="{Binding isAnimated,Mode=OneWay}" Height="42" Style="{StaticResource RectangleButton}" Tapped="EditInvertButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Rectangle Canvas.Left="5" Canvas.Top="3" Width="18" Height="30" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeThickness="2,2,0,2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Border Canvas.Left="20" Canvas.Top="3" Width="16" Height="30" CornerRadius="0,3,3,0" Background="{StaticResource Yellow}" />
</Canvas>
<TextBlock x:Uid="/Mask/Invert" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<Border Margin="12,0" Height="1" HorizontalAlignment="Stretch" Background="{Binding LineColor,Mode=OneWay}" />
<!--Feather:羽化-->
<Button x:Name="EditFeatherButton" IsEnabled="{Binding isAnimated,Mode=OneWay}" Height="44" Style="{StaticResource RectangleButton}" Tapped="EditFeatherButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Rectangle Canvas.Left="4" Canvas.Top="2" Width="32" Height="32" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeDashOffset="2" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Viewbox Canvas.Left="-4" Canvas.Top="-6" Width="40" Height="40" >
<Path Data="M1248.74,211.139C1150.77,336.708 1022.91,416.704 1022.91,416.704C1022.91,416.704 1014.04,483.932 1008.65,496.997C1006.35,502.592 994.172,490.212 990.601,495.097C987.011,500.007 992.026,520.753 987.117,526.454C982.207,532.156 965.039,537.095 961.144,529.305C956.234,519.486 957.66,467.541 957.66,467.541L687.163,661.227C687.163,661.227 657.258,846.072 647.096,883.104C645.252,889.825 627.691,890.226 626.191,883.421C620.982,859.794 615.84,741.344 615.84,741.344C615.84,741.344 595.854,872.041 587.232,898.308C584.827,905.633 565.994,906.417 564.11,898.941C559.306,879.884 560.188,862.466 558.409,783.964C523.62,822.105 416.982,1002.43 443.273,1096.9C548.454,1019.99 995.895,658.282 1163.36,362.846C1185.93,354.867 1188.42,372.967 1184.4,381.405C1051.99,658.739 488.717,1172.2 281.007,1326.07C294.691,1328.9 317.171,1327.69 317.171,1327.69L489.478,1177.03C489.478,1177.03 563.993,1185.17 599.019,1174.83C674.527,1168 804.744,1083.95 804.744,1083.95C804.744,1083.95 688.318,1081.69 665.882,1076.02C656.676,1073.69 656.006,1052.8 668.313,1052.11C699.019,1050.38 843.226,1030.55 843.226,1030.55C843.226,1030.55 786.793,1030.19 779.561,1025.48C768.149,1021.32 771.345,1004.21 780.948,1000.32C808.034,999.858 914.652,988.538 915.918,987.196C1150.18,717.009 1228.13,437.748 1248.74,211.139Z" Fill="{Binding SignForeground,Mode=OneWay}"/>
</Viewbox>
</Canvas>
<TextBlock x:Uid="/Mask/Feather" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
<!--Transform:变换选区-->
<Button x:Name="EditTransformButton" IsEnabled="{Binding isAnimated,Mode=OneWay}" Height="44" Style="{StaticResource RectangleButton}" Tapped="EditTransformButton_Tapped">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Width="40" Height="40" >
<Rectangle Canvas.Left="4" Canvas.Top="2" Width="32" Height="32" RadiusX="1" RadiusY="1" StrokeDashArray="4 1" StrokeDashOffset="2" StrokeThickness="2" Stroke="{Binding Foreground,Mode=OneWay}" />
<Viewbox Canvas.Left="2" Canvas.Top="0" Width="32" Height="32" >
<Path Data="M358.796,186.791c0,0 -26.718,0.372 -55.614,-0.422c-15.487,-0.425 -15.748,-12.543 -11.014,-20.191c23.045,-22.839 56.691,-62.318 83.201,-86.194c6.287,-5.025 17.761,-4.505 24.142,0.399c20.724,20.777 49.224,54.699 72.188,79.809c14.941,16.338 11.267,27.954 -14.087,27.853c-35.183,1.053 -43.062,0.454 -43.062,0.454l-0.598,165.164l179.347,-0.834c0,0 -0.241,-35.881 -0.399,-49.531c-0.259,-22.305 7.282,-28.001 21.548,-16.56c16.373,13.13 69.967,65.586 85.795,82.402c11.155,11.852 5.141,20.777 -1.197,27.335c-17.06,17.651 -62.828,62.878 -77.216,77.614c-17.111,17.525 -25.475,15.421 -25.938,-9.577c-0.189,-10.23 -1.596,-53.397 -1.596,-53.397l-180.145,-1.56l-0.572,177.295c0,0 44.704,0.133 55.193,0.424c16.386,0.455 21.523,9.547 11.772,22.546c-13.117,17.487 -65.543,72.759 -83.6,87.191c-6.444,5.151 -18.464,4.754 -24.741,-0.598c-16.926,-14.432 -63.697,-69.154 -76.816,-85.994c-13.641,-17.512 -6.564,-23.89 9.777,-23.145c9.945,0.454 52.462,-0.935 52.462,-0.935l0.771,-176.298l-176.318,1.135c0,0 0.4,36.884 -0.04,47.052c-1.083,25.086 -6.455,29.977 -21.708,18.117c-16.774,-13.044 -72.027,-66.719 -86.393,-83.201c-3.437,-3.944 -3.228,-11.742 0.2,-15.694c13.484,-15.546 65.349,-61.69 80.707,-77.583c13.346,-13.812 28.387,-17.911 28.831,9.677c0.273,17.052 0.399,43.945 0.399,43.945l173.524,0.461l1.197,-167.159" Fill="{Binding SignForeground,Mode=OneWay}"/>
</Viewbox>
</Canvas>
<TextBlock x:Uid="/Mask/Transform" Grid.Column="1" Style="{StaticResource TipTextBlock}"/>
</Grid>
</Button>
</StackPanel>
</Grid>
</Flyout>
</Button.Flyout>
<Rectangle Width="22" Height="22" StrokeThickness="1.2" Stroke="{Binding SignForeground,Mode=OneWay}" StrokeDashArray="4 2" />
</Button>
</UserControl>