using modified exiv2-ql (QL-Win/exiv2@cf560437bb) to detect Exif; switch from NConvert to Magick.NET

This commit is contained in:
Paddy Xu
2020-05-01 19:02:15 +03:00
parent 208c5d5391
commit b98f8e5ec6
36 changed files with 400 additions and 5612 deletions

View File

@@ -31,6 +31,7 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using QuickLook.Common.Annotations;
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
@@ -48,10 +49,10 @@ namespace QuickLook.Plugin.ImageViewer
private bool _isZoomFactorFirstSet = true;
private DateTime _lastZoomTime = DateTime.MinValue;
private double _maxZoomFactor = 3d;
private NConvert _meta;
private MetaProvider _meta;
private Visibility _metaIconVisibility = Visibility.Visible;
private double _minZoomFactor = 0.1d;
private BitmapScalingMode _renderMode = BitmapScalingMode.HighQuality;
private BitmapScalingMode _renderMode = BitmapScalingMode.NearestNeighbor;
private bool _showZoomLevelInfo = true;
private BitmapSource _source;
private double _zoomFactor = 1d;
@@ -87,14 +88,14 @@ namespace QuickLook.Plugin.ImageViewer
viewPanel.ManipulationDelta += ViewPanel_ManipulationDelta;
}
internal ImagePanel(ContextObject context, NConvert meta) : this()
internal ImagePanel(ContextObject context, MetaProvider meta) : this()
{
ContextObject = context;
Meta = meta;
var s = meta.GetSize();
_minZoomFactor = Math.Min(200d / s.Height, 400d / s.Width);
_maxZoomFactor = Math.Min(9000d / s.Height, 9000d / s.Width);
//_minZoomFactor = Math.Min(200d / s.Height, 400d / s.Width);
//_maxZoomFactor = Math.Min(9000d / s.Height, 9000d / s.Width);
ShowMeta();
Theme = ContextObject.Theme;
@@ -254,7 +255,7 @@ namespace QuickLook.Plugin.ImageViewer
}
}
public NConvert Meta
public MetaProvider Meta
{
get => _meta;
set
@@ -283,16 +284,11 @@ namespace QuickLook.Plugin.ImageViewer
private void ShowMeta()
{
textMeta.Inlines.Clear();
Meta.GetExif().ForEach(m =>
Meta.GetExif().Values.ForEach(m =>
{
if (string.IsNullOrWhiteSpace(m.Item1) || string.IsNullOrWhiteSpace(m.Item2))
return;
if (m.Item1 == "File name" || m.Item1 == "File size" || m.Item1 == "MIME type" ||
m.Item1 == "Exif comment"
|| m.Item1 == "Thumbnail" || m.Item1 == "Exif comment")
return;
textMeta.Inlines.Add(new Run(m.Item1) {FontWeight = FontWeights.SemiBold});
textMeta.Inlines.Add(": ");
textMeta.Inlines.Add(m.Item2);
@@ -304,7 +300,7 @@ namespace QuickLook.Plugin.ImageViewer
}
public event EventHandler<int> ImageScrolled;
public event EventHandler DelayedReRender;
public event EventHandler ZoomChanged;
private void ImagePanel_SizeChanged(object sender, SizeChangedEventArgs e)
{
@@ -488,10 +484,10 @@ namespace QuickLook.Plugin.ImageViewer
UpdateLayout();
if (!suppressEvent)
ProcessDelayed();
FireZoomChangedEvent();
}
private void ProcessDelayed()
private void FireZoomChangedEvent()
{
_lastZoomTime = DateTime.Now;
@@ -500,9 +496,9 @@ namespace QuickLook.Plugin.ImageViewer
if (DateTime.Now - _lastZoomTime < TimeSpan.FromSeconds(0.5))
return;
Debug.WriteLine($"ProcessDelayed fired: {Thread.CurrentThread.ManagedThreadId}");
Debug.WriteLine($"FireZoomChangedEvent fired: {Thread.CurrentThread.ManagedThreadId}");
Dispatcher.BeginInvoke(new Action(() => DelayedReRender?.Invoke(this, new EventArgs())),
Dispatcher.BeginInvoke(new Action(() => ZoomChanged?.Invoke(this, new EventArgs())),
DispatcherPriority.Background);
});
}