Skip to content

Commit df724d3

Browse files
committed
add fixed transparent palette color button
1 parent ac8beaa commit df724d3

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

PixelArtTool/MainWindow.xaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@
199199
<Button x:Name="btnScrollRight" Click="OnScrollButtonRightClicked" Content="&gt;" HorizontalAlignment="Left" Margin="415,262,0,0" VerticalAlignment="Top" Width="24"/>
200200
<Button x:Name="btnFlipX" Click="OnFlipXButtonDown" Content="FlipX" HorizontalAlignment="Left" Margin="365,316,0,0" VerticalAlignment="Top" Width="32"/>
201201
<Button x:Name="btnFlipY" Click="OnFlipYButtonDown" Content="FlipY" HorizontalAlignment="Left" Margin="402,316,0,0" VerticalAlignment="Top" Width="32"/>
202-
<Button x:Name="btnLoadPalette" Click="OnLoadPaletteButton" Content="Load Palette" HorizontalAlignment="Left" Margin="10,321,0,0" VerticalAlignment="Top" Width="71"/>
202+
<Button x:Name="btnLoadPalette" Click="OnLoadPaletteButton" Content="Load Palette" HorizontalAlignment="Left" Margin="10,324,0,0" VerticalAlignment="Top" Width="71"/>
203203
</Grid>
204204
<CheckBox x:Name="chkOutline" Content="Outline" HorizontalAlignment="Left" Margin="638,50,0,0" VerticalAlignment="Top" Width="64" Click="chkOutline_Click"/>
205-
<Rectangle x:Name="rectCurrentColor" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28" Margin="10,276,0,0" Stroke="Black" VerticalAlignment="Top" Width="28"/>
205+
<Rectangle x:Name="rectCurrentColor" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28" Margin="10,256,0,0" Stroke="Black" VerticalAlignment="Top" Width="28"/>
206206
<CheckBox x:Name="chkMirrorX" Content="Symmetry X" HorizontalAlignment="Left" Margin="638,71,0,0" VerticalAlignment="Top" Width="93"/>
207-
<Rectangle x:Name="rectSecondaryColor" Fill="Black" HorizontalAlignment="Left" Height="28" Margin="47,276,0,0" Stroke="Black" VerticalAlignment="Top" Width="28"/>
207+
<Rectangle x:Name="rectSecondaryColor" Fill="Black" HorizontalAlignment="Left" Height="28" Margin="47,256,0,0" Stroke="Black" VerticalAlignment="Top" Width="28"/>
208208

209209
<!-- https://stackoverflow.com/a/32514853/5452781 -->
210210
<Rectangle x:Name="tempRect" Width="200" Height="200" Margin="459,130,0,0" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" UseLayoutRounding="False" Fill="Black" />
@@ -221,6 +221,11 @@
221221
</Rectangle>
222222
<Line x:Name="lineCurrentHueLine" X1="91" Y1="312" X2="91" Y2="334" Stroke="Red" StrokeThickness="1" />
223223
</Grid>
224+
<Rectangle x:Name="rectGetTransparent" HorizontalAlignment="Left" Height="28" Margin="10,289,0,0" Stroke="Black" VerticalAlignment="Top" Width="28" MouseDown="OnGetTransparentColorButton">
225+
<Rectangle.Fill>
226+
<ImageBrush ImageSource="Resources/Images/transparentbg.png"/>
227+
</Rectangle.Fill>
228+
</Rectangle>
224229

225230
</Grid>
226231
</Window>

PixelArtTool/MainWindow.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,18 @@ private void OnLevelSaturationMouseDown(object sender, MouseButtonEventArgs e)
10091009
rectCurrentColor.Fill = new SolidColorBrush(Color.FromArgb(c2.Alpha, c2.Red, c2.Green, c2.Blue));
10101010
ResetCurrentBrightnessPreview(currentColor);
10111011
}
1012+
1013+
private void OnGetTransparentColorButton(object sender, MouseButtonEventArgs e)
1014+
{
1015+
var c = new PixelColor();
1016+
c.Red = 255;
1017+
c.Green = 255;
1018+
c.Blue = 255;
1019+
c.Alpha = 0;
1020+
currentColor = c;
1021+
rectCurrentColor.Fill = new SolidColorBrush(Color.FromArgb(c.Alpha, c.Red, c.Green, c.Blue));
1022+
ResetCurrentBrightnessPreview(currentColor);
1023+
}
10121024
} // class
10131025

10141026
} // namespace

PixelArtTool/PixelArtTool.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,8 @@
142142
<ItemGroup>
143143
<Resource Include="Resources\Buttons\paint.png" />
144144
</ItemGroup>
145+
<ItemGroup>
146+
<Resource Include="Resources\Images\transparentbg.png" />
147+
</ItemGroup>
145148
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
146149
</Project>
972 Bytes
Loading

0 commit comments

Comments
 (0)