mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
abstract plugin interface
This commit is contained in:
@@ -43,10 +43,11 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
BitmapSource previousStateRenderedFrame = null;
|
||||
foreach (var nextFrame in decoder.Frames)
|
||||
{
|
||||
var nextRenderedFrame = MakeNextFrame(header, nextFrame, currentFrame, currentRenderedFrame, previousStateRenderedFrame);
|
||||
var nextRenderedFrame = MakeNextFrame(header, nextFrame, currentFrame, currentRenderedFrame,
|
||||
previousStateRenderedFrame);
|
||||
|
||||
var delay = TimeSpan.FromSeconds(
|
||||
(double)nextFrame.fcTLChunk.DelayNum /
|
||||
(double) nextFrame.fcTLChunk.DelayNum /
|
||||
(nextFrame.fcTLChunk.DelayDen == 0 ? 100 : nextFrame.fcTLChunk.DelayDen));
|
||||
|
||||
animator.KeyFrames.Add(new DiscreteObjectKeyFrame(nextRenderedFrame, clock));
|
||||
@@ -79,40 +80,35 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
if (nextFrame.fcTLChunk.BlendOp == BlendOps.APNGBlendOpSource)
|
||||
{
|
||||
var freeRegion = new CombinedGeometry(GeometryCombineMode.Xor,
|
||||
new RectangleGeometry(fullRect),
|
||||
new RectangleGeometry(frameRect));
|
||||
context.PushOpacityMask(new DrawingBrush(new GeometryDrawing(Brushes.Transparent, null, freeRegion)));
|
||||
new RectangleGeometry(fullRect),
|
||||
new RectangleGeometry(frameRect));
|
||||
context.PushOpacityMask(
|
||||
new DrawingBrush(new GeometryDrawing(Brushes.Transparent, null, freeRegion)));
|
||||
}
|
||||
|
||||
if (currentFrame != null && currentRenderedFrame != null)
|
||||
{
|
||||
switch (currentFrame.fcTLChunk.DisposeOp)
|
||||
{
|
||||
case DisposeOps.APNGDisposeOpNone:
|
||||
// restore currentRenderedFrame
|
||||
if (currentRenderedFrame != null)
|
||||
{
|
||||
context.DrawImage(currentRenderedFrame, fullRect);
|
||||
}
|
||||
if (currentRenderedFrame != null) context.DrawImage(currentRenderedFrame, fullRect);
|
||||
break;
|
||||
case DisposeOps.APNGDisposeOpPrevious:
|
||||
// restore previousStateRenderedFrame
|
||||
if (previousStateRenderedFrame != null)
|
||||
{
|
||||
context.DrawImage(previousStateRenderedFrame, fullRect);
|
||||
}
|
||||
break;
|
||||
case DisposeOps.APNGDisposeOpBackground:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// unprotect region and draw the next frame
|
||||
if (nextFrame.fcTLChunk.BlendOp == BlendOps.APNGBlendOpSource)
|
||||
context.Pop();
|
||||
context.DrawImage(fs, frameRect);
|
||||
}
|
||||
|
||||
var bitmap = new RenderTargetBitmap(
|
||||
header.Width, header.Height,
|
||||
Math.Floor(fs.DpiX), Math.Floor(fs.DpiY),
|
||||
|
@@ -24,7 +24,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using QuickLook.Helpers;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Plugin.ImageViewer.Exiv2;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
|
@@ -83,6 +83,7 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
|
||||
context.DrawImage(rawFrame, frameInfo.Rect);
|
||||
}
|
||||
|
||||
var bitmap = new RenderTargetBitmap(
|
||||
fullImage.PixelWidth, fullImage.PixelHeight,
|
||||
Math.Floor(fullImage.DpiX), Math.Floor(fullImage.DpiY),
|
||||
@@ -186,6 +187,7 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
if (value != null)
|
||||
return (T) value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -16,8 +16,6 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Animation;
|
||||
using ImageMagick;
|
||||
|
@@ -52,7 +52,8 @@
|
||||
</Border>
|
||||
|
||||
<Button x:Name="buttonMeta" Style="{StaticResource CaptionButtonStyle}" Width="24" Height="24"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Top" Visibility="{Binding ElementName=imagePanel, Path=MetaIconVisibility}"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||
Visibility="{Binding ElementName=imagePanel, Path=MetaIconVisibility}"
|
||||
Margin="0,8,8,0" Content="" />
|
||||
|
||||
<TextBlock x:Name="textMeta" IsHitTestVisible="False" Visibility="Collapsed" HorizontalAlignment="Right"
|
||||
|
@@ -29,9 +29,9 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using QuickLook.Annotations;
|
||||
using QuickLook.ExtensionMethods;
|
||||
using QuickLook.Helpers;
|
||||
using QuickLook.Common.Annotations;
|
||||
using QuickLook.Common.ExtensionMethods;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Plugin.ImageViewer.Exiv2;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer
|
||||
@@ -186,6 +186,7 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
_isZoomFactorFirstSet = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ShowZoomLevelInfo)
|
||||
((Storyboard) zoomLevelInfo.FindResource("StoryboardShowZoomLevelInfo")).Begin();
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using ImageMagick;
|
||||
using QuickLook.Common;
|
||||
using QuickLook.Plugin.ImageViewer.Exiv2;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer
|
||||
@@ -38,9 +39,9 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
// animated
|
||||
".png", ".apng", ".gif"
|
||||
};
|
||||
private Size _imageSize;
|
||||
private ImagePanel _ip;
|
||||
private Meta _meta;
|
||||
private Size _imageSize;
|
||||
|
||||
public int Priority => int.MaxValue;
|
||||
|
||||
@@ -62,7 +63,7 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
context.SetPreferredSizeFit(_imageSize, 0.8);
|
||||
else
|
||||
context.PreferredSize = new Size(800, 600);
|
||||
|
||||
|
||||
context.UseDarkTheme = true;
|
||||
}
|
||||
|
||||
|
@@ -91,9 +91,9 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||
<Name>QuickLook</Name>
|
||||
<ProjectReference Include="..\..\QuickLook.Plugin.IViewerPlugin\QuickLook.Common.csproj">
|
||||
<Project>{85FDD6BA-871D-46C8-BD64-F6BB0CB5EA95}</Project>
|
||||
<Name>QuickLook.Common</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
@@ -27,7 +27,7 @@ using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ImageMagick;
|
||||
using QuickLook.ExtensionMethods;
|
||||
using QuickLook.Common.ExtensionMethods;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.Exiv2
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Magick.NET-Q8-AnyCPU" version="7.2.1" targetFramework="net462" />
|
||||
</packages>
|
Reference in New Issue
Block a user