[Peek] Remove WIC project and only keep used ComImport (#25968)

* Peek (#22498)

* Add peek dll project

* add spacebar preview and launch on hotkey press

* add todo

* add process handle to handle continuous press of hotkey

* add tool to stop all powertoys processes

* Add a blank Peek page and update nav menu

* Add some initial content to Peek page including a toggle

* refactor settings parsing

* rename spacebar peek to peek viewer

* rename script to stop powertoys processes

* remove tool

* Adding FileUtils for retrieving selected file in File Explorer

* Remove unnecessary SndPeekSettings

* Add shortcut setting

* Set the shortcut to ctrl+space

* Launching viewer with selected FE file

* Add PeekUI WinUI3 project with interop events

* Moving FileTypeUtils into PeekFileUtils project

* execute winui3 app on hotkey

* Fix paths with spaces

* remove winui3 project

* Resolve comment

* add wpf app with toggle visibility on hotkey

* fix visibility on startup

* remove window properties and add todos

* Fixed hidden extension and system file handling

* wip

* Add working WPF app with FileExplorer querying

* remove c++ projects

* Move native awaiter

* Working Image control with image files

* Resize and move window based on explorer monitor

* Image render, window positioning and sizing clean up

* add window management logic and selection logic

* add extension methods to add circular iterating capability to linkedlistnode

* Add OnArrowKeyPresshandler

* Added titlebar with file name and scaling with titlebar height

* fix flashing window on startup and process kept alive when powertoys exits

* remove wait for debugger loop in ui

* Add KeyIsDown method

* Fix KeyDown issue with Key handled and check for repeat

* Add thumbnail logic

* Add all folder items if only one item is selected

* File type helper

* Using hresult

* Add cancellation and rotation handling

* Use extension instead of path

* fIX CONFLICTS

* Fixing some file type checks

* Add new icon for Peek

* Update page with the new Peek icon

* Initialize IsEnabled and hook ActivationShortcut to dllmain

* add icon to taskbar and titlebar

* Add theme sensitive backgrounds

* rename event handlers

* add settings image

* Move window data into obserable object

* Refactor viewmodel, interop and helpers

* Clean up

* Add loading spinner

* Add todos

* Fix conflicts

* Move native code into its own folder

* Add peek to installer

* Fix building peek and peekui projects

* Replace UWP namespaces to WinAppSDK

* Working WASDK placeholder project

* Add exit when powertoys runner exit

* Working winui3 with image display

* Add WIC project with <TreatWarningAsErros> false for now

* Fit content to window

* Use Size from Windows.Foundation

* Change order

* Add some todos

* Refactored native/interop code and added helpers to imagepreviewer

* Rename projects

* Move some code

* Remove using

Co-authored-by: Michael Salmon <miksalmon@users.noreply.github.com>
Co-authored-by: Michael Salmon 🐟 <michaelpsalmon@outlook.com>
Co-authored-by: Alireza Ebadi Ghajari <alirezae@microsoft.com>
Co-authored-by: Jessie Su <Jessie.Su@microsoft.com>
Co-authored-by: sujessie <102062556+sujessie@users.noreply.github.com>

* Bump Microsoft.Windows.SDK.BuildTools version

* [Peek] Plugin pattern to enable any file type previewing (#22475)

* [Peek] Fetching image size through PropertyStore (#22530)

* Fetching metadata from PropertySTore

* Releasing objects to fix crash

* Creating new PropertyHelper

Co-authored-by: Daniel Chau <dancha@microsoft.com>

* Juliata/filetypes (#22538)

* Using the same list of file extensions as Lightbox's AppxManifest, and ensuring we convert file extension to lowercase

* Add IsFileTypeSupported to IPreviewer

* respond to PR comments

* Add scale awareness to window centering (#22541)

* [Peek] Fix installer builds, project configs and update assets (#22540)

* Update installer

* Fix installer errors

* Fix peek vcxproj

* Add package signing

* Add peek to arm64

* Add back ARM64 toMeasureToolUI

* Add versions to project

* Update assets and icons

* Add correct icon

* [Peek] Enable PropertyStore for offline files (#22567)

* Enabling PropertyStore for offline files

Co-authored-by: Daniel Chau <dancha@microsoft.com>

* [Peek] Adding unsupported file previewer (#22598)

* Unsupported file previewer

* Fix file display info

* Fix property store calls

* Update TODO

* [Peek] Add WebView2 integration (#22506)

* First commit with WIP logic to support WV2 in Peek module

* Minor code cleanup and try/catch block

* Added control to wrap WebView2 logic

* Cleanup

* Added logic to handle HTML previewing
Properly update FilePreview according to file type

* Code cleanup
Updated comments

* Updated comment

* Removed comment

* Code cleanup

* Improved opening of web browser preview to avoid "blank" or "seeing previous page" issue
Removed unused method
Added xaml fallback to guarantee default/starting state

* Removed folder

* Updated factory logic to match master

* address code review

* addressed PR review

* address PR review

* Address PR review

* address PR review

* Address PR review

* [Peek] Add basic file querying and navigation (#22589)

* Refactor to facilitate file data initialization

* Extract file-related code to new FileManager class

* Add temp basic version

* Clean + add todo for cancellations

* Fix various nav-related issues

* Temp - start moving iteration-related code to bg thread

* Minor tweaks

* Add FEHelper todo

* Rename FileManager + various tweaks

* Add basic throttling

* Improve bg thread synchronization

* Clean

* Clean

* Rename based on feedback

* Rename FileQuery

* Rename properties

* Rename remaining fields

* Add todos for nav success/failures

Co-authored-by: Esteban Margaron <emargaron@microsoft.com>

* [Peek] Add customized title bar  (#22600)

* Add basic button UI

* Add function to get default app name and to open file in default app

* Correct error output

* Add filename to titlebar

* Remove titlebar text from Resw

* Add basic button UI

* Add function to get default app name and to open file in default app

* Add filename to titlebar

* Correct error output

* Remove titlebar text from Resw

* Add SetDragRectangles

* Correct logic, update function name

* Add localization

* Cleanup and adaptive width

* Add fileIndex/NumberOfFiles for multiple files activation

* Refine titlebar styles

* Update error message; Return HResult from native methods; Update variable initialisation and string null testing

* Titlebar height and adaptive width refinement

* Add fallback to launch app picker if fail to open default app

* Temp change to hide AppTitle_FileCount

* Update launch button to command; Add keyboard accelerator

* Update titlebar inactive background color

* Update tooltip to add keyboard accelerator

* Add comments to resw file

* Fix accidental deletion from previous merge

Co-authored-by: Jojo Zhou <yizzho@microsoft.com>
Co-authored-by: Yawen Hou <yawenhou@microsoft.com>

* Fix crash

* Fix wrong thread exception

* Make CurrentItemIndex setter private

* Update titlebar filecount text

* Fix titlebar draggable region and interactive region (bump WinAppSdk to latest)

* [Peek] Unsupported File Previewer - Formatting string from resources (#22609)

* Moving to string resource usage

* Moving ReadableStringHelper to common project

* Fix comments

* [Peek] Fix foregrounding (#22633)

* Fixing foregrounding

* Get window handle inside BringToForeground extension method

Co-authored-by: Daniel Chau <dancha@microsoft.com>
Co-authored-by: Samuel Chapleau <sachaple@microsoft.com>

* [Peek] ImagePreviewer - Handle error states (#22637)

* add better preview state handling

* add error handling in imagepreviewer and better state handling

* fix error handling so exception is not bubbled up

* improve performance and hook up unsupported previewer on error

* remove commented code

* address pr comments

* [Peek] add PDF viewing support (#22636)

* [Peek] add PDF viewing support

* Fixed issue which would redirect some HTML and PDF files to external browser

* Fixed refactored interface name

* [Peek] Refine titlebar adaptive width (#22642)

* Adjust adaptive width of titlebar

* Remove visualstate setters for AppTitle_FileCount

Co-authored-by: Jojo Zhou <yizzho@microsoft.com>

* [Peek] New File Explorer tabs break Shell API to get selected files (#22641)

* fix FE tab bug

* remove unnecessary unsafe keyword

* [Peek] add extra logic to properly render PNG files with transparency (#22613)

* [Peek] added extra logic to render PNG files with proper transparency

* Moved logic to ThumbnailHelper
Cleanup

* Created a separated previewer for PNG to only load the preview image with thumbnail logic

* removed unused code

* Updated state loading change

* [Peek] Unsupported File Previewer - Setting Window Size (#22645)

* Adding setting for unsupported file window

* Fix

* [Peek] Add tooltip to File (#22640)

* Add tooltip to File

* Add placeholder text for no tooltip

* Address comments

* Use StringBuilder

Co-authored-by: Jojo Zhou <yizzho@microsoft.com>

* Add full image quality support (#22654)

* [Peek] Window foregrounding simplification and fixes + keep window visible if FE single selection changed (#22657)

* Use different apis to bring to foreground removing remote thread wait and work as well as library loading

* Keep window open if single selected file in FE is different

* Removed unused methods

* [Peek] Add cancellation token OnFilePropertyChanged (#22643)

* Cancel file loading before opening another file

* Add omitted cancellation checks

* Catch task cancelled exception; Add more cancellation checkpoints

* Add cancellation checkpoint beofre GetBitmapFromHBitmapAsync

* Correct typo

* Update to pass cancellation token individually to each async methods

* Add lost cancellationToken source

* Add cancellation token to PngPreviewer

Co-authored-by: Yawen Hou <yawenhou@microsoft.com>

* [Peek] Unsupported File Previewer - Preserve Transparency For File Icons (#22650)

* Preserving transparency or icons

* Remove TODO

Co-authored-by: Samuel Chapleau <sachaple@microsoft.com>

* [Peek] Update some installer build steps + assets update (#22683)

* Fix settings & peek.ui.wpf

* Add back missing icon

* Add missing files and actions to installer

* Keep window open if the selected file in explorer is different (only works for single file selection)

* Undo last

* [Peek] Add copy keyboard accelerator (#22647)

* add copy keyboard accelerator

* Fix comments

Co-authored-by: Samuel Chapleau <sachaple@microsoft.com>

* [Peek] add WV2 improvements (behavior and UX) (#22685)

* [Peek] added logic to get max monitor size for opening WebView2

* Removed ununsed dependency property

* Added workaround for cases where the web page would not finish navigating in a quick timing, for example google.com.

* Remove window extensions from common and use nullable size argument instead

Co-authored-by: Samuel Chapleau <sachaple@microsoft.com>

* [Peek] Merge main, self-contained .NET and fix WebView2 user data dir issue (#22899)

* Merge remote-tracking branch 'origin/main' into peek

* Test sc

* Set WebView2 user data dir

* spellcheck

* Fix comment

* Move check if higher quality image is already loaded to the exact line where we change the Preview bitmap (#23083)

* Fix opening Peek when FE window is set to full name path (#23082)

* Move check for png thubmnail loading priority

* Remove Peek.UI.WPF project

* Remove duplicated method in powertoys setup

* [Peek] Fix selecting files from the correct focused opened File Explorer tab & from Desktop (#23489)

* Get file based on active tab handle instead of window title

* Refactor code to get active tab

* Getting all items from the shell API working again, except for desktop

* Refactor and cleanup com & native code

* Add back removed peek xaml assets in Product.wxs

* Remove some dependencies that do not seem necessary in Product.wxs

* [Peek] Small images (#23554)

* change stretch value

* compare with actual window size

* consider scaling factor

* set max size

* clean up

* clean up

* clean up previewers

* scaling factor in bitmap previewer

* max image size property

* [Peek]Handle errors for HEIC/HEIF and fall back to default previewer if there is no thumbnail (#22684)

* Handle errors when getting filesize by falling back to default previewer

* Bringing back other file types that are fixed with these code changes

---------

Co-authored-by: Samuel Chapleau <sachaple@microsoft.com>

* [Peek] Add unsupported file icon fallback (#23735)

* Refactor icon retrieval, refactor hbitmap to bitmap conversion, add icon fallback

* Add svg to assets in installer

* [Peek] Refactoring of file system models, removal of PngPreviewer, retrieving of folder size via Scripting com reference and other fixes (#23955)

* Refactor icon retrieval, refactor hbitmap to bitmap conversion, add icon fallback

* Add svg to assets in installer

* - Refactor File class into IFileSystemItem, FileItem & FolderItem
- Display size for folders using Scripting namespace
- Remove default app buttons for files or folders not supporting it

* Add better content type via storage apis

* Add check for storagefile in PngPreviewer

* Fix png stretching

* Remove png previewer

* Rename ThumbnailOptions.None to ThumbnailOptions.ResizeToFit

* [Peek] Removed monitor percentage evaluation for the UnsupportedFilePreview control (#24002)

* Remove settings for percentage of windows and keep default min size.

* Fix margin on unsupported control

* Use nullable Size for image size & open file on background thread (#24004)

* [Peek] SVG support (#24237)

* svg previewer

* svg size

* set scaling factor

* set image size

* changed image source type

* non nullable image size

* notify svg previewer changed

* uncomment

* rename BitmapPreviewer

* move svg support

* remove svg previewer

* [Peek] Implementation of a performant and reliable Neighboring Files Query (#24943)

* Use IShellItemArray as the backing array of item

* Finalize and cleanup NFQ implementation

* Cleanup remainder of the code

* Remove unused using

* [Peek] Pin the window position  (#24927)

* [Peek] Telemetry and logging (#25231)

* text preview

* scrolling

* changed size

* Handle errors more gracefuly

* webview2 preview

* common preview project

* previewpane: use common project

* peek: use common

* previewpane: moved md

* peek: md

* previewpane: clean up

* clean up

* moved monaco files

* moved formatters

* rename

* moved common monaco helper

* dev files support

* installer

* removed versions

* warnings: culture info

* warnings: names

* clean up

* warnings: dispose

* warnings: default values

* warnings

* warnings: charset

* warnings: exceptions

* suppress warning

* installer: added peek

* changed peek guid

* monaco folders

* peek deps

* peek files

* peek resources

* removed additional monaco folder

* set host name

* Update installer

* hardcode monaco path

* leave single webview control

* moved path to common

* project

* more meaningful todos

* moved temp folder cleanup

* todo

* extension check

* spell: monaco

* spellcheck

* spellcheck

* fix id

* fix spelling

* key to spelling

* id fix

* Fix monaco resolution at install time

* Fix user install. Add needed files

* installer: remove peek localization files. It's a WinUI app

* installer:fix signing

* removed unused

* settings: flyout enable/disable for Peek

* simplify string

* property changed handle

* [Peek][Settings] Peek OOBE page (#25895)

* Add placeholder error icon

* Only open FilStream in read-only mode; Release propertyStore handle after getting the file properties

(cherry picked from commit 3b1481da2c)

* Update calls to PropertyStoreHelper

* Add disposable property store

* Make GetPropertyStoreFromPath return Disposable property store

* correct typo

* correct typo

* Remove nullable in DisposablePropertyStore

* Add property getters

* Remove usued method

* Correct typo

* Correct typo again...

* Update description

* Add cleaner fallback error

* Fix build

* Cleanup code

* Fix indents

* Delete WIC project and keep only necessary WIC comimport

* Fix spellcheck

---------

Co-authored-by: Michael Salmon <miksalmon@users.noreply.github.com>
Co-authored-by: Michael Salmon 🐟 <michaelpsalmon@outlook.com>
Co-authored-by: Alireza Ebadi Ghajari <alirezae@microsoft.com>
Co-authored-by: Jessie Su <Jessie.Su@microsoft.com>
Co-authored-by: sujessie <102062556+sujessie@users.noreply.github.com>
Co-authored-by: Daniel Chau <d.chau@alumni.ubc.ca>
Co-authored-by: Daniel Chau <dancha@microsoft.com>
Co-authored-by: jth-ms <73617023+jth-ms@users.noreply.github.com>
Co-authored-by: Robson <rp.pontin@gmail.com>
Co-authored-by: estebanm123 <49930791+estebanm123@users.noreply.github.com>
Co-authored-by: Esteban Margaron <emargaron@microsoft.com>
Co-authored-by: Yawen Hou <Sytta@users.noreply.github.com>
Co-authored-by: Jojo Zhou <yizzho@microsoft.com>
Co-authored-by: Yawen Hou <yawenhou@microsoft.com>
Co-authored-by: Jojo Zhou <39350350+Joanna-Zhou@users.noreply.github.com>
Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
Co-authored-by: Seraphima Zykova <zykovas91@gmail.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
Samuel Chapleau
2023-05-15 08:58:39 -07:00
committed by GitHub
parent 0c5113e908
commit d50f092403
114 changed files with 152 additions and 3574 deletions

View File

@@ -976,7 +976,7 @@ ipc
ipcmanager
IPlugin
IPower
ipreview
IPREVIEW
ipreviewhandlervisualssetfont
IProperty
IPublic
@@ -994,7 +994,7 @@ iss
ISurface
ITask
ith
ithumbnail
ITHUMBNAIL
IUI
IUnknown
IWbem
@@ -1478,7 +1478,7 @@ PATINVERT
PATPAINT
PAUDIO
pbc
pbgra
Pbgra
PBlob
pcb
pcch

View File

@@ -93,7 +93,6 @@
"modules\\Peek\\Peek.FilePreviewer.dll",
"modules\\Peek\\Powertoys.Peek.UI.dll",
"modules\\Peek\\Powertoys.Peek.UI.exe",
"modules\\Peek\\WIC.dll",
"modules\\Peek\\Powertoys.Peek.dll",
"modules\\ImageResizer\\PowerToys.ImageResizer.exe",

View File

@@ -475,8 +475,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.Common", "src\modules\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.FilePreviewer", "src\modules\peek\Peek.FilePreviewer\Peek.FilePreviewer.csproj", "{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WIC", "src\modules\peek\WIC\WIC.csproj", "{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MarkdownPreviewHandlerCpp", "src\modules\previewpane\MarkdownPreviewHandlerCpp\MarkdownPreviewHandlerCpp.vcxproj", "{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GcodePreviewHandlerCpp", "src\modules\previewpane\GcodePreviewHandlerCpp\GcodePreviewHandlerCpp.vcxproj", "{5A5DD09D-723A-44D3-8F2B-293584C3D731}"
@@ -515,7 +513,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RegistryPreview", "Registry
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilePreviewCommon", "src\common\FilePreviewCommon\FilePreviewCommon.csproj", "{9EBAA524-0EDA-470B-95D4-39383285CBB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Run.Plugin.PowerToys", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.PowerToys\Microsoft.PowerToys.Run.Plugin.PowerToys.csproj", "{500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.PowerToys", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.PowerToys\Microsoft.PowerToys.Run.Plugin.PowerToys.csproj", "{500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1975,18 +1973,6 @@ Global
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x64.Build.0 = Release|x64
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x86.ActiveCfg = Release|x64
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x86.Build.0 = Release|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|ARM64.ActiveCfg = Debug|ARM64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|ARM64.Build.0 = Debug|ARM64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x64.ActiveCfg = Debug|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x64.Build.0 = Debug|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x86.ActiveCfg = Debug|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x86.Build.0 = Debug|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|ARM64.ActiveCfg = Release|ARM64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|ARM64.Build.0 = Release|ARM64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x64.ActiveCfg = Release|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x64.Build.0 = Release|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x86.ActiveCfg = Release|x64
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x86.Build.0 = Release|x64
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|ARM64.ActiveCfg = Debug|ARM64
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|ARM64.Build.0 = Debug|ARM64
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|x64.ActiveCfg = Debug|x64
@@ -2367,7 +2353,6 @@ Global
{9D7A6DE0-7D27-424D-ABAE-41B2161F9A03} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545} = {2F305555-C296-497E-AC20-5FA1B237996A}
{5A5DD09D-723A-44D3-8F2B-293584C3D731} = {2F305555-C296-497E-AC20-5FA1B237996A}
{B3E869C4-8210-4EBD-A621-FF4C4AFCBFA9} = {2F305555-C296-497E-AC20-5FA1B237996A}

View File

@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Peek.Common.WIC
{
internal static class CLSID
{
public const string WICImagingFactory = "cacaf262-9370-4615-a13b-9f5539da4c0a";
}
}

View File

@@ -1,4 +1,8 @@
namespace WIC
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Peek.Common.WIC
{
internal static class IID
{

View File

@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
namespace Peek.Common.WIC
{
[ComImport]
[Guid(IID.IWICBitmapDecoder)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapDecoder
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")]
void _VtblGap1_10(); // skip 10 methods
IWICBitmapFrameDecode GetFrame([In] int index);
}
}

View File

@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
namespace Peek.Common.WIC
{
[ComImport]
[Guid(IID.IWICBitmapFrameDecode)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapFrameDecode : IWICBitmapSource
{
new void GetSize([Out] out int puiWidth, [Out] out int puiHeight);
}
}

View File

@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
namespace Peek.Common.WIC
{
[ComImport]
[Guid(IID.IWICBitmapSource)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapSource
{
void GetSize([Out] out int puiWidth, [Out] out int puiHeight);
}
}

View File

@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
namespace Peek.Common.WIC
{
[ComImport]
[Guid(IID.IWICImagingFactory)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICImagingFactory
{
IWICBitmapDecoder CreateDecoderFromFilename(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzFilename,
[In] IntPtr pguidVendor,
[In] StreamAccessMode dwDesiredAccess,
[In] WICDecodeOptions metadataOptions);
}
}

View File

@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Peek.Common.WIC
{
[Flags]
public enum StreamAccessMode : int
{
GENERIC_WRITE = 0x40000000,
GENERIC_READ = unchecked((int)0x80000000U),
}
}

View File

@@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Peek.Common.WIC
{
public enum WICDecodeOptions : int
{
WICDecodeMetadataCacheOnDemand = 0x00000000,
WICDecodeMetadataCacheOnLoad = 0x00000001,
}
}

View File

@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
namespace Peek.Common.WIC
{
[ComImport]
[Guid(CLSID.WICImagingFactory)]
[ComDefaultInterface(typeof(IWICImagingFactoryClass))]
public class WICImagingFactory
{
}
[ComImport]
[Guid(IID.IWICImagingFactory)]
[CoClass(typeof(WICImagingFactory))]
public interface IWICImagingFactoryClass : IWICImagingFactory
{
}
}

View File

@@ -33,7 +33,12 @@
<ProjectReference Include="..\..\..\common\FilePreviewCommon\FilePreviewCommon.csproj" />
<ProjectReference Include="..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
<ProjectReference Include="..\Peek.Common\Peek.Common.csproj" />
<ProjectReference Include="..\WIC\WIC.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="Controls\UnsupportedFilePreview\FailedFallbackPreviewControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>

View File

@@ -4,7 +4,7 @@
using System;
using System.Threading.Tasks;
using WIC;
using Peek.Common.WIC;
namespace Peek.FilePreviewer.Previewers
{
@@ -15,7 +15,7 @@ namespace Peek.FilePreviewer.Previewers
return Task.Run(() =>
{
// TODO: Find a way to get file metadata without hydrating files. Look into Shell API/Windows Property System, e.g., IPropertyStore
IWICImagingFactory factory = (IWICImagingFactory)new WICImagingFactoryClass();
IWICImagingFactory factory = (IWICImagingFactory)new WICImagingFactory();
var decoder = factory.CreateDecoderFromFilename(filePath, IntPtr.Zero, StreamAccessMode.GENERIC_READ, WICDecodeOptions.WICDecodeMetadataCacheOnLoad);
var frame = decoder?.GetFrame(0);
int width = 0;

View File

@@ -1,7 +0,0 @@
namespace WIC
{
internal static class CLSID
{
public const string WICImagingFactory = "cacaf262-9370-4615-a13b-9f5539da4c0a";
}
}

View File

@@ -1,14 +0,0 @@
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICImagingFactory)]
[CoClass(typeof(WICImagingFactoryClass))]
public interface WICImagingFactory : IWICImagingFactory { }
[ComImport]
[Guid(CLSID.WICImagingFactory)]
[ComDefaultInterface(typeof(IWICImagingFactory))]
public class WICImagingFactoryClass { }
}

View File

@@ -1,43 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
internal struct CoTaskMemPtr : IDisposable
{
public static CoTaskMemPtr From<T>(T? nullableStructure) where T : struct
{
IntPtr value;
if (nullableStructure.HasValue)
{
value = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(T)));
Marshal.StructureToPtr(nullableStructure, value, false);
}
else
{
value = IntPtr.Zero;
}
return new CoTaskMemPtr(value);
}
public CoTaskMemPtr(IntPtr value)
{
this.value = value;
}
private IntPtr value;
public static implicit operator IntPtr(CoTaskMemPtr safeIntPtr)
{
return safeIntPtr.value;
}
public void Dispose()
{
if (value != IntPtr.Zero)
{
Marshal.FreeCoTaskMem(value);
}
}
}
}

View File

@@ -1,16 +0,0 @@
using System;
namespace WIC
{
public static class ContainerFormat
{
public static readonly Guid Bmp = new Guid(0x0af1d87e, 0xfcfe, 0x4188, 0xbd, 0xeb, 0xa7, 0x90, 0x64, 0x71, 0xcb, 0xe3);
public static readonly Guid Png = new Guid(0x1b7cfaf4, 0x713f, 0x473c, 0xbb, 0xcd, 0x61, 0x37, 0x42, 0x5f, 0xae, 0xaf);
public static readonly Guid Ico = new Guid(0xa3a860c4, 0x338f, 0x4c17, 0x91, 0x9a, 0xfb, 0xa4, 0xb5, 0x62, 0x8f, 0x21);
public static readonly Guid Jpeg = new Guid(0x19e4a5aa, 0x5662, 0x4fc5, 0xa0, 0xc0, 0x17, 0x58, 0x02, 0x8e, 0x10, 0x57);
public static readonly Guid Tiff = new Guid(0x163bcc30, 0xe2e9, 0x4f0b, 0x96, 0x1d, 0xa3, 0xe9, 0xfd, 0xb7, 0x88, 0xa3);
public static readonly Guid Gif = new Guid(0x1f8a5601, 0x7d4d, 0x4cbd, 0x9c, 0x82, 0x1b, 0xc8, 0xd4, 0xee, 0xb9, 0xa5);
public static readonly Guid Wmp = new Guid(0x57a37caa, 0x367a, 0x4540, 0x91, 0x6b, 0xf1, 0x83, 0xc5, 0x09, 0x3a, 0x4b);
public static readonly Guid Dds = new Guid(0x9967cb95, 0x2e85, 0x4ac8, 0x8c, 0xa2, 0x83, 0xd7, 0xcc, 0xd4, 0x25, 0xc9);
}
}

View File

@@ -1,7 +0,0 @@
namespace WIC
{
public struct HResult
{
public const int WINCODEC_ERR_PROPERTYNOTFOUND = unchecked((int)0x88982F40);
}
}

View File

@@ -1,10 +0,0 @@
using System;
namespace WIC
{
public static class Vendor
{
public static readonly Guid Microsoft = new Guid(0xf0e749ca, 0xedef, 0x4589, 0xa7, 0x3a, 0xee, 0xe, 0x62, 0x6a, 0x2a, 0x2b);
public static readonly Guid MicrosoftBuiltIn = new Guid(0x257a30fd, 0x6b6, 0x462b, 0xae, 0xa4, 0x63, 0xf7, 0xb, 0x86, 0xe5, 0x33);
}
}

View File

@@ -1,98 +0,0 @@
using System;
namespace WIC.Constants
{
public static class WICPixelFormat
{
public static readonly Guid WICPixelFormatDontCare = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x00);
public static readonly Guid WICPixelFormat1bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x01);
public static readonly Guid WICPixelFormat2bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x02);
public static readonly Guid WICPixelFormat4bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x03);
public static readonly Guid WICPixelFormat8bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x04);
public static readonly Guid WICPixelFormatBlackWhite = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x05);
public static readonly Guid WICPixelFormat2bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x06);
public static readonly Guid WICPixelFormat4bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x07);
public static readonly Guid WICPixelFormat8bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x08);
public static readonly Guid WICPixelFormat8bppAlpha = new Guid(0xe6cd0116, 0xeeba, 0x4161, 0xaa, 0x85, 0x27, 0xdd, 0x9f, 0xb3, 0xa8, 0x95);
public static readonly Guid WICPixelFormat16bppBGR555 = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x09);
public static readonly Guid WICPixelFormat16bppBGR565 = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0a);
public static readonly Guid WICPixelFormat16bppBGRA5551 = new Guid(0x05ec7c2b, 0xf1e6, 0x4961, 0xad, 0x46, 0xe1, 0xcc, 0x81, 0x0a, 0x87, 0xd2);
public static readonly Guid WICPixelFormat16bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0b);
public static readonly Guid WICPixelFormat24bppBGR = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0c);
public static readonly Guid WICPixelFormat24bppRGB = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0d);
public static readonly Guid WICPixelFormat32bppBGR = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0e);
public static readonly Guid WICPixelFormat32bppBGRA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0f);
public static readonly Guid WICPixelFormat32bppPBGRA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x10);
public static readonly Guid WICPixelFormat32bppGrayFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x11);
public static readonly Guid WICPixelFormat32bppRGB = new Guid(0xd98c6b95, 0x3efe, 0x47d6, 0xbb, 0x25, 0xeb, 0x17, 0x48, 0xab, 0x0c, 0xf1);
public static readonly Guid WICPixelFormat32bppRGBA = new Guid(0xf5c7ad2d, 0x6a8d, 0x43dd, 0xa7, 0xa8, 0xa2, 0x99, 0x35, 0x26, 0x1a, 0xe9);
public static readonly Guid WICPixelFormat32bppPRGBA = new Guid(0x3cc4a650, 0xa527, 0x4d37, 0xa9, 0x16, 0x31, 0x42, 0xc7, 0xeb, 0xed, 0xba);
public static readonly Guid WICPixelFormat48bppRGB = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x15);
public static readonly Guid WICPixelFormat48bppBGR = new Guid(0xe605a384, 0xb468, 0x46ce, 0xbb, 0x2e, 0x36, 0xf1, 0x80, 0xe6, 0x43, 0x13);
public static readonly Guid WICPixelFormat64bppRGB = new Guid(0xa1182111, 0x186d, 0x4d42, 0xbc, 0x6a, 0x9c, 0x83, 0x03, 0xa8, 0xdf, 0xf9);
public static readonly Guid WICPixelFormat64bppRGBA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x16);
public static readonly Guid WICPixelFormat64bppBGRA = new Guid(0x1562ff7c, 0xd352, 0x46f9, 0x97, 0x9e, 0x42, 0x97, 0x6b, 0x79, 0x22, 0x46);
public static readonly Guid WICPixelFormat64bppPRGBA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x17);
public static readonly Guid WICPixelFormat64bppPBGRA = new Guid(0x8c518e8e, 0xa4ec, 0x468b, 0xae, 0x70, 0xc9, 0xa3, 0x5a, 0x9c, 0x55, 0x30);
public static readonly Guid WICPixelFormat16bppGrayFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x13);
public static readonly Guid WICPixelFormat32bppBGR101010 = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x14);
public static readonly Guid WICPixelFormat48bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x12);
public static readonly Guid WICPixelFormat48bppBGRFixedPoint = new Guid(0x49ca140e, 0xcab6, 0x493b, 0x9d, 0xdf, 0x60, 0x18, 0x7c, 0x37, 0x53, 0x2a);
public static readonly Guid WICPixelFormat96bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x18);
public static readonly Guid WICPixelFormat96bppRGBFloat = new Guid(0xe3fed78f, 0xe8db, 0x4acf, 0x84, 0xc1, 0xe9, 0x7f, 0x61, 0x36, 0xb3, 0x27);
public static readonly Guid WICPixelFormat128bppRGBAFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x19);
public static readonly Guid WICPixelFormat128bppPRGBAFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1a);
public static readonly Guid WICPixelFormat128bppRGBFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1b);
public static readonly Guid WICPixelFormat32bppCMYK = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1c);
public static readonly Guid WICPixelFormat64bppRGBAFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1d);
public static readonly Guid WICPixelFormat64bppBGRAFixedPoint = new Guid(0x356de33c, 0x54d2, 0x4a23, 0xbb, 0x4, 0x9b, 0x7b, 0xf9, 0xb1, 0xd4, 0x2d);
public static readonly Guid WICPixelFormat64bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x40);
public static readonly Guid WICPixelFormat128bppRGBAFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1e);
public static readonly Guid WICPixelFormat128bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x41);
public static readonly Guid WICPixelFormat64bppRGBAHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3a);
public static readonly Guid WICPixelFormat64bppPRGBAHalf = new Guid(0x58ad26c2, 0xc623, 0x4d9d, 0xb3, 0x20, 0x38, 0x7e, 0x49, 0xf8, 0xc4, 0x42);
public static readonly Guid WICPixelFormat64bppRGBHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x42);
public static readonly Guid WICPixelFormat48bppRGBHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3b);
public static readonly Guid WICPixelFormat32bppRGBE = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3d);
public static readonly Guid WICPixelFormat16bppGrayHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3e);
public static readonly Guid WICPixelFormat32bppGrayFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3f);
public static readonly Guid WICPixelFormat32bppRGBA1010102 = new Guid(0x25238D72, 0xFCF9, 0x4522, 0xb5, 0x14, 0x55, 0x78, 0xe5, 0xad, 0x55, 0xe0);
public static readonly Guid WICPixelFormat32bppRGBA1010102XR = new Guid(0x00DE6B9A, 0xC101, 0x434b, 0xb5, 0x02, 0xd0, 0x16, 0x5e, 0xe1, 0x12, 0x2c);
public static readonly Guid WICPixelFormat32bppR10G10B10A2 = new Guid(0x604e1bb5, 0x8a3c, 0x4b65, 0xb1, 0x1c, 0xbc, 0x0b, 0x8d, 0xd7, 0x5b, 0x7f);
public static readonly Guid WICPixelFormat32bppR10G10B10A2HDR10 = new Guid(0x9c215c5d, 0x1acc, 0x4f0e, 0xa4, 0xbc, 0x70, 0xfb, 0x3a, 0xe8, 0xfd, 0x28);
public static readonly Guid WICPixelFormat64bppCMYK = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1f);
public static readonly Guid WICPixelFormat24bpp3Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x20);
public static readonly Guid WICPixelFormat32bpp4Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x21);
public static readonly Guid WICPixelFormat40bpp5Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x22);
public static readonly Guid WICPixelFormat48bpp6Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x23);
public static readonly Guid WICPixelFormat56bpp7Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x24);
public static readonly Guid WICPixelFormat64bpp8Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x25);
public static readonly Guid WICPixelFormat48bpp3Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x26);
public static readonly Guid WICPixelFormat64bpp4Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x27);
public static readonly Guid WICPixelFormat80bpp5Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x28);
public static readonly Guid WICPixelFormat96bpp6Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x29);
public static readonly Guid WICPixelFormat112bpp7Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2a);
public static readonly Guid WICPixelFormat128bpp8Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2b);
public static readonly Guid WICPixelFormat40bppCMYKAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2c);
public static readonly Guid WICPixelFormat80bppCMYKAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2d);
public static readonly Guid WICPixelFormat32bpp3ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2e);
public static readonly Guid WICPixelFormat40bpp4ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2f);
public static readonly Guid WICPixelFormat48bpp5ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x30);
public static readonly Guid WICPixelFormat56bpp6ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x31);
public static readonly Guid WICPixelFormat64bpp7ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x32);
public static readonly Guid WICPixelFormat72bpp8ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x33);
public static readonly Guid WICPixelFormat64bpp3ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x34);
public static readonly Guid WICPixelFormat80bpp4ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x35);
public static readonly Guid WICPixelFormat96bpp5ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x36);
public static readonly Guid WICPixelFormat112bpp6ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x37);
public static readonly Guid WICPixelFormat128bpp7ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x38);
public static readonly Guid WICPixelFormat144bpp8ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x39);
public static readonly Guid WICPixelFormat8bppY = new Guid(0x91B4DB54, 0x2DF9, 0x42F0, 0xB4, 0x49, 0x29, 0x09, 0xBB, 0x3D, 0xF8, 0x8E);
public static readonly Guid WICPixelFormat8bppCb = new Guid(0x1339F224, 0x6BFE, 0x4C3E, 0x93, 0x02, 0xE4, 0xF3, 0xA6, 0xD0, 0xCA, 0x2A);
public static readonly Guid WICPixelFormat8bppCr = new Guid(0xB8145053, 0x2116, 0x49F0, 0x88, 0x35, 0xED, 0x84, 0x4B, 0x20, 0x5C, 0x51);
public static readonly Guid WICPixelFormat16bppCbCr = new Guid(0xFF95BA6E, 0x11E0, 0x4263, 0xBB, 0x45, 0x01, 0x72, 0x1F, 0x34, 0x60, 0xA4);
public static readonly Guid WICPixelFormat16bppYQuantizedDctCoefficients = new Guid(0xA355F433, 0x48E8, 0x4A42, 0x84, 0xD8, 0xE2, 0xAA, 0x26, 0xCA, 0x80, 0xA4);
public static readonly Guid WICPixelFormat16bppCbQuantizedDctCoefficients = new Guid(0xD2C4FF61, 0x56A5, 0x49C2, 0x8B, 0x5C, 0x4C, 0x19, 0x25, 0x96, 0x48, 0x37);
public static readonly Guid WICPixelFormat16bppCrQuantizedDctCoefficients = new Guid(0x2FE354F0, 0x1680, 0x42D8, 0x92, 0x31, 0xE7, 0x3C, 0x05, 0x65, 0xBF, 0xC1);
}
}

