diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml index 240b2fc..310d2a5 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:QuickLook.Plugin.ImageViewer" xmlns:animatedImage="clr-namespace:QuickLook.Plugin.ImageViewer.AnimatedImage" mc:Ignorable="d" + Background="White" x:Name="imagePanel" d:DesignHeight="300" d:DesignWidth="300"> @@ -13,7 +14,7 @@ VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True"> + AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" Margin="0,28,0,0" /> \ No newline at end of file diff --git a/QuickLook/Controls/BackgroundVisualHost.cs b/QuickLook/Controls/BusyDecorator/BackgroundVisualHost.cs similarity index 99% rename from QuickLook/Controls/BackgroundVisualHost.cs rename to QuickLook/Controls/BusyDecorator/BackgroundVisualHost.cs index f077acf..712921c 100644 --- a/QuickLook/Controls/BackgroundVisualHost.cs +++ b/QuickLook/Controls/BusyDecorator/BackgroundVisualHost.cs @@ -22,7 +22,7 @@ using System.Windows; using System.Windows.Media; using System.Windows.Threading; -namespace QuickLook.Controls +namespace QuickLook.Controls.BusyDecorator { public delegate Visual CreateContentFunction(); diff --git a/QuickLook/Controls/BusyDecorator.cs b/QuickLook/Controls/BusyDecorator/BusyDecorator.cs similarity index 99% rename from QuickLook/Controls/BusyDecorator.cs rename to QuickLook/Controls/BusyDecorator/BusyDecorator.cs index 675ec97..1398e4a 100644 --- a/QuickLook/Controls/BusyDecorator.cs +++ b/QuickLook/Controls/BusyDecorator/BusyDecorator.cs @@ -22,7 +22,7 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; -namespace QuickLook.Controls +namespace QuickLook.Controls.BusyDecorator { [StyleTypedProperty(Property = "BusyStyle", StyleTargetType = typeof(Control))] public class BusyDecorator : Decorator, IDisposable diff --git a/QuickLook/Controls/VisualTargetPresentationSource.cs b/QuickLook/Controls/BusyDecorator/VisualTargetPresentationSource.cs similarity index 98% rename from QuickLook/Controls/VisualTargetPresentationSource.cs rename to QuickLook/Controls/BusyDecorator/VisualTargetPresentationSource.cs index 82b67d2..04512e6 100644 --- a/QuickLook/Controls/VisualTargetPresentationSource.cs +++ b/QuickLook/Controls/BusyDecorator/VisualTargetPresentationSource.cs @@ -18,7 +18,7 @@ using System.Windows; using System.Windows.Media; -namespace QuickLook.Controls +namespace QuickLook.Controls.BusyDecorator { public class VisualTargetPresentationSource : PresentationSource { diff --git a/QuickLook/Controls/GlassLayer/100-50-5-monochrome.png b/QuickLook/Controls/GlassLayer/100-50-5-monochrome.png new file mode 100644 index 0000000..69d69bc Binary files /dev/null and b/QuickLook/Controls/GlassLayer/100-50-5-monochrome.png differ diff --git a/QuickLook/Controls/GlassLayer/GaussianBlur.fx b/QuickLook/Controls/GlassLayer/GaussianBlur.fx new file mode 100644 index 0000000..f519425 --- /dev/null +++ b/QuickLook/Controls/GlassLayer/GaussianBlur.fx @@ -0,0 +1,48 @@ +sampler2D Texture1Sampler : register(S0); + +float2 Direction : register(C0); + +float4 DdxDdy : register(C1); + +// http://dev.theomader.com/gaussian-kernel-calculator/ +static const float HalfWidth = 80; +static const float poisson[161] = +{ + 0.004411,0.004466,0.004521,0.004576,0.004631,0.004686,0.004741,0.004796,0.004851,0.004905, + 0.004959,0.005014,0.005067,0.005121,0.005175,0.005228,0.005281,0.005334,0.005386,0.005438, + 0.00549,0.005541,0.005592,0.005642,0.005692,0.005742,0.005791,0.005839,0.005888,0.005935, + 0.005982,0.006029,0.006074,0.00612,0.006164,0.006208,0.006252,0.006294,0.006336,0.006377, + 0.006418,0.006458,0.006497,0.006535,0.006572,0.006609,0.006644,0.006679,0.006713,0.006746, + 0.006779,0.00681,0.00684,0.00687,0.006898,0.006926,0.006952,0.006978,0.007003,0.007026, + 0.007049,0.00707,0.007091,0.00711,0.007128,0.007146,0.007162,0.007177,0.007191,0.007204, + 0.007216,0.007227,0.007236,0.007245,0.007252,0.007258,0.007263,0.007267,0.00727,0.007272, + 0.007272, + 0.007272,0.00727,0.007267,0.007263,0.007258,0.007252,0.007245,0.007236,0.007227,0.007216, + 0.007204,0.007191,0.007177,0.007162,0.007146,0.007128,0.00711,0.007091,0.00707,0.007049, + 0.007026,0.007003,0.006978,0.006952,0.006926,0.006898,0.00687,0.00684,0.00681,0.006779, + 0.006746,0.006713,0.006679,0.006644,0.006609,0.006572,0.006535,0.006497,0.006458,0.006418, + 0.006377,0.006336,0.006294,0.006252,0.006208,0.006164,0.00612,0.006074,0.006029,0.005982, + 0.005935,0.005888,0.005839,0.005791,0.005742,0.005692,0.005642,0.005592,0.005541,0.00549, + 0.005438,0.005386,0.005334,0.005281,0.005228,0.005175,0.005121,0.005067,0.005014,0.004959, + 0.004905,0.004851,0.004796,0.004741,0.004686,0.004631,0.004576,0.004521,0.004466,0.004411 +}; + +float4 main(float2 uv : TEXCOORD) : COLOR +{ + float4 color = { 0, 0, 0, 1 }; + +for (int delta = -HalfWidth; delta <= HalfWidth; delta++) +{ + float2 coord; + coord.x = uv.x + delta * DdxDdy.x * Direction.x; + coord.y = uv.y + delta * DdxDdy.w * Direction.y; + coord = saturate(coord); + + // Sample pixel + color += tex2D(Texture1Sampler, coord) * poisson[delta + HalfWidth]; +} + +return(color); +} + + diff --git a/QuickLook/Controls/GlassLayer/GaussianBlur.ps b/QuickLook/Controls/GlassLayer/GaussianBlur.ps new file mode 100644 index 0000000..49c5022 Binary files /dev/null and b/QuickLook/Controls/GlassLayer/GaussianBlur.ps differ diff --git a/QuickLook/Controls/GlassLayer/GaussianBlurEffect.cs b/QuickLook/Controls/GlassLayer/GaussianBlurEffect.cs new file mode 100644 index 0000000..c8e8aeb --- /dev/null +++ b/QuickLook/Controls/GlassLayer/GaussianBlurEffect.cs @@ -0,0 +1,59 @@ +// Copyright © 2017 Paddy Xu +// +// This file is part of QuickLook program. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using System; +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Effects; + +namespace QuickLook.Controls.GlassLayer +{ + public class GaussianBlurEffect : ShaderEffect + { + public static readonly DependencyProperty InputProperty = + RegisterPixelShaderSamplerProperty("Input", typeof(GaussianBlurEffect), 0); + public static readonly DependencyProperty DirectionProperty = + DependencyProperty.Register("Direction", typeof(Point), typeof(GaussianBlurEffect), + new UIPropertyMetadata(new Point(0, 1), PixelShaderConstantCallback(0))); + + public GaussianBlurEffect() + { + var pixelShader = new PixelShader + { + UriSource = new Uri("pack://application:,,,/QuickLook;component/Controls/GlassLayer/GaussianBlur.ps", + UriKind.Absolute) + }; + PixelShader = pixelShader; + + DdxUvDdyUvRegisterIndex = 1; + UpdateShaderValue(InputProperty); + UpdateShaderValue(DirectionProperty); + } + + public Brush Input + { + get => (Brush) GetValue(InputProperty); + set => SetValue(InputProperty, value); + } + + public Point Direction + { + get => (Point) GetValue(DirectionProperty); + set => SetValue(DirectionProperty, value); + } + } +} \ No newline at end of file diff --git a/QuickLook/Controls/GlassLayer/GlassLayer.xaml b/QuickLook/Controls/GlassLayer/GlassLayer.xaml new file mode 100644 index 0000000..b87d5ca --- /dev/null +++ b/QuickLook/Controls/GlassLayer/GlassLayer.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook/Controls/GlassLayer/GlassLayer.xaml.cs b/QuickLook/Controls/GlassLayer/GlassLayer.xaml.cs new file mode 100644 index 0000000..4e28cbe --- /dev/null +++ b/QuickLook/Controls/GlassLayer/GlassLayer.xaml.cs @@ -0,0 +1,93 @@ +// Copyright © 2017 Paddy Xu +// +// This file is part of QuickLook program. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace QuickLook.Controls.GlassLayer +{ + /// + /// Interaction logic for GlassLayer.xaml + /// + public partial class GlassLayer : UserControl + { + public GlassLayer() + { + InitializeComponent(); + } + + #region public Visual BlurredElement + + /// + /// Identifies the BlurredElement dependency property. + /// + public static DependencyProperty BlurredElementProperty = + DependencyProperty.Register("BlurredElement", typeof(Visual), typeof(GlassLayer), null); + + /// + /// + public Visual BlurredElement + { + get => (Visual) GetValue(BlurredElementProperty); + + set => SetValue(BlurredElementProperty, value); + } + + #endregion public Visual BlurredElement + + #region public double GlassOpacity + + /// + /// Identifies the GlassOpacity dependency property. + /// + public static DependencyProperty GlassOpacityProperty = + DependencyProperty.Register("GlassOpacity", typeof(double), typeof(GlassLayer), + new UIPropertyMetadata(0.6)); + + /// + /// + public double GlassOpacity + { + get => (double) GetValue(GlassOpacityProperty); + + set => SetValue(GlassOpacityProperty, value); + } + + #endregion public double GlassOpacity + + #region public Visibility NoiseVisibility + + /// + /// Identifies the NoiseVisibility dependency property. + /// + public static DependencyProperty NoiseVisibilityProperty = + DependencyProperty.Register("NoiseVisibility", typeof(Visibility), typeof(GlassLayer), + new UIPropertyMetadata(Visibility.Visible)); + + /// + /// + public Visibility NoiseVisibility + { + get => (Visibility) GetValue(NoiseVisibilityProperty); + + set => SetValue(NoiseVisibilityProperty, value); + } + + #endregion public Visibility NoiseVisibility + } +} \ No newline at end of file diff --git a/QuickLook/MainWindowTransparent.xaml b/QuickLook/MainWindowTransparent.xaml index 557c1ec..d06ff8b 100644 --- a/QuickLook/MainWindowTransparent.xaml +++ b/QuickLook/MainWindowTransparent.xaml @@ -3,17 +3,20 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:local="clr-namespace:QuickLook" - xmlns:control="clr-namespace:QuickLook.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:converters="clr-namespace:QuickLook.Converters" + xmlns:controls="clr-namespace:QuickLook.Controls" + xmlns:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator" + xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer" mc:Ignorable="d" x:Class="QuickLook.MainWindowTransparent" x:Name="mainWindow" UseLayoutRounding="True" d:DesignWidth="624" d:DesignHeight="700" MinWidth="275" MinHeight="150" WindowStartupLocation="CenterScreen" Focusable="False" WindowStyle="None" - Background="#E5FAFAFA" AllowsTransparency="True" + AllowsTransparency="True" + Background="Transparent" ShowActivated="False" ShowInTaskbar="False"> @@ -21,213 +24,218 @@ - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + diff --git a/QuickLook/MainWindowTransparent.xaml.cs b/QuickLook/MainWindowTransparent.xaml.cs index 37779d1..6b3cef1 100644 --- a/QuickLook/MainWindowTransparent.xaml.cs +++ b/QuickLook/MainWindowTransparent.xaml.cs @@ -50,8 +50,8 @@ namespace QuickLook SourceInitialized += (sender, e) => { - if (AllowsTransparency) - BlurWindow.EnableWindowBlur(this); + //if (AllowsTransparency) + // BlurWindow.EnableWindowBlur(this); }; buttonPin.MouseLeftButtonUp += (sender, e) => @@ -234,10 +234,8 @@ namespace QuickLook // revert UI changes ContextObject.IsBusy = true; - var newHeight = ContextObject.PreferredSize.Height + titlebar.Height + windowBorder.BorderThickness.Top + - windowBorder.BorderThickness.Bottom; - var newWidth = ContextObject.PreferredSize.Width + windowBorder.BorderThickness.Left + - windowBorder.BorderThickness.Right; + var newHeight = ContextObject.PreferredSize.Height + titlebar.Height; + var newWidth = ContextObject.PreferredSize.Width; ResizeAndCenter(new Size(newWidth, newHeight)); diff --git a/QuickLook/Plugin/InfoPanel/InfoPanel.xaml b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml index 8a21ac4..37fe420 100644 --- a/QuickLook/Plugin/InfoPanel/InfoPanel.xaml +++ b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml @@ -5,13 +5,18 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel" FontSize="14" - mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True"> + Background="#FFF8F8FB" + mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True" TextOptions.TextHintingMode="Animated"> + + + + - + - + @@ -43,13 +48,19 @@ - + LineHeight="25" MaxHeight="60" TextTrimming="CharacterEllipsis" FontWeight="Normal"> FilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilename.ext - Last modified at 01/01/2017 00:00:00 - Calculating size... + + Last modified at 01/01/2017 00:00:00 + + + Calculating size... + \ No newline at end of file diff --git a/QuickLook/QuickLook.csproj b/QuickLook/QuickLook.csproj index bb62c09..073ea42 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -111,15 +111,19 @@ Properties\GitVersion.cs + + + GlassLayer.xaml + - - - + + + @@ -163,6 +167,10 @@ Component + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -218,6 +226,7 @@ Always + @@ -269,6 +278,10 @@ Designer + + + + powershell -file "$(SolutionDir)Scripts\update-version.ps1" diff --git a/QuickLook/Styles/BusyDecorator.xaml b/QuickLook/Styles/BusyDecorator.xaml index 9911782..ec08b35 100644 --- a/QuickLook/Styles/BusyDecorator.xaml +++ b/QuickLook/Styles/BusyDecorator.xaml @@ -3,9 +3,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:local="clr-namespace:QuickLook" - xmlns:controls="clr-namespace:QuickLook.Controls"> + xmlns:controls="clr-namespace:QuickLook.Controls" + xmlns:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator"> -