mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-23 19:49:17 +08:00
[Peek]Expand image format support for Image Previewer using local capabilities (#35622)
* Use BitmapDecoder to query compatible file extensions. * Delete spellcheck exceptions for removed file types * Remove unused usings.
This commit is contained in:
parent
40acdea356
commit
b81478eb97
24
.github/actions/spell-check/expect.txt
vendored
24
.github/actions/spell-check/expect.txt
vendored
@ -69,11 +69,9 @@ AQS
|
|||||||
ARandom
|
ARandom
|
||||||
ARCHITEW
|
ARCHITEW
|
||||||
ARemapped
|
ARemapped
|
||||||
ari
|
|
||||||
ARPINSTALLLOCATION
|
ARPINSTALLLOCATION
|
||||||
ARPPRODUCTICON
|
ARPPRODUCTICON
|
||||||
ARRAYSIZE
|
ARRAYSIZE
|
||||||
arw
|
|
||||||
asf
|
asf
|
||||||
AShortcut
|
AShortcut
|
||||||
ASingle
|
ASingle
|
||||||
@ -261,7 +259,6 @@ critsec
|
|||||||
Crossdevice
|
Crossdevice
|
||||||
CRSEL
|
CRSEL
|
||||||
crx
|
crx
|
||||||
crw
|
|
||||||
CSearch
|
CSearch
|
||||||
CSettings
|
CSettings
|
||||||
cso
|
cso
|
||||||
@ -303,8 +300,8 @@ DCOM
|
|||||||
dcommon
|
dcommon
|
||||||
dcomp
|
dcomp
|
||||||
DComposition
|
DComposition
|
||||||
dcr
|
DCR
|
||||||
dcs
|
DCs
|
||||||
ddd
|
ddd
|
||||||
DDEIf
|
DDEIf
|
||||||
DDevice
|
DDevice
|
||||||
@ -374,7 +371,6 @@ DRAWCLIPBOARD
|
|||||||
DRAWFRAME
|
DRAWFRAME
|
||||||
drawingcolor
|
drawingcolor
|
||||||
dreamsofameaningfullife
|
dreamsofameaningfullife
|
||||||
drf
|
|
||||||
drivedetectionwarning
|
drivedetectionwarning
|
||||||
dshow
|
dshow
|
||||||
DSTINVERT
|
DSTINVERT
|
||||||
@ -418,7 +414,6 @@ editkeyboardwindow
|
|||||||
EDITSHORTCUTS
|
EDITSHORTCUTS
|
||||||
editshortcutswindow
|
editshortcutswindow
|
||||||
EFile
|
EFile
|
||||||
eip
|
|
||||||
ekus
|
ekus
|
||||||
emmintrin
|
emmintrin
|
||||||
Emoji
|
Emoji
|
||||||
@ -592,7 +587,7 @@ Hiberboot
|
|||||||
HIBYTE
|
HIBYTE
|
||||||
hicon
|
hicon
|
||||||
HIDEWINDOW
|
HIDEWINDOW
|
||||||
hif
|
Hif
|
||||||
HIMAGELIST
|
HIMAGELIST
|
||||||
himl
|
himl
|
||||||
hinst
|
hinst
|
||||||
@ -668,7 +663,6 @@ IGNOREUNKNOWN
|
|||||||
IGraphics
|
IGraphics
|
||||||
iid
|
iid
|
||||||
Iindex
|
Iindex
|
||||||
iiq
|
|
||||||
IJson
|
IJson
|
||||||
Ijwhost
|
Ijwhost
|
||||||
IKs
|
IKs
|
||||||
@ -739,10 +733,8 @@ IWeb
|
|||||||
IWIC
|
IWIC
|
||||||
iwr
|
iwr
|
||||||
IYUV
|
IYUV
|
||||||
jfi
|
|
||||||
jfif
|
jfif
|
||||||
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
|
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
|
||||||
jif
|
|
||||||
jjw
|
jjw
|
||||||
jobject
|
jobject
|
||||||
jpe
|
jpe
|
||||||
@ -751,7 +743,6 @@ Jsons
|
|||||||
jsonval
|
jsonval
|
||||||
junja
|
junja
|
||||||
jxr
|
jxr
|
||||||
kdc
|
|
||||||
keybd
|
keybd
|
||||||
KEYBDDATA
|
KEYBDDATA
|
||||||
KEYBDINPUT
|
KEYBDINPUT
|
||||||
@ -876,7 +867,6 @@ MAXIMIZEBOX
|
|||||||
MAXSHORTCUTSIZE
|
MAXSHORTCUTSIZE
|
||||||
maxversiontested
|
maxversiontested
|
||||||
MBR
|
MBR
|
||||||
mdc
|
|
||||||
MDICHILD
|
MDICHILD
|
||||||
MDL
|
MDL
|
||||||
mdtext
|
mdtext
|
||||||
@ -884,7 +874,6 @@ mdtxt
|
|||||||
mdwn
|
mdwn
|
||||||
MEDIASUBTYPE
|
MEDIASUBTYPE
|
||||||
mediatype
|
mediatype
|
||||||
mef
|
|
||||||
MENUITEMINFO
|
MENUITEMINFO
|
||||||
MENUITEMINFOW
|
MENUITEMINFOW
|
||||||
MERGECOPY
|
MERGECOPY
|
||||||
@ -942,7 +931,6 @@ mpmc
|
|||||||
MRM
|
MRM
|
||||||
MRT
|
MRT
|
||||||
mru
|
mru
|
||||||
mrw
|
|
||||||
msc
|
msc
|
||||||
mscorlib
|
mscorlib
|
||||||
msdata
|
msdata
|
||||||
@ -1065,7 +1053,6 @@ NOZORDER
|
|||||||
NPH
|
NPH
|
||||||
npmjs
|
npmjs
|
||||||
NResize
|
NResize
|
||||||
nrw
|
|
||||||
nsunt
|
nsunt
|
||||||
NTAPI
|
NTAPI
|
||||||
ntdll
|
ntdll
|
||||||
@ -1095,7 +1082,6 @@ opensource
|
|||||||
openxmlformats
|
openxmlformats
|
||||||
OPTIMIZEFORINVOKE
|
OPTIMIZEFORINVOKE
|
||||||
ORAW
|
ORAW
|
||||||
ori
|
|
||||||
ORPHANEDDIALOGTITLE
|
ORPHANEDDIALOGTITLE
|
||||||
ORSCANS
|
ORSCANS
|
||||||
oss
|
oss
|
||||||
@ -1274,7 +1260,6 @@ QUERYENDSESSION
|
|||||||
QUERYOPEN
|
QUERYOPEN
|
||||||
QUEUESYNC
|
QUEUESYNC
|
||||||
QUNS
|
QUNS
|
||||||
raf
|
|
||||||
RAII
|
RAII
|
||||||
RAlt
|
RAlt
|
||||||
Rasterize
|
Rasterize
|
||||||
@ -1378,8 +1363,6 @@ runtimes
|
|||||||
ruuid
|
ruuid
|
||||||
rvm
|
rvm
|
||||||
rwin
|
rwin
|
||||||
rwl
|
|
||||||
rwz
|
|
||||||
sacl
|
sacl
|
||||||
safeprojectname
|
safeprojectname
|
||||||
SAMEKEYPREVIOUSLYMAPPED
|
SAMEKEYPREVIOUSLYMAPPED
|
||||||
@ -1513,7 +1496,6 @@ Srch
|
|||||||
SRCINVERT
|
SRCINVERT
|
||||||
SRCPAINT
|
SRCPAINT
|
||||||
SResize
|
SResize
|
||||||
srf
|
|
||||||
srme
|
srme
|
||||||
srre
|
srre
|
||||||
srw
|
srw
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ using Peek.FilePreviewer.Models;
|
|||||||
using Peek.FilePreviewer.Previewers.Helpers;
|
using Peek.FilePreviewer.Previewers.Helpers;
|
||||||
using Peek.FilePreviewer.Previewers.Interfaces;
|
using Peek.FilePreviewer.Previewers.Interfaces;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
|
using Windows.Graphics.Imaging;
|
||||||
|
|
||||||
namespace Peek.FilePreviewer.Previewers
|
namespace Peek.FilePreviewer.Previewers
|
||||||
{
|
{
|
||||||
@ -58,6 +60,12 @@ namespace Peek.FilePreviewer.Previewers
|
|||||||
|
|
||||||
private DispatcherQueue Dispatcher { get; }
|
private DispatcherQueue Dispatcher { get; }
|
||||||
|
|
||||||
|
private static readonly HashSet<string> _supportedFileTypes =
|
||||||
|
BitmapDecoder.GetDecoderInformationEnumerator()
|
||||||
|
.SelectMany(di => di.FileExtensions)
|
||||||
|
.Union([".svg", ".qoi"])
|
||||||
|
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
public static bool IsItemSupported(IFileSystemItem item)
|
public static bool IsItemSupported(IFileSystemItem item)
|
||||||
{
|
{
|
||||||
return _supportedFileTypes.Contains(item.Extension);
|
return _supportedFileTypes.Contains(item.Extension);
|
||||||
@ -199,74 +207,5 @@ namespace Peek.FilePreviewer.Previewers
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly HashSet<string> _supportedFileTypes = new HashSet<string>
|
|
||||||
{
|
|
||||||
// Image types
|
|
||||||
".bmp",
|
|
||||||
".gif",
|
|
||||||
".jpg",
|
|
||||||
".jfif",
|
|
||||||
".jfi",
|
|
||||||
".jif",
|
|
||||||
".jpeg",
|
|
||||||
".jpe",
|
|
||||||
".png",
|
|
||||||
".tif", // very slow for large files: no thumbnail?
|
|
||||||
".tiff", // NEED TO TEST
|
|
||||||
".dib", // NEED TO TEST
|
|
||||||
".heic",
|
|
||||||
".heif",
|
|
||||||
".hif", // NEED TO TEST
|
|
||||||
".avif", // NEED TO TEST
|
|
||||||
".jxr",
|
|
||||||
".wdp",
|
|
||||||
".ico", // NEED TO TEST
|
|
||||||
".thumb", // NEED TO TEST
|
|
||||||
".webp",
|
|
||||||
|
|
||||||
// Raw types
|
|
||||||
".arw",
|
|
||||||
".cr2",
|
|
||||||
".crw",
|
|
||||||
".erf",
|
|
||||||
".kdc", // NEED TO TEST
|
|
||||||
".mrw",
|
|
||||||
".nef",
|
|
||||||
".nrw",
|
|
||||||
".orf",
|
|
||||||
".pef",
|
|
||||||
".raf",
|
|
||||||
".raw",
|
|
||||||
".rw2",
|
|
||||||
".rwl",
|
|
||||||
".sr2",
|
|
||||||
".srw",
|
|
||||||
".srf",
|
|
||||||
".dcs", // NEED TO TEST
|
|
||||||
".dcr",
|
|
||||||
".drf", // NEED TO TEST
|
|
||||||
".k25",
|
|
||||||
".3fr",
|
|
||||||
".ari", // NEED TO TEST
|
|
||||||
".bay", // NEED TO TEST
|
|
||||||
".cap", // NEED TO TEST
|
|
||||||
".iiq",
|
|
||||||
".eip", // NEED TO TEST
|
|
||||||
".fff",
|
|
||||||
".mef",
|
|
||||||
|
|
||||||
// ".mdc", // Crashes in GetFullBitmapFromPathAsync
|
|
||||||
".mos",
|
|
||||||
".R3D",
|
|
||||||
".rwz", // NEED TO TEST
|
|
||||||
".x3f",
|
|
||||||
".ori",
|
|
||||||
".cr3",
|
|
||||||
|
|
||||||
".svg",
|
|
||||||
|
|
||||||
".qoi",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user