View File

@@ -1,8 +0,0 @@
namespace WIC
{
public enum ExifColorSpace : int
{
SRGB = 1,
AdobeSRGB = 2,
}
}

View File

@@ -1,14 +0,0 @@
using System;
using System.ComponentModel;
namespace WIC
{
[Flags]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public enum LOCKTYPE : int
{
LOCK_WRITE = 1,
LOCK_EXCLUSIVE = 2,
LOCK_ONLYONCE = 4,
}
}

View File

@@ -1,19 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum MetadataCreationAndPersistOptions : int
{
WICMetadataCreationDefault = 0x00000000,
WICMetadataCreationAllowUnknown = WICMetadataCreationDefault,
WICMetadataCreationFailUnknown = 0x00010000,
WICPersistOptionDefault = 0x00000000,
WICPersistOptionLittleEndian = 0x00000000,
WICPersistOptionBigEndian = 0x00000001,
WICPersistOptionStrictFormat = 0x00000002,
WICPersistOptionNoCacheStream = 0x00000004,
WICPersistOptionPreferUTF8 = 0x00000008,
}
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public enum STATFLAG : int
{
STATFLAG_DEFAULT = 0,
STATFLAG_NONAME = 1,
STATFLAG_NOOPEN = 2,
}
}

View File

@@ -1,16 +0,0 @@
using System;
using System.ComponentModel;
namespace WIC
{
[Flags]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public enum STGC : int
{
STGC_DEFAULT = 0,
STGC_OVERWRITE = 1,
STGC_ONLYIFCURRENT = 2,
STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4,
STGC_CONSOLIDATE = 8,
}
}

