This commit is contained in:
Paddy Xu
2017-08-06 17:27:30 +03:00
parent 3a20245304
commit 5b97e7ef60
17 changed files with 243 additions and 23 deletions

View File

@@ -21,6 +21,7 @@ using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using LibAPNG;
using QuickLook.Helpers;
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
{
@@ -99,7 +100,7 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
var bitmap = new RenderTargetBitmap(
header.Width, header.Height,
96, 96,
DpiHelper.DefaultDpi, DpiHelper.DefaultDpi,
PixelFormats.Pbgra32);
bitmap.Render(visual);
return bitmap;

View File

@@ -9,6 +9,12 @@
x:Name="imagePanel"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Rectangle>
<Rectangle.Fill>
<ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background.png" AlignmentY="Top" Viewport="0,0,32,32"
ViewportUnits="Absolute" Stretch="UniformToFill" TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
<ScrollViewer x:Name="viewPanel" BorderThickness="0" HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True">
<animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None"

View File

@@ -28,6 +28,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using QuickLook.Annotations;
using QuickLook.Helpers;
namespace QuickLook.Plugin.ImageViewer
{
@@ -51,6 +52,11 @@ namespace QuickLook.Plugin.ImageViewer
{
InitializeComponent();
var scale = DpiHelper.GetCurrentScaleFactor();
backgroundBrush.Viewport = new Rect(new Size(
backgroundBrush.ImageSource.Width / scale.Horizontal,
backgroundBrush.ImageSource.Height / scale.Vertical));
SizeChanged += ImagePanel_SizeChanged;
viewPanel.PreviewMouseWheel += ViewPanel_PreviewMouseWheel;

View File

@@ -112,6 +112,7 @@
<Content Include="dcraw.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\background.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB