-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from emoacht/develop
Develop
- Loading branch information
Showing
83 changed files
with
4,692 additions
and
4,804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows; | ||
|
||
namespace IconImage | ||
namespace IconImage; | ||
|
||
public partial class App : Application | ||
{ | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<UserControl x:Class="IconImage.DarkAppIcon" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:sys="clr-namespace:System;assembly=mscorlib" | ||
xmlns:local="clr-namespace:IconImage" | ||
mc:Ignorable="d" | ||
d:DesignHeight="256" d:DesignWidth="256" | ||
Width="256" Height="256"> | ||
<UserControl.Resources> | ||
<Color x:Key="EdgeColor">#FF343434</Color> | ||
<Color x:Key="BackColor">#FF262626</Color> | ||
|
||
<SolidColorBrush x:Key="FanBrush" Color="White"/> | ||
<SolidColorBrush x:Key="EdgeBrush" Color="{StaticResource BackColor}"/> | ||
<SolidColorBrush x:Key="BackBrush" Color="{StaticResource BackColor}"/> | ||
|
||
<sys:Double x:Key="OutlineStrokeThickness">20</sys:Double> | ||
|
||
<PathGeometry x:Key="ArcPath"> | ||
<PathFigure IsClosed="True" StartPoint="0,100"> | ||
<ArcSegment Point="100,0" | ||
Size="100,100" | ||
IsLargeArc="False" SweepDirection="Clockwise"/> | ||
<LineSegment Point="100,23"/> | ||
<ArcSegment Point="23, 100" | ||
Size="77,77" | ||
IsLargeArc="False" SweepDirection="Counterclockwise"/> | ||
</PathFigure> | ||
</PathGeometry> | ||
|
||
<PathGeometry x:Key="FanPath"> | ||
<PathFigure IsClosed="True" StartPoint="0,100"> | ||
<ArcSegment Point="100,0" | ||
Size="100,100" | ||
IsLargeArc="False" SweepDirection="Clockwise"/> | ||
<LineSegment Point="100,100"/> | ||
</PathFigure> | ||
</PathGeometry> | ||
|
||
<Style x:Key="PathStyleBack" TargetType="{x:Type Path}"> | ||
<Setter Property="Fill" Value="{StaticResource FanBrush}"/> | ||
<Setter Property="Stroke" Value="{StaticResource EdgeBrush}"/> | ||
<Setter Property="StrokeThickness" Value="{DynamicResource OutlineStrokeThickness}"/> | ||
<Setter Property="Stretch" Value="Uniform"/> | ||
<!--<Setter Property="Visibility" Value="Hidden"/>--> | ||
</Style> | ||
<Style x:Key="PathStyleFront" TargetType="{x:Type Path}" BasedOn="{StaticResource PathStyleBack}"> | ||
<Setter Property="StrokeThickness" Value="0"/> | ||
<Setter Property="Visibility" Value="Visible"/> | ||
</Style> | ||
|
||
<Style x:Key="CanvasStyle" TargetType="{x:Type Canvas}"> | ||
<Setter Property="Background" Value="{x:Null}"/> | ||
<!--<Setter Property="Background" Value="{StaticResource BackBrush}"/>--> | ||
</Style> | ||
</UserControl.Resources> | ||
|
||
<Grid> | ||
<Rectangle x:Name="RoundedMask" | ||
Width="256" Height="256" | ||
RadiusX="28" RadiusY="28" | ||
Fill="{StaticResource BackBrush}"/> | ||
|
||
<Canvas Style="{StaticResource CanvasStyle}"> | ||
<Canvas.OpacityMask> | ||
<VisualBrush Visual="{Binding ElementName=RoundedMask}"/> | ||
</Canvas.OpacityMask> | ||
|
||
<!-- Right --> | ||
<Path Style="{StaticResource PathStyleBack}" | ||
Data="{StaticResource ArcPath}" | ||
Canvas.Left="130" Canvas.Top="98" Height="120" Width="120"/> | ||
<Path Style="{StaticResource PathStyleFront}" | ||
Data="{StaticResource ArcPath}" | ||
Canvas.Left="140" Canvas.Top="108" Height="100" Width="100"/> | ||
|
||
<Path Style="{StaticResource PathStyleBack}" | ||
Data="{StaticResource FanPath}" | ||
Canvas.Left="184" Canvas.Top="152" Height="66" Width="66"/> | ||
<Path Style="{StaticResource PathStyleFront}" | ||
Data="{StaticResource FanPath}" | ||
Canvas.Left="194" Canvas.Top="162" Height="46" Width="46"/> | ||
|
||
<!-- Left Top --> | ||
<Path Style="{StaticResource PathStyleBack}" | ||
Data="{StaticResource ArcPath}" | ||
Canvas.Left="40" Canvas.Top="6" Width="116" Height="116"/> | ||
<Path Style="{StaticResource PathStyleFront}" | ||
Data="{StaticResource ArcPath}" | ||
Canvas.Left="50" Canvas.Top="16" Width="96" Height="96"/> | ||
|
||
<Path Style="{StaticResource PathStyleBack}" | ||
Data="{StaticResource FanPath}" | ||
Canvas.Left="90" Canvas.Top="58" Height="64" Width="64"/> | ||
<Path Style="{StaticResource PathStyleFront}" | ||
Data="{StaticResource FanPath}" | ||
Canvas.Left="100" Canvas.Top="68" Height="44" Width="44"/> | ||
|
||
<!-- Left Bottom --> | ||
<Path Style="{StaticResource PathStyleBack}" | ||
Data="{StaticResource ArcPath}" | ||
Canvas.Left="6" Canvas.Top="134" Width="116" Height="116"/> | ||
<Path Style="{StaticResource PathStyleFront}" | ||
Data="{StaticResource ArcPath}" | ||
Canvas.Left="16" Canvas.Top="144" Width="96" Height="96"/> | ||
|
||
<Path Style="{StaticResource PathStyleBack}" | ||
Data="{StaticResource FanPath}" | ||
Canvas.Left="58" Canvas.Top="186" Height="64" Width="64"/> | ||
<Path Style="{StaticResource PathStyleFront}" | ||
Data="{StaticResource FanPath}" | ||
Canvas.Left="68" Canvas.Top="196" Height="44" Width="44"/> | ||
</Canvas> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace IconImage; | ||
|
||
public partial class DarkAppIcon : UserControl | ||
{ | ||
public DarkAppIcon() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
|
||
namespace IconImage | ||
namespace IconImage; | ||
|
||
public class FrameworkElementImage | ||
{ | ||
public class FrameworkElementImage | ||
/// <summary> | ||
/// Saves the image of a specified FrameworkElement to file in PNG format. | ||
/// </summary> | ||
/// <param name="source">FrameworkElement</param> | ||
/// <param name="filePath">File path</param> | ||
/// <param name="width">Width of saved image (optional)</param> | ||
/// <param name="height">Height of saved image (optional)</param> | ||
public static void SaveImage(FrameworkElement source, string filePath, double width = 0D, double height = 0D) | ||
{ | ||
/// <summary> | ||
/// Saves the image of a specified FrameworkElement to file in PNG format. | ||
/// </summary> | ||
/// <param name="source">FrameworkElement</param> | ||
/// <param name="filePath">File path</param> | ||
/// <param name="width">Width of saved image (optional)</param> | ||
/// <param name="height">Height of saved image (optional)</param> | ||
public static void SaveImage(FrameworkElement source, string filePath, double width = 0D, double height = 0D) | ||
{ | ||
if (source is null) | ||
throw new ArgumentNullException(nameof(source)); | ||
if (string.IsNullOrWhiteSpace(filePath)) | ||
throw new ArgumentNullException(nameof(filePath)); | ||
|
||
var rtb = new RenderTargetBitmap( | ||
(int)source.Width, | ||
(int)source.Height, | ||
96D, 96D, | ||
PixelFormats.Pbgra32); | ||
if (source is null) | ||
throw new ArgumentNullException(nameof(source)); | ||
if (string.IsNullOrWhiteSpace(filePath)) | ||
throw new ArgumentNullException(nameof(filePath)); | ||
|
||
rtb.Render(source); | ||
var rtb = new RenderTargetBitmap( | ||
(int)source.Width, | ||
(int)source.Height, | ||
96D, 96D, | ||
PixelFormats.Pbgra32); | ||
|
||
var encoder = new PngBitmapEncoder(); | ||
encoder.Frames.Add(BitmapFrame.Create(rtb)); | ||
rtb.Render(source); | ||
|
||
if ((0 < width) || (0 < height)) | ||
{ | ||
var bi = new BitmapImage(); | ||
var encoder = new PngBitmapEncoder(); | ||
encoder.Frames.Add(BitmapFrame.Create(rtb)); | ||
|
||
using (var ms = new MemoryStream()) | ||
{ | ||
encoder.Save(ms); | ||
ms.Seek(0, SeekOrigin.Begin); | ||
if ((0 < width) || (0 < height)) | ||
{ | ||
var bi = new BitmapImage(); | ||
|
||
bi.BeginInit(); | ||
bi.CacheOption = BitmapCacheOption.OnLoad; | ||
bi.StreamSource = ms; | ||
using (var ms = new MemoryStream()) | ||
{ | ||
encoder.Save(ms); | ||
ms.Seek(0, SeekOrigin.Begin); | ||
|
||
if (0 < width) | ||
bi.DecodePixelWidth = (int)width; | ||
if (0 < height) | ||
bi.DecodePixelHeight = (int)height; | ||
bi.BeginInit(); | ||
bi.CacheOption = BitmapCacheOption.OnLoad; | ||
bi.StreamSource = ms; | ||
|
||
bi.EndInit(); | ||
} | ||
if (0 < width) | ||
bi.DecodePixelWidth = (int)width; | ||
if (0 < height) | ||
bi.DecodePixelHeight = (int)height; | ||
|
||
encoder = new PngBitmapEncoder(); // Save method cannot be used twice. | ||
encoder.Frames.Add(BitmapFrame.Create(bi)); | ||
bi.EndInit(); | ||
} | ||
|
||
using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) | ||
{ | ||
encoder.Save(fs); | ||
} | ||
encoder = new PngBitmapEncoder(); // Save method cannot be used twice. | ||
encoder.Frames.Add(BitmapFrame.Create(bi)); | ||
} | ||
|
||
using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) | ||
{ | ||
encoder.Save(fs); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.