View File

@@ -1,15 +0,0 @@
using System;
using System.ComponentModel;
namespace WIC
{
[Flags]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public enum STGM : int
{
STGM_READ = 0x00000000,
STGM_WRITE = 0x00000001,
STGM_READWRITE = 0x00000002,
#warning `STGM`: Enumeration incomplete. Consider adding all values.
}
}

View File

@@ -1,13 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public enum STGTY : int
{
STGTY_STORAGE = 1,
STGTY_STREAM = 2,
STGTY_LOCKBYTES = 3,
STGTY_PROPERTY = 4,
}
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public enum STREAM_SEEK : int
{
STREAM_SEEK_SET = 0,
STREAM_SEEK_CUR = 1,
STREAM_SEEK_END = 2,
}
}

View File

@@ -1,11 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum StreamAccessMode : int
{
GENERIC_WRITE = 0x40000000,
GENERIC_READ = unchecked((int)0x80000000U),
}
}

View File

@@ -1,9 +0,0 @@
namespace WIC
{
public enum WICBitmapAlphaChannelOption : int
{
WICBitmapUseAlpha = 0x00000000,
WICBitmapUsePremultipliedAlpha = 0x00000001,
WICBitmapIgnoreAlpha = 0x00000002,
}
}

View File

@@ -1,9 +0,0 @@
namespace WIC
{
public enum WICBitmapCreateCacheOption : int
{
WICBitmapNoCache = 0x00000000,
WICBitmapCacheOnDemand = 0x00000001,
WICBitmapCacheOnLoad = 0x00000002,
}
}

View File

@@ -1,14 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICBitmapDecoderCapabilities : int
{
WICBitmapDecoderCapabilitySameEncoder = 0x00000001,
WICBitmapDecoderCapabilityCanDecodeAllImages = 0x00000002,
WICBitmapDecoderCapabilityCanDecodeSomeImages = 0x00000004,
WICBitmapDecoderCapabilityCanEnumerateMetadata = 0x00000008,
WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x00000010,
}
}

View File

@@ -1,19 +0,0 @@
namespace WIC
{
public enum WICBitmapDitherType : int
{
WICBitmapDitherTypeNone = 0x00000000,
WICBitmapDitherTypeSolid = 0x00000000,
WICBitmapDitherTypeOrdered4x4 = 0x00000001,
WICBitmapDitherTypeOrdered8x8 = 0x00000002,
WICBitmapDitherTypeOrdered16x16 = 0x00000003,
WICBitmapDitherTypeSpiral4x4 = 0x00000004,
WICBitmapDitherTypeSpiral8x8 = 0x00000005,
WICBitmapDitherTypeDualSpiral4x4 = 0x00000006,
WICBitmapDitherTypeDualSpiral8x8 = 0x00000007,
WICBitmapDitherTypeErrorDiffusion = 0x00000008,
}
}

View File

@@ -1,9 +0,0 @@
namespace WIC
{
public enum WICBitmapEncoderCacheOption : int
{
WICBitmapEncoderCacheInMemory = 0x00000000,
WICBitmapEncoderCacheTempFile = 0x00000001,
WICBitmapEncoderNoCache = 0x00000002,
}
}

View File

@@ -1,14 +0,0 @@
namespace WIC
{
public enum WICBitmapInterpolationMode : int
{
WICBitmapInterpolationModeNearestNeighbor = 0x00000000,
WICBitmapInterpolationModeLinear = 0x00000001,
WICBitmapInterpolationModeCubic = 0x00000002,
WICBitmapInterpolationModeFant = 0x00000003,
/// <remarks>
/// Supported beginning with Windows 10.
/// </remarks>
WICBitmapInterpolationModeHighQualityCubic = 0x00000004,
}
}

View File

@@ -1,11 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICBitmapLockFlags : int
{
WICBitmapLockRead = 0x00000001,
WICBitmapLockWrite = 0x00000002,
}
}

View File

@@ -1,20 +0,0 @@
namespace WIC
{
public enum WICBitmapPaletteType : int
{
WICBitmapPaletteTypeCustom = 0x00000000,
WICBitmapPaletteTypeMedianCut = 0x00000001,
WICBitmapPaletteTypeFixedBW = 0x00000002,
WICBitmapPaletteTypeFixedHalftone8 = 0x00000003,
WICBitmapPaletteTypeFixedHalftone27 = 0x00000004,
WICBitmapPaletteTypeFixedHalftone64 = 0x00000005,
WICBitmapPaletteTypeFixedHalftone125 = 0x00000006,
WICBitmapPaletteTypeFixedHalftone216 = 0x00000007,
WICBitmapPaletteTypeFixedWebPalette = WICBitmapPaletteTypeFixedHalftone216,
WICBitmapPaletteTypeFixedHalftone252 = 0x00000008,
WICBitmapPaletteTypeFixedHalftone256 = 0x00000009,
WICBitmapPaletteTypeFixedGray4 = 0x0000000A,
WICBitmapPaletteTypeFixedGray16 = 0x0000000B,
WICBitmapPaletteTypeFixedGray256 = 0x0000000C,
}
}

View File

@@ -1,17 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICBitmapTransformOptions : int
{
WICBitmapTransformRotate0 = 0x00000000,
WICBitmapTransformRotate90 = 0x00000001,
WICBitmapTransformRotate180 = 0x00000002,
WICBitmapTransformRotate270 = 0x00000003,
WICBitmapTransformFlipHorizontal = 0x00000008,
WICBitmapTransformFlipVertical = 0x00000010,
}
}

View File

@@ -1,9 +0,0 @@
namespace WIC
{
public enum WICColorContextType : int
{
WICColorContextUninitialized = 0x00000000,
WICColorContextProfile = 0x00000001,
WICColorContextExifColorSpace = 0x00000002,
}
}

View File

@@ -1,14 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICComponentEnumerateOptions : int
{
WICComponentEnumerateDefault = 0x00000000,
WICComponentEnumerateRefresh = 0x00000001,
WICComponentEnumerateBuiltInOnly = 0x20000000,
WICComponentEnumerateUnsigned = 0x40000000,
WICComponentEnumerateDisabled = unchecked((int)0x80000000U),
}
}

View File

@@ -1,13 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICComponentSigning : int
{
WICComponentSigned = 0x00000001,
WICComponentUnsigned = 0x00000002,
WICComponentSafe = 0x00000004,
WICComponentDisabled = unchecked((int)0x80000000U),
}
}

View File

@@ -1,16 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICComponentType : int
{
WICDecoder = 0x00000001,
WICEncoder = 0x00000002,
WICPixelFormatConverter = 0x00000004,
WICMetadataReader = 0x00000008,
WICMetadataWriter = 0x00000010,
WICPixelFormat = 0x00000020,
WICAllComponents = 0x0000003F,
}
}

View File

@@ -1,8 +0,0 @@
namespace WIC
{
public enum WICDecodeOptions : int
{
WICDecodeMetadataCacheOnDemand = 0x00000000,
WICDecodeMetadataCacheOnLoad = 0x00000001,
}
}

View File

@@ -1,13 +0,0 @@
using System;
namespace WIC
{
[Flags]
public enum WICMetadataCreationOptions : int
{
WICMetadataCreationDefault = 0x00000000,
WICMetadataCreationAllowUnknown = WICMetadataCreationDefault,
WICMetadataCreationFailUnknown = 0x00010000,
WICMetadataCreationMask = unchecked((int)0xFFFF0000),
}
}

View File

@@ -1,21 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IEnumStringExtensions
{
public static IEnumerable<string> AsEnumerable(this IEnumString enumString)
{
var buffer = new string[1];
for (;;)
{
int length;
enumString.Next(1, buffer, out length);
if (length != 1) break;
yield return buffer[0];
}
}
}
}

View File

@@ -1,21 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IEnumUnknownExtensions
{
public static IEnumerable<object> AsEnumerable(this IEnumUnknown enumUnknown)
{
var buffer = new object[1];
for (;;)
{
int length;
enumUnknown.Next(1, buffer, out length);
if (length != 1) break;
yield return buffer[0];
}
}
}
}

View File

@@ -1,67 +0,0 @@
using System;
using System.ComponentModel;
using Marshal = System.Runtime.InteropServices.Marshal;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IStreamExtensions
{
public static void Read(this IStream stream, byte[] pv, int cb)
{
stream.Read(pv, cb, IntPtr.Zero);
}
public static void Read(this IStream stream, byte[] pv, int cb, out int pcbRead)
{
var pcbReadPtr = Marshal.AllocCoTaskMem(4);
try
{
stream.Read(pv, cb, pcbReadPtr);
pcbRead = Marshal.ReadInt32(pcbReadPtr);
}
finally
{
Marshal.FreeCoTaskMem(pcbReadPtr);
}
}
public static void Seek(this IStream stream, long dlibMove, STREAM_SEEK dwOrigin)
{
stream.Seek(dlibMove, dwOrigin, IntPtr.Zero);
}
public static void Seek(this IStream stream, long dlibMove, STREAM_SEEK dwOrigin, out long plibNewPosition)
{
var plibNewPositionPtr = Marshal.AllocCoTaskMem(8);
try
{
stream.Seek(dlibMove, dwOrigin, plibNewPositionPtr);
plibNewPosition = Marshal.ReadInt64(plibNewPositionPtr, 0);
}
finally
{
Marshal.FreeCoTaskMem(plibNewPositionPtr);
}
}
public static void Write(this IStream stream, byte[] pv, int cb)
{
stream.Write(pv, cb, IntPtr.Zero);
}
public static void Write(this IStream stream, byte[] pv, int cb, out int pcbWritten)
{
var pcbWrittenPtr = Marshal.AllocCoTaskMem(4);
try
{
stream.Read(pv, cb, pcbWrittenPtr);
pcbWritten = Marshal.ReadInt32(pcbWrittenPtr);
}
finally
{
Marshal.FreeCoTaskMem(pcbWrittenPtr);
}
}
}
}

View File

@@ -1,38 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapCodecInfoExtensions
{
public static string GetColorManagementVersion(this IWICBitmapCodecInfo bitmapCodecInfo)
{
FetchIntoBuffer<char> fetcher = bitmapCodecInfo.GetColorManagementVersion;
return fetcher.FetchString();
}
public static string GetDeviceManufacturer(this IWICBitmapCodecInfo bitmapCodecInfo)
{
FetchIntoBuffer<char> fetcher = bitmapCodecInfo.GetDeviceManufacturer;
return fetcher.FetchString();
}
public static string GetDeviceModels(this IWICBitmapCodecInfo bitmapCodecInfo)
{
FetchIntoBuffer<char> fetcher = bitmapCodecInfo.GetDeviceModels;
return fetcher.FetchString();
}
public static string[] GetMimeTypes(this IWICBitmapCodecInfo bitmapCodecInfo)
{
FetchIntoBuffer<char> fetcher = bitmapCodecInfo.GetMimeTypes;
return fetcher.FetchString().Split(',');
}
public static string[] GetFileExtensions(this IWICBitmapCodecInfo bitmapCodecInfo)
{
FetchIntoBuffer<char> fetcher = bitmapCodecInfo.GetFileExtensions;
return fetcher.FetchString().Split(',');
}
}
}

View File

@@ -1,34 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapDecoderExtensions
{
public static IWICMetadataBlockReader AsMetadataBlockReader(this IWICBitmapDecoder bitmapDecoder)
{
return bitmapDecoder as IWICMetadataBlockReader;
}
public static IWICColorContext[] GetColorContexts(this IWICBitmapDecoder bitmapDecoder)
{
int length;
bitmapDecoder.GetColorContexts(0, null, out length);
var colorContexts = new IWICColorContext[length];
if (length > 0)
{
bitmapDecoder.GetColorContexts(length, colorContexts, out length);
}
return colorContexts;
}
public static IEnumerable<IWICBitmapFrameDecode> GetFrames(this IWICBitmapDecoder bitmapDecoder)
{
for (int i = 0, n = bitmapDecoder.GetFrameCount(); i < n; ++i)
{
yield return bitmapDecoder.GetFrame(i);
}
}
}
}

View File

@@ -1,43 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapDecoderInfoExtensions
{
public static WICBitmapPattern[] GetPatterns(this IWICBitmapDecoderInfo bitmapDecoderInfo)
{
int count;
int size;
bitmapDecoderInfo.GetPatterns(0, IntPtr.Zero, out count, out size);
if (count == 0)
{
return new WICBitmapPattern[0];
}
using (var buffer = new CoTaskMemPtr(Marshal.AllocCoTaskMem(size)))
{
bitmapDecoderInfo.GetPatterns(size, buffer, out count, out size);
IntPtr at = buffer;
var patterns = new WICBitmapPattern[count];
for (int i = 0, stride = Marshal.SizeOf(typeof(WICBitmapPatternRaw)); i < count; ++i, at += stride)
{
var raw = (WICBitmapPatternRaw)Marshal.PtrToStructure(at, typeof(WICBitmapPatternRaw));
int length = raw.Length;
patterns[i] = new WICBitmapPattern()
{
Length = length,
Position = raw.Position,
Pattern = new byte[length],
Mask = new byte[length],
EndOfStream = raw.EndOfStream
};
Marshal.Copy(raw.Pattern, patterns[i].Pattern, 0, length);
Marshal.Copy(raw.Mask, patterns[i].Mask, 0, length);
}
return patterns;
}
}
}
}

View File

@@ -1,20 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapEncoderExtensions
{
public static IWICMetadataBlockWriter AsMetadataBlockWriter(this IWICBitmapEncoder bitmapEncoder)
{
return bitmapEncoder as IWICMetadataBlockWriter;
}
public static IWICBitmapFrameEncode CreateNewFrame(this IWICBitmapEncoder bitmapEncoder, IPropertyBag2 ppIEncoderOptions = null)
{
IWICBitmapFrameEncode ppIFrameEncode;
bitmapEncoder.CreateNewFrame(out ppIFrameEncode, ppIEncoderOptions);
return ppIFrameEncode;
}
}
}

View File

@@ -1,21 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapExtensions
{
public static IWICBitmapLock Lock(this IWICBitmap bitmap, WICBitmapLockFlags flags, WICRect? prcLock = null)
{
using (var prcLockPtr = CoTaskMemPtr.From(prcLock))
{
return bitmap.Lock(prcLockPtr, flags);
}
}
public static void SetResolution(this IWICBitmap bitmap, Resolution resolution)
{
bitmap.SetResolution(resolution.DpiX, resolution.DpiY);
}
}
}

View File

@@ -1,37 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapFrameDecodeExtensions
{
public static IWICMetadataBlockReader AsMetadataBlockReader(this IWICBitmapFrameDecode bitmapFrameDecode)
{
return bitmapFrameDecode as IWICMetadataBlockReader;
}
public static IWICColorContext[] GetColorContexts(this IWICBitmapFrameDecode bitmapFrameDecode)
{
FetchIntoBuffer<IWICColorContext> fetcher = bitmapFrameDecode.GetColorContexts;
return fetcher.FetchArray();
}
public static void Initialize(this IWICBitmapFrameEncode bitmapFrameEncode, IPropertyBag2 pIEncoderOptions = null)
{
bitmapFrameEncode.Initialize(pIEncoderOptions);
}
public static void WriteSource(this IWICBitmapFrameEncode bitmapFrameEncode, IWICBitmapSource pIBitmapSource, WICRect? prc = null)
{
using (var prcPtr = CoTaskMemPtr.From(prc))
{
bitmapFrameEncode.WriteSource(pIBitmapSource, prcPtr);
}
}
public static void WritePixels(this IWICBitmapFrameEncode bitmapFrameEncode, int lineCount, int cbStride, byte[] pbPixels)
{
bitmapFrameEncode.WritePixels(lineCount, cbStride, pbPixels.Length, pbPixels);
}
}
}

View File

@@ -1,46 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapFrameEncodeExtensions
{
public static IWICMetadataBlockWriter AsMetadataBlockWriter(this IWICBitmapFrameEncode bitmapFrameEncode)
{
return bitmapFrameEncode as IWICMetadataBlockWriter;
}
public static void Initialize(this IWICBitmapFrameEncode bitmapFrameEncode, IPropertyBag2 pIEncoderOptions = null)
{
bitmapFrameEncode.Initialize(pIEncoderOptions);
}
public static void SetColorContexts(this IWICBitmapFrameEncode bitmapFrameEncode, IWICColorContext[] colorContexts)
{
bitmapFrameEncode.SetColorContexts(colorContexts.Length, colorContexts);
}
public static void SetResolution(this IWICBitmapFrameEncode bitmapFrameEncode, Resolution resolution)
{
bitmapFrameEncode.SetResolution(resolution.DpiX, resolution.DpiY);
}
public static void SetSize(this IWICBitmapFrameEncode bitmapFrameEncode, Size size)
{
bitmapFrameEncode.SetSize(size.Width, size.Height);
}
public static void WriteSource(this IWICBitmapFrameEncode bitmapFrameEncode, IWICBitmapSource pIBitmapSource, WICRect? prc = null)
{
using (var prcPtr = CoTaskMemPtr.From(prc))
{
bitmapFrameEncode.WriteSource(pIBitmapSource, prcPtr);
}
}
public static void WritePixels(this IWICBitmapFrameEncode bitmapFrameEncode, int lineCount, int cbStride, byte[] pbPixels)
{
bitmapFrameEncode.WritePixels(lineCount, cbStride, pbPixels.Length, pbPixels);
}
}
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapLockExtensions
{
public static Size GetSize(this IWICBitmapLock bitmapLock)
{
int width, height;
bitmapLock.GetSize(out width, out height);
return new Size(width, height);
}
}
}

View File

@@ -1,13 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapScalerExtensions
{
public static void Initialize(this IWICBitmapScaler bitmapScaler, IWICBitmapSource pISource, Size size, WICBitmapInterpolationMode mode)
{
bitmapScaler.Initialize(pISource, size.Width, size.Height, mode);
}
}
}

View File

@@ -1,30 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICBitmapSourceExtensions
{
public static void CopyPixels(this IWICBitmapSource bitmapSource, int cbStride, byte[] pbBuffer, WICRect? prc = null)
{
using (var prcPtr = CoTaskMemPtr.From(prc))
{
bitmapSource.CopyPixels(prcPtr, cbStride, pbBuffer.Length, pbBuffer);
}
}
public static Size GetSize(this IWICBitmapSource bitmapSource)
{
int width, height;
bitmapSource.GetSize(out width, out height);
return new Size(width, height);
}
public static Resolution GetResolution(this IWICBitmapSource bitmapSource)
{
double dpiX, dpiY;
bitmapSource.GetResolution(out dpiX, out dpiY);
return new Resolution(dpiX, dpiY);
}
}
}

View File

@@ -1,19 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICColorContextExtensions
{
public static void InitializeFromMemory(this IWICColorContext colorContext, byte[] pbBuffer)
{
colorContext.InitializeFromMemory(pbBuffer, pbBuffer.Length);
}
public static byte[] GetProfileBytes(this IWICColorContext colorContext)
{
FetchIntoBuffer<byte> fetcher = colorContext.GetProfileBytes;
return fetcher.FetchArray();
}
}
}

View File

@@ -1,32 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICComponentInfoExtensions
{
public static string GetAuthor(this IWICComponentInfo componentInfo)
{
FetchIntoBuffer<char> fetcher = componentInfo.GetAuthor;
return fetcher.FetchString();
}
public static string GetFriendlyName(this IWICComponentInfo componentInfo)
{
FetchIntoBuffer<char> fetcher = componentInfo.GetFriendlyName;
return fetcher.FetchString();
}
public static string GetVersion(this IWICComponentInfo componentInfo)
{
FetchIntoBuffer<char> fetcher = componentInfo.GetVersion;
return fetcher.FetchString();
}
public static string GetSpecVersion(this IWICComponentInfo componentInfo)
{
FetchIntoBuffer<char> fetcher = componentInfo.GetSpecVersion;
return fetcher.FetchString();
}
}
}

View File

@@ -1,16 +0,0 @@
using System;
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICFormatConverterInfoExtensions
{
public static Guid[] GetPixelFormats(this IWICFormatConverterInfo formatConverterInfo)
{
FetchIntoBuffer<Guid> fetcher = formatConverterInfo.GetPixelFormats;
return fetcher.FetchArray();
}
}
}

View File

@@ -1,80 +0,0 @@
using System;
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICImagingFactoryExtensions
{
public static IWICBitmap CreateBitmap(this IWICImagingFactory imagingFactory, Size size, Guid pixelFormat, WICBitmapCreateCacheOption option)
{
return imagingFactory.CreateBitmap(size.Width, size.Height, pixelFormat, option);
}
public static IWICBitmap CreateBitmapFromSourceRect(this IWICImagingFactory imagingFactory, IWICBitmapSource pIBitmapSource, WICRect rect)
{
return imagingFactory.CreateBitmapFromSourceRect(pIBitmapSource, rect.X, rect.Y, rect.Width, rect.Height);
}
public static IWICBitmap CreateBitmapFromMemory(this IWICImagingFactory imagingFactory, Size size, Guid pixelFormat, int cbStride, byte[] pbBuffer)
{
return imagingFactory.CreateBitmapFromMemory(size.Width, size.Height, pixelFormat, cbStride, pbBuffer.Length, pbBuffer);
}
public static IWICBitmapDecoder CreateDecoder(this IWICImagingFactory imagingFactory, Guid guidContainerFormat, Guid? pguidVendor = null)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return imagingFactory.CreateDecoder(guidContainerFormat, pguidVendorPtr);
}
}
public static IWICBitmapDecoder CreateDecoderFromFileHandle(this IWICImagingFactory imagingFactory, IntPtr hFile, WICDecodeOptions metadataOptions, Guid? pguidVendor = null)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return imagingFactory.CreateDecoderFromFileHandle(hFile, pguidVendorPtr, metadataOptions);
}
}
public static IWICBitmapDecoder CreateDecoderFromFilename(this IWICImagingFactory imagingFactory, string wzFilename, Guid? pguidVendor = null, WICDecodeOptions metadataOptions = WICDecodeOptions.WICDecodeMetadataCacheOnDemand)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return imagingFactory.CreateDecoderFromFilename(wzFilename, pguidVendorPtr, StreamAccessMode.GENERIC_READ, metadataOptions);
}
}
public static IWICBitmapDecoder CreateDecoderFromStream(this IWICImagingFactory imagingFactory, IStream pIStream, WICDecodeOptions metadataOptions, Guid? pguidVendor = null)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return imagingFactory.CreateDecoderFromStream(pIStream, pguidVendorPtr, metadataOptions);
}
}
public static IWICBitmapEncoder CreateEncoder(this IWICImagingFactory factory, Guid guidContainerFormat, Guid? pguidVendor = null)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return factory.CreateEncoder(guidContainerFormat, pguidVendorPtr);
}
}
public static IWICMetadataQueryWriter CreateQueryWriter(this IWICImagingFactory imagingFactory, Guid guidMetadataFormat, Guid? pguidVendor = null)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return imagingFactory.CreateQueryWriter(guidMetadataFormat, pguidVendorPtr);
}
}
public static IWICMetadataQueryWriter CreateQueryWriterFromReader(this IWICImagingFactory imagingFactory, IWICMetadataQueryReader pIQueryReader, Guid? pguidVendor = null)
{
using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
{
return imagingFactory.CreateQueryWriterFromReader(pIQueryReader, pguidVendorPtr);
}
}
}
}

View File

@@ -1,27 +0,0 @@
using System;
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICMetadataHandlerInfoExtensions
{
public static Guid[] GetContainerFormats(this IWICMetadataHandlerInfo metadataHandlerInfo)
{
FetchIntoBuffer<Guid> fetcher = metadataHandlerInfo.GetContainerFormats;
return fetcher.FetchArray();
}
public static string GetDeviceManufacturer(this IWICMetadataHandlerInfo metadataHandlerInfo)
{
FetchIntoBuffer<char> fetcher = metadataHandlerInfo.GetDeviceManufacturer;
return fetcher.FetchString();
}
public static string GetDeviceModels(this IWICMetadataHandlerInfo metadataHandlerInfo)
{
FetchIntoBuffer<char> fetcher = metadataHandlerInfo.GetDeviceModels;
return fetcher.FetchString();
}
}
}

View File

@@ -1,35 +0,0 @@
using System.ComponentModel;
using System.Runtime.InteropServices;
using static WIC.PropVariantHelpers;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICMetadataQueryReaderExtensions
{
public static string GetLocation(this IWICMetadataQueryReader metadataQueryReader)
{
FetchIntoBuffer<char> fetcher = metadataQueryReader.GetLocation;
return fetcher.FetchString();
}
public static bool TryGetMetadataByName<T>(this IWICMetadataQueryReader metadataQueryReader, string name, out T value)
{
var variant = new PROPVARIANT();
try
{
metadataQueryReader.GetMetadataByName(name, ref variant);
return TryDecode(ref variant, out value);
}
catch (COMException ex) when (ex.ErrorCode == HResult.WINCODEC_ERR_PROPERTYNOTFOUND)
{
value = default(T);
return false;
}
finally
{
Dispose(ref variant);
}
}
}
}

View File

@@ -1,19 +0,0 @@
using System.ComponentModel;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class IWICPaletteExtensions
{
public static int[] GetColors(this IWICPalette palette)
{
FetchIntoBuffer<int> fetcher = palette.GetColors;
return fetcher.FetchArray();
}
public static void InitializeCustom(this IWICPalette palette, int[] pColors)
{
palette.InitializeCustom(pColors, pColors.Length);
}
}
}

View File

@@ -1,129 +0,0 @@
using System;
using System.ComponentModel;
using System.IO;
using Marshal = System.Runtime.InteropServices.Marshal;
namespace WIC
{
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class StreamExtensions
{
public static IStream AsCOMStream(this Stream stream)
{
return new COMStream(stream);
}
private sealed class COMStream : IStream
{
public COMStream(Stream underlyingStream)
{
UnderlyingStream = underlyingStream;
}
private Stream UnderlyingStream { get; }
public void Read(byte[] pv, int cb, IntPtr pcbRead)
{
int bytesRead = UnderlyingStream.Read(pv, 0, cb);
if (pcbRead != IntPtr.Zero)
{
Marshal.WriteInt32(pcbRead, 0, bytesRead);
}
}
public void Write(byte[] pv, int cb, IntPtr pcbWritten)
{
var bytesWritten = Math.Min(pv.Length, cb);
UnderlyingStream.Write(pv, 0, bytesWritten);
if (pcbWritten != IntPtr.Zero)
{
Marshal.WriteInt32(pcbWritten, 0, bytesWritten);
}
}
public void Seek(long dlibMove, STREAM_SEEK dwOrigin, IntPtr plibNewPosition)
{
SeekOrigin seekOrigin;
switch (dwOrigin)
{
case STREAM_SEEK.STREAM_SEEK_SET:
seekOrigin = SeekOrigin.Begin;
break;
case STREAM_SEEK.STREAM_SEEK_CUR:
seekOrigin = SeekOrigin.Current;
break;
case STREAM_SEEK.STREAM_SEEK_END:
seekOrigin = SeekOrigin.End;
break;
default:
throw new ArgumentOutOfRangeException(nameof(dwOrigin));
}
long newPosition = UnderlyingStream.Seek(dlibMove, seekOrigin);
if (plibNewPosition != IntPtr.Zero)
{
Marshal.WriteInt64(plibNewPosition, 0, newPosition);
}
}
public void SetSize(long libNewSize)
{
UnderlyingStream.SetLength(libNewSize);
}
void IStream.CopyTo(IStream pstm, long cb, out long pcbRead, out long pcbWritten)
{
throw new System.NotImplementedException();
}
void IStream.Commit(STGC grfCommitFlags)
{
throw new System.NotImplementedException();
}
void IStream.Revert()
{
throw new System.NotImplementedException();
}
void IStream.LockRegion(long libOffset, long cb, LOCKTYPE dwLockType)
{
throw new System.NotImplementedException();
}
void IStream.UnlockRegion(long libOffset, long cb, LOCKTYPE dwLockType)
{
throw new System.NotImplementedException();
}
public void Stat(ref STATSTG pstatstg, STATFLAG grfStatFlag)
{
pstatstg = new STATSTG();
pstatstg.type = STGTY.STGTY_STREAM;
pstatstg.cbSize = UnderlyingStream.Length;
pstatstg.grfMode = 0;
if (UnderlyingStream.CanRead && UnderlyingStream.CanWrite)
{
pstatstg.grfMode |= STGM.STGM_READWRITE;
}
else if (UnderlyingStream.CanRead)
{
pstatstg.grfMode |= STGM.STGM_READ;
}
else if (UnderlyingStream.CanWrite)
{
pstatstg.grfMode |= STGM.STGM_WRITE;
}
else
{
throw new ObjectDisposedException(null);
}
}
IStream IStream.Clone()
{
throw new System.NotImplementedException();
}
}
}
}

View File

@@ -1,37 +0,0 @@
namespace WIC
{
internal delegate void FetchIntoBuffer<T>(int size, T[] buffer, out int length);
internal static class FetchIntoBufferExtensions
{
internal static T[] FetchArray<T>(this FetchIntoBuffer<T> fetcher)
{
int length;
fetcher.Invoke(0, null, out length);
var buffer = new T[length];
if (length > 0)
{
fetcher.Invoke(length, buffer, out length);
}
return buffer;
}
internal static string FetchString(this FetchIntoBuffer<char> fetcher)
{
var buffer = fetcher.FetchArray();
int length = buffer.Length - 1;
if (length > 0)
{
return new string(buffer, 0, length);
}
else if (length == 0)
{
return string.Empty;
}
else
{
return null;
}
}
}
}

View File

@@ -1,23 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IEnumString)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IEnumString
{
void Next(
[In] int celt,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rgelt,
[Out] out int pceltFetched);
void Skip(
[In] int celt);
void Reset();
IEnumString Clone();
}
}

View File

@@ -1,22 +0,0 @@
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IEnumUnknown)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IEnumUnknown
{
void Next(
[In] int celt,
[Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] object[] rgelt,
[Out] out int pceltFetched);
void Skip(
[In] int celt);
void Reset();
IEnumUnknown Clone();
}
}

View File

@@ -1,15 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IErrorLog)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IErrorLog
{
void AddError(
[In, MarshalAs(UnmanagedType.LPWStr)] string pszPropName,
[In] IntPtr pExcepInfo); // EXCEPINFO*
}
}

View File

@@ -1,37 +0,0 @@
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IPropertyBag2)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPropertyBag2
{
void Read(
[In] int cProperties,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPBAG2[] pPropBag,
[In] IErrorLog pErrLog,
[Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct, SizeParamIndex = 0)] object[] pvarValue,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] int[] phrError
);
void Write(
[In] int cProperties,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPBAG2[] pPropBag,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct, SizeParamIndex = 0)] object[] pvarValue);
int CountProperties();
void GetPropertyInfo(
[In] int iProperty,
[In] int cProperties,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] PROPBAG2[] pPropBag,
[Out] out int pcProperties);
void LoadObject(
[In, MarshalAs(UnmanagedType.LPWStr)] string pstrName,
[In] int dwHint,
[In, MarshalAs(UnmanagedType.IUnknown)] object pUnkObject,
[In] IErrorLog pErrLog);
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.ISequentialStream)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISequentialStream
{
void Read(
[Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] pv,
[In] int cb,
[Out] IntPtr pcbRead);
void Write(
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] pv,
[In] int cb,
[Out] IntPtr pcbWritten);
}
}

View File

@@ -1,61 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IStream)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IStream : ISequentialStream
{
#region Members inherited from `ISequentialStream`
new void Read(
[Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] pv,
[In] int cb,
[Out] IntPtr pcbRead);
new void Write(
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] pv,
[In] int cb,
[Out] IntPtr pcbWritten);
#endregion
void Seek(
[In] long dlibMove,
[In] STREAM_SEEK dwOrigin,
[Out] IntPtr plibNewPosition);
void SetSize(
[In] long libNewSize);
void CopyTo(
[In] IStream pstm,
[In] long cb,
[Out] out long pcbRead,
[Out] out long pcbWritten);
void Commit(
[In] STGC grfCommitFlags);
void Revert();
void LockRegion(
[In] long libOffset,
[In] long cb,
[In] LOCKTYPE dwLockType);
void UnlockRegion(
[In] long libOffset,
[In] long cb,
[In] LOCKTYPE dwLockType);
void Stat(
[In, Out] ref STATSTG pstatstg,
[In] STATFLAG grfStatFlag);
IStream Clone();
}
}

View File

@@ -1,45 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmap)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmap : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
IWICBitmapLock Lock(
[In] IntPtr prcLock, // WICRect*
[In] WICBitmapLockFlags flags);
void SetPalette(
[In] IWICPalette pIPalette);
void SetResolution(
[In] double dpiX,
[In] double dpiY);
}
}

View File

@@ -1,38 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapClipper)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapClipper : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
void Initialize(
[In] IWICBitmapSource pISource,
[In, MarshalAs(UnmanagedType.LPStruct)] WICRect prc);
}
}

View File

@@ -1,86 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapCodecInfo)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapCodecInfo : IWICComponentInfo
{
#region Members inherited from `IWICComponentInfo`
new WICComponentType GetComponentType();
new Guid GetCLSID();
new WICComponentSigning GetSigningStatus();
new void GetAuthor(
[In] int cchAuthor,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzAuthor,
[Out] out int pcchActual);
new Guid GetVendorGUID();
new void GetVersion(
[In] int cchVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzVersion,
[Out] out int pcchActual);
new void GetSpecVersion(
[In] int cchSpecVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzSpecVersion,
[Out] out int pcchActual);
new void GetFriendlyName(
[In] int cchFriendlyName,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFriendlyName,
[Out] out int pcchActual);
#endregion
Guid GetContainerFormat();
void GetPixelFormats(
[In] int cFormats,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] pguidPixelFormats,
[Out] out int pcActual);
void GetColorManagementVersion(
[In] int cchColorManagementVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzColorManagementVersion,
[Out] out int pcchActual);
void GetDeviceManufacturer(
[In] int cchDeviceManufacturer,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceManufacturer,
[Out] out int pcchActual);
void GetDeviceModels(
[In] int cchDeviceModels,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceModels,
[Out] out int pcchActual);
void GetMimeTypes(
[In] int cchMimeTypes,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzMimeTypes,
[Out] out int pcchActual);
void GetFileExtensions(
[In] int cchFileExtensions,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFileExtensions,
[Out] out int pcchActual);
bool DoesSupportAnimation();
bool DoesSupportChromakey();
bool DoesSupportLossless();
bool DoesSupportMultiframe();
bool MatchesMimeType(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzMimeType);
}
}

View File

@@ -1,41 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapDecoder)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapDecoder
{
WICBitmapDecoderCapabilities QueryCapability(
[In] IStream pIStream);
void Initialize(
[In] IStream pIStream,
[In] WICDecodeOptions cacheOptions);
Guid GetContainerFormat();
IWICBitmapDecoderInfo GetDecoderInfo();
void CopyPalette(
[In] IWICPalette pIPalette);
IWICMetadataQueryReader GetMetadataQueryReader();
IWICBitmapSource GetPreview();
void GetColorContexts(
[In] int cCount,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContexts,
[Out] out int pcActualCount);
IWICBitmapSource GetThumbnail();
int GetFrameCount();
IWICBitmapFrameDecode GetFrame(
[In] int index);
}
}

View File

@@ -1,102 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapDecoderInfo)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapDecoderInfo : IWICBitmapCodecInfo
{
#region Members inherited from `IWICBitmapCodecInfo`
#region Members inherited from `IWICComponentInfo`
new WICComponentType GetComponentType();
new Guid GetCLSID();
new WICComponentSigning GetSigningStatus();
new void GetAuthor(
[In] int cchAuthor,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzAuthor,
[Out] out int pcchActual);
new Guid GetVendorGUID();
new void GetVersion(
[In] int cchVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzVersion,
[Out] out int pcchActual);
new void GetSpecVersion(
[In] int cchSpecVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzSpecVersion,
[Out] out int pcchActual);
new void GetFriendlyName(
[In] int cchFriendlyName,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFriendlyName,
[Out] out int pcchActual);
#endregion
new Guid GetContainerFormat();
new void GetPixelFormats(
[In] int cFormats,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] pguidPixelFormats,
[Out] out int pcActual);
new void GetColorManagementVersion(
[In] int cchColorManagementVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzColorManagementVersion,
[Out] out int pcchActual);
new void GetDeviceManufacturer(
[In] int cchDeviceManufacturer,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceManufacturer,
[Out] out int pcchActual);
new void GetDeviceModels(
[In] int cchDeviceModels,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceModels,
[Out] out int pcchActual);
new void GetMimeTypes(
[In] int cchMimeTypes,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzMimeTypes,
[Out] out int pcchActual);
new void GetFileExtensions(
[In] int cchFileExtensions,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFileExtensions,
[Out] out int pcchActual);
new bool DoesSupportAnimation();
new bool DoesSupportChromakey();
new bool DoesSupportLossless();
new bool DoesSupportMultiframe();
new bool MatchesMimeType(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzMimeType);
#endregion
void GetPatterns(
[In] int cbSizePatterns,
[In] IntPtr pPatterns,
[Out] out int pcPatterns,
[Out] out int pcbPatternsActual);
bool MatchesPattern(
[In] IStream pIStream);
IWICBitmapDecoder CreateInstance();
}
}

View File

@@ -1,40 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapEncoder)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapEncoder
{
void Initialize(
[In] IStream pIStream,
[In] WICBitmapEncoderCacheOption cacheOption);
Guid GetContainerFormat();
IWICBitmapEncoderInfo GetEncoderInfo();
void SetColorContexts(
[In] int cCount,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContext);
void SetPalette(
[In] IWICPalette pIPalette);
void SetThumbnail(
[In] IWICBitmapSource pIThumbnail);
void SetPreview(
[In] IWICBitmapSource pIPreview);
void CreateNewFrame(
[Out] out IWICBitmapFrameEncode ppIFrameEncode,
[In, Out] IPropertyBag2 ppIEncoderOptions);
void Commit();
IWICMetadataQueryWriter GetMetadataQueryWriter();
}
}

View File

@@ -1,92 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapEncoderInfo)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapEncoderInfo : IWICBitmapCodecInfo
{
#region Members inherited from `IWICBitmapCodecInfo`
#region Members inherited from `IWICComponentInfo`
new WICComponentType GetComponentType();
new Guid GetCLSID();
new WICComponentSigning GetSigningStatus();
new void GetAuthor(
[In] int cchAuthor,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzAuthor,
[Out] out int pcchActual);
new Guid GetVendorGUID();
new void GetVersion(
[In] int cchVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzVersion,
[Out] out int pcchActual);
new void GetSpecVersion(
[In] int cchSpecVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzSpecVersion,
[Out] out int pcchActual);
new void GetFriendlyName(
[In] int cchFriendlyName,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFriendlyName,
[Out] out int pcchActual);
#endregion
new Guid GetContainerFormat();
new void GetPixelFormats(
[In] int cFormats,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] pguidPixelFormats,
[Out] out int pcActual);
new void GetColorManagementVersion(
[In] int cchColorManagementVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzColorManagementVersion,
[Out] out int pcchActual);
new void GetDeviceManufacturer(
[In] int cchDeviceManufacturer,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceManufacturer,
[Out] out int pcchActual);
new void GetDeviceModels(
[In] int cchDeviceModels,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceModels,
[Out] out int pcchActual);
new void GetMimeTypes(
[In] int cchMimeTypes,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzMimeTypes,
[Out] out int pcchActual);
new void GetFileExtensions(
[In] int cchFileExtensions,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFileExtensions,
[Out] out int pcchActual);
new bool DoesSupportAnimation();
new bool DoesSupportChromakey();
new bool DoesSupportLossless();
new bool DoesSupportMultiframe();
new bool MatchesMimeType(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzMimeType);
#endregion
IWICBitmapEncoder CreateInstance();
}
}

View File

@@ -1,38 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapFlipRotator)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapFlipRotator : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
void Initialize(
[In] IWICBitmapSource pISource,
[In] WICBitmapTransformOptions options);
}
}

View File

@@ -1,43 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapFrameDecode)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapFrameDecode : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
IWICMetadataQueryReader GetMetadataQueryReader();
void GetColorContexts(
[In] int cCount,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContexts,
[Out] out int pcActualCount);
IWICBitmapSource GetThumbnail();
}
}

View File

@@ -1,49 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapFrameEncode)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapFrameEncode
{
void Initialize(
[In] IPropertyBag2 pIEncoderOptions);
void SetSize(
[In] int uiWidth,
[In] int uiHeight);
void SetResolution(
[In] double dpiX,
[In] double dpiY);
void SetPixelFormat(
[In, Out] ref Guid pPixelFormat);
void SetColorContexts(
[In] int cCount,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContext);
void SetPalette(
[In] IWICPalette pIPalette);
void SetThumbnail(
[In] IWICBitmapSource pIThumbnail);
void WritePixels(
[In] int lineCount,
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbPixels);
void WriteSource(
[In] IWICBitmapSource pIBitmapSource,
[In] IntPtr prc);
void Commit();
IWICMetadataQueryWriter GetMetadataQueryWriter();
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapLock)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapLock
{
void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
int GetStride();
IntPtr GetDataPointer( // byte*
[Out] out int pcbBufferSize);
Guid GetPixelFormat();
}
}

View File

@@ -1,40 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapScaler)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapScaler : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
void Initialize(
[In] IWICBitmapSource pISource,
[In] int uiWidth,
[In] int uiHeight,
[In] WICBitmapInterpolationMode mode);
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICBitmapSource)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICBitmapSource
{
void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
Guid GetPixelFormat();
void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
void CopyPalette(
[In] IWICPalette pIPalette);
void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICColorContext)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICColorContext
{
void InitializeFromFilename(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzFilename);
void InitializeFromMemory(
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] pbBuffer,
[In] int cbBufferSize);
void InitializeFromExifColorSpace(
[In] ExifColorSpace value);
WICColorContextType GetType();
void GetProfileBytes(
[In] int cbBuffer,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 0)] byte[] pbBuffer,
[Out] out int pcbActual);
ExifColorSpace GetExifColorSpace();
}
}

View File

@@ -1,40 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICColorTransform)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICColorTransform : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
void Initialize(
[In] IWICBitmapSource pIBitmapSource,
[In] IWICColorContext pIContextSource,
[In] IWICColorContext pIContextDest,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid pixelFmtDest);
}
}

View File

@@ -1,140 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICComponentFactory)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICComponentFactory : IWICImagingFactory
{
#region Members inherited from `IWICImagingFactory`
new IWICBitmapDecoder CreateDecoderFromFilename(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzFilename,
[In] IntPtr pguidVendor,
[In] StreamAccessMode dwDesiredAccess,
[In] WICDecodeOptions metadataOptions);
new IWICBitmapDecoder CreateDecoderFromStream(
[In] IStream pIStream,
[In] IntPtr pguidVendor,
[In] WICDecodeOptions metadataOptions);
new IWICBitmapDecoder CreateDecoderFromFileHandle(
[In] IntPtr hFile,
[In] IntPtr pguidVendor,
[In] WICDecodeOptions metadataOptions);
new IWICComponentInfo CreateComponentInfo(
[In] Guid clsidComponent);
new IWICBitmapDecoder CreateDecoder(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor);
new IWICBitmapEncoder CreateEncoder(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor);
new IWICPalette CreatePalette();
new IWICFormatConverter CreateFormatConverter();
new IWICBitmapScaler CreateBitmapScaler();
new IWICBitmapClipper CreateBitmapClipper();
new IWICBitmapFlipRotator CreateBitmapFlipRotator();
new IWICStream CreateStream();
new IWICColorContext CreateColorContext();
new IWICColorTransform CreateColorTransformer();
new IWICBitmap CreateBitmap(
[In] int uiWidth,
[In] int uiHeight,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid pixelFormat,
[In] WICBitmapCreateCacheOption option);
new IWICBitmap CreateBitmapFromSource(
[In] IWICBitmapSource pIBitmapSource,
[In] WICBitmapCreateCacheOption option);
new IWICBitmap CreateBitmapFromSourceRect(
[In] IWICBitmapSource pIBitmapSource,
[In] int x,
[In] int y,
[In] int width,
[In] int height);
new IWICBitmap CreateBitmapFromMemory(
[In] int uiWidth,
[In] int uiHeight,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid pixelFormat,
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 4)] byte[] pbBuffer);
new IWICBitmap CreateBitmapFromHBITMAP(
[In] IntPtr hBitmap,
[In] IntPtr hPalette,
[In] WICBitmapAlphaChannelOption options);
new IWICBitmap CreateBitmapFromHICON(
[In] IntPtr hIcon);
new IEnumUnknown CreateComponentEnumerator(
[In] WICComponentType componentTypes,
[In] WICComponentEnumerateOptions options);
new IWICFastMetadataEncoder CreateFastMetadataEncoderFromDecoder(
[In] IWICBitmapDecoder pIDecoder);
new IWICFastMetadataEncoder CreateFastMetadataEncoderFromFrameDecode(
[In] IWICBitmapFrameDecode pIFrameDecoder);
new IWICMetadataQueryWriter CreateQueryWriter(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidMetadataFormat,
[In] IntPtr pguidVendor);
new IWICMetadataQueryWriter CreateQueryWriterFromReader(
[In] IWICMetadataQueryReader pIQueryReader,
[In] IntPtr pguidVendor);
#endregion
IWICMetadataReader CreateMetadataReader(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor,
[In] MetadataCreationAndPersistOptions dwOptions,
[In] IStream pIStream);
IWICMetadataReader CreateMetadataReaderFromContainer(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor,
[In] MetadataCreationAndPersistOptions dwOptions,
[In] IStream pIStream);
IWICMetadataWriter CreateMetadataWriter(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor,
[In] WICMetadataCreationOptions dwMetadataOptions);
IWICMetadataWriter CreateMetadataWriterFromReader(
[In] IWICMetadataReader pIReader,
[In] IntPtr pguidVendor);
IWICMetadataQueryReader CreateQueryReaderFromBlockReader(
[In] IWICMetadataBlockReader pIBlockReader);
IWICMetadataQueryWriter CreateQueryWriterFromBlockWriter(
[In] IWICMetadataBlockWriter pIBlockWriter);
IPropertyBag2 CreateEncoderPropertyBag(
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] PROPBAG2[] ppropOptions,
[In] int cCount);
};
}

View File

@@ -1,39 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICComponentInfo)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICComponentInfo
{
WICComponentType GetComponentType();
Guid GetCLSID();
WICComponentSigning GetSigningStatus();
void GetAuthor(
[In] int cchAuthor,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzAuthor,
[Out] out int pcchActual);
Guid GetVendorGUID();
void GetVersion(
[In] int cchVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzVersion,
[Out] out int pcchActual);
void GetSpecVersion(
[In] int cchSpecVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzSpecVersion,
[Out] out int pcchActual);
void GetFriendlyName(
[In] int cchFriendlyName,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFriendlyName,
[Out] out int pcchActual);
}
}

View File

@@ -1,24 +0,0 @@
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICEnumMetadataItem)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICEnumMetadataItem
{
void Next(
[In] int celt,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPVARIANT[] rgeltSchema,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPVARIANT[] rgeltId,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPVARIANT[] rgeltValue,
[Out] out int pceltFetched);
void Skip(
[In] int celt);
void Reset();
IWICEnumMetadataItem Clone();
}
}

View File

@@ -1,14 +0,0 @@
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICFastMetadataEncoder)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICFastMetadataEncoder
{
void Commit();
IWICMetadataQueryWriter GetMetadataQueryWriter();
}
}

View File

@@ -1,46 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICFormatConverter)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICFormatConverter : IWICBitmapSource
{
#region Members inherited from `IWICBitmapSource`
new void GetSize(
[Out] out int puiWidth,
[Out] out int puiHeight);
new Guid GetPixelFormat();
new void GetResolution(
[Out] out double pDpiX,
[Out] out double pDpiY);
new void CopyPalette(
[In] IWICPalette pIPalette);
new void CopyPixels(
[In] IntPtr prc, // WICRect*
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] pbBuffer);
#endregion
void Initialize(
[In] IWICBitmapSource pISource,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid dstFormat,
[In] WICBitmapDitherType dither,
[In] IWICPalette pIPalette,
[In] double alphaThresholdPercent,
[In] WICBitmapPaletteType paletteTranslate);
bool CanConvert(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid srcPixelFormat,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid dstPixelFormat);
}
}

View File

@@ -1,50 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICFormatConverterInfo)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICFormatConverterInfo : IWICComponentInfo
{
#region Members inherited from `IWICComponentInfo`
new WICComponentType GetComponentType();
new Guid GetCLSID();
new WICComponentSigning GetSigningStatus();
new void GetAuthor(
[In] int cchAuthor,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzAuthor,
[Out] out int pcchActual);
new Guid GetVendorGUID();
new void GetVersion(
[In] int cchVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzVersion,
[Out] out int pcchActual);
new void GetSpecVersion(
[In] int cchSpecVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzSpecVersion,
[Out] out int pcchActual);
new void GetFriendlyName(
[In] int cchFriendlyName,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFriendlyName,
[Out] out int pcchActual);
#endregion
void GetPixelFormats(
[In] int cFormats,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] pPixelFormatGUIDs,
[Out] out int pcActual);
IWICFormatConverter CreateInstance();
}
}

View File

@@ -1,105 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICImagingFactory)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICImagingFactory
{
IWICBitmapDecoder CreateDecoderFromFilename(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzFilename,
[In] IntPtr pguidVendor,
[In] StreamAccessMode dwDesiredAccess,
[In] WICDecodeOptions metadataOptions);
IWICBitmapDecoder CreateDecoderFromStream(
[In] IStream pIStream,
[In] IntPtr pguidVendor,
[In] WICDecodeOptions metadataOptions);
IWICBitmapDecoder CreateDecoderFromFileHandle(
[In] IntPtr hFile,
[In] IntPtr pguidVendor,
[In] WICDecodeOptions metadataOptions);
IWICComponentInfo CreateComponentInfo(
[In] Guid clsidComponent);
IWICBitmapDecoder CreateDecoder(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor);
IWICBitmapEncoder CreateEncoder(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidContainerFormat,
[In] IntPtr pguidVendor);
IWICPalette CreatePalette();
IWICFormatConverter CreateFormatConverter();
IWICBitmapScaler CreateBitmapScaler();
IWICBitmapClipper CreateBitmapClipper();
IWICBitmapFlipRotator CreateBitmapFlipRotator();
IWICStream CreateStream();
IWICColorContext CreateColorContext();
IWICColorTransform CreateColorTransformer();
IWICBitmap CreateBitmap(
[In] int uiWidth,
[In] int uiHeight,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid pixelFormat,
[In] WICBitmapCreateCacheOption option);
IWICBitmap CreateBitmapFromSource(
[In] IWICBitmapSource pIBitmapSource,
[In] WICBitmapCreateCacheOption option);
IWICBitmap CreateBitmapFromSourceRect(
[In] IWICBitmapSource pIBitmapSource,
[In] int x,
[In] int y,
[In] int width,
[In] int height);
IWICBitmap CreateBitmapFromMemory(
[In] int uiWidth,
[In] int uiHeight,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid pixelFormat,
[In] int cbStride,
[In] int cbBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 4)] byte[] pbBuffer);
IWICBitmap CreateBitmapFromHBITMAP(
[In] IntPtr hBitmap,
[In] IntPtr hPalette,
[In] WICBitmapAlphaChannelOption options);
IWICBitmap CreateBitmapFromHICON(
[In] IntPtr hIcon);
IEnumUnknown CreateComponentEnumerator(
[In] WICComponentType componentTypes,
[In] WICComponentEnumerateOptions options);
IWICFastMetadataEncoder CreateFastMetadataEncoderFromDecoder(
[In] IWICBitmapDecoder pIDecoder);
IWICFastMetadataEncoder CreateFastMetadataEncoderFromFrameDecode(
[In] IWICBitmapFrameDecode pIFrameDecoder);
IWICMetadataQueryWriter CreateQueryWriter(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid guidMetadataFormat,
[In] IntPtr pguidVendor);
IWICMetadataQueryWriter CreateQueryWriterFromReader(
[In] IWICMetadataQueryReader pIQueryReader,
[In] IntPtr pguidVendor);
}
}

View File

@@ -1,20 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICMetadataBlockReader)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICMetadataBlockReader
{
Guid GetContainerFormat();
int GetCount();
IWICMetadataReader GetReaderByIndex(
[In] int nIndex);
IEnumUnknown GetEnumerator();
}
}

View File

@@ -1,40 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICMetadataBlockWriter)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICMetadataBlockWriter : IWICMetadataBlockReader
{
#region Members inherited from `IWICMetadataBlockReader`
new Guid GetContainerFormat();
new int GetCount();
new IWICMetadataReader GetReaderByIndex(
[In] int nIndex);
new IEnumUnknown GetEnumerator();
#endregion
void InitializeFromBlockReader(
[In] IWICMetadataBlockReader pIMDBlockReader);
IWICMetadataWriter GetWriterByIndex(
[In] int nIndex);
void AddWriter(
[In] IWICMetadataWriter pIMetadataWriter);
void SetWriterByIndex(
[In] int nIndex,
[In] IWICMetadataWriter pIMetadataWriter);
void RemoveWriterByIndex(
[In] int nIndex);
}
}

View File

@@ -1,66 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICMetadataHandlerInfo)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICMetadataHandlerInfo : IWICComponentInfo
{
#region Members inherited from `IWICComponentInfo`
new WICComponentType GetComponentType();
new Guid GetCLSID();
new WICComponentSigning GetSigningStatus();
new void GetAuthor(
[In] int cchAuthor,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzAuthor,
[Out] out int pcchActual);
new Guid GetVendorGUID();
new void GetVersion(
[In] int cchVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzVersion,
[Out] out int pcchActual);
new void GetSpecVersion(
[In] int cchSpecVersion,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzSpecVersion,
[Out] out int pcchActual);
new void GetFriendlyName(
[In] int cchFriendlyName,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzFriendlyName,
[Out] out int pcchActual);
#endregion
Guid GetMetadataFormat();
void GetContainerFormats(
[In] int cContainerFormats,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] pguidContainerFormats,
[Out] out int pcchActual);
void GetDeviceManufacturer(
[In] int cchDeviceManufacturer,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceManufacturer,
[Out] out int pcchActual);
void GetDeviceModels(
[In] int cchDeviceModels,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzDeviceModels,
[Out] out int pcchActual);
bool DoesRequireFullStream();
bool DoesSupportPadding();
bool DoesRequireFixedSize();
}
}

View File

@@ -1,24 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICMetadataQueryReader)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICMetadataQueryReader
{
Guid GetContainerFormat();
void GetLocation(
[In] int cchMaxLength,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzNamespace,
[Out] out int pcchActualLength);
void GetMetadataByName(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzName,
[In, Out, MarshalAs(UnmanagedType.Struct)] ref PROPVARIANT pvarValue);
IEnumString GetEnumerator();
}
}

View File

@@ -1,35 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace WIC
{
[ComImport]
[Guid(IID.IWICMetadataQueryWriter)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWICMetadataQueryWriter : IWICMetadataQueryReader
{
#region Members inherited from `IWICMetadataQueryReader`
new Guid GetContainerFormat();
new void GetLocation(
[In] int cchMaxLength,
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeParamIndex = 0)] char[] wzNamespace,
[Out] out int pcchActualLength);
new void GetMetadataByName(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzName,
[In, Out, MarshalAs(UnmanagedType.Struct)] ref PROPVARIANT pvarValue);
new IEnumString GetEnumerator();
#endregion
void SetMetadataByName(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzName,
[In, MarshalAs(UnmanagedType.Struct)] ref PROPVARIANT pvarValue);
void RemoveMetadataByName(
[In, MarshalAs(UnmanagedType.LPWStr)] string wzName);
}
}

Some files were not shown because too many files have changed in this diff Show More