diff --git a/PInvoke/Graphics/CorrelationReport.md b/PInvoke/Graphics/CorrelationReport.md new file mode 100644 index 00000000..89feaed1 --- /dev/null +++ b/PInvoke/Graphics/CorrelationReport.md @@ -0,0 +1,255 @@ +## Correlation report for d2d1.dll, dxgi.dll, dwrite.dll, windowscodecs.dll +### Methods (100% complete, 25 of 25 functions) +Native Method | Native DLL | Header | Managed Method +--- | --- | --- | --- +[CreateDXGIFactory](https://www.google.com/search?num=5&q=CreateDXGIFactory+site%3Adocs.microsoft.com) | dxgi.dll | dxgi.h | [Vanara.PInvoke.DXGI.CreateDXGIFactory](https://github.com/dahall/Vanara/search?l=C%23&q=CreateDXGIFactory) +[CreateDXGIFactory1](https://www.google.com/search?num=5&q=CreateDXGIFactory1+site%3Adocs.microsoft.com) | dxgi.dll | dxgi.h | [Vanara.PInvoke.DXGI.CreateDXGIFactory1](https://github.com/dahall/Vanara/search?l=C%23&q=CreateDXGIFactory1) +[CreateDXGIFactory2](https://www.google.com/search?num=5&q=CreateDXGIFactory2+site%3Adocs.microsoft.com) | dxgi.dll | dxgi1_3.h | [Vanara.PInvoke.DXGI.CreateDXGIFactory2](https://github.com/dahall/Vanara/search?l=C%23&q=CreateDXGIFactory2) +[D2D1ComputeMaximumScaleFactor](https://www.google.com/search?num=5&q=D2D1ComputeMaximumScaleFactor+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_2.h | [Vanara.PInvoke.D2d1.D2D1ComputeMaximumScaleFactor](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1ComputeMaximumScaleFactor) +[D2D1ConvertColorSpace](https://www.google.com/search?num=5&q=D2D1ConvertColorSpace+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1ConvertColorSpace](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1ConvertColorSpace) +[D2D1CreateDevice](https://www.google.com/search?num=5&q=D2D1CreateDevice+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1CreateDevice](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1CreateDevice) +[D2D1CreateDeviceContext](https://www.google.com/search?num=5&q=D2D1CreateDeviceContext+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1CreateDeviceContext](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1CreateDeviceContext) +[D2D1CreateFactory](https://www.google.com/search?num=5&q=D2D1CreateFactory+site%3Adocs.microsoft.com) | d2d1.dll | d2d1.h | [Vanara.PInvoke.D2d1.D2D1CreateFactory](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1CreateFactory) +[D2D1GetGradientMeshInteriorPointsFromCoonsPatch](https://www.google.com/search?num=5&q=D2D1GetGradientMeshInteriorPointsFromCoonsPatch+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_3.h | [Vanara.PInvoke.D2d1.D2D1GetGradientMeshInteriorPointsFromCoonsPatch](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1GetGradientMeshInteriorPointsFromCoonsPatch) +[D2D1InvertMatrix](https://www.google.com/search?num=5&q=D2D1InvertMatrix+site%3Adocs.microsoft.com) | d2d1.dll | d2d1.h | [Vanara.PInvoke.D2d1.D2D1InvertMatrix](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1InvertMatrix) +[D2D1IsMatrixInvertible](https://www.google.com/search?num=5&q=D2D1IsMatrixInvertible+site%3Adocs.microsoft.com) | d2d1.dll | d2d1.h | [Vanara.PInvoke.D2d1.D2D1IsMatrixInvertible](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1IsMatrixInvertible) +[D2D1MakeRotateMatrix](https://www.google.com/search?num=5&q=D2D1MakeRotateMatrix+site%3Adocs.microsoft.com) | d2d1.dll | d2d1.h | [Vanara.PInvoke.D2d1.D2D1MakeRotateMatrix](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1MakeRotateMatrix) +[D2D1MakeSkewMatrix](https://www.google.com/search?num=5&q=D2D1MakeSkewMatrix+site%3Adocs.microsoft.com) | d2d1.dll | d2d1.h | [Vanara.PInvoke.D2d1.D2D1MakeSkewMatrix](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1MakeSkewMatrix) +[D2D1SinCos](https://www.google.com/search?num=5&q=D2D1SinCos+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1SinCos](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1SinCos) +[D2D1Tan](https://www.google.com/search?num=5&q=D2D1Tan+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1Tan](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1Tan) +[D2D1Vec3Length](https://www.google.com/search?num=5&q=D2D1Vec3Length+site%3Adocs.microsoft.com) | d2d1.dll | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1Vec3Length](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1Vec3Length) +[DWriteCreateFactory](https://www.google.com/search?num=5&q=DWriteCreateFactory+site%3Adocs.microsoft.com) | dwrite.dll | dwrite.h | [Vanara.PInvoke.Dwrite.DWriteCreateFactory](https://github.com/dahall/Vanara/search?l=C%23&q=DWriteCreateFactory) +[DXGIDeclareAdapterRemovalSupport](https://www.google.com/search?num=5&q=DXGIDeclareAdapterRemovalSupport+site%3Adocs.microsoft.com) | dxgi.dll | dxgi1_6.h | [Vanara.PInvoke.DXGI.DXGIDeclareAdapterRemovalSupport](https://github.com/dahall/Vanara/search?l=C%23&q=DXGIDeclareAdapterRemovalSupport) +[DXGIGetDebugInterface1](https://www.google.com/search?num=5&q=DXGIGetDebugInterface1+site%3Adocs.microsoft.com) | dxgi.dll | dxgi1_3.h | [Vanara.PInvoke.DXGI.DXGIGetDebugInterface1](https://github.com/dahall/Vanara/search?l=C%23&q=DXGIGetDebugInterface1) +[WICConvertBitmapSource](https://www.google.com/search?num=5&q=WICConvertBitmapSource+site%3Adocs.microsoft.com) | windowscodecs.dll | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICConvertBitmapSource](https://github.com/dahall/Vanara/search?l=C%23&q=WICConvertBitmapSource) +[WICCreateBitmapFromSection](https://www.google.com/search?num=5&q=WICCreateBitmapFromSection+site%3Adocs.microsoft.com) | windowscodecs.dll | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICCreateBitmapFromSection](https://github.com/dahall/Vanara/search?l=C%23&q=WICCreateBitmapFromSection) +[WICCreateBitmapFromSectionEx](https://www.google.com/search?num=5&q=WICCreateBitmapFromSectionEx+site%3Adocs.microsoft.com) | windowscodecs.dll | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICCreateBitmapFromSectionEx](https://github.com/dahall/Vanara/search?l=C%23&q=WICCreateBitmapFromSectionEx) +[WICMapGuidToShortName](https://www.google.com/search?num=5&q=WICMapGuidToShortName+site%3Adocs.microsoft.com) | windowscodecs.dll | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICMapGuidToShortName](https://github.com/dahall/Vanara/search?l=C%23&q=WICMapGuidToShortName) +[WICMapSchemaToName](https://www.google.com/search?num=5&q=WICMapSchemaToName+site%3Adocs.microsoft.com) | windowscodecs.dll | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICMapSchemaToName](https://github.com/dahall/Vanara/search?l=C%23&q=WICMapSchemaToName) +[WICMapShortNameToGuid](https://www.google.com/search?num=5&q=WICMapShortNameToGuid+site%3Adocs.microsoft.com) | windowscodecs.dll | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICMapShortNameToGuid](https://github.com/dahall/Vanara/search?l=C%23&q=WICMapShortNameToGuid) +### Structures +Native Structure | Header | Managed Structure +--- | --- | --- +[D2D_MATRIX_3X2_F](https://www.google.com/search?num=5&q=D2D_MATRIX_3X2_F+site%3Adocs.microsoft.com) | dcommon.h | [Vanara.PInvoke.D2d1.D2D_MATRIX_3X2_F](https://github.com/dahall/Vanara/search?l=C%23&q=D2D_MATRIX_3X2_F) +[D2D_POINT_2F](https://www.google.com/search?num=5&q=D2D_POINT_2F+site%3Adocs.microsoft.com) | dcommon.h | [Vanara.PInvoke.D2d1.D2D_POINT_2F](https://github.com/dahall/Vanara/search?l=C%23&q=D2D_POINT_2F) +[D2D_RECT_F](https://www.google.com/search?num=5&q=D2D_RECT_F+site%3Adocs.microsoft.com) | dcommon.h | [Vanara.PInvoke.D2d1.D2D_RECT_F](https://github.com/dahall/Vanara/search?l=C%23&q=D2D_RECT_F) +[D2D_SIZE_F](https://www.google.com/search?num=5&q=D2D_SIZE_F+site%3Adocs.microsoft.com) | dcommon.h | [Vanara.PInvoke.D2d1.D2D_SIZE_F](https://github.com/dahall/Vanara/search?l=C%23&q=D2D_SIZE_F) +[D2D_SIZE_U](https://www.google.com/search?num=5&q=D2D_SIZE_U+site%3Adocs.microsoft.com) | dcommon.h | [Vanara.PInvoke.D2d1.D2D_SIZE_U](https://github.com/dahall/Vanara/search?l=C%23&q=D2D_SIZE_U) +[D2D1_ARC_SEGMENT](https://www.google.com/search?num=5&q=D2D1_ARC_SEGMENT+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_ARC_SEGMENT](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_ARC_SEGMENT) +[D2D1_BEZIER_SEGMENT](https://www.google.com/search?num=5&q=D2D1_BEZIER_SEGMENT+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_BEZIER_SEGMENT](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_BEZIER_SEGMENT) +[D2D1_BITMAP_BRUSH_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_BITMAP_BRUSH_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_BITMAP_BRUSH_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_BITMAP_BRUSH_PROPERTIES) +[D2D1_BITMAP_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_BITMAP_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_BITMAP_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_BITMAP_PROPERTIES) +[D2D1_BITMAP_PROPERTIES1](https://www.google.com/search?num=5&q=D2D1_BITMAP_PROPERTIES1+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_BITMAP_PROPERTIES1](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_BITMAP_PROPERTIES1) +[D2D1_BRUSH_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_BRUSH_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_BRUSH_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_BRUSH_PROPERTIES) +[D2D1_CREATION_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_CREATION_PROPERTIES+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_CREATION_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_CREATION_PROPERTIES) +[D2D1_DRAWING_STATE_DESCRIPTION](https://www.google.com/search?num=5&q=D2D1_DRAWING_STATE_DESCRIPTION+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_DRAWING_STATE_DESCRIPTION](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_DRAWING_STATE_DESCRIPTION) +[D2D1_EFFECT_INPUT_DESCRIPTION](https://www.google.com/search?num=5&q=D2D1_EFFECT_INPUT_DESCRIPTION+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_EFFECT_INPUT_DESCRIPTION](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_EFFECT_INPUT_DESCRIPTION) +[D2D1_ELLIPSE](https://www.google.com/search?num=5&q=D2D1_ELLIPSE+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_ELLIPSE](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_ELLIPSE) +[D2D1_FACTORY_OPTIONS](https://www.google.com/search?num=5&q=D2D1_FACTORY_OPTIONS+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_FACTORY_OPTIONS](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_FACTORY_OPTIONS) +[D2D1_GRADIENT_STOP](https://www.google.com/search?num=5&q=D2D1_GRADIENT_STOP+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_GRADIENT_STOP](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_GRADIENT_STOP) +[D2D1_HWND_RENDER_TARGET_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_HWND_RENDER_TARGET_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_HWND_RENDER_TARGET_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_HWND_RENDER_TARGET_PROPERTIES) +[D2D1_IMAGE_BRUSH_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_IMAGE_BRUSH_PROPERTIES+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_IMAGE_BRUSH_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_IMAGE_BRUSH_PROPERTIES) +[D2D1_LAYER_PARAMETERS](https://www.google.com/search?num=5&q=D2D1_LAYER_PARAMETERS+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_LAYER_PARAMETERS](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_LAYER_PARAMETERS) +[D2D1_LAYER_PARAMETERS1](https://www.google.com/search?num=5&q=D2D1_LAYER_PARAMETERS1+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_LAYER_PARAMETERS1](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_LAYER_PARAMETERS1) +[D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES) +[D2D1_MAPPED_RECT](https://www.google.com/search?num=5&q=D2D1_MAPPED_RECT+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_MAPPED_RECT](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_MAPPED_RECT) +[D2D1_PIXEL_FORMAT](https://www.google.com/search?num=5&q=D2D1_PIXEL_FORMAT+site%3Adocs.microsoft.com) | dcommon.h | [Vanara.PInvoke.D2d1.D2D1_PIXEL_FORMAT](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_PIXEL_FORMAT) +[D2D1_PRINT_CONTROL_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_PRINT_CONTROL_PROPERTIES+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_PRINT_CONTROL_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_PRINT_CONTROL_PROPERTIES) +[D2D1_QUADRATIC_BEZIER_SEGMENT](https://www.google.com/search?num=5&q=D2D1_QUADRATIC_BEZIER_SEGMENT+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_QUADRATIC_BEZIER_SEGMENT](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_QUADRATIC_BEZIER_SEGMENT) +[D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES) +[D2D1_RENDER_TARGET_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_RENDER_TARGET_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_RENDER_TARGET_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_RENDER_TARGET_PROPERTIES) +[D2D1_RENDERING_CONTROLS](https://www.google.com/search?num=5&q=D2D1_RENDERING_CONTROLS+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.D2D1_RENDERING_CONTROLS](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_RENDERING_CONTROLS) +[D2D1_ROUNDED_RECT](https://www.google.com/search?num=5&q=D2D1_ROUNDED_RECT+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_ROUNDED_RECT](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_ROUNDED_RECT) +[D2D1_STROKE_STYLE_PROPERTIES](https://www.google.com/search?num=5&q=D2D1_STROKE_STYLE_PROPERTIES+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_STROKE_STYLE_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_STROKE_STYLE_PROPERTIES) +[D2D1_TRIANGLE](https://www.google.com/search?num=5&q=D2D1_TRIANGLE+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.D2D1_TRIANGLE](https://github.com/dahall/Vanara/search?l=C%23&q=D2D1_TRIANGLE) +[D3DCOLORVALUE](https://www.google.com/search?num=5&q=D3DCOLORVALUE+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.D2d1.D3DCOLORVALUE](https://github.com/dahall/Vanara/search?l=C%23&q=D3DCOLORVALUE) +[DWRITE_CLUSTER_METRICS](https://www.google.com/search?num=5&q=DWRITE_CLUSTER_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_CLUSTER_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_CLUSTER_METRICS) +[DWRITE_FONT_FEATURE](https://www.google.com/search?num=5&q=DWRITE_FONT_FEATURE+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_FONT_FEATURE](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_FONT_FEATURE) +[DWRITE_FONT_METRICS](https://www.google.com/search?num=5&q=DWRITE_FONT_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_FONT_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_FONT_METRICS) +[DWRITE_GLYPH_METRICS](https://www.google.com/search?num=5&q=DWRITE_GLYPH_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_GLYPH_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_GLYPH_METRICS) +[DWRITE_GLYPH_OFFSET](https://www.google.com/search?num=5&q=DWRITE_GLYPH_OFFSET+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_GLYPH_OFFSET](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_GLYPH_OFFSET) +[DWRITE_GLYPH_RUN](https://www.google.com/search?num=5&q=DWRITE_GLYPH_RUN+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.D2d1.DWRITE_GLYPH_RUN](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_GLYPH_RUN) +[DWRITE_GLYPH_RUN](https://www.google.com/search?num=5&q=DWRITE_GLYPH_RUN+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_GLYPH_RUN](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_GLYPH_RUN) +[DWRITE_GLYPH_RUN_DESCRIPTION](https://www.google.com/search?num=5&q=DWRITE_GLYPH_RUN_DESCRIPTION+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_GLYPH_RUN_DESCRIPTION](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_GLYPH_RUN_DESCRIPTION) +[DWRITE_HIT_TEST_METRICS](https://www.google.com/search?num=5&q=DWRITE_HIT_TEST_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_HIT_TEST_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_HIT_TEST_METRICS) +[DWRITE_INLINE_OBJECT_METRICS](https://www.google.com/search?num=5&q=DWRITE_INLINE_OBJECT_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_INLINE_OBJECT_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_INLINE_OBJECT_METRICS) +[DWRITE_LINE_BREAKPOINT](https://www.google.com/search?num=5&q=DWRITE_LINE_BREAKPOINT+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_LINE_BREAKPOINT](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_LINE_BREAKPOINT) +[DWRITE_LINE_METRICS](https://www.google.com/search?num=5&q=DWRITE_LINE_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_LINE_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_LINE_METRICS) +[DWRITE_MATRIX](https://www.google.com/search?num=5&q=DWRITE_MATRIX+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_MATRIX](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_MATRIX) +[DWRITE_OVERHANG_METRICS](https://www.google.com/search?num=5&q=DWRITE_OVERHANG_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_OVERHANG_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_OVERHANG_METRICS) +[DWRITE_SCRIPT_ANALYSIS](https://www.google.com/search?num=5&q=DWRITE_SCRIPT_ANALYSIS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_SCRIPT_ANALYSIS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_SCRIPT_ANALYSIS) +[DWRITE_SHAPING_GLYPH_PROPERTIES](https://www.google.com/search?num=5&q=DWRITE_SHAPING_GLYPH_PROPERTIES+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_SHAPING_GLYPH_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_SHAPING_GLYPH_PROPERTIES) +[DWRITE_SHAPING_TEXT_PROPERTIES](https://www.google.com/search?num=5&q=DWRITE_SHAPING_TEXT_PROPERTIES+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_SHAPING_TEXT_PROPERTIES](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_SHAPING_TEXT_PROPERTIES) +[DWRITE_STRIKETHROUGH](https://www.google.com/search?num=5&q=DWRITE_STRIKETHROUGH+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_STRIKETHROUGH](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_STRIKETHROUGH) +[DWRITE_TEXT_METRICS](https://www.google.com/search?num=5&q=DWRITE_TEXT_METRICS+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_TEXT_METRICS](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_TEXT_METRICS) +[DWRITE_TEXT_RANGE](https://www.google.com/search?num=5&q=DWRITE_TEXT_RANGE+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_TEXT_RANGE](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_TEXT_RANGE) +[DWRITE_TRIMMING](https://www.google.com/search?num=5&q=DWRITE_TRIMMING+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_TRIMMING](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_TRIMMING) +[DWRITE_TYPOGRAPHIC_FEATURES](https://www.google.com/search?num=5&q=DWRITE_TYPOGRAPHIC_FEATURES+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_TYPOGRAPHIC_FEATURES](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_TYPOGRAPHIC_FEATURES) +[DWRITE_UNDERLINE](https://www.google.com/search?num=5&q=DWRITE_UNDERLINE+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.DWRITE_UNDERLINE](https://github.com/dahall/Vanara/search?l=C%23&q=DWRITE_UNDERLINE) +[DXGI_ADAPTER_DESC](https://www.google.com/search?num=5&q=DXGI_ADAPTER_DESC+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_ADAPTER_DESC](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_ADAPTER_DESC) +[DXGI_ADAPTER_DESC1](https://www.google.com/search?num=5&q=DXGI_ADAPTER_DESC1+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_ADAPTER_DESC1](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_ADAPTER_DESC1) +[DXGI_FRAME_STATISTICS](https://www.google.com/search?num=5&q=DXGI_FRAME_STATISTICS+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_FRAME_STATISTICS](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_FRAME_STATISTICS) +[DXGI_GAMMA_CONTROL](https://www.google.com/search?num=5&q=DXGI_GAMMA_CONTROL+site%3Adocs.microsoft.com) | DXGI.h | [Vanara.PInvoke.DXGI.DXGI_GAMMA_CONTROL](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_GAMMA_CONTROL) +[DXGI_GAMMA_CONTROL_CAPABILITIES](https://www.google.com/search?num=5&q=DXGI_GAMMA_CONTROL_CAPABILITIES+site%3Adocs.microsoft.com) | dxgitype.h | [Vanara.PInvoke.DXGI.DXGI_GAMMA_CONTROL_CAPABILITIES](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_GAMMA_CONTROL_CAPABILITIES) +[DXGI_JPEG_AC_HUFFMAN_TABLE](https://www.google.com/search?num=5&q=DXGI_JPEG_AC_HUFFMAN_TABLE+site%3Adocs.microsoft.com) | dxgitype.h | [Vanara.PInvoke.D2d1.DXGI_JPEG_AC_HUFFMAN_TABLE](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_JPEG_AC_HUFFMAN_TABLE) +[DXGI_JPEG_DC_HUFFMAN_TABLE](https://www.google.com/search?num=5&q=DXGI_JPEG_DC_HUFFMAN_TABLE+site%3Adocs.microsoft.com) | dxgitype.h | [Vanara.PInvoke.D2d1.DXGI_JPEG_DC_HUFFMAN_TABLE](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_JPEG_DC_HUFFMAN_TABLE) +[DXGI_JPEG_QUANTIZATION_TABLE](https://www.google.com/search?num=5&q=DXGI_JPEG_QUANTIZATION_TABLE+site%3Adocs.microsoft.com) | dxgitype.h | [Vanara.PInvoke.D2d1.DXGI_JPEG_QUANTIZATION_TABLE](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_JPEG_QUANTIZATION_TABLE) +[DXGI_MAPPED_RECT](https://www.google.com/search?num=5&q=DXGI_MAPPED_RECT+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_MAPPED_RECT](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_MAPPED_RECT) +[DXGI_MODE_DESC](https://www.google.com/search?num=5&q=DXGI_MODE_DESC+site%3Adocs.microsoft.com) | DXGI.h | [Vanara.PInvoke.DXGI.DXGI_MODE_DESC](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_MODE_DESC) +[DXGI_OUTPUT_DESC](https://www.google.com/search?num=5&q=DXGI_OUTPUT_DESC+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_OUTPUT_DESC](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_OUTPUT_DESC) +[DXGI_RATIONAL](https://www.google.com/search?num=5&q=DXGI_RATIONAL+site%3Adocs.microsoft.com) | dxgicommon.h | [Vanara.PInvoke.DXGI.DXGI_RATIONAL](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_RATIONAL) +[DXGI_RGB](https://www.google.com/search?num=5&q=DXGI_RGB+site%3Adocs.microsoft.com) | DXGI.h | [Vanara.PInvoke.DXGI.DXGI_RGB](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_RGB) +[DXGI_SAMPLE_DESC](https://www.google.com/search?num=5&q=DXGI_SAMPLE_DESC+site%3Adocs.microsoft.com) | dxgicommon.h | [Vanara.PInvoke.DXGI.DXGI_SAMPLE_DESC](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_SAMPLE_DESC) +[DXGI_SHARED_RESOURCE](https://www.google.com/search?num=5&q=DXGI_SHARED_RESOURCE+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_SHARED_RESOURCE](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_SHARED_RESOURCE) +[DXGI_SURFACE_DESC](https://www.google.com/search?num=5&q=DXGI_SURFACE_DESC+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_SURFACE_DESC](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_SURFACE_DESC) +[DXGI_SWAP_CHAIN_DESC](https://www.google.com/search?num=5&q=DXGI_SWAP_CHAIN_DESC+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.DXGI_SWAP_CHAIN_DESC](https://github.com/dahall/Vanara/search?l=C%23&q=DXGI_SWAP_CHAIN_DESC) +[PWICRect](https://www.google.com/search?num=5&q=PWICRect+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.PWICRect](https://github.com/dahall/Vanara/search?l=C%23&q=PWICRect) +[WICBitmapPattern](https://www.google.com/search?num=5&q=WICBitmapPattern+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICBitmapPattern](https://github.com/dahall/Vanara/search?l=C%23&q=WICBitmapPattern) +[WICBitmapPlane](https://www.google.com/search?num=5&q=WICBitmapPlane+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICBitmapPlane](https://github.com/dahall/Vanara/search?l=C%23&q=WICBitmapPlane) +[WICBitmapPlaneDescription](https://www.google.com/search?num=5&q=WICBitmapPlaneDescription+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICBitmapPlaneDescription](https://github.com/dahall/Vanara/search?l=C%23&q=WICBitmapPlaneDescription) +[WICDdsFormatInfo](https://www.google.com/search?num=5&q=WICDdsFormatInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICDdsFormatInfo](https://github.com/dahall/Vanara/search?l=C%23&q=WICDdsFormatInfo) +[WICDdsParameters](https://www.google.com/search?num=5&q=WICDdsParameters+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICDdsParameters](https://github.com/dahall/Vanara/search?l=C%23&q=WICDdsParameters) +[WICImageParameters](https://www.google.com/search?num=5&q=WICImageParameters+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICImageParameters](https://github.com/dahall/Vanara/search?l=C%23&q=WICImageParameters) +[WICJpegFrameHeader](https://www.google.com/search?num=5&q=WICJpegFrameHeader+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICJpegFrameHeader](https://github.com/dahall/Vanara/search?l=C%23&q=WICJpegFrameHeader) +[WICJpegScanHeader](https://www.google.com/search?num=5&q=WICJpegScanHeader+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICJpegScanHeader](https://github.com/dahall/Vanara/search?l=C%23&q=WICJpegScanHeader) +[WICMetadataHeader](https://www.google.com/search?num=5&q=WICMetadataHeader+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.WICMetadataHeader](https://github.com/dahall/Vanara/search?l=C%23&q=WICMetadataHeader) +[WICMetadataPattern](https://www.google.com/search?num=5&q=WICMetadataPattern+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.WICMetadataPattern](https://github.com/dahall/Vanara/search?l=C%23&q=WICMetadataPattern) +[WICRawCapabilitiesInfo](https://www.google.com/search?num=5&q=WICRawCapabilitiesInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICRawCapabilitiesInfo](https://github.com/dahall/Vanara/search?l=C%23&q=WICRawCapabilitiesInfo) +[WICRawToneCurve](https://www.google.com/search?num=5&q=WICRawToneCurve+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICRawToneCurve](https://github.com/dahall/Vanara/search?l=C%23&q=WICRawToneCurve) +[WICRawToneCurvePoint](https://www.google.com/search?num=5&q=WICRawToneCurvePoint+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICRawToneCurvePoint](https://github.com/dahall/Vanara/search?l=C%23&q=WICRawToneCurvePoint) +[WICRect](https://www.google.com/search?num=5&q=WICRect+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.WICRect](https://github.com/dahall/Vanara/search?l=C%23&q=WICRect) +### Interfaces +Native Interface | Header | Managed Interface +--- | --- | --- +[ID2D1Bitmap](https://www.google.com/search?num=5&q=ID2D1Bitmap+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Bitmap](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Bitmap) +[ID2D1Bitmap1](https://www.google.com/search?num=5&q=ID2D1Bitmap1+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1Bitmap1](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Bitmap1) +[ID2D1BitmapBrush](https://www.google.com/search?num=5&q=ID2D1BitmapBrush+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1BitmapBrush](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1BitmapBrush) +[ID2D1BitmapBrush1](https://www.google.com/search?num=5&q=ID2D1BitmapBrush1+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1BitmapBrush1](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1BitmapBrush1) +[ID2D1BitmapRenderTarget](https://www.google.com/search?num=5&q=ID2D1BitmapRenderTarget+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1BitmapRenderTarget](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1BitmapRenderTarget) +[ID2D1Brush](https://www.google.com/search?num=5&q=ID2D1Brush+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Brush](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Brush) +[ID2D1ColorContext](https://www.google.com/search?num=5&q=ID2D1ColorContext+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1ColorContext](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1ColorContext) +[ID2D1CommandList](https://www.google.com/search?num=5&q=ID2D1CommandList+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.D2d1.ID2D1CommandList](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1CommandList) +[ID2D1CommandSink](https://www.google.com/search?num=5&q=ID2D1CommandSink+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1CommandSink](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1CommandSink) +[ID2D1DCRenderTarget](https://www.google.com/search?num=5&q=ID2D1DCRenderTarget+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1DCRenderTarget](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1DCRenderTarget) +[ID2D1Device](https://www.google.com/search?num=5&q=ID2D1Device+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1Device](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Device) +[ID2D1DeviceContext](https://www.google.com/search?num=5&q=ID2D1DeviceContext+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1DeviceContext](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1DeviceContext) +[ID2D1DrawingStateBlock](https://www.google.com/search?num=5&q=ID2D1DrawingStateBlock+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1DrawingStateBlock](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1DrawingStateBlock) +[ID2D1Effect](https://www.google.com/search?num=5&q=ID2D1Effect+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1Effect](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Effect) +[ID2D1EllipseGeometry](https://www.google.com/search?num=5&q=ID2D1EllipseGeometry+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1EllipseGeometry](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1EllipseGeometry) +[ID2D1Factory](https://www.google.com/search?num=5&q=ID2D1Factory+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Factory](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Factory) +[ID2D1GdiMetafile](https://www.google.com/search?num=5&q=ID2D1GdiMetafile+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1GdiMetafile](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1GdiMetafile) +[ID2D1GdiMetafileSink](https://www.google.com/search?num=5&q=ID2D1GdiMetafileSink+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1GdiMetafileSink](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1GdiMetafileSink) +[ID2D1Geometry](https://www.google.com/search?num=5&q=ID2D1Geometry+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Geometry](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Geometry) +[ID2D1GeometryGroup](https://www.google.com/search?num=5&q=ID2D1GeometryGroup+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1GeometryGroup](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1GeometryGroup) +[ID2D1GeometrySink](https://www.google.com/search?num=5&q=ID2D1GeometrySink+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1GeometrySink](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1GeometrySink) +[ID2D1GradientStopCollection](https://www.google.com/search?num=5&q=ID2D1GradientStopCollection+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1GradientStopCollection](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1GradientStopCollection) +[ID2D1GradientStopCollection1](https://www.google.com/search?num=5&q=ID2D1GradientStopCollection1+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1GradientStopCollection1](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1GradientStopCollection1) +[ID2D1HwndRenderTarget](https://www.google.com/search?num=5&q=ID2D1HwndRenderTarget+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1HwndRenderTarget](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1HwndRenderTarget) +[ID2D1Image](https://www.google.com/search?num=5&q=ID2D1Image+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Image](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Image) +[ID2D1ImageBrush](https://www.google.com/search?num=5&q=ID2D1ImageBrush+site%3Adocs.microsoft.com) | d2d1_1.h | [Vanara.PInvoke.D2d1.ID2D1ImageBrush](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1ImageBrush) +[ID2D1Layer](https://www.google.com/search?num=5&q=ID2D1Layer+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Layer](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Layer) +[ID2D1LinearGradientBrush](https://www.google.com/search?num=5&q=ID2D1LinearGradientBrush+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1LinearGradientBrush](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1LinearGradientBrush) +[ID2D1Mesh](https://www.google.com/search?num=5&q=ID2D1Mesh+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Mesh](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Mesh) +[ID2D1PathGeometry](https://www.google.com/search?num=5&q=ID2D1PathGeometry+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1PathGeometry](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1PathGeometry) +[ID2D1PrintControl](https://www.google.com/search?num=5&q=ID2D1PrintControl+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.D2d1.ID2D1PrintControl](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1PrintControl) +[ID2D1Properties](https://www.google.com/search?num=5&q=ID2D1Properties+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.D2d1.ID2D1Properties](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Properties) +[ID2D1RadialGradientBrush](https://www.google.com/search?num=5&q=ID2D1RadialGradientBrush+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1RadialGradientBrush](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1RadialGradientBrush) +[ID2D1RectangleGeometry](https://www.google.com/search?num=5&q=ID2D1RectangleGeometry+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1RectangleGeometry](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1RectangleGeometry) +[ID2D1RenderTarget](https://www.google.com/search?num=5&q=ID2D1RenderTarget+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1RenderTarget](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1RenderTarget) +[ID2D1Resource](https://www.google.com/search?num=5&q=ID2D1Resource+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1Resource](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1Resource) +[ID2D1RoundedRectangleGeometry](https://www.google.com/search?num=5&q=ID2D1RoundedRectangleGeometry+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1RoundedRectangleGeometry](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1RoundedRectangleGeometry) +[ID2D1SimplifiedGeometrySink](https://www.google.com/search?num=5&q=ID2D1SimplifiedGeometrySink+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1SimplifiedGeometrySink](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1SimplifiedGeometrySink) +[ID2D1SolidColorBrush](https://www.google.com/search?num=5&q=ID2D1SolidColorBrush+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1SolidColorBrush](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1SolidColorBrush) +[ID2D1StrokeStyle](https://www.google.com/search?num=5&q=ID2D1StrokeStyle+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1StrokeStyle](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1StrokeStyle) +[ID2D1TessellationSink](https://www.google.com/search?num=5&q=ID2D1TessellationSink+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1TessellationSink](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1TessellationSink) +[ID2D1TransformedGeometry](https://www.google.com/search?num=5&q=ID2D1TransformedGeometry+site%3Adocs.microsoft.com) | d2d1.h | [Vanara.PInvoke.D2d1.ID2D1TransformedGeometry](https://github.com/dahall/Vanara/search?l=C%23&q=ID2D1TransformedGeometry) +[IDWriteBitmapRenderTarget](https://www.google.com/search?num=5&q=IDWriteBitmapRenderTarget+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteBitmapRenderTarget](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteBitmapRenderTarget) +[IDWriteFactory](https://www.google.com/search?num=5&q=IDWriteFactory+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFactory](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFactory) +[IDWriteFont](https://www.google.com/search?num=5&q=IDWriteFont+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFont](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFont) +[IDWriteFontCollection](https://www.google.com/search?num=5&q=IDWriteFontCollection+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontCollection](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontCollection) +[IDWriteFontCollectionLoader](https://www.google.com/search?num=5&q=IDWriteFontCollectionLoader+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontCollectionLoader](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontCollectionLoader) +[IDWriteFontFace](https://www.google.com/search?num=5&q=IDWriteFontFace+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontFace](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontFace) +[IDWriteFontFamily](https://www.google.com/search?num=5&q=IDWriteFontFamily+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontFamily](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontFamily) +[IDWriteFontFile](https://www.google.com/search?num=5&q=IDWriteFontFile+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontFile](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontFile) +[IDWriteFontFileEnumerator](https://www.google.com/search?num=5&q=IDWriteFontFileEnumerator+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontFileEnumerator](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontFileEnumerator) +[IDWriteFontFileLoader](https://www.google.com/search?num=5&q=IDWriteFontFileLoader+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontFileLoader](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontFileLoader) +[IDWriteFontFileStream](https://www.google.com/search?num=5&q=IDWriteFontFileStream+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontFileStream](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontFileStream) +[IDWriteFontList](https://www.google.com/search?num=5&q=IDWriteFontList+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteFontList](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteFontList) +[IDWriteGdiInterop](https://www.google.com/search?num=5&q=IDWriteGdiInterop+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteGdiInterop](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteGdiInterop) +[IDWriteGlyphRunAnalysis](https://www.google.com/search?num=5&q=IDWriteGlyphRunAnalysis+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteGlyphRunAnalysis](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteGlyphRunAnalysis) +[IDWriteInlineObject](https://www.google.com/search?num=5&q=IDWriteInlineObject+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteInlineObject](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteInlineObject) +[IDWriteLocalFontFileLoader](https://www.google.com/search?num=5&q=IDWriteLocalFontFileLoader+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteLocalFontFileLoader](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteLocalFontFileLoader) +[IDWriteLocalizedStrings](https://www.google.com/search?num=5&q=IDWriteLocalizedStrings+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteLocalizedStrings](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteLocalizedStrings) +[IDWriteNumberSubstitution](https://www.google.com/search?num=5&q=IDWriteNumberSubstitution+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.Dwrite.IDWriteNumberSubstitution](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteNumberSubstitution) +[IDWritePixelSnapping](https://www.google.com/search?num=5&q=IDWritePixelSnapping+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWritePixelSnapping](https://github.com/dahall/Vanara/search?l=C%23&q=IDWritePixelSnapping) +[IDWriteRenderingParams](https://www.google.com/search?num=5&q=IDWriteRenderingParams+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteRenderingParams](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteRenderingParams) +[IDWriteTextAnalysisSink](https://www.google.com/search?num=5&q=IDWriteTextAnalysisSink+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteTextAnalysisSink](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTextAnalysisSink) +[IDWriteTextAnalysisSource](https://www.google.com/search?num=5&q=IDWriteTextAnalysisSource+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteTextAnalysisSource](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTextAnalysisSource) +[IDWriteTextAnalyzer](https://www.google.com/search?num=5&q=IDWriteTextAnalyzer+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteTextAnalyzer](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTextAnalyzer) +[IDWriteTextFormat](https://www.google.com/search?num=5&q=IDWriteTextFormat+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteTextFormat](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTextFormat) +[IDWriteTextLayout](https://www.google.com/search?num=5&q=IDWriteTextLayout+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteTextLayout](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTextLayout) +[IDWriteTextRenderer](https://www.google.com/search?num=5&q=IDWriteTextRenderer+site%3Adocs.microsoft.com) | dwrite.h | [Vanara.PInvoke.Dwrite.IDWriteTextRenderer](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTextRenderer) +[IDWriteTypography](https://www.google.com/search?num=5&q=IDWriteTypography+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.Dwrite.IDWriteTypography](https://github.com/dahall/Vanara/search?l=C%23&q=IDWriteTypography) +[IDXGIAdapter](https://www.google.com/search?num=5&q=IDXGIAdapter+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGIAdapter](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIAdapter) +[IDXGIAdapter1](https://www.google.com/search?num=5&q=IDXGIAdapter1+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGIAdapter1](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIAdapter1) +[IDXGIDevice](https://www.google.com/search?num=5&q=IDXGIDevice+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGIDevice](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIDevice) +[IDXGIDeviceSubObject](https://www.google.com/search?num=5&q=IDXGIDeviceSubObject+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.DXGI.IDXGIDeviceSubObject](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIDeviceSubObject) +[IDXGIFactory](https://www.google.com/search?num=5&q=IDXGIFactory+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGIFactory](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIFactory) +[IDXGIFactory1](https://www.google.com/search?num=5&q=IDXGIFactory1+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.DXGI.IDXGIFactory1](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIFactory1) +[IDXGIObject](https://www.google.com/search?num=5&q=IDXGIObject+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.DXGI.IDXGIObject](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIObject) +[IDXGIOutput](https://www.google.com/search?num=5&q=IDXGIOutput+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGIOutput](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGIOutput) +[IDXGISurface](https://www.google.com/search?num=5&q=IDXGISurface+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGISurface](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGISurface) +[IDXGISwapChain](https://www.google.com/search?num=5&q=IDXGISwapChain+site%3Adocs.microsoft.com) | dxgi.h | [Vanara.PInvoke.DXGI.IDXGISwapChain](https://github.com/dahall/Vanara/search?l=C%23&q=IDXGISwapChain) +[IWICBitmap](https://www.google.com/search?num=5&q=IWICBitmap+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmap](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmap) +[IWICBitmapClipper](https://www.google.com/search?num=5&q=IWICBitmapClipper+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapClipper](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapClipper) +[IWICBitmapCodecInfo](https://www.google.com/search?num=5&q=IWICBitmapCodecInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapCodecInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapCodecInfo) +[IWICBitmapCodecProgressNotification](https://www.google.com/search?num=5&q=IWICBitmapCodecProgressNotification+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.WindowsCodecs.IWICBitmapCodecProgressNotification](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapCodecProgressNotification) +[IWICBitmapDecoder](https://www.google.com/search?num=5&q=IWICBitmapDecoder+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapDecoder](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapDecoder) +[IWICBitmapDecoderInfo](https://www.google.com/search?num=5&q=IWICBitmapDecoderInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapDecoderInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapDecoderInfo) +[IWICBitmapEncoder](https://www.google.com/search?num=5&q=IWICBitmapEncoder+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapEncoder](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapEncoder) +[IWICBitmapEncoderInfo](https://www.google.com/search?num=5&q=IWICBitmapEncoderInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapEncoderInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapEncoderInfo) +[IWICBitmapFlipRotator](https://www.google.com/search?num=5&q=IWICBitmapFlipRotator+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapFlipRotator](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapFlipRotator) +[IWICBitmapFrameDecode](https://www.google.com/search?num=5&q=IWICBitmapFrameDecode+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapFrameDecode](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapFrameDecode) +[IWICBitmapFrameEncode](https://www.google.com/search?num=5&q=IWICBitmapFrameEncode+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapFrameEncode](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapFrameEncode) +[IWICBitmapLock](https://www.google.com/search?num=5&q=IWICBitmapLock+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapLock](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapLock) +[IWICBitmapScaler](https://www.google.com/search?num=5&q=IWICBitmapScaler+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapScaler](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapScaler) +[IWICBitmapSource](https://www.google.com/search?num=5&q=IWICBitmapSource+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapSource](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapSource) +[IWICBitmapSourceTransform](https://www.google.com/search?num=5&q=IWICBitmapSourceTransform+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICBitmapSourceTransform](https://github.com/dahall/Vanara/search?l=C%23&q=IWICBitmapSourceTransform) +[IWICColorContext](https://www.google.com/search?num=5&q=IWICColorContext+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICColorContext](https://github.com/dahall/Vanara/search?l=C%23&q=IWICColorContext) +[IWICColorTransform](https://www.google.com/search?num=5&q=IWICColorTransform+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICColorTransform](https://github.com/dahall/Vanara/search?l=C%23&q=IWICColorTransform) +[IWICComponentFactory](https://www.google.com/search?num=5&q=IWICComponentFactory+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICComponentFactory](https://github.com/dahall/Vanara/search?l=C%23&q=IWICComponentFactory) +[IWICComponentInfo](https://www.google.com/search?num=5&q=IWICComponentInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICComponentInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICComponentInfo) +[IWICDdsDecoder](https://www.google.com/search?num=5&q=IWICDdsDecoder+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICDdsDecoder](https://github.com/dahall/Vanara/search?l=C%23&q=IWICDdsDecoder) +[IWICDdsEncoder](https://www.google.com/search?num=5&q=IWICDdsEncoder+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICDdsEncoder](https://github.com/dahall/Vanara/search?l=C%23&q=IWICDdsEncoder) +[IWICDdsFrameDecode](https://www.google.com/search?num=5&q=IWICDdsFrameDecode+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICDdsFrameDecode](https://github.com/dahall/Vanara/search?l=C%23&q=IWICDdsFrameDecode) +[IWICDevelopRaw](https://www.google.com/search?num=5&q=IWICDevelopRaw+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICDevelopRaw](https://github.com/dahall/Vanara/search?l=C%23&q=IWICDevelopRaw) +[IWICDevelopRawNotificationCallback](https://www.google.com/search?num=5&q=IWICDevelopRawNotificationCallback+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICDevelopRawNotificationCallback](https://github.com/dahall/Vanara/search?l=C%23&q=IWICDevelopRawNotificationCallback) +[IWICEnumMetadataItem](https://www.google.com/search?num=5&q=IWICEnumMetadataItem+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICEnumMetadataItem](https://github.com/dahall/Vanara/search?l=C%23&q=IWICEnumMetadataItem) +[IWICFastMetadataEncoder](https://www.google.com/search?num=5&q=IWICFastMetadataEncoder+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICFastMetadataEncoder](https://github.com/dahall/Vanara/search?l=C%23&q=IWICFastMetadataEncoder) +[IWICFormatConverter](https://www.google.com/search?num=5&q=IWICFormatConverter+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICFormatConverter](https://github.com/dahall/Vanara/search?l=C%23&q=IWICFormatConverter) +[IWICFormatConverterInfo](https://www.google.com/search?num=5&q=IWICFormatConverterInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICFormatConverterInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICFormatConverterInfo) +[IWICImageEncoder](https://www.google.com/search?num=5&q=IWICImageEncoder+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICImageEncoder](https://github.com/dahall/Vanara/search?l=C%23&q=IWICImageEncoder) +[IWICImagingFactory](https://www.google.com/search?num=5&q=IWICImagingFactory+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICImagingFactory](https://github.com/dahall/Vanara/search?l=C%23&q=IWICImagingFactory) +[IWICImagingFactory2](https://www.google.com/search?num=5&q=IWICImagingFactory2+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICImagingFactory2](https://github.com/dahall/Vanara/search?l=C%23&q=IWICImagingFactory2) +[IWICJpegFrameDecode](https://www.google.com/search?num=5&q=IWICJpegFrameDecode+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICJpegFrameDecode](https://github.com/dahall/Vanara/search?l=C%23&q=IWICJpegFrameDecode) +[IWICJpegFrameEncode](https://www.google.com/search?num=5&q=IWICJpegFrameEncode+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICJpegFrameEncode](https://github.com/dahall/Vanara/search?l=C%23&q=IWICJpegFrameEncode) +[IWICMetadataBlockReader](https://www.google.com/search?num=5&q=IWICMetadataBlockReader+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataBlockReader](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataBlockReader) +[IWICMetadataBlockWriter](https://www.google.com/search?num=5&q=IWICMetadataBlockWriter+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataBlockWriter](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataBlockWriter) +[IWICMetadataHandlerInfo](https://www.google.com/search?num=5&q=IWICMetadataHandlerInfo+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.WindowsCodecs.IWICMetadataHandlerInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataHandlerInfo) +[IWICMetadataQueryReader](https://www.google.com/search?num=5&q=IWICMetadataQueryReader+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataQueryReader](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataQueryReader) +[IWICMetadataQueryWriter](https://www.google.com/search?num=5&q=IWICMetadataQueryWriter+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataQueryWriter](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataQueryWriter) +[IWICMetadataReader](https://www.google.com/search?num=5&q=IWICMetadataReader+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataReader](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataReader) +[IWICMetadataReaderInfo](https://www.google.com/search?num=5&q=IWICMetadataReaderInfo+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataReaderInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataReaderInfo) +[IWICMetadataWriter](https://www.google.com/search?num=5&q=IWICMetadataWriter+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataWriter](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataWriter) +[IWICMetadataWriterInfo](https://www.google.com/search?num=5&q=IWICMetadataWriterInfo+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICMetadataWriterInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICMetadataWriterInfo) +[IWICPalette](https://www.google.com/search?num=5&q=IWICPalette+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICPalette](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPalette) +[IWICPersistStream](https://www.google.com/search?num=5&q=IWICPersistStream+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICPersistStream](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPersistStream) +[IWICPixelFormatInfo](https://www.google.com/search?num=5&q=IWICPixelFormatInfo+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICPixelFormatInfo](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPixelFormatInfo) +[IWICPixelFormatInfo2](https://www.google.com/search?num=5&q=IWICPixelFormatInfo2+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICPixelFormatInfo2](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPixelFormatInfo2) +[IWICPlanarBitmapFrameEncode](https://www.google.com/search?num=5&q=IWICPlanarBitmapFrameEncode+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICPlanarBitmapFrameEncode](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPlanarBitmapFrameEncode) +[IWICPlanarBitmapSourceTransform](https://www.google.com/search?num=5&q=IWICPlanarBitmapSourceTransform+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.WindowsCodecs.IWICPlanarBitmapSourceTransform](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPlanarBitmapSourceTransform) +[IWICPlanarFormatConverter](https://www.google.com/search?num=5&q=IWICPlanarFormatConverter+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICPlanarFormatConverter](https://github.com/dahall/Vanara/search?l=C%23&q=IWICPlanarFormatConverter) +[IWICProgressCallback](https://www.google.com/search?num=5&q=IWICProgressCallback+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICProgressCallback](https://github.com/dahall/Vanara/search?l=C%23&q=IWICProgressCallback) +[IWICProgressiveLevelControl](https://www.google.com/search?num=5&q=IWICProgressiveLevelControl+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICProgressiveLevelControl](https://github.com/dahall/Vanara/search?l=C%23&q=IWICProgressiveLevelControl) +[IWICStream](https://www.google.com/search?num=5&q=IWICStream+site%3Adocs.microsoft.com) | wincodec.h | [Vanara.PInvoke.WindowsCodecs.IWICStream](https://github.com/dahall/Vanara/search?l=C%23&q=IWICStream) +[IWICStreamProvider](https://www.google.com/search?num=5&q=IWICStreamProvider+site%3Adocs.microsoft.com) | wincodecsdk.h | [Vanara.PInvoke.WindowsCodecs.IWICStreamProvider](https://github.com/dahall/Vanara/search?l=C%23&q=IWICStreamProvider) diff --git a/PInvoke/Graphics/Direct2D/D2d1.Interfaces1.cs b/PInvoke/Graphics/Direct2D/D2d1.Interfaces1.cs new file mode 100644 index 00000000..2a05d662 --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1.Interfaces1.cs @@ -0,0 +1,3581 @@ +using System; +using System.Runtime.InteropServices; +using Vanara.InteropServices; +using static Vanara.PInvoke.Dwrite; +using static Vanara.PInvoke.WindowsCodecs; + +namespace Vanara.PInvoke +{ + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// Represents a bitmap that has been bound to an ID2D1RenderTarget. + /// + /// Creating ID2D1Bitmap Objects + /// To create a bitmap, use one of the following methods of the render target on which the bitmap will be drawn: + /// + /// + /// ID2D1RenderTarget::CreateBitmap + /// + /// + /// ID2D1RenderTarget::CreateBitmapFromWicBitmap + /// + /// + /// For information about the pixel formats supported by Direct2D bitmaps, see Supported Pixel Formats and Alpha Modes. + /// + /// An ID2D1Bitmap is a device-dependent resource: your application should create bitmaps after it initializes the render + /// target with which the bitmap will be used, and recreate the bitmap whenever the render target needs recreated. (For more + /// information about resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1bitmap + [PInvokeData("d2d1.h", MSDNShortId = "e58216ea-e6b5-450f-a0ea-b879aa5dff38")] + [ComImport, Guid("a2296057-ea42-4099-983b-539fb6505426"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Bitmap : ID2D1Image + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Returns the size, in device-independent pixels (DIPs), of the bitmap. + /// + /// Type: D2D1_SIZE_F + /// The size, in DIPs, of the bitmap. + /// + /// A DIP is 1/96 of an inch. To retrieve the size in device pixels, use the ID2D1Bitmap::GetPixelSizemethod. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + D2D_SIZE_F GetSize(); + + /// Returns the size, in device-dependent units (pixels), of the bitmap. + /// + /// Type: D2D1_SIZE_U + /// The size, in pixels, of the bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + D2D_SIZE_U GetPixelSize(); + + /// Retrieves the pixel format and alpha mode of the bitmap. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Return the dots per inch (DPI) of the bitmap. + /// + /// Type: FLOAT* + /// The horizontal DPI of the image. You must allocate storage for this parameter. + /// + /// + /// Type: FLOAT* + /// The vertical DPI of the image. You must allocate storage for this parameter. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getdpi void GetDpi( FLOAT *dpiX, FLOAT *dpiY ); + [PreserveSig] + void GetDpi(out float dpiX, out float dpiY); + + /// Copies the specified region from the specified bitmap into the current bitmap. + /// + /// Type: const D2D1_POINT_2U* + /// In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied. + /// + /// + /// Type: ID2D1Bitmap* + /// The bitmap to copy from. + /// + /// + /// Type: const D2D1_RECT_U* + /// The area of bitmap to copy. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current + /// bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap + /// formats do not match. + /// + /// + /// Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed + /// does not complete successfully, this method fails. However, this method does not clear the error state of the render target + /// on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush. + /// + /// + /// Starting with Windows 8.1, this method supports block compressed bitmaps. If you are using a block compressed format, the + /// end coordinates of the srcRect parameter must be multiples of 4 or the method returns E_INVALIDARG. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrombitmap HRESULT CopyFromBitmap( const + // D2D1_POINT_2U *destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect ); + void CopyFromBitmap([In, Optional] IntPtr destPoint, [In] ID2D1Bitmap bitmap, [In, Optional] IntPtr srcRect); + + /// Copies the specified region from the specified render target into the current bitmap. + /// + /// Type: const D2D1_POINT_2U* + /// In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied. + /// + /// + /// Type: ID2D1RenderTarget* + /// The render target that contains the region to copy. + /// + /// + /// Type: const D2D1_RECT_U* + /// The area of renderTarget to copy. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current + /// bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap + /// formats do not match. + /// + /// + /// Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed + /// does not complete successfully, this method fails. However, this method does not clear the error state of the render target + /// on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush. + /// + /// + /// All clips and layers must be popped off of the render target before calling this method. The method returns + /// D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT if any clips or layers are currently applied to the render target. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfromrendertarget HRESULT + // CopyFromRenderTarget( const D2D1_POINT_2U *destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect ); + void CopyFromRenderTarget([In, Optional] IntPtr destPoint, [In] ID2D1RenderTarget renderTarget, [In, Optional] IntPtr srcRect); + + /// Copies the specified region from memory into the current bitmap. + /// + /// Type: const D2D1_RECT_U* + /// In the current bitmap, the rectangle to which the region specified by srcRect is copied. + /// + /// + /// Type: const void* + /// The data to copy. + /// + /// + /// Type: UINT32 + /// + /// The stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels + /// in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current + /// bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. + /// + /// + /// If this method is passed invalid input (such as an invalid destination rectangle), can produce unpredictable results, such + /// as a distorted image or device failure. + /// + /// + /// Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed + /// does not complete successfully, this method fails. However, this method does not clear the error state of the render target + /// on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush. + /// + /// + /// Starting with Windows 8.1, this method supports block compressed bitmaps. If you are using a block compressed format, the + /// end coordinates of the srcRect parameter must be multiples of 4 or the method returns E_INVALIDARG. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrommemory HRESULT CopyFromMemory( const + // D2D1_RECT_U *dstRect, const void *srcData, UINT32 pitch ); + void CopyFromMemory([In, Optional] IntPtr dstRect, [In] IntPtr srcData, uint pitch); + } + + /// Paints an area with a bitmap. + /// + /// + /// A bitmap brush is used to fill a geometry with a bitmap. Like all brushes, it defines an infinite plane of content. Because + /// bitmaps are finite, the brush relies on an "extend mode" to determine how the plane is filled horizontally and vertically. + /// + /// Creating ID2D1BitmapBrush Objects + /// To create a bitmap brush, use the ID2D1RenderTarget::CreateBitmapBrush method. + /// + /// An ID2D1BitmapBrush is a device-dependent resource: your application should create bitmap brushes after it initializes + /// the render target with which the bitmap brush will be used, and recreate the bitmap brush whenever the render target needs + /// recreated. (For more information about resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1bitmapbrush + [PInvokeData("d2d1.h", MSDNShortId = "22b14ffa-14cb-4e4d-bf80-7d81e4ae9ee4")] + [ComImport, Guid("2cd906aa-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1BitmapBrush : ID2D1Brush + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + new void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + new float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// Specifies how the brush horizontally tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush horizontally tiles those areas that extend past its bitmap. + /// + /// None + /// + /// + /// Sometimes, the bitmap for a bitmap brush doesn't completely fill the area being painted. When this happens, Direct2D uses + /// the brush's horizontal ( SetExtendModeX) and vertical (SetExtendModeY) extend mode settings to determine how to fill + /// the remaining area. + /// + /// + /// The following illustration shows the results from every possible combination of the extend modes for an ID2D1BitmapBrush: + /// D2D1_EXTEND_MODE_CLAMP (CLAMP), D2D1_EXTEND_MODE_WRAP (WRAP), and D2D1_EXTEND_MIRROR (MIRROR). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setextendmodex void SetExtendModeX( + // D2D1_EXTEND_MODE extendModeX ); + [PreserveSig] + void SetExtendModeX(D2D1_EXTEND_MODE extendModeX); + + /// Specifies how the brush vertically tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush vertically tiles those areas that extend past its bitmap. + /// + /// None + /// + /// + /// Sometimes, the bitmap for a bitmap brush doesn't completely fill the area being painted. When this happens, Direct2D uses + /// the brush's horizontal (SetExtendModeX) and vertical ( SetExtendModeY) extend mode settings to determine how to fill + /// the remaining area. + /// + /// + /// The following illustration shows the results from every possible combination of the extend modes for an ID2D1BitmapBrush: + /// D2D1_EXTEND_MODE_CLAMP (CLAMP), D2D1_EXTEND_MODE_WRAP (WRAP), and D2D1_EXTEND_MIRROR (MIRROR). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setextendmodey void SetExtendModeY( + // D2D1_EXTEND_MODE extendModeY ); + [PreserveSig] + void SetExtendModeY(D2D1_EXTEND_MODE extendModeY); + + /// Specifies the interpolation mode used when the brush bitmap is scaled or rotated. + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode used when the brush bitmap is scaled or rotated. + /// + /// None + /// + /// + /// This method sets the interpolation mode for a bitmap, which is an enum value that is specified in the + /// D2D1_BITMAP_INTERPOLATION_MODE enumeration type. D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR represents nearest neighbor + /// filtering. It looks up the nearest bitmap pixel to the current rendering pixel and chooses its exact color. + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR represents linear filtering, and interpolates a color from the four nearest bitmap pixels. + /// + /// + /// The interpolation mode of a bitmap also affects subpixel translations. In a subpixel translation, bilinear interpolation + /// positions the bitmap more precisely to the application requests, but blurs the bitmap in the process. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setinterpolationmode void + // SetInterpolationMode( D2D1_BITMAP_INTERPOLATION_MODE interpolationMode ); + [PreserveSig] + void SetInterpolationMode(D2D1_BITMAP_INTERPOLATION_MODE interpolationMode); + + /// Specifies the bitmap source that this brush uses to paint. + /// + /// Type: ID2D1Bitmap* + /// The bitmap source used by the brush. + /// + /// None + /// + /// + /// This method specifies the bitmap source that this brush uses to paint. The bitmap is not resized or rescaled automatically + /// to fit the geometry that it fills. The bitmap stays at its native size. To resize or translate the bitmap, use the + /// SetTransform method to apply a transform to the brush. + /// + /// + /// The native size of a bitmap is the width and height in bitmap pixels, divided by the bitmap DPI. This native size forms the + /// base tile of the brush. To tile a subregion of the bitmap, you must generate a new bitmap containing this subregion and use + /// SetBitmap to apply it to the brush. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setbitmap void SetBitmap( ID2D1Bitmap + // *bitmap ); + [PreserveSig] + void SetBitmap([In, Optional] ID2D1Bitmap bitmap); + + /// Gets the method by which the brush horizontally tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush horizontally tiles those areas that extend past its bitmap. + /// + /// + /// Like all brushes, ID2D1BitmapBrush defines an infinite plane of content. Because bitmaps are finite, it relies on an extend + /// mode to determine how the plane is filled horizontally and vertically. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getextendmodex D2D1_EXTEND_MODE GetExtendModeX(); + [PreserveSig] + D2D1_EXTEND_MODE GetExtendModeX(); + + /// Gets the method by which the brush vertically tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush vertically tiles those areas that extend past its bitmap. + /// + /// + /// Like all brushes, ID2D1BitmapBrush defines an infinite plane of content. + /// Because bitmaps are finite, it relies on an extend mode to determine how the plane is filled horizontally and vertically. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getextendmodey D2D1_EXTEND_MODE GetExtendModeY(); + [PreserveSig] + D2D1_EXTEND_MODE GetExtendModeY(); + + /// Gets the interpolation method used when the brush bitmap is scaled or rotated. + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation method used when the brush bitmap is scaled or rotated. + /// + /// + /// + /// This method gets the interpolation mode of a bitmap, which is specified by the D2D1_BITMAP_INTERPOLATION_MODE enumeration + /// type. D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR represents nearest neighbor filtering. It looks up the bitmap + /// pixel nearest to the current rendering pixel and chooses its exact color. D2D1_BITMAP_INTERPOLATION_MODE_LINEAR + /// represents linear filtering, and interpolates a color from the four nearest bitmap pixels. + /// + /// + /// The interpolation mode of a bitmap also affects subpixel translations. In a subpixel translation, linear interpolation + /// positions the bitmap more precisely to the application request, but blurs the bitmap in the process. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getinterpolationmode + // D2D1_BITMAP_INTERPOLATION_MODE GetInterpolationMode(); + [PreserveSig] + D2D1_BITMAP_INTERPOLATION_MODE GetInterpolationMode(); + + /// Gets the bitmap source that this brush uses to paint. + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address to a pointer to the bitmap with which this brush paints. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getbitmap void GetBitmap( ID2D1Bitmap + // **bitmap ); + [PreserveSig] + void GetBitmap(out ID2D1Bitmap bitmap); + } + + /// Renders to an intermediate texture created by the CreateCompatibleRenderTarget method. + /// + /// + /// An ID2D1BitmapRenderTarget writes to an intermediate texture. It's useful for creating patterns for use with an + /// ID2D1BitmapBrush or caching drawing data that will be used repeatedly. + /// + /// + /// To write directly to a WIC bitmap instead, use the ID2D1Factory::CreateWicBitmapRenderTarget method. This method returns an + /// ID2D1RenderTarget that writes to the specified WIC bitmap. + /// + /// Creating ID2D1BitmapRenderTarget Objects + /// To create a bitmap render target, call the ID2D1RenderTarget::CreateCompatibleRenderTarget method. + /// + /// Like other render targets, an ID2D1BitmapRenderTarget is a device-dependent resource and must be recreated when the + /// associated device becomes unavailable. For more information, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1bitmaprendertarget + [PInvokeData("d2d1.h", MSDNShortId = "f298d4f7-acb8-4fbe-89f7-2410e3b753bd")] + [ComImport, Guid("2cd90695-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Creates a Direct2D bitmap from a pointer to in-memory source data. + /// + /// Type: [in] D2D1_SIZE_U + /// The dimensions of the bitmap to create in pixels. + /// + /// + /// Type: [in, optional] const void* + /// A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap. + /// + /// + /// Type: [in] UINT32 + /// + /// The byte count of each scanline, which is equal to (the image width in pixels × the number of bytes per pixel) + memory + /// padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.) + /// + /// + /// + /// Type: [in] const D2D1_BITMAP_PROPERTIES & + /// The pixel format and dots per inch (DPI) of the bitmap to create. + /// + /// + /// Type: [out] ID2D1Bitmap** + /// When this method returns, contains a pointer to a pointer to the new bitmap. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmap(d2d1_size_u_constvoid_uint32_constd2d1_bitmap_properties__id2d1bitmap) + // HRESULT CreateBitmap( D2D1_SIZE_U size, const void *srcData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES & + // bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmap(D2D_SIZE_U size, [In, Optional] IntPtr srcData, uint pitch, in D2D1_BITMAP_PROPERTIES bitmapProperties); + + /// Creates an ID2D1Bitmap by copying the specified Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: [in] IWICBitmapSource* + /// The WIC bitmap to copy. + /// + /// + /// Type: [in, optional] const D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create. The pixel format must match the pixel format of wicBitmapSource, or the + /// method will fail. To prevent a mismatch, you can pass NULL or pass the value obtained from calling the + /// D2D1::PixelFormat helper function without specifying any parameter values. If both dpiX and dpiY are 0.0f, the default DPI, + /// 96, is used. DPI information embedded in wicBitmapSource is ignored. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// Before Direct2D can load a WIC bitmap, that bitmap must be converted to a supported pixel format and alpha mode. For a list + /// of supported pixel formats and alpha modes, see Supported Pixel Formats and Alpha Modes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) + // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, + // ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1Bitmap whose data is shared with another resource. + /// + /// Type: REFIID + /// The interface ID of the object supplying the source data. + /// + /// + /// Type: void* + /// + /// An ID2D1Bitmap, IDXGISurface, or an IWICBitmapLock that contains the data to share with the new ID2D1Bitmap. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create . The DXGI_FORMAT portion of the pixel format must match the DXGI_FORMAT of + /// data or the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or + /// the value obtained from the D2D1::PixelFormat helper function. The DPI settings do not have to match those of data. If both + /// dpiX and dpiY are 0.0f, the DPI of the render target is used. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// + /// The CreateSharedBitmap method is useful for efficiently reusing bitmap data and can also be used to provide + /// interoperability with Direct3D. + /// + /// Sharing an ID2D1Bitmap + /// + /// By passing an ID2D1Bitmap created by a render target that is resource-compatible, you can share a bitmap with that render + /// target; both the original ID2D1Bitmap and the new ID2D1Bitmap created by this method will point to the same + /// bitmap data. For more information about when render target resources can be shared, see the Sharing Render Target Resources + /// section of the Resources Overview. + /// + /// + /// You may also use this method to reinterpret the data of an existing bitmap and specify a new DPI or alpha mode. For example, + /// in the case of a bitmap atlas, an ID2D1Bitmap may contain multiple sub-images, each of which should be rendered with a + /// different D2D1_ALPHA_MODE ( D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE). You could use the + /// CreateSharedBitmap method to reinterpret the bitmap using the desired alpha mode without having to load a separate + /// copy of the bitmap into memory. + /// + /// Sharing an IDXGISurface + /// + /// When using a DXGI surface render target (an ID2D1RenderTarget object created by the CreateDxgiSurfaceRenderTarget method), + /// you can pass an IDXGISurface surface to the CreateSharedBitmap method to share video memory with Direct3D and + /// manipulate Direct3D content as an ID2D1Bitmap. As described in the Resources Overview, the render target and the + /// IDXGISurface must be using the same Direct3D device. + /// + /// + /// Note also that the IDXGISurface must use one of the supported pixel formats and alpha modes described in Supported Pixel + /// Formats and Alpha Modes. + /// + /// For more information about interoperability with Direct3D, see the Direct2D and Direct3D Interoperability Overview. + /// Sharing an IWICBitmapLock + /// + /// An IWICBitmapLock stores the content of a WIC bitmap and shields it from simultaneous accesses. By passing an + /// IWICBitmapLock to the CreateSharedBitmap method, you can create an ID2D1Bitmap that points to the bitmap data + /// already stored in the IWICBitmapLock. + /// + /// + /// To use an IWICBitmapLock with the CreateSharedBitmap method, the render target must use software rendering. To force + /// a render target to use software rendering, set to D2D1_RENDER_TARGET_TYPE_SOFTWARE the type field of the + /// D2D1_RENDER_TARGET_PROPERTIES structure that you use to create the render target. To check whether an existing render target + /// uses software rendering, use the IsSupported method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT + // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1BitmapBrush from the specified bitmap. + /// + /// Type: ID2D1Bitmap* + /// The bitmap contents of the new brush. + /// + /// + /// Type: D2D1_BITMAP_BRUSH_PROPERTIES* + /// + /// The extend modes and interpolation mode of the new brush, or NULL. If you set this parameter to NULL, the + /// brush defaults to the D2D1_EXTEND_MODE_CLAMP horizontal and vertical extend modes and the + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR interpolation mode. + /// + /// + /// + /// Type: D2D1_BRUSH_PROPERTIES* + /// + /// A structure that contains the opacity and transform of the new brush, or NULL. If you set this parameter to + /// NULL, the brush sets the opacity member to 1.0F and the transform member to the identity matrix. + /// + /// + /// + /// Type: ID2D1BitmapBrush** + /// + /// When this method returns, this output parameter contains a pointer to a pointer to the new brush. Pass this parameter uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) + // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The red, green, blue, and alpha values of the brush's color. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES & + /// The base opacity of the brush. + /// + /// + /// Type: [out] ID2D1SolidColorBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) + // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, + // ID2D1SolidColorBrush **solidColorBrush ); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + + /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. + /// + /// Type: [in] D2D1_GRADIENT_STOP* + /// A pointer to an array of D2D1_GRADIENT_STOP structures. + /// + /// + /// Type: [in] UINT + /// A value greater than or equal to 1 that specifies the number of gradient stops in the gradientStops array. + /// + /// + /// Type: [in] D2D1_GAMMA + /// The space in which color interpolation between the gradient stops is performed. + /// + /// + /// Type: [in] D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized range. + /// + /// + /// Type: [out] ID2D1GradientStopCollection** + /// When this method returns, contains a pointer to a pointer to the new gradient stop collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 + // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA + // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); + new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + + /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. + /// + /// Type: [in] const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES* + /// The start and end points of the gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the + /// gradient line. + /// + /// + /// + /// Type: [out] ID2D1LinearGradientBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlineargradientbrush%28constd2d1_linear_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1lineargradientbrush%29 + // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush + // **linearGradientBrush ); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. + /// + /// Type: const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES* + /// The center, gradient origin offset, and x-radius and y-radius of the brush's gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the gradient. + /// + /// + /// + /// Type: [out] ID2D1RadialGradientBrush** + /// When this method returns, contains a pointer to a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createradialgradientbrush%28constd2d1_radial_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1radialgradientbrush%29 + // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush + // **radialGradientBrush ); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// + /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. + /// + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// The desired size of the new render target (in device-independent pixels), if it should be different from the original render + /// target. For more info, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_SIZE_U* + /// + /// The desired size of the new render target in pixels if it should be different from the original render target. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_PIXEL_FORMAT* + /// + /// The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new + /// render target uses the same pixel format as the original render target. If the alpha mode is D2D1_ALPHA_MODE_UNKNOWN, the + /// alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel + /// formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: [in] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS + /// A value that specifies whether the new render target must be compatible with GDI. + /// + /// + /// Type: [out] ID2D1BitmapRenderTarget** + /// + /// When this method returns, contains a pointer to a pointer to a new bitmap render target. This parameter is passed uninitialized. + /// + /// + /// + /// The pixel size and DPI of the new render target can be altered by specifying values for desiredSize or desiredPixelSize: + /// + /// + /// + /// If desiredSize is specified but desiredPixelSize is not, the pixel size is computed from the desired size using the parent + /// target DPI. If the desiredSize maps to a integer-pixel size, the DPI of the compatible render target is the same as the DPI + /// of the parent target. If desiredSize maps to a fractional-pixel size, the pixel size is rounded up to the nearest integer + /// and the DPI for the compatible render target is slightly higher than the DPI of the parent render target. In all cases, the + /// coordinate (desiredSize.width, desiredSize.height) maps to the lower-right corner of the compatible render target. + /// + /// + /// + /// + /// If the desiredPixelSize is specified and desiredSize is not, the DPI of the new render target is the same as the original + /// render target. + /// + /// + /// + /// + /// If both desiredSize and desiredPixelSize are specified, the DPI of the new render target is computed to account for the + /// difference in scale. + /// + /// + /// + /// + /// If neither desiredSize nor desiredPixelSize is specified, the new render target size and DPI match the original render target. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) + // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const + // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + + /// Creates a layer resource that can be used with this render target and its compatible render targets. + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// If (0, 0) is specified, no backing store is created behind the layer resource. The layer resource is allocated to the + /// minimum size when PushLayer is called. + /// + /// + /// + /// Type: [out] ID2D1Layer** + /// When the method returns, contains a pointer to a pointer to the new layer. This parameter is passed uninitialized. + /// + /// The layer automatically resizes itself, as needed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) + // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); + new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + + /// Create a mesh that uses triangles to describe a shape. + /// + /// Type: ID2D1Mesh** + /// When this method returns, contains a pointer to a pointer to the new mesh. + /// + /// + /// To populate a mesh, use its Open method to obtain an ID2D1TessellationSink. To draw the mesh, use the render target's + /// FillMesh method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createmesh HRESULT CreateMesh( ID2D1Mesh + // **mesh ); + new ID2D1Mesh CreateMesh(); + + /// Draws a line between the specified points using the specified stroke style. + /// + /// Type: D2D1_POINT_2F + /// The start point of the line, in device-independent pixels. + /// + /// + /// Type: D2D1_POINT_2F + /// The end point of the line, in device-independent pixels. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the line's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid line. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline void DrawLine( D2D1_POINT_2F + // point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawLine(D2D_POINT_2F point0, D2D_POINT_2F point1, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Draws the outline of a rectangle that has the specified dimensions and stroke style. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimensions of the rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's stroke. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid stroke. + /// + /// None + /// + /// When this method fails, it does not return an error code. To determine whether a drawing method (such as DrawRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawrectangle(constd2d1_rect_f__id2d1brush_float_id2d1strokestyle) + // void DrawRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rectangle. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimension of the rectangle to paint, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's interior. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillrectangle(constd2d1_rect_f__id2d1brush) + // void FillRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified rounded rectangle using the specified stroke style. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rounded rectangle's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawroundedrectangle(constd2d1_rounded_rect__id2d1brush_float_id2d1strokestyle) + // void DrawRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle + // *strokeStyle ); + [PreserveSig] + new void DrawRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rounded rectangle. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to paint, in device independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the rounded rectangle. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// FillRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillroundedrectangle(constd2d1_rounded_rect__id2d1brush) + // void FillRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified ellipse using the specified stroke style. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius of the ellipse to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the ellipse's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the ellipse's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// The DrawEllipse method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawEllipse) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawellipse(constd2d1_ellipse__id2d1brush_float_id2d1strokestyle) + // void DrawEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified ellipse. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius, in device-independent pixels, of the ellipse to paint. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the ellipse. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillEllipse) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillellipse(constd2d1_ellipse__id2d1brush) + // void FillEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush ); + [PreserveSig] + new void FillEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush); + + /// Draws the outline of the specified geometry using the specified stroke style. + /// + /// Type: ID2D1Geometry* + /// The geometry to draw. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawgeometry void DrawGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified geometry. + /// + /// Type: ID2D1Geometry* + /// The geometry to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's interior. + /// + /// + /// Type: ID2D1Brush* + /// + /// The opacity mask to apply to the geometry, or NULL for no opacity mask. If an opacity mask (the opacityBrush + /// parameter) is specified, brush must be an ID2D1BitmapBrush that has its x- and y-extend modes set to D2D1_EXTEND_MODE_CLAMP. + /// For more information, see the Remarks section. + /// + /// + /// None + /// + /// + /// If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to + /// determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush + /// is used for this processing; all other color information is ignored. + /// + /// + /// The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted + /// by brush. + /// + /// + /// When this method fails, it does not return an error code. To determine whether a drawing operation (such as + /// FillGeometry) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillgeometry void FillGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush ); + [PreserveSig] + new void FillGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, [In] ID2D1Brush opacityBrush = null); + + /// Paints the interior of the specified mesh. + /// + /// Type: ID2D1Mesh* + /// The mesh to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the mesh. + /// + /// None + /// + /// + /// The current antialias mode of the render target must be D2D1_ANTIALIAS_MODE_ALIASED when FillMesh is called. To + /// change the render target's antialias mode, use the SetAntialiasMode method. + /// + /// + /// FillMesh does not expect a particular winding order for the triangles in the ID2D1Mesh; both clockwise and + /// counter-clockwise will work. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillMesh) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillmesh void FillMesh( ID2D1Mesh *mesh, + // ID2D1Brush *brush ); + [PreserveSig] + new void FillMesh([In] ID2D1Mesh mesh, [In] ID2D1Brush brush); + + /// + /// Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target. + /// + /// + /// Type: ID2D1Bitmap* + /// + /// The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is + /// multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle. + /// + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the region of the render target specified by destinationRectangle. + /// + /// + /// Type: D2D1_OPACITY_MASK_CONTENT + /// + /// The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended. + /// + /// + /// Note Starting with Windows 8, the D2D1_OPACITY_MASK_CONTENT is not required. See the + /// ID2D1DeviceContext::FillOpacityMask method, which has no D2D1_OPACITY_MASK_CONTENT parameter. + /// + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the render target to paint, in device-independent pixels. + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the bitmap to use as the opacity mask, in device-independent pixels. + /// + /// None + /// + /// + /// For this method to work properly, the render target must be using the D2D1_ANTIALIAS_MODE_ALIASED antialiasing mode. You can + /// set the antialiasing mode by calling the ID2D1RenderTarget::SetAntialiasMode method. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillOpacityMask) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_) + // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & + // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + + /// Draws the specified bitmap after scaling it to the size of the specified rectangle. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to render. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap + /// is drawn. If the rectangle is not well-ordered, nothing is drawn, but the render target does not enter an error state. + /// + /// + /// + /// Type: FLOAT + /// + /// A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied + /// against the alpha values of the bitmap's contents. + /// + /// + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to draw. + /// + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawBitmap) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawbitmap(id2d1bitmap_constd2d1_rect_f__float_d2d1_bitmap_interpolation_mode_constd2d1_rect_f_) + // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, + // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + + /// Draws the specified text using the format information provided by an IDWriteTextFormat object. + /// + /// Type: WCHAR* + /// A pointer to an array of Unicode characters to draw. + /// + /// + /// Type: UINT + /// The number of characters in string. + /// + /// + /// Type: IDWriteTextFormat* + /// An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction. + /// + /// + /// Type: const D2D1_RECT_F + /// The size and position of the area in which the text is drawn. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the text. + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// To create an IDWriteTextFormat object, create an IDWriteFactory and call its CreateTextFormat method. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawText) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtext(constwchar_uint32_idwritetextformat_constd2d1_rect_f__id2d1brush_d2d1_draw_text_options_dwrite_measuring_mode) + // void DrawText( const WCHAR *string, UINT32 stringLength, IDWriteTextFormat *textFormat, const D2D1_RECT_F & layoutRect, + // ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + new void DrawText([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, in D2D_RECT_F layoutRect, + [In] ID2D1Brush defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// Draws the formatted text described by the specified IDWriteTextLayout object. + /// + /// Type: D2D1_POINT_2F + /// + /// The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn. + /// + /// + /// + /// Type: IDWriteTextLayout* + /// + /// The formatted text to draw. Any drawing effects that do not inherit from ID2D1Resource are ignored. If there are drawing + /// effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an + /// error state. + /// + /// + /// + /// Type: ID2D1Brush* + /// + /// The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect + /// (specified by the IDWriteTextLayout::SetDrawingEffect method). + /// + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// None + /// + /// + /// When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the DrawText + /// method because the text doesn't need to be formatted and the layout processed with each call. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawTextLayout) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtextlayout void DrawTextLayout( + // D2D1_POINT_2F origin, IDWriteTextLayout *textLayout, ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options ); + [PreserveSig] + new void DrawTextLayout(D2D_POINT_2F origin, [In] IDWriteTextLayout textLayout, [In] ID2D1Brush defaultFillBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE); + + /// Draws the specified glyphs. + /// + /// Type: D2D1_POINT_2F + /// The origin, in device-independent pixels, of the glyphs' baseline. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the specified glyphs. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGlyphRun) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawglyphrun void DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE + // measuringMode ); + [PreserveSig] + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In] ID2D1Brush foregroundBrush, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// + /// Applies the specified transform to the render target, replacing the existing transformation. All subsequent drawing + /// operations occur in the transformed space. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the current transform of the render target. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this returns, contains the current transform of the render target. This parameter is passed uninitialized. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettransform void GetTransform( + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// + /// Sets the antialiasing mode of the render target. The antialiasing mode applies to all subsequent drawing operations, + /// excluding text and glyph drawing operations. + /// + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode for future drawing operations. + /// + /// None + /// To specify the antialiasing mode for text and glyph operations, use the SetTextAntialiasMode method. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setantialiasmode void SetAntialiasMode( + // D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); + + /// Retrieves the current antialiasing mode for nontext drawing operations. + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The current antialiasing mode for nontext drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getantialiasmode D2D1_ANTIALIAS_MODE GetAntialiasMode(); + [PreserveSig] + new D2D1_ANTIALIAS_MODE GetAntialiasMode(); + + /// Specifies the antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextantialiasmode void + // SetTextAntialiasMode( D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode ); + [PreserveSig] + new void SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); + + /// Gets the current antialiasing mode for text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The current antialiasing mode for text and glyph drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextantialiasmode + // D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + [PreserveSig] + new D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + + /// Specifies text rendering options to be applied to all subsequent text and glyph drawing operations. + /// + /// Type: IDWriteRenderingParams* + /// + /// The text rendering options to be applied to all subsequent text and glyph drawing operations; NULL to clear current + /// text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextrenderingparams void + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + new void SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Retrieves the render target's current text rendering options. + /// + /// Type: IDWriteRenderingParams** + /// + /// When this method returns, textRenderingParamscontains the address of a pointer to the render target's current text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextrenderingparams void + // GetTextRenderingParams( IDWriteRenderingParams **textRenderingParams ); + [PreserveSig] + new void GetTextRenderingParams(out IDWriteRenderingParams textRenderingParams); + + /// Specifies a label for subsequent drawing operations. + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// None + /// + /// The labels specified by this method are printed by debug error messages. If no tag is set, the default value for each tag is 0. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settags void SetTags( ulong tag1, ulong + // tag2 ); + [PreserveSig] + new void SetTags(ulong tag1, ulong tag2); + + /// Gets the label for subsequent drawing operations. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the first label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the second label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// None + /// If the same address is passed for both parameters, both parameters receive the value of the second tag. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettags void GetTags( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + [PreserveSig] + new void GetTags(out ulong tag1, out ulong tag2); + + /// + /// Adds the specified layer to the render target so that it receives all subsequent drawing operations until PopLayer is called. + /// + /// + /// Type: const D2D1_LAYER_PARAMETERS + /// The content bounds, geometric mask, opacity, opacity mask, and antialiasing options for the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer that receives subsequent drawing operations. + /// + /// Note Starting with Windows 8, this parameter is optional. If a layer is not specified, Direct2D manages the layer + /// resource automatically. + /// + /// + /// None + /// + /// + /// The PushLayer method allows a caller to begin redirecting rendering to a layer. All rendering operations are valid in + /// a layer. The location of the layer is affected by the world transform set on the render target. + /// + /// + /// Each PushLayer must have a matching PopLayer call. If there are more PopLayer calls than PushLayer calls, the + /// render target is placed into an error state. If Flush is called before all outstanding layers are popped, the render target + /// is placed into an error state, and an error is returned. The error state can be cleared by a call to EndDraw. + /// + /// + /// A particular ID2D1Layer resource can be active only at one time. In other words, you cannot call a PushLayer method, + /// and then immediately follow with another PushLayer method with the same layer resource. Instead, you must call the + /// second PushLayer method with different layer resources. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushLayer) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushlayer(constd2d1_layer_parameters__id2d1layer) + // void PushLayer( const D2D1_LAYER_PARAMETERS & layerParameters, ID2D1Layer *layer ); + [PreserveSig] + new void PushLayer(in D2D1_LAYER_PARAMETERS layerParameters, [In, Optional] ID2D1Layer layer); + + /// Stops redirecting drawing operations to the layer that is specified by the last PushLayer call. + /// None + /// + /// A PopLayer must match a previous PushLayer call. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PopLayer) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-poplayer void PopLayer(); + [PreserveSig] + new void PopLayer(); + + /// Executes all pending drawing commands. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. If no error occurred, this method sets the error tag state to be (0,0). + /// + /// + /// + /// This command does not flush the Direct3D device context that is associated with the render target. + /// Calling this method resets the error state of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-flush HRESULT Flush( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void Flush(out ulong tag1, out ulong tag2); + + /// Saves the current drawing state to the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// + /// When this method returns, contains the current drawing state of the render target. This parameter must be initialized before + /// passing it to the method. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-savedrawingstate void SaveDrawingState( + // ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void SaveDrawingState([In, Out] ID2D1DrawingStateBlock drawingStateBlock); + + /// Sets the render target's drawing state to that of the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// The new drawing state of the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-restoredrawingstate void + // RestoreDrawingState( ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void RestoreDrawingState([In] ID2D1DrawingStateBlock drawingStateBlock); + + /// Specifies a rectangle to which all subsequent drawing operations are clipped. + /// + /// Type: [in] const D2D1_RECT_F & + /// The size and position of the clipping area, in device-independent pixels. + /// + /// + /// Type: [in] D2D1_ANTIALIAS_MODE + /// + /// The antialiasing mode that is used to draw the edges of clip rects that have subpixel boundaries, and to blend the clip with + /// the scene contents. The blending is performed once when the PopAxisAlignedClip method is called, and does not apply to each + /// primitive within the layer. + /// + /// + /// None + /// + /// + /// The clipRect is transformed by the current world transform set on the render target. After the transform is applied to the + /// clipRect that is passed in, the axis-aligned bounding box for the clipRect is computed. For efficiency, the contents are + /// clipped to this axis-aligned bounding box and not to the original clipRect that is passed in. + /// + /// + /// The following diagrams show how a rotation transform is applied to the render target, the resulting clipRect, and a + /// calculated axis-aligned bounding box. + /// + /// + /// + /// Assume the rectangle in the following illustration is a render target that is aligned to the screen pixels. + /// + /// + /// + /// Apply a rotation transform to the render target. In the following illustration, the black rectangle represents the original + /// render target and the red dashed rectangle represents the transformed render target. + /// + /// + /// + /// + /// After calling PushAxisAlignedClip, the rotation transform is applied to the clipRect. In the following illustration, + /// the blue rectangle represents the transformed clipRect. + /// + /// + /// + /// + /// The axis-aligned bounding box is calculated. The green dashed rectangle represents the bounding box in the following + /// illustration. All contents are clipped to this axis-aligned bounding box. + /// + /// + /// + /// + /// Note If rendering operations fail or if PopAxisAlignedClip is not called, clip rects may cause some artifacts on the + /// render target. PopAxisAlignedClip can be considered a drawing operation that is designed to fix the borders of a + /// clipping region. Without this call, the borders of a clipped area may be not antialiased or otherwise corrected. + /// + /// + /// The PushAxisAlignedClip and PopAxisAlignedClip must match. Otherwise, the error state is set. For the render target + /// to continue receiving new commands, you can call Flush to clear the error. + /// + /// + /// A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot + /// overlap. For example, the sequence of PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip is valid, + /// but the sequence of PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer is invalid. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushAxisAlignedClip) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushaxisalignedclip(constd2d1_rect_f__d2d1_antialias_mode) + // void PushAxisAlignedClip( const D2D1_RECT_F & clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void PushAxisAlignedClip(in D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode); + + /// + /// Removes the last axis-aligned clip from the render target. After this method is called, the clip is no longer applied to + /// subsequent drawing operations. + /// + /// None + /// + /// + /// A PushAxisAlignedClip/ PopAxisAlignedClip pair can occur around or within a PushLayer/PopLayer pair, but may not + /// overlap. For example, a PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip sequence is + /// valid, but a PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer sequence is not. + /// + /// PopAxisAlignedClip must be called once for every call to PushAxisAlignedClip. + /// For an example, see How to Clip with an Axis-Aligned Clip Rectangle. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// PopAxisAlignedClip) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-popaxisalignedclip void PopAxisAlignedClip(); + [PreserveSig] + new void PopAxisAlignedClip(); + + /// Clears the drawing area to the specified color. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The color to which the drawing area is cleared. + /// + /// None + /// + /// + /// Direct2D interprets the clearColor as straight alpha (not premultiplied). If the render target's alpha mode is + /// D2D1_ALPHA_MODE_IGNORE, the alpha channel of clearColor is ignored and replaced with 1.0f (fully opaque). + /// + /// + /// If the render target has an active clip (specified by PushAxisAlignedClip), the clear command is applied only to the area + /// within the clip region. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const + // D2D1_COLOR_F & clearColor ); + [PreserveSig] + new void Clear([In, Optional] IntPtr clearColor); + + /// Initiates drawing on this render target. + /// None + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are used to indicate that a render target is in use by the Direct2D system. Different implementations + /// of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget may be locked + /// between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on + /// EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing + /// of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success + /// of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw + /// method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-begindraw void BeginDraw(); + [PreserveSig] + new void BeginDraw(); + + /// Ends drawing operations on the render target and indicates the current error state and associated tags. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. + /// + /// + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different + /// implementations of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget + /// may be locked between BeginDraw/ EndDraw calls, a DXGI surface render target might be acquired on + /// BeginDraw and released on EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and + /// may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/ EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of + /// these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the + /// success of the operations and, optionally, the tag state of the render target at the time the error occurred. The + /// EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-enddraw HRESULT EndDraw( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void EndDraw(out ulong tag1, out ulong tag2); + + /// Retrieves the pixel format and alpha mode of the render target. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + new D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Sets the dots per inch (DPI) of the render target. + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the horizontal DPI of the render target. + /// + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the vertical DPI of the render target. + /// + /// None + /// + /// + /// This method specifies the mapping from pixel space to device-independent space for the render target. If both dpiX and dpiY + /// are 0, the factory-read system DPI is chosen. If one parameter is zero and the other unspecified, the DPI is not changed. + /// + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setdpi void SetDpi( FLOAT dpiX, FLOAT dpiY ); + [PreserveSig] + new void SetDpi(float dpiX, float dpiY); + + /// Return the render target's dots per inch (DPI). + /// + /// Type: FLOAT* + /// When this method returns, contains the horizontal DPI of the render target. This parameter is passed uninitialized. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the vertical DPI of the render target. This parameter is passed uninitialized. + /// + /// None + /// + /// This method indicates the mapping from pixel space to device-independent space for the render target. + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getdpi void GetDpi( FLOAT *dpiX, FLOAT + // *dpiY ); + [PreserveSig] + new void GetDpi(out float dpiX, out float dpiY); + + /// Returns the size of the render target in device-independent pixels. + /// + /// Type: D2D1_SIZE_F + /// The current size of the render target in device-independent pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + new D2D_SIZE_F GetSize(); + + /// Returns the size of the render target in device pixels. + /// + /// Type: D2D1_SIZE_U + /// The size of the render target in device pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + new D2D_SIZE_U GetPixelSize(); + + /// + /// Gets the maximum size, in device-dependent units (pixels), of any one bitmap dimension supported by the render target. + /// + /// + /// Type: UINT32 + /// The maximum size, in pixels, of any one bitmap dimension supported by the render target. + /// + /// + /// This method returns the maximum texture size of the Direct3D device. + /// + /// Note The software renderer and WARP devices return the value of 16 megapixels (16*1024*1024). You can create a + /// Direct2D texture that is this size, but not a Direct3D texture that is this size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getmaximumbitmapsize UINT32 GetMaximumBitmapSize(); + [PreserveSig] + new uint GetMaximumBitmapSize(); + + /// Indicates whether the render target supports the specified properties. + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES* + /// The render target properties to test. + /// + /// + /// Type: BOOL + /// TRUE if the specified render target properties are supported by this render target; otherwise, FALSE. + /// + /// This method does not evaluate the DPI settings specified by the renderTargetProperties parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-issupported(constd2d1_render_target_properties_) + // BOOL IsSupported( const D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + new bool IsSupported(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + + /// Retrieves the bitmap for this render target. The returned bitmap can be used for drawing operations. + /// + /// Type: ID2D1Bitmap** + /// + /// When this method returns, contains the address of a pointer to the bitmap for this render target. This bitmap can be used + /// for drawing operations. + /// + /// + /// + /// The DPI for the ID2D1Bitmap obtained from GetBitmap will be the DPI of the ID2D1BitmapRenderTarget when the render + /// target was created. Changing the DPI of the ID2D1BitmapRenderTarget by calling SetDpi doesn't affect the DPI of the + /// bitmap, even if SetDpi is called before GetBitmap. Using SetDpi to change the DPI of the + /// ID2D1BitmapRenderTarget does affect how contents are rendered into the bitmap: it just doesn't affect the DPI of the + /// bitmap retrieved by GetBitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmaprendertarget-getbitmap HRESULT GetBitmap( + // ID2D1Bitmap **bitmap ); + ID2D1Bitmap GetBitmap(); + } + + /// Defines an object that paints an area. Interfaces that derive from ID2D1Brush describe how the area is painted. + /// + /// + /// An ID2D1BitmapBrush is a device-dependent resource: your application should create bitmap brushes after it initializes the + /// render target with which the bitmap brush will be used, and recreate the bitmap brush whenever the render target needs + /// recreated. (For more information about resources, see Resources Overview.) + /// + /// + /// Brush space in Direct2D is specified differently than in XPS and Windows Presentation Foundation (WPF). In Direct2D, brush space + /// is not relative to the object being drawn, but rather is the current coordinate system of the render target, transformed by the + /// brush transform, if present. To paint an object as it would be painted by a WPF brush, you must translate the brush space origin + /// to the upper-left corner of the object's bounding box, and then scale the brush space so that the base tile fills the bounding + /// box of the object. + /// + /// For more information about brushes, see the Brushes Overview. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1brush + [PInvokeData("d2d1.h", MSDNShortId = "5b8f6ff8-ba52-4d30-9bea-3de89793c868")] + [ComImport, Guid("2cd906a8-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Brush : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + void GetTransform(out D2D_MATRIX_3X2_F transform); + } + + /// Issues drawing commands to a GDI device context. + /// + /// Creating ID2D1DCRenderTarget Objects + /// To create an ID2D1DCRenderTarget, use the ID2D1Factory::CreateDCRenderTarget method. + /// + /// Before you can render with the DC render target, you must use its BindDC method to associate it with a GDI DC. You do this each + /// time you use a different DC, or the size of the area you want to draw to changes. + /// + /// + /// To enable the DC render target to work with GDI, set its pixel format to DXGI_FORMAT_B8G8R8A8_UNORM and its alpha mode to + /// D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE. + /// + /// + /// Your application should create render targets once and hold onto them for the life of the application or until the render + /// target's EndDraw method returns the D2DERR_RECREATE_TARGET error. When you receive this error, you need to recreate the render + /// target (and any resources it created). + /// + /// ID2D1DCRenderTargets, GDI Transforms, and Right-to-Left Language Builds of Windows + /// + /// When you use an ID2D1DCRenderTarget, it renders Direct2D content to an internal bitmap, and then renders the bitmap to + /// the DC with GDI. + /// + /// + /// It's possible for GDI to apply a GDI transform (through the SetWorldTransform method) or other effect to the same DC used by the + /// render target, in which case GDI transforms the bitmap produced by Direct2D. Using a GDI transform to transform the Direct2D + /// content has the potential to degrade the visual quality of the output, because you're transforming a bitmap for which + /// antialiasing and subpixel positioning have already been calculated. + /// + /// + /// For example, suppose you use the render target to draw a scene that contains antialiased geometries and text. If you use a GDI + /// transform to apply a scale transform to the DC and scale the scene so that it's 10 times larger, you'll see pixelization and + /// jagged edges. (If, however, you applied a similar transform using Direct2D, the visual quality of the scene would not be degraded.) + /// + /// + /// In some cases, it might not be obvious that GDI is performing additional processing that might degrade the quality of the + /// Direct2D content. For example, on a right-to-left (RTL) build of Windows, content rendered by an ID2D1DCRenderTarget + /// might be horizontally inverted when GDI copies it to its destination. Whether the content is actually inverted depends on the + /// current settings of the DC. + /// + /// + /// Depending on the type of content being rendered, you might want to prevent the inversion. If the Direct2D content includes + /// ClearType text, this inversion will degrade the quality of the text. + /// + /// + /// You can control RTL rendering behavior by using the SetLayout GDI function. To prevent the mirroring, call the SetLayout + /// GDI function and specify LAYOUT_BITMAPORIENTATIONPRESERVED as the only value for the second parameter (do not combine it + /// with LAYOUT_RTL), as shown in the following example: + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1dcrendertarget + [PInvokeData("d2d1.h", MSDNShortId = "6546998e-6740-413a-88c5-36fa0decec8f")] + [ComImport, Guid("1c51bc64-de61-46fd-9899-63a5d8f03950"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1DCRenderTarget : ID2D1RenderTarget + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Creates a Direct2D bitmap from a pointer to in-memory source data. + /// + /// Type: [in] D2D1_SIZE_U + /// The dimensions of the bitmap to create in pixels. + /// + /// + /// Type: [in, optional] const void* + /// A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap. + /// + /// + /// Type: [in] UINT32 + /// + /// The byte count of each scanline, which is equal to (the image width in pixels × the number of bytes per pixel) + memory + /// padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.) + /// + /// + /// + /// Type: [in] const D2D1_BITMAP_PROPERTIES & + /// The pixel format and dots per inch (DPI) of the bitmap to create. + /// + /// + /// Type: [out] ID2D1Bitmap** + /// When this method returns, contains a pointer to a pointer to the new bitmap. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmap(d2d1_size_u_constvoid_uint32_constd2d1_bitmap_properties__id2d1bitmap) + // HRESULT CreateBitmap( D2D1_SIZE_U size, const void *srcData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES & + // bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmap(D2D_SIZE_U size, [In, Optional] IntPtr srcData, uint pitch, in D2D1_BITMAP_PROPERTIES bitmapProperties); + + /// Creates an ID2D1Bitmap by copying the specified Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: [in] IWICBitmapSource* + /// The WIC bitmap to copy. + /// + /// + /// Type: [in, optional] const D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create. The pixel format must match the pixel format of wicBitmapSource, or the + /// method will fail. To prevent a mismatch, you can pass NULL or pass the value obtained from calling the + /// D2D1::PixelFormat helper function without specifying any parameter values. If both dpiX and dpiY are 0.0f, the default DPI, + /// 96, is used. DPI information embedded in wicBitmapSource is ignored. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// Before Direct2D can load a WIC bitmap, that bitmap must be converted to a supported pixel format and alpha mode. For a list + /// of supported pixel formats and alpha modes, see Supported Pixel Formats and Alpha Modes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) + // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, + // ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1Bitmap whose data is shared with another resource. + /// + /// Type: REFIID + /// The interface ID of the object supplying the source data. + /// + /// + /// Type: void* + /// + /// An ID2D1Bitmap, IDXGISurface, or an IWICBitmapLock that contains the data to share with the new ID2D1Bitmap. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create . The DXGI_FORMAT portion of the pixel format must match the DXGI_FORMAT of + /// data or the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or + /// the value obtained from the D2D1::PixelFormat helper function. The DPI settings do not have to match those of data. If both + /// dpiX and dpiY are 0.0f, the DPI of the render target is used. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// + /// The CreateSharedBitmap method is useful for efficiently reusing bitmap data and can also be used to provide + /// interoperability with Direct3D. + /// + /// Sharing an ID2D1Bitmap + /// + /// By passing an ID2D1Bitmap created by a render target that is resource-compatible, you can share a bitmap with that render + /// target; both the original ID2D1Bitmap and the new ID2D1Bitmap created by this method will point to the same + /// bitmap data. For more information about when render target resources can be shared, see the Sharing Render Target Resources + /// section of the Resources Overview. + /// + /// + /// You may also use this method to reinterpret the data of an existing bitmap and specify a new DPI or alpha mode. For example, + /// in the case of a bitmap atlas, an ID2D1Bitmap may contain multiple sub-images, each of which should be rendered with a + /// different D2D1_ALPHA_MODE ( D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE). You could use the + /// CreateSharedBitmap method to reinterpret the bitmap using the desired alpha mode without having to load a separate + /// copy of the bitmap into memory. + /// + /// Sharing an IDXGISurface + /// + /// When using a DXGI surface render target (an ID2D1RenderTarget object created by the CreateDxgiSurfaceRenderTarget method), + /// you can pass an IDXGISurface surface to the CreateSharedBitmap method to share video memory with Direct3D and + /// manipulate Direct3D content as an ID2D1Bitmap. As described in the Resources Overview, the render target and the + /// IDXGISurface must be using the same Direct3D device. + /// + /// + /// Note also that the IDXGISurface must use one of the supported pixel formats and alpha modes described in Supported Pixel + /// Formats and Alpha Modes. + /// + /// For more information about interoperability with Direct3D, see the Direct2D and Direct3D Interoperability Overview. + /// Sharing an IWICBitmapLock + /// + /// An IWICBitmapLock stores the content of a WIC bitmap and shields it from simultaneous accesses. By passing an + /// IWICBitmapLock to the CreateSharedBitmap method, you can create an ID2D1Bitmap that points to the bitmap data + /// already stored in the IWICBitmapLock. + /// + /// + /// To use an IWICBitmapLock with the CreateSharedBitmap method, the render target must use software rendering. To force + /// a render target to use software rendering, set to D2D1_RENDER_TARGET_TYPE_SOFTWARE the type field of the + /// D2D1_RENDER_TARGET_PROPERTIES structure that you use to create the render target. To check whether an existing render target + /// uses software rendering, use the IsSupported method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT + // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1BitmapBrush from the specified bitmap. + /// + /// Type: ID2D1Bitmap* + /// The bitmap contents of the new brush. + /// + /// + /// Type: D2D1_BITMAP_BRUSH_PROPERTIES* + /// + /// The extend modes and interpolation mode of the new brush, or NULL. If you set this parameter to NULL, the + /// brush defaults to the D2D1_EXTEND_MODE_CLAMP horizontal and vertical extend modes and the + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR interpolation mode. + /// + /// + /// + /// Type: D2D1_BRUSH_PROPERTIES* + /// + /// A structure that contains the opacity and transform of the new brush, or NULL. If you set this parameter to + /// NULL, the brush sets the opacity member to 1.0F and the transform member to the identity matrix. + /// + /// + /// + /// Type: ID2D1BitmapBrush** + /// + /// When this method returns, this output parameter contains a pointer to a pointer to the new brush. Pass this parameter uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) + // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The red, green, blue, and alpha values of the brush's color. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES & + /// The base opacity of the brush. + /// + /// + /// Type: [out] ID2D1SolidColorBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) + // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, + // ID2D1SolidColorBrush **solidColorBrush ); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + + /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. + /// + /// Type: [in] D2D1_GRADIENT_STOP* + /// A pointer to an array of D2D1_GRADIENT_STOP structures. + /// + /// + /// Type: [in] UINT + /// A value greater than or equal to 1 that specifies the number of gradient stops in the gradientStops array. + /// + /// + /// Type: [in] D2D1_GAMMA + /// The space in which color interpolation between the gradient stops is performed. + /// + /// + /// Type: [in] D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized range. + /// + /// + /// Type: [out] ID2D1GradientStopCollection** + /// When this method returns, contains a pointer to a pointer to the new gradient stop collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 + // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA + // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); + new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + + /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. + /// + /// Type: [in] const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES* + /// The start and end points of the gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the + /// gradient line. + /// + /// + /// + /// Type: [out] ID2D1LinearGradientBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlineargradientbrush%28constd2d1_linear_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1lineargradientbrush%29 + // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush + // **linearGradientBrush ); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. + /// + /// Type: const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES* + /// The center, gradient origin offset, and x-radius and y-radius of the brush's gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the gradient. + /// + /// + /// + /// Type: [out] ID2D1RadialGradientBrush** + /// When this method returns, contains a pointer to a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createradialgradientbrush%28constd2d1_radial_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1radialgradientbrush%29 + // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush + // **radialGradientBrush ); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// + /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. + /// + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// The desired size of the new render target (in device-independent pixels), if it should be different from the original render + /// target. For more info, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_SIZE_U* + /// + /// The desired size of the new render target in pixels if it should be different from the original render target. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_PIXEL_FORMAT* + /// + /// The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new + /// render target uses the same pixel format as the original render target. If the alpha mode is D2D1_ALPHA_MODE_UNKNOWN, the + /// alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel + /// formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: [in] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS + /// A value that specifies whether the new render target must be compatible with GDI. + /// + /// + /// Type: [out] ID2D1BitmapRenderTarget** + /// + /// When this method returns, contains a pointer to a pointer to a new bitmap render target. This parameter is passed uninitialized. + /// + /// + /// + /// The pixel size and DPI of the new render target can be altered by specifying values for desiredSize or desiredPixelSize: + /// + /// + /// + /// If desiredSize is specified but desiredPixelSize is not, the pixel size is computed from the desired size using the parent + /// target DPI. If the desiredSize maps to a integer-pixel size, the DPI of the compatible render target is the same as the DPI + /// of the parent target. If desiredSize maps to a fractional-pixel size, the pixel size is rounded up to the nearest integer + /// and the DPI for the compatible render target is slightly higher than the DPI of the parent render target. In all cases, the + /// coordinate (desiredSize.width, desiredSize.height) maps to the lower-right corner of the compatible render target. + /// + /// + /// + /// + /// If the desiredPixelSize is specified and desiredSize is not, the DPI of the new render target is the same as the original + /// render target. + /// + /// + /// + /// + /// If both desiredSize and desiredPixelSize are specified, the DPI of the new render target is computed to account for the + /// difference in scale. + /// + /// + /// + /// + /// If neither desiredSize nor desiredPixelSize is specified, the new render target size and DPI match the original render target. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) + // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const + // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + + /// Creates a layer resource that can be used with this render target and its compatible render targets. + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// If (0, 0) is specified, no backing store is created behind the layer resource. The layer resource is allocated to the + /// minimum size when PushLayer is called. + /// + /// + /// + /// Type: [out] ID2D1Layer** + /// When the method returns, contains a pointer to a pointer to the new layer. This parameter is passed uninitialized. + /// + /// The layer automatically resizes itself, as needed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) + // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); + new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + + /// Create a mesh that uses triangles to describe a shape. + /// + /// Type: ID2D1Mesh** + /// When this method returns, contains a pointer to a pointer to the new mesh. + /// + /// + /// To populate a mesh, use its Open method to obtain an ID2D1TessellationSink. To draw the mesh, use the render target's + /// FillMesh method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createmesh HRESULT CreateMesh( ID2D1Mesh + // **mesh ); + new ID2D1Mesh CreateMesh(); + + /// Draws a line between the specified points using the specified stroke style. + /// + /// Type: D2D1_POINT_2F + /// The start point of the line, in device-independent pixels. + /// + /// + /// Type: D2D1_POINT_2F + /// The end point of the line, in device-independent pixels. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the line's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid line. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline void DrawLine( D2D1_POINT_2F + // point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawLine(D2D_POINT_2F point0, D2D_POINT_2F point1, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Draws the outline of a rectangle that has the specified dimensions and stroke style. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimensions of the rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's stroke. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid stroke. + /// + /// None + /// + /// When this method fails, it does not return an error code. To determine whether a drawing method (such as DrawRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawrectangle(constd2d1_rect_f__id2d1brush_float_id2d1strokestyle) + // void DrawRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rectangle. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimension of the rectangle to paint, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's interior. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillrectangle(constd2d1_rect_f__id2d1brush) + // void FillRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified rounded rectangle using the specified stroke style. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rounded rectangle's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawroundedrectangle(constd2d1_rounded_rect__id2d1brush_float_id2d1strokestyle) + // void DrawRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle + // *strokeStyle ); + [PreserveSig] + new void DrawRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rounded rectangle. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to paint, in device independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the rounded rectangle. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// FillRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillroundedrectangle(constd2d1_rounded_rect__id2d1brush) + // void FillRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified ellipse using the specified stroke style. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius of the ellipse to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the ellipse's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the ellipse's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// The DrawEllipse method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawEllipse) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawellipse(constd2d1_ellipse__id2d1brush_float_id2d1strokestyle) + // void DrawEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified ellipse. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius, in device-independent pixels, of the ellipse to paint. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the ellipse. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillEllipse) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillellipse(constd2d1_ellipse__id2d1brush) + // void FillEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush ); + [PreserveSig] + new void FillEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush); + + /// Draws the outline of the specified geometry using the specified stroke style. + /// + /// Type: ID2D1Geometry* + /// The geometry to draw. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawgeometry void DrawGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified geometry. + /// + /// Type: ID2D1Geometry* + /// The geometry to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's interior. + /// + /// + /// Type: ID2D1Brush* + /// + /// The opacity mask to apply to the geometry, or NULL for no opacity mask. If an opacity mask (the opacityBrush + /// parameter) is specified, brush must be an ID2D1BitmapBrush that has its x- and y-extend modes set to D2D1_EXTEND_MODE_CLAMP. + /// For more information, see the Remarks section. + /// + /// + /// None + /// + /// + /// If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to + /// determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush + /// is used for this processing; all other color information is ignored. + /// + /// + /// The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted + /// by brush. + /// + /// + /// When this method fails, it does not return an error code. To determine whether a drawing operation (such as + /// FillGeometry) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillgeometry void FillGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush ); + [PreserveSig] + new void FillGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, [In] ID2D1Brush opacityBrush = null); + + /// Paints the interior of the specified mesh. + /// + /// Type: ID2D1Mesh* + /// The mesh to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the mesh. + /// + /// None + /// + /// + /// The current antialias mode of the render target must be D2D1_ANTIALIAS_MODE_ALIASED when FillMesh is called. To + /// change the render target's antialias mode, use the SetAntialiasMode method. + /// + /// + /// FillMesh does not expect a particular winding order for the triangles in the ID2D1Mesh; both clockwise and + /// counter-clockwise will work. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillMesh) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillmesh void FillMesh( ID2D1Mesh *mesh, + // ID2D1Brush *brush ); + [PreserveSig] + new void FillMesh([In] ID2D1Mesh mesh, [In] ID2D1Brush brush); + + /// + /// Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target. + /// + /// + /// Type: ID2D1Bitmap* + /// + /// The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is + /// multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle. + /// + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the region of the render target specified by destinationRectangle. + /// + /// + /// Type: D2D1_OPACITY_MASK_CONTENT + /// + /// The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended. + /// + /// + /// Note Starting with Windows 8, the D2D1_OPACITY_MASK_CONTENT is not required. See the + /// ID2D1DeviceContext::FillOpacityMask method, which has no D2D1_OPACITY_MASK_CONTENT parameter. + /// + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the render target to paint, in device-independent pixels. + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the bitmap to use as the opacity mask, in device-independent pixels. + /// + /// None + /// + /// + /// For this method to work properly, the render target must be using the D2D1_ANTIALIAS_MODE_ALIASED antialiasing mode. You can + /// set the antialiasing mode by calling the ID2D1RenderTarget::SetAntialiasMode method. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillOpacityMask) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_) + // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & + // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + + /// Draws the specified bitmap after scaling it to the size of the specified rectangle. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to render. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap + /// is drawn. If the rectangle is not well-ordered, nothing is drawn, but the render target does not enter an error state. + /// + /// + /// + /// Type: FLOAT + /// + /// A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied + /// against the alpha values of the bitmap's contents. + /// + /// + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to draw. + /// + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawBitmap) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawbitmap(id2d1bitmap_constd2d1_rect_f__float_d2d1_bitmap_interpolation_mode_constd2d1_rect_f_) + // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, + // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + + /// Draws the specified text using the format information provided by an IDWriteTextFormat object. + /// + /// Type: WCHAR* + /// A pointer to an array of Unicode characters to draw. + /// + /// + /// Type: UINT + /// The number of characters in string. + /// + /// + /// Type: IDWriteTextFormat* + /// An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction. + /// + /// + /// Type: const D2D1_RECT_F + /// The size and position of the area in which the text is drawn. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the text. + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// To create an IDWriteTextFormat object, create an IDWriteFactory and call its CreateTextFormat method. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawText) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtext(constwchar_uint32_idwritetextformat_constd2d1_rect_f__id2d1brush_d2d1_draw_text_options_dwrite_measuring_mode) + // void DrawText( const WCHAR *string, UINT32 stringLength, IDWriteTextFormat *textFormat, const D2D1_RECT_F & layoutRect, + // ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + new void DrawText([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, in D2D_RECT_F layoutRect, + [In] ID2D1Brush defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// Draws the formatted text described by the specified IDWriteTextLayout object. + /// + /// Type: D2D1_POINT_2F + /// + /// The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn. + /// + /// + /// + /// Type: IDWriteTextLayout* + /// + /// The formatted text to draw. Any drawing effects that do not inherit from ID2D1Resource are ignored. If there are drawing + /// effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an + /// error state. + /// + /// + /// + /// Type: ID2D1Brush* + /// + /// The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect + /// (specified by the IDWriteTextLayout::SetDrawingEffect method). + /// + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// None + /// + /// + /// When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the DrawText + /// method because the text doesn't need to be formatted and the layout processed with each call. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawTextLayout) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtextlayout void DrawTextLayout( + // D2D1_POINT_2F origin, IDWriteTextLayout *textLayout, ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options ); + [PreserveSig] + new void DrawTextLayout(D2D_POINT_2F origin, [In] IDWriteTextLayout textLayout, [In] ID2D1Brush defaultFillBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE); + + /// Draws the specified glyphs. + /// + /// Type: D2D1_POINT_2F + /// The origin, in device-independent pixels, of the glyphs' baseline. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the specified glyphs. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGlyphRun) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawglyphrun void DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE + // measuringMode ); + [PreserveSig] + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In] ID2D1Brush foregroundBrush, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// + /// Applies the specified transform to the render target, replacing the existing transformation. All subsequent drawing + /// operations occur in the transformed space. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the current transform of the render target. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this returns, contains the current transform of the render target. This parameter is passed uninitialized. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettransform void GetTransform( + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// + /// Sets the antialiasing mode of the render target. The antialiasing mode applies to all subsequent drawing operations, + /// excluding text and glyph drawing operations. + /// + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode for future drawing operations. + /// + /// None + /// To specify the antialiasing mode for text and glyph operations, use the SetTextAntialiasMode method. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setantialiasmode void SetAntialiasMode( + // D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); + + /// Retrieves the current antialiasing mode for nontext drawing operations. + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The current antialiasing mode for nontext drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getantialiasmode D2D1_ANTIALIAS_MODE GetAntialiasMode(); + [PreserveSig] + new D2D1_ANTIALIAS_MODE GetAntialiasMode(); + + /// Specifies the antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextantialiasmode void + // SetTextAntialiasMode( D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode ); + [PreserveSig] + new void SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); + + /// Gets the current antialiasing mode for text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The current antialiasing mode for text and glyph drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextantialiasmode + // D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + [PreserveSig] + new D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + + /// Specifies text rendering options to be applied to all subsequent text and glyph drawing operations. + /// + /// Type: IDWriteRenderingParams* + /// + /// The text rendering options to be applied to all subsequent text and glyph drawing operations; NULL to clear current + /// text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextrenderingparams void + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + new void SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Retrieves the render target's current text rendering options. + /// + /// Type: IDWriteRenderingParams** + /// + /// When this method returns, textRenderingParamscontains the address of a pointer to the render target's current text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextrenderingparams void + // GetTextRenderingParams( IDWriteRenderingParams **textRenderingParams ); + [PreserveSig] + new void GetTextRenderingParams(out IDWriteRenderingParams textRenderingParams); + + /// Specifies a label for subsequent drawing operations. + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// None + /// + /// The labels specified by this method are printed by debug error messages. If no tag is set, the default value for each tag is 0. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settags void SetTags( ulong tag1, ulong + // tag2 ); + [PreserveSig] + new void SetTags(ulong tag1, ulong tag2); + + /// Gets the label for subsequent drawing operations. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the first label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the second label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// None + /// If the same address is passed for both parameters, both parameters receive the value of the second tag. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettags void GetTags( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + [PreserveSig] + new void GetTags(out ulong tag1, out ulong tag2); + + /// + /// Adds the specified layer to the render target so that it receives all subsequent drawing operations until PopLayer is called. + /// + /// + /// Type: const D2D1_LAYER_PARAMETERS + /// The content bounds, geometric mask, opacity, opacity mask, and antialiasing options for the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer that receives subsequent drawing operations. + /// + /// Note Starting with Windows 8, this parameter is optional. If a layer is not specified, Direct2D manages the layer + /// resource automatically. + /// + /// + /// None + /// + /// + /// The PushLayer method allows a caller to begin redirecting rendering to a layer. All rendering operations are valid in + /// a layer. The location of the layer is affected by the world transform set on the render target. + /// + /// + /// Each PushLayer must have a matching PopLayer call. If there are more PopLayer calls than PushLayer calls, the + /// render target is placed into an error state. If Flush is called before all outstanding layers are popped, the render target + /// is placed into an error state, and an error is returned. The error state can be cleared by a call to EndDraw. + /// + /// + /// A particular ID2D1Layer resource can be active only at one time. In other words, you cannot call a PushLayer method, + /// and then immediately follow with another PushLayer method with the same layer resource. Instead, you must call the + /// second PushLayer method with different layer resources. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushLayer) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushlayer(constd2d1_layer_parameters__id2d1layer) + // void PushLayer( const D2D1_LAYER_PARAMETERS & layerParameters, ID2D1Layer *layer ); + [PreserveSig] + new void PushLayer(in D2D1_LAYER_PARAMETERS layerParameters, [In, Optional] ID2D1Layer layer); + + /// Stops redirecting drawing operations to the layer that is specified by the last PushLayer call. + /// None + /// + /// A PopLayer must match a previous PushLayer call. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PopLayer) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-poplayer void PopLayer(); + [PreserveSig] + new void PopLayer(); + + /// Executes all pending drawing commands. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. If no error occurred, this method sets the error tag state to be (0,0). + /// + /// + /// + /// This command does not flush the Direct3D device context that is associated with the render target. + /// Calling this method resets the error state of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-flush HRESULT Flush( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void Flush(out ulong tag1, out ulong tag2); + + /// Saves the current drawing state to the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// + /// When this method returns, contains the current drawing state of the render target. This parameter must be initialized before + /// passing it to the method. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-savedrawingstate void SaveDrawingState( + // ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void SaveDrawingState([In, Out] ID2D1DrawingStateBlock drawingStateBlock); + + /// Sets the render target's drawing state to that of the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// The new drawing state of the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-restoredrawingstate void + // RestoreDrawingState( ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void RestoreDrawingState([In] ID2D1DrawingStateBlock drawingStateBlock); + + /// Specifies a rectangle to which all subsequent drawing operations are clipped. + /// + /// Type: [in] const D2D1_RECT_F & + /// The size and position of the clipping area, in device-independent pixels. + /// + /// + /// Type: [in] D2D1_ANTIALIAS_MODE + /// + /// The antialiasing mode that is used to draw the edges of clip rects that have subpixel boundaries, and to blend the clip with + /// the scene contents. The blending is performed once when the PopAxisAlignedClip method is called, and does not apply to each + /// primitive within the layer. + /// + /// + /// None + /// + /// + /// The clipRect is transformed by the current world transform set on the render target. After the transform is applied to the + /// clipRect that is passed in, the axis-aligned bounding box for the clipRect is computed. For efficiency, the contents are + /// clipped to this axis-aligned bounding box and not to the original clipRect that is passed in. + /// + /// + /// The following diagrams show how a rotation transform is applied to the render target, the resulting clipRect, and a + /// calculated axis-aligned bounding box. + /// + /// + /// + /// Assume the rectangle in the following illustration is a render target that is aligned to the screen pixels. + /// + /// + /// + /// Apply a rotation transform to the render target. In the following illustration, the black rectangle represents the original + /// render target and the red dashed rectangle represents the transformed render target. + /// + /// + /// + /// + /// After calling PushAxisAlignedClip, the rotation transform is applied to the clipRect. In the following illustration, + /// the blue rectangle represents the transformed clipRect. + /// + /// + /// + /// + /// The axis-aligned bounding box is calculated. The green dashed rectangle represents the bounding box in the following + /// illustration. All contents are clipped to this axis-aligned bounding box. + /// + /// + /// + /// + /// Note If rendering operations fail or if PopAxisAlignedClip is not called, clip rects may cause some artifacts on the + /// render target. PopAxisAlignedClip can be considered a drawing operation that is designed to fix the borders of a + /// clipping region. Without this call, the borders of a clipped area may be not antialiased or otherwise corrected. + /// + /// + /// The PushAxisAlignedClip and PopAxisAlignedClip must match. Otherwise, the error state is set. For the render target + /// to continue receiving new commands, you can call Flush to clear the error. + /// + /// + /// A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot + /// overlap. For example, the sequence of PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip is valid, + /// but the sequence of PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer is invalid. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushAxisAlignedClip) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushaxisalignedclip(constd2d1_rect_f__d2d1_antialias_mode) + // void PushAxisAlignedClip( const D2D1_RECT_F & clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void PushAxisAlignedClip(in D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode); + + /// + /// Removes the last axis-aligned clip from the render target. After this method is called, the clip is no longer applied to + /// subsequent drawing operations. + /// + /// None + /// + /// + /// A PushAxisAlignedClip/ PopAxisAlignedClip pair can occur around or within a PushLayer/PopLayer pair, but may not + /// overlap. For example, a PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip sequence is + /// valid, but a PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer sequence is not. + /// + /// PopAxisAlignedClip must be called once for every call to PushAxisAlignedClip. + /// For an example, see How to Clip with an Axis-Aligned Clip Rectangle. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// PopAxisAlignedClip) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-popaxisalignedclip void PopAxisAlignedClip(); + [PreserveSig] + new void PopAxisAlignedClip(); + + /// Clears the drawing area to the specified color. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The color to which the drawing area is cleared. + /// + /// None + /// + /// + /// Direct2D interprets the clearColor as straight alpha (not premultiplied). If the render target's alpha mode is + /// D2D1_ALPHA_MODE_IGNORE, the alpha channel of clearColor is ignored and replaced with 1.0f (fully opaque). + /// + /// + /// If the render target has an active clip (specified by PushAxisAlignedClip), the clear command is applied only to the area + /// within the clip region. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const + // D2D1_COLOR_F & clearColor ); + [PreserveSig] + new void Clear([In, Optional] IntPtr clearColor); + + /// Initiates drawing on this render target. + /// None + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are used to indicate that a render target is in use by the Direct2D system. Different implementations + /// of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget may be locked + /// between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on + /// EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing + /// of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success + /// of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw + /// method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-begindraw void BeginDraw(); + [PreserveSig] + new void BeginDraw(); + + /// Ends drawing operations on the render target and indicates the current error state and associated tags. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. + /// + /// + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different + /// implementations of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget + /// may be locked between BeginDraw/ EndDraw calls, a DXGI surface render target might be acquired on + /// BeginDraw and released on EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and + /// may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/ EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of + /// these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the + /// success of the operations and, optionally, the tag state of the render target at the time the error occurred. The + /// EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-enddraw HRESULT EndDraw( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void EndDraw(out ulong tag1, out ulong tag2); + + /// Retrieves the pixel format and alpha mode of the render target. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + new D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Sets the dots per inch (DPI) of the render target. + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the horizontal DPI of the render target. + /// + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the vertical DPI of the render target. + /// + /// None + /// + /// + /// This method specifies the mapping from pixel space to device-independent space for the render target. If both dpiX and dpiY + /// are 0, the factory-read system DPI is chosen. If one parameter is zero and the other unspecified, the DPI is not changed. + /// + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setdpi void SetDpi( FLOAT dpiX, FLOAT dpiY ); + [PreserveSig] + new void SetDpi(float dpiX, float dpiY); + + /// Return the render target's dots per inch (DPI). + /// + /// Type: FLOAT* + /// When this method returns, contains the horizontal DPI of the render target. This parameter is passed uninitialized. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the vertical DPI of the render target. This parameter is passed uninitialized. + /// + /// None + /// + /// This method indicates the mapping from pixel space to device-independent space for the render target. + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getdpi void GetDpi( FLOAT *dpiX, FLOAT + // *dpiY ); + [PreserveSig] + new void GetDpi(out float dpiX, out float dpiY); + + /// Returns the size of the render target in device-independent pixels. + /// + /// Type: D2D1_SIZE_F + /// The current size of the render target in device-independent pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + new D2D_SIZE_F GetSize(); + + /// Returns the size of the render target in device pixels. + /// + /// Type: D2D1_SIZE_U + /// The size of the render target in device pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + new D2D_SIZE_U GetPixelSize(); + + /// + /// Gets the maximum size, in device-dependent units (pixels), of any one bitmap dimension supported by the render target. + /// + /// + /// Type: UINT32 + /// The maximum size, in pixels, of any one bitmap dimension supported by the render target. + /// + /// + /// This method returns the maximum texture size of the Direct3D device. + /// + /// Note The software renderer and WARP devices return the value of 16 megapixels (16*1024*1024). You can create a + /// Direct2D texture that is this size, but not a Direct3D texture that is this size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getmaximumbitmapsize UINT32 GetMaximumBitmapSize(); + [PreserveSig] + new uint GetMaximumBitmapSize(); + + /// Indicates whether the render target supports the specified properties. + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES* + /// The render target properties to test. + /// + /// + /// Type: BOOL + /// TRUE if the specified render target properties are supported by this render target; otherwise, FALSE. + /// + /// This method does not evaluate the DPI settings specified by the renderTargetProperties parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-issupported(constd2d1_render_target_properties_) + // BOOL IsSupported( const D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + new bool IsSupported(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + + /// Binds the render target to the device context to which it issues drawing commands. + /// + /// Type: const HDC + /// The device context to which the render target issues drawing commands. + /// + /// + /// Type: const RECT* + /// The dimensions of the handle to a device context (HDC) to which the render target is bound. + /// + /// + /// Before you can render with the DC render target, you must use its BindDC method to associate it with a GDI DC. You do + /// this each time you use a different DC, or the size of the area you want to draw to changes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1dcrendertarget-binddc HRESULT BindDC( const HDC hDC, + // const RECT *pSubRect ); + void BindDC([In] HDC hDC, in RECT pSubRect); + } + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// The instance. + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by less + /// than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + public static bool FillContainsPoint(this ID2D1Geometry geometry, D2D_POINT_2F point, float flatteningTolerance, D2D_MATRIX_3X2_F? worldTransform = null) + { + using SafeHGlobalStruct mem = worldTransform; + return geometry.FillContainsPoint(point, mem, flatteningTolerance); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct2D/D2d1.Interfaces2.cs b/PInvoke/Graphics/Direct2D/D2d1.Interfaces2.cs new file mode 100644 index 00000000..6cb756cb --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1.Interfaces2.cs @@ -0,0 +1,3535 @@ +using System; +using System.Runtime.InteropServices; +using static Vanara.PInvoke.Dwrite; +using static Vanara.PInvoke.DXGI; +using static Vanara.PInvoke.WindowsCodecs; + +namespace Vanara.PInvoke +{ + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// Represents a resource domain whose objects and device contexts can be used together. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1device + [PInvokeData("d2d1_1.h", MSDNShortId = "21f77c38-c115-4fdf-b294-570577a29201")] + [ComImport, Guid("47dd575d-ac05-4cdd-8049-9b02cd16f44c"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Device : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Creates a new device context from a Direct2D device. + /// + /// Type: D2D1_DEVICE_CONTEXT_OPTIONS + /// The options to be applied to the created device context. + /// + /// + /// Type: const ID2D1DeviceContext** + /// When this method returns, contains the address of a pointer to the new device context. + /// + /// + /// The new device context will not have a selected target bitmap. The caller must create and select a bitmap as the target + /// surface of the context. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1device-createdevicecontext HRESULT + // CreateDeviceContext( D2D1_DEVICE_CONTEXT_OPTIONS options, ID2D1DeviceContext **deviceContext ); + ID2D1DeviceContext CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS options); + + /// + /// Creates an ID2D1PrintControl object that converts Direct2D primitives stored in ID2D1CommandList into a fixed page + /// representation. The print sub-system then consumes the primitives. + /// + /// + /// Type: IWICImagingFactory* + /// A WIC imaging factory. + /// + /// + /// Type: IPrintDocumentPackageTarget* + /// The target print job for this control. + /// + /// + /// Type: const D2D1_PRINT_CONTROL_PROPERTIES* + /// The options to be applied to the print control. + /// + /// + /// Type: ID2D1PrintControl** + /// When this method returns, contains the address of a pointer to an ID2D1PrintControl object. + /// + /// + /// Note This is a blocking or synchronous function and might not return immediately. How quickly this function returns + /// depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors + /// that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with + /// the user interface could make the application appear to be unresponsive. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1device-createprintcontrol(iwicimagingfactory_iprintdocumentpackagetarget_constd2d1_print_control_properties_id2d1printcontrol) + // HRESULT CreatePrintControl( IWICImagingFactory *wicFactory, IPrintDocumentPackageTarget *documentTarget, const + // D2D1_PRINT_CONTROL_PROPERTIES *printControlProperties, ID2D1PrintControl **printControl ); + ID2D1PrintControl CreatePrintControl(IWICImagingFactory wicFactory, [In, MarshalAs(UnmanagedType.Interface)] /*IPrintDocumentPackageTarget*/ object documentTarget, in D2D1_PRINT_CONTROL_PROPERTIES printControlProperties); + + /// + /// Sets the maximum amount of texture memory Direct2D accumulates before it purges the image caches and cached texture allocations. + /// + /// + /// Type: UINT64 + /// The new maximum texture memory in bytes. + /// + /// None + /// + /// Note Direct2D may exceed the maximum texture memory you set with this method for a single frame if necessary to + /// render the frame. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1device-setmaximumtexturememory void + // SetMaximumTextureMemory( UINT64 maximumInBytes ); + [PreserveSig] + void SetMaximumTextureMemory(ulong maximumInBytes); + + /// + /// Sets the maximum amount of texture memory Direct2D accumulates before it purges the image caches and cached texture allocations. + /// + /// + /// Type: UINT64 + /// The maximum amount of texture memory in bytes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1device-getmaximumtexturememory UINT64 GetMaximumTextureMemory(); + [PreserveSig] + ulong GetMaximumTextureMemory(); + + /// Clears all of the rendering resources used by Direct2D. + /// + /// Type: UINT + /// + /// Discards only resources that haven't been used for greater than the specified time in milliseconds. The default is 0 milliseconds. + /// + /// + /// + /// Type: HRESULT + /// If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1device-clearresources void ClearResources( UINT32 + // millisecondsSinceUse ); + [PreserveSig] + void ClearResources(uint millisecondsSinceUse); + } + + /// + /// Represents a set of state and command buffers that are used to render to a target. + /// The device context can render to a target bitmap or a command list. + /// + /// + /// Any resource created from a device context can be shared with any other resource created from a device context when both + /// contexts are created on the same device. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1devicecontext + [PInvokeData("d2d1_1.h", MSDNShortId = "a54dd628-c2a2-4b04-9ced-7749a395f187")] + [ComImport, Guid("e8f7fe7a-191c-466d-ad95-975678bda998"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1DeviceContext : ID2D1RenderTarget + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Creates a Direct2D bitmap from a pointer to in-memory source data. + /// + /// Type: [in] D2D1_SIZE_U + /// The dimensions of the bitmap to create in pixels. + /// + /// + /// Type: [in, optional] const void* + /// A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap. + /// + /// + /// Type: [in] UINT32 + /// + /// The byte count of each scanline, which is equal to (the image width in pixels × the number of bytes per pixel) + memory + /// padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.) + /// + /// + /// + /// Type: [in] const D2D1_BITMAP_PROPERTIES & + /// The pixel format and dots per inch (DPI) of the bitmap to create. + /// + /// + /// Type: [out] ID2D1Bitmap** + /// When this method returns, contains a pointer to a pointer to the new bitmap. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmap(d2d1_size_u_constvoid_uint32_constd2d1_bitmap_properties__id2d1bitmap) + // HRESULT CreateBitmap( D2D1_SIZE_U size, const void *srcData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES & + // bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmap(D2D_SIZE_U size, [In, Optional] IntPtr srcData, uint pitch, in D2D1_BITMAP_PROPERTIES bitmapProperties); + + /// Creates an ID2D1Bitmap by copying the specified Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: [in] IWICBitmapSource* + /// The WIC bitmap to copy. + /// + /// + /// Type: [in, optional] const D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create. The pixel format must match the pixel format of wicBitmapSource, or the + /// method will fail. To prevent a mismatch, you can pass NULL or pass the value obtained from calling the + /// D2D1::PixelFormat helper function without specifying any parameter values. If both dpiX and dpiY are 0.0f, the default DPI, + /// 96, is used. DPI information embedded in wicBitmapSource is ignored. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// Before Direct2D can load a WIC bitmap, that bitmap must be converted to a supported pixel format and alpha mode. For a list + /// of supported pixel formats and alpha modes, see Supported Pixel Formats and Alpha Modes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) + // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, + // ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1Bitmap whose data is shared with another resource. + /// + /// Type: REFIID + /// The interface ID of the object supplying the source data. + /// + /// + /// Type: void* + /// + /// An ID2D1Bitmap, IDXGISurface, or an IWICBitmapLock that contains the data to share with the new ID2D1Bitmap. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create . The DXGI_FORMAT portion of the pixel format must match the DXGI_FORMAT of + /// data or the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or + /// the value obtained from the D2D1::PixelFormat helper function. The DPI settings do not have to match those of data. If both + /// dpiX and dpiY are 0.0f, the DPI of the render target is used. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// + /// The CreateSharedBitmap method is useful for efficiently reusing bitmap data and can also be used to provide + /// interoperability with Direct3D. + /// + /// Sharing an ID2D1Bitmap + /// + /// By passing an ID2D1Bitmap created by a render target that is resource-compatible, you can share a bitmap with that render + /// target; both the original ID2D1Bitmap and the new ID2D1Bitmap created by this method will point to the same + /// bitmap data. For more information about when render target resources can be shared, see the Sharing Render Target Resources + /// section of the Resources Overview. + /// + /// + /// You may also use this method to reinterpret the data of an existing bitmap and specify a new DPI or alpha mode. For example, + /// in the case of a bitmap atlas, an ID2D1Bitmap may contain multiple sub-images, each of which should be rendered with a + /// different D2D1_ALPHA_MODE ( D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE). You could use the + /// CreateSharedBitmap method to reinterpret the bitmap using the desired alpha mode without having to load a separate + /// copy of the bitmap into memory. + /// + /// Sharing an IDXGISurface + /// + /// When using a DXGI surface render target (an ID2D1RenderTarget object created by the CreateDxgiSurfaceRenderTarget method), + /// you can pass an IDXGISurface surface to the CreateSharedBitmap method to share video memory with Direct3D and + /// manipulate Direct3D content as an ID2D1Bitmap. As described in the Resources Overview, the render target and the + /// IDXGISurface must be using the same Direct3D device. + /// + /// + /// Note also that the IDXGISurface must use one of the supported pixel formats and alpha modes described in Supported Pixel + /// Formats and Alpha Modes. + /// + /// For more information about interoperability with Direct3D, see the Direct2D and Direct3D Interoperability Overview. + /// Sharing an IWICBitmapLock + /// + /// An IWICBitmapLock stores the content of a WIC bitmap and shields it from simultaneous accesses. By passing an + /// IWICBitmapLock to the CreateSharedBitmap method, you can create an ID2D1Bitmap that points to the bitmap data + /// already stored in the IWICBitmapLock. + /// + /// + /// To use an IWICBitmapLock with the CreateSharedBitmap method, the render target must use software rendering. To force + /// a render target to use software rendering, set to D2D1_RENDER_TARGET_TYPE_SOFTWARE the type field of the + /// D2D1_RENDER_TARGET_PROPERTIES structure that you use to create the render target. To check whether an existing render target + /// uses software rendering, use the IsSupported method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT + // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1BitmapBrush from the specified bitmap. + /// + /// Type: ID2D1Bitmap* + /// The bitmap contents of the new brush. + /// + /// + /// Type: D2D1_BITMAP_BRUSH_PROPERTIES* + /// + /// The extend modes and interpolation mode of the new brush, or NULL. If you set this parameter to NULL, the + /// brush defaults to the D2D1_EXTEND_MODE_CLAMP horizontal and vertical extend modes and the + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR interpolation mode. + /// + /// + /// + /// Type: D2D1_BRUSH_PROPERTIES* + /// + /// A structure that contains the opacity and transform of the new brush, or NULL. If you set this parameter to + /// NULL, the brush sets the opacity member to 1.0F and the transform member to the identity matrix. + /// + /// + /// + /// Type: ID2D1BitmapBrush** + /// + /// When this method returns, this output parameter contains a pointer to a pointer to the new brush. Pass this parameter uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) + // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The red, green, blue, and alpha values of the brush's color. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES & + /// The base opacity of the brush. + /// + /// + /// Type: [out] ID2D1SolidColorBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) + // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, + // ID2D1SolidColorBrush **solidColorBrush ); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + + /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. + /// + /// Type: [in] D2D1_GRADIENT_STOP* + /// A pointer to an array of D2D1_GRADIENT_STOP structures. + /// + /// + /// Type: [in] UINT + /// A value greater than or equal to 1 that specifies the number of gradient stops in the gradientStops array. + /// + /// + /// Type: [in] D2D1_GAMMA + /// The space in which color interpolation between the gradient stops is performed. + /// + /// + /// Type: [in] D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized range. + /// + /// + /// Type: [out] ID2D1GradientStopCollection** + /// When this method returns, contains a pointer to a pointer to the new gradient stop collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 + // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA + // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); + new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + + /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. + /// + /// Type: [in] const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES* + /// The start and end points of the gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the + /// gradient line. + /// + /// + /// + /// Type: [out] ID2D1LinearGradientBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlineargradientbrush%28constd2d1_linear_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1lineargradientbrush%29 + // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush + // **linearGradientBrush ); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. + /// + /// Type: const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES* + /// The center, gradient origin offset, and x-radius and y-radius of the brush's gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the gradient. + /// + /// + /// + /// Type: [out] ID2D1RadialGradientBrush** + /// When this method returns, contains a pointer to a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createradialgradientbrush%28constd2d1_radial_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1radialgradientbrush%29 + // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush + // **radialGradientBrush ); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// + /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. + /// + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// The desired size of the new render target (in device-independent pixels), if it should be different from the original render + /// target. For more info, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_SIZE_U* + /// + /// The desired size of the new render target in pixels if it should be different from the original render target. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_PIXEL_FORMAT* + /// + /// The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new + /// render target uses the same pixel format as the original render target. If the alpha mode is D2D1_ALPHA_MODE_UNKNOWN, the + /// alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel + /// formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: [in] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS + /// A value that specifies whether the new render target must be compatible with GDI. + /// + /// + /// Type: [out] ID2D1BitmapRenderTarget** + /// + /// When this method returns, contains a pointer to a pointer to a new bitmap render target. This parameter is passed uninitialized. + /// + /// + /// + /// The pixel size and DPI of the new render target can be altered by specifying values for desiredSize or desiredPixelSize: + /// + /// + /// + /// If desiredSize is specified but desiredPixelSize is not, the pixel size is computed from the desired size using the parent + /// target DPI. If the desiredSize maps to a integer-pixel size, the DPI of the compatible render target is the same as the DPI + /// of the parent target. If desiredSize maps to a fractional-pixel size, the pixel size is rounded up to the nearest integer + /// and the DPI for the compatible render target is slightly higher than the DPI of the parent render target. In all cases, the + /// coordinate (desiredSize.width, desiredSize.height) maps to the lower-right corner of the compatible render target. + /// + /// + /// + /// + /// If the desiredPixelSize is specified and desiredSize is not, the DPI of the new render target is the same as the original + /// render target. + /// + /// + /// + /// + /// If both desiredSize and desiredPixelSize are specified, the DPI of the new render target is computed to account for the + /// difference in scale. + /// + /// + /// + /// + /// If neither desiredSize nor desiredPixelSize is specified, the new render target size and DPI match the original render target. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) + // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const + // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + + /// Creates a layer resource that can be used with this render target and its compatible render targets. + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// If (0, 0) is specified, no backing store is created behind the layer resource. The layer resource is allocated to the + /// minimum size when PushLayer is called. + /// + /// + /// + /// Type: [out] ID2D1Layer** + /// When the method returns, contains a pointer to a pointer to the new layer. This parameter is passed uninitialized. + /// + /// The layer automatically resizes itself, as needed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) + // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); + new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + + /// Create a mesh that uses triangles to describe a shape. + /// + /// Type: ID2D1Mesh** + /// When this method returns, contains a pointer to a pointer to the new mesh. + /// + /// + /// To populate a mesh, use its Open method to obtain an ID2D1TessellationSink. To draw the mesh, use the render target's + /// FillMesh method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createmesh HRESULT CreateMesh( ID2D1Mesh + // **mesh ); + new ID2D1Mesh CreateMesh(); + + /// Draws a line between the specified points using the specified stroke style. + /// + /// Type: D2D1_POINT_2F + /// The start point of the line, in device-independent pixels. + /// + /// + /// Type: D2D1_POINT_2F + /// The end point of the line, in device-independent pixels. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the line's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid line. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline void DrawLine( D2D1_POINT_2F + // point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawLine(D2D_POINT_2F point0, D2D_POINT_2F point1, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Draws the outline of a rectangle that has the specified dimensions and stroke style. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimensions of the rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's stroke. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid stroke. + /// + /// None + /// + /// When this method fails, it does not return an error code. To determine whether a drawing method (such as DrawRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawrectangle(constd2d1_rect_f__id2d1brush_float_id2d1strokestyle) + // void DrawRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rectangle. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimension of the rectangle to paint, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's interior. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillrectangle(constd2d1_rect_f__id2d1brush) + // void FillRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified rounded rectangle using the specified stroke style. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rounded rectangle's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawroundedrectangle(constd2d1_rounded_rect__id2d1brush_float_id2d1strokestyle) + // void DrawRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle + // *strokeStyle ); + [PreserveSig] + new void DrawRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rounded rectangle. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to paint, in device independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the rounded rectangle. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// FillRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillroundedrectangle(constd2d1_rounded_rect__id2d1brush) + // void FillRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified ellipse using the specified stroke style. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius of the ellipse to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the ellipse's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the ellipse's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// The DrawEllipse method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawEllipse) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawellipse(constd2d1_ellipse__id2d1brush_float_id2d1strokestyle) + // void DrawEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified ellipse. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius, in device-independent pixels, of the ellipse to paint. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the ellipse. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillEllipse) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillellipse(constd2d1_ellipse__id2d1brush) + // void FillEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush ); + [PreserveSig] + new void FillEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush); + + /// Draws the outline of the specified geometry using the specified stroke style. + /// + /// Type: ID2D1Geometry* + /// The geometry to draw. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawgeometry void DrawGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified geometry. + /// + /// Type: ID2D1Geometry* + /// The geometry to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's interior. + /// + /// + /// Type: ID2D1Brush* + /// + /// The opacity mask to apply to the geometry, or NULL for no opacity mask. If an opacity mask (the opacityBrush + /// parameter) is specified, brush must be an ID2D1BitmapBrush that has its x- and y-extend modes set to D2D1_EXTEND_MODE_CLAMP. + /// For more information, see the Remarks section. + /// + /// + /// None + /// + /// + /// If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to + /// determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush + /// is used for this processing; all other color information is ignored. + /// + /// + /// The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted + /// by brush. + /// + /// + /// When this method fails, it does not return an error code. To determine whether a drawing operation (such as + /// FillGeometry) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillgeometry void FillGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush ); + [PreserveSig] + new void FillGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, [In] ID2D1Brush opacityBrush = null); + + /// Paints the interior of the specified mesh. + /// + /// Type: ID2D1Mesh* + /// The mesh to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the mesh. + /// + /// None + /// + /// + /// The current antialias mode of the render target must be D2D1_ANTIALIAS_MODE_ALIASED when FillMesh is called. To + /// change the render target's antialias mode, use the SetAntialiasMode method. + /// + /// + /// FillMesh does not expect a particular winding order for the triangles in the ID2D1Mesh; both clockwise and + /// counter-clockwise will work. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillMesh) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillmesh void FillMesh( ID2D1Mesh *mesh, + // ID2D1Brush *brush ); + [PreserveSig] + new void FillMesh([In] ID2D1Mesh mesh, [In] ID2D1Brush brush); + + /// + /// Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target. + /// + /// + /// Type: ID2D1Bitmap* + /// + /// The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is + /// multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle. + /// + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the region of the render target specified by destinationRectangle. + /// + /// + /// Type: D2D1_OPACITY_MASK_CONTENT + /// + /// The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended. + /// + /// + /// Note Starting with Windows 8, the D2D1_OPACITY_MASK_CONTENT is not required. See the + /// ID2D1DeviceContext::FillOpacityMask method, which has no D2D1_OPACITY_MASK_CONTENT parameter. + /// + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the render target to paint, in device-independent pixels. + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the bitmap to use as the opacity mask, in device-independent pixels. + /// + /// None + /// + /// + /// For this method to work properly, the render target must be using the D2D1_ANTIALIAS_MODE_ALIASED antialiasing mode. You can + /// set the antialiasing mode by calling the ID2D1RenderTarget::SetAntialiasMode method. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillOpacityMask) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_) + // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & + // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + + /// Draws the specified bitmap after scaling it to the size of the specified rectangle. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to render. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap + /// is drawn. If the rectangle is not well-ordered, nothing is drawn, but the render target does not enter an error state. + /// + /// + /// + /// Type: FLOAT + /// + /// A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied + /// against the alpha values of the bitmap's contents. + /// + /// + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to draw. + /// + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawBitmap) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawbitmap(id2d1bitmap_constd2d1_rect_f__float_d2d1_bitmap_interpolation_mode_constd2d1_rect_f_) + // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, + // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + + /// Draws the specified text using the format information provided by an IDWriteTextFormat object. + /// + /// Type: WCHAR* + /// A pointer to an array of Unicode characters to draw. + /// + /// + /// Type: UINT + /// The number of characters in string. + /// + /// + /// Type: IDWriteTextFormat* + /// An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction. + /// + /// + /// Type: const D2D1_RECT_F + /// The size and position of the area in which the text is drawn. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the text. + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// To create an IDWriteTextFormat object, create an IDWriteFactory and call its CreateTextFormat method. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawText) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtext(constwchar_uint32_idwritetextformat_constd2d1_rect_f__id2d1brush_d2d1_draw_text_options_dwrite_measuring_mode) + // void DrawText( const WCHAR *string, UINT32 stringLength, IDWriteTextFormat *textFormat, const D2D1_RECT_F & layoutRect, + // ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + new void DrawText([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, in D2D_RECT_F layoutRect, + [In] ID2D1Brush defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// Draws the formatted text described by the specified IDWriteTextLayout object. + /// + /// Type: D2D1_POINT_2F + /// + /// The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn. + /// + /// + /// + /// Type: IDWriteTextLayout* + /// + /// The formatted text to draw. Any drawing effects that do not inherit from ID2D1Resource are ignored. If there are drawing + /// effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an + /// error state. + /// + /// + /// + /// Type: ID2D1Brush* + /// + /// The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect + /// (specified by the IDWriteTextLayout::SetDrawingEffect method). + /// + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// None + /// + /// + /// When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the DrawText + /// method because the text doesn't need to be formatted and the layout processed with each call. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawTextLayout) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtextlayout void DrawTextLayout( + // D2D1_POINT_2F origin, IDWriteTextLayout *textLayout, ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options ); + [PreserveSig] + new void DrawTextLayout(D2D_POINT_2F origin, [In] IDWriteTextLayout textLayout, [In] ID2D1Brush defaultFillBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE); + + /// Draws the specified glyphs. + /// + /// Type: D2D1_POINT_2F + /// The origin, in device-independent pixels, of the glyphs' baseline. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the specified glyphs. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGlyphRun) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawglyphrun void DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE + // measuringMode ); + [PreserveSig] + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In] ID2D1Brush foregroundBrush, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// + /// Applies the specified transform to the render target, replacing the existing transformation. All subsequent drawing + /// operations occur in the transformed space. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the current transform of the render target. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this returns, contains the current transform of the render target. This parameter is passed uninitialized. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettransform void GetTransform( + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// + /// Sets the antialiasing mode of the render target. The antialiasing mode applies to all subsequent drawing operations, + /// excluding text and glyph drawing operations. + /// + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode for future drawing operations. + /// + /// None + /// To specify the antialiasing mode for text and glyph operations, use the SetTextAntialiasMode method. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setantialiasmode void SetAntialiasMode( + // D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); + + /// Retrieves the current antialiasing mode for nontext drawing operations. + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The current antialiasing mode for nontext drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getantialiasmode D2D1_ANTIALIAS_MODE GetAntialiasMode(); + [PreserveSig] + new D2D1_ANTIALIAS_MODE GetAntialiasMode(); + + /// Specifies the antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextantialiasmode void + // SetTextAntialiasMode( D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode ); + [PreserveSig] + new void SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); + + /// Gets the current antialiasing mode for text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The current antialiasing mode for text and glyph drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextantialiasmode + // D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + [PreserveSig] + new D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + + /// Specifies text rendering options to be applied to all subsequent text and glyph drawing operations. + /// + /// Type: IDWriteRenderingParams* + /// + /// The text rendering options to be applied to all subsequent text and glyph drawing operations; NULL to clear current + /// text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextrenderingparams void + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + new void SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Retrieves the render target's current text rendering options. + /// + /// Type: IDWriteRenderingParams** + /// + /// When this method returns, textRenderingParamscontains the address of a pointer to the render target's current text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextrenderingparams void + // GetTextRenderingParams( IDWriteRenderingParams **textRenderingParams ); + [PreserveSig] + new void GetTextRenderingParams(out IDWriteRenderingParams textRenderingParams); + + /// Specifies a label for subsequent drawing operations. + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// None + /// + /// The labels specified by this method are printed by debug error messages. If no tag is set, the default value for each tag is 0. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settags void SetTags( ulong tag1, ulong + // tag2 ); + [PreserveSig] + new void SetTags(ulong tag1, ulong tag2); + + /// Gets the label for subsequent drawing operations. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the first label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the second label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// None + /// If the same address is passed for both parameters, both parameters receive the value of the second tag. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettags void GetTags( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + [PreserveSig] + new void GetTags(out ulong tag1, out ulong tag2); + + /// + /// Adds the specified layer to the render target so that it receives all subsequent drawing operations until PopLayer is called. + /// + /// + /// Type: const D2D1_LAYER_PARAMETERS + /// The content bounds, geometric mask, opacity, opacity mask, and antialiasing options for the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer that receives subsequent drawing operations. + /// + /// Note Starting with Windows 8, this parameter is optional. If a layer is not specified, Direct2D manages the layer + /// resource automatically. + /// + /// + /// None + /// + /// + /// The PushLayer method allows a caller to begin redirecting rendering to a layer. All rendering operations are valid in + /// a layer. The location of the layer is affected by the world transform set on the render target. + /// + /// + /// Each PushLayer must have a matching PopLayer call. If there are more PopLayer calls than PushLayer calls, the + /// render target is placed into an error state. If Flush is called before all outstanding layers are popped, the render target + /// is placed into an error state, and an error is returned. The error state can be cleared by a call to EndDraw. + /// + /// + /// A particular ID2D1Layer resource can be active only at one time. In other words, you cannot call a PushLayer method, + /// and then immediately follow with another PushLayer method with the same layer resource. Instead, you must call the + /// second PushLayer method with different layer resources. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushLayer) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushlayer(constd2d1_layer_parameters__id2d1layer) + // void PushLayer( const D2D1_LAYER_PARAMETERS & layerParameters, ID2D1Layer *layer ); + [PreserveSig] + new void PushLayer(in D2D1_LAYER_PARAMETERS layerParameters, [In, Optional] ID2D1Layer layer); + + /// Stops redirecting drawing operations to the layer that is specified by the last PushLayer call. + /// None + /// + /// A PopLayer must match a previous PushLayer call. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PopLayer) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-poplayer void PopLayer(); + [PreserveSig] + new void PopLayer(); + + /// Executes all pending drawing commands. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. If no error occurred, this method sets the error tag state to be (0,0). + /// + /// + /// + /// This command does not flush the Direct3D device context that is associated with the render target. + /// Calling this method resets the error state of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-flush HRESULT Flush( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void Flush(out ulong tag1, out ulong tag2); + + /// Saves the current drawing state to the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// + /// When this method returns, contains the current drawing state of the render target. This parameter must be initialized before + /// passing it to the method. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-savedrawingstate void SaveDrawingState( + // ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void SaveDrawingState([In, Out] ID2D1DrawingStateBlock drawingStateBlock); + + /// Sets the render target's drawing state to that of the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// The new drawing state of the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-restoredrawingstate void + // RestoreDrawingState( ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void RestoreDrawingState([In] ID2D1DrawingStateBlock drawingStateBlock); + + /// Specifies a rectangle to which all subsequent drawing operations are clipped. + /// + /// Type: [in] const D2D1_RECT_F & + /// The size and position of the clipping area, in device-independent pixels. + /// + /// + /// Type: [in] D2D1_ANTIALIAS_MODE + /// + /// The antialiasing mode that is used to draw the edges of clip rects that have subpixel boundaries, and to blend the clip with + /// the scene contents. The blending is performed once when the PopAxisAlignedClip method is called, and does not apply to each + /// primitive within the layer. + /// + /// + /// None + /// + /// + /// The clipRect is transformed by the current world transform set on the render target. After the transform is applied to the + /// clipRect that is passed in, the axis-aligned bounding box for the clipRect is computed. For efficiency, the contents are + /// clipped to this axis-aligned bounding box and not to the original clipRect that is passed in. + /// + /// + /// The following diagrams show how a rotation transform is applied to the render target, the resulting clipRect, and a + /// calculated axis-aligned bounding box. + /// + /// + /// + /// Assume the rectangle in the following illustration is a render target that is aligned to the screen pixels. + /// + /// + /// + /// Apply a rotation transform to the render target. In the following illustration, the black rectangle represents the original + /// render target and the red dashed rectangle represents the transformed render target. + /// + /// + /// + /// + /// After calling PushAxisAlignedClip, the rotation transform is applied to the clipRect. In the following illustration, + /// the blue rectangle represents the transformed clipRect. + /// + /// + /// + /// + /// The axis-aligned bounding box is calculated. The green dashed rectangle represents the bounding box in the following + /// illustration. All contents are clipped to this axis-aligned bounding box. + /// + /// + /// + /// + /// Note If rendering operations fail or if PopAxisAlignedClip is not called, clip rects may cause some artifacts on the + /// render target. PopAxisAlignedClip can be considered a drawing operation that is designed to fix the borders of a + /// clipping region. Without this call, the borders of a clipped area may be not antialiased or otherwise corrected. + /// + /// + /// The PushAxisAlignedClip and PopAxisAlignedClip must match. Otherwise, the error state is set. For the render target + /// to continue receiving new commands, you can call Flush to clear the error. + /// + /// + /// A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot + /// overlap. For example, the sequence of PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip is valid, + /// but the sequence of PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer is invalid. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushAxisAlignedClip) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushaxisalignedclip(constd2d1_rect_f__d2d1_antialias_mode) + // void PushAxisAlignedClip( const D2D1_RECT_F & clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void PushAxisAlignedClip(in D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode); + + /// + /// Removes the last axis-aligned clip from the render target. After this method is called, the clip is no longer applied to + /// subsequent drawing operations. + /// + /// None + /// + /// + /// A PushAxisAlignedClip/ PopAxisAlignedClip pair can occur around or within a PushLayer/PopLayer pair, but may not + /// overlap. For example, a PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip sequence is + /// valid, but a PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer sequence is not. + /// + /// PopAxisAlignedClip must be called once for every call to PushAxisAlignedClip. + /// For an example, see How to Clip with an Axis-Aligned Clip Rectangle. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// PopAxisAlignedClip) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-popaxisalignedclip void PopAxisAlignedClip(); + [PreserveSig] + new void PopAxisAlignedClip(); + + /// Clears the drawing area to the specified color. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The color to which the drawing area is cleared. + /// + /// None + /// + /// + /// Direct2D interprets the clearColor as straight alpha (not premultiplied). If the render target's alpha mode is + /// D2D1_ALPHA_MODE_IGNORE, the alpha channel of clearColor is ignored and replaced with 1.0f (fully opaque). + /// + /// + /// If the render target has an active clip (specified by PushAxisAlignedClip), the clear command is applied only to the area + /// within the clip region. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const + // D2D1_COLOR_F & clearColor ); + [PreserveSig] + new void Clear([In, Optional] IntPtr clearColor); + + /// Initiates drawing on this render target. + /// None + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are used to indicate that a render target is in use by the Direct2D system. Different implementations + /// of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget may be locked + /// between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on + /// EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing + /// of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success + /// of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw + /// method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-begindraw void BeginDraw(); + [PreserveSig] + new void BeginDraw(); + + /// Ends drawing operations on the render target and indicates the current error state and associated tags. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. + /// + /// + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different + /// implementations of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget + /// may be locked between BeginDraw/ EndDraw calls, a DXGI surface render target might be acquired on + /// BeginDraw and released on EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and + /// may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/ EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of + /// these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the + /// success of the operations and, optionally, the tag state of the render target at the time the error occurred. The + /// EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-enddraw HRESULT EndDraw( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void EndDraw(out ulong tag1, out ulong tag2); + + /// Retrieves the pixel format and alpha mode of the render target. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + new D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Sets the dots per inch (DPI) of the render target. + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the horizontal DPI of the render target. + /// + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the vertical DPI of the render target. + /// + /// None + /// + /// + /// This method specifies the mapping from pixel space to device-independent space for the render target. If both dpiX and dpiY + /// are 0, the factory-read system DPI is chosen. If one parameter is zero and the other unspecified, the DPI is not changed. + /// + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setdpi void SetDpi( FLOAT dpiX, FLOAT dpiY ); + [PreserveSig] + new void SetDpi(float dpiX, float dpiY); + + /// Return the render target's dots per inch (DPI). + /// + /// Type: FLOAT* + /// When this method returns, contains the horizontal DPI of the render target. This parameter is passed uninitialized. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the vertical DPI of the render target. This parameter is passed uninitialized. + /// + /// None + /// + /// This method indicates the mapping from pixel space to device-independent space for the render target. + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getdpi void GetDpi( FLOAT *dpiX, FLOAT + // *dpiY ); + [PreserveSig] + new void GetDpi(out float dpiX, out float dpiY); + + /// Returns the size of the render target in device-independent pixels. + /// + /// Type: D2D1_SIZE_F + /// The current size of the render target in device-independent pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + new D2D_SIZE_F GetSize(); + + /// Returns the size of the render target in device pixels. + /// + /// Type: D2D1_SIZE_U + /// The size of the render target in device pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + new D2D_SIZE_U GetPixelSize(); + + /// + /// Gets the maximum size, in device-dependent units (pixels), of any one bitmap dimension supported by the render target. + /// + /// + /// Type: UINT32 + /// The maximum size, in pixels, of any one bitmap dimension supported by the render target. + /// + /// + /// This method returns the maximum texture size of the Direct3D device. + /// + /// Note The software renderer and WARP devices return the value of 16 megapixels (16*1024*1024). You can create a + /// Direct2D texture that is this size, but not a Direct3D texture that is this size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getmaximumbitmapsize UINT32 GetMaximumBitmapSize(); + [PreserveSig] + new uint GetMaximumBitmapSize(); + + /// Indicates whether the render target supports the specified properties. + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES* + /// The render target properties to test. + /// + /// + /// Type: BOOL + /// TRUE if the specified render target properties are supported by this render target; otherwise, FALSE. + /// + /// This method does not evaluate the DPI settings specified by the renderTargetProperties parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-issupported(constd2d1_render_target_properties_) + // BOOL IsSupported( const D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + new bool IsSupported(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + + /// + /// Creates a bitmap that can be used as a target surface, for reading back to the CPU, or as a source for the DrawBitmap and + /// ID2D1BitmapBrush APIs. In addition, color context information can be passed to the bitmap. + /// + /// + /// Type: D2D1_SIZE_U + /// The pixel size of the bitmap to be created. + /// + /// + /// Type: const void* + /// The initial data that will be loaded into the bitmap. + /// + /// + /// Type: UINT32 + /// The pitch of the source data, if specified. + /// + /// + /// Type: const D2D1_BITMAP_PROPERTIES1 + /// The properties of the bitmap to be created. + /// + /// + /// Type: ID2D1Bitmap1** + /// When this method returns, contains the address of a pointer to a new bitmap object. + /// + /// The new bitmap can be used as a target for SetTarget if it is created with D2D1_BITMAP_OPTIONS_TARGET. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmap(d2d1_size_u_constvoid_uint32_constd2d1_bitmap_properties1_id2d1bitmap1) + // HRESULT CreateBitmap( D2D1_SIZE_U size, const void *sourceData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 + // *bitmapProperties, ID2D1Bitmap1 **bitmap ); + ID2D1Bitmap1 CreateBitmap(D2D_SIZE_U size, [In, Optional] IntPtr sourceData, uint pitch, in D2D1_BITMAP_PROPERTIES1 bitmapProperties); + + /// Creates an ID2D1Bitmap by copying the specified Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: IWICBitmapSource* + /// The WIC bitmap to copy. + /// + /// + /// Type: const D2D1_BITMAP_PROPERTIES1 + /// The properties of the bitmap to be created. + /// + /// + /// Type: ID2D1Bitmap1** + /// When this method returns, contains a pointer to a pointer to the new bitmap. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) + // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); + ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + + /// Creates a color context. + /// + /// Type: D2D1_COLOR_SPACE + /// The space of color context to create. + /// + /// + /// Type: const BYTE* + /// + /// A buffer containing the ICC profile bytes used to initialize the color context when space is D2D1_COLOR_SPACE_CUSTOM. For + /// other types, the parameter is ignored and should be set to NULL. + /// + /// + /// + /// Type: UINT32 + /// The size in bytes of Profile. + /// + /// + /// Type: ID2D1ColorContext** + /// When this method returns, contains the address of a pointer to a new color context object. + /// + /// + /// The new color context can be used in D2D1_BITMAP_PROPERTIES1 to initialize the color context of a created bitmap. + /// + /// When space is D2D1_COLOR_SPACE_CUSTOM, profile and profileSize must be specified. Otherwise, these parameters should be set + /// to NULL and zero respectively. When the space is D2D1_COLOR_SPACE_CUSTOM, the model field of the profile header is + /// inspected to determine if this profile is sRGB or scRGB and the color space is updated respectively. Otherwise the space + /// remains custom. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createcolorcontext HRESULT + // CreateColorContext( D2D1_COLOR_SPACE space, const BYTE *profile, UINT32 profileSize, ID2D1ColorContext **colorContext ); + ID2D1ColorContext CreateColorContext(D2D1_COLOR_SPACE space, [In, Optional] IntPtr profile, int profileSize); + + /// + /// Creates a color context by loading it from the specified filename. The profile bytes are the contents of the file specified + /// by Filename. + /// + /// + /// Type: PCWSTR + /// The path to the file containing the profile bytes to initialize the color context with. + /// + /// + /// Type: ID2D1ColorContext** + /// When this method returns, contains the address of a pointer to a new color context. + /// + /// + /// The new color context can be used in D2D1_BITMAP_PROPERTIES1 to initialize the color context of a created bitmap. The model + /// field of the profile header is inspected to determine whether this profile is sRGB or scRGB and the color space is updated + /// respectively. Otherwise the space is custom. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createcolorcontextfromfilename HRESULT + // CreateColorContextFromFilename( PCWSTR filename, ID2D1ColorContext **colorContext ); + ID2D1ColorContext CreateColorContextFromFilename([MarshalAs(UnmanagedType.LPWStr)] string filename); + + /// + /// Creates a color context from an IWICColorContext. The D2D1ColorContext space of the resulting context varies, see Remarks + /// for more info. + /// + /// + /// Type: IWICColorContext* + /// The IWICColorContext used to initialize the color context. + /// + /// + /// Type: ID2D1ColorContext** + /// When this method returns, contains the address of a pointer to a new color context. + /// + /// + /// The new color context can be used in D2D1_BITMAP_PROPERTIES1 to initialize the color context of a created bitmap. The model + /// field of the profile header is inspected to determine whether this profile is sRGB or scRGB and the color space is updated + /// respectively. Otherwise the space is custom. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createcolorcontextfromwiccolorcontext + // HRESULT CreateColorContextFromWicColorContext( IWICColorContext *wicColorContext, ID2D1ColorContext **colorContext ); + ID2D1ColorContext CreateColorContextFromWicColorContext(IWICColorContext wicColorContext); + + /// + /// Creates a bitmap from a DXGI surface that can be set as a target surface or have additional color context information specified. + /// + /// + /// Type: IDXGISurface* + /// The DXGI surface from which the bitmap can be created. + /// + /// Note The DXGI surface must have been created from the same Direct3D device that the Direct2D device context is + /// associated with. + /// + /// + /// + /// Type: const D2D1_BITMAP_PROPERTIES1* + /// The bitmap properties specified in addition to the surface. + /// + /// + /// Type: ID2D1Bitmap1** + /// When this method returns, contains the address of a pointer to a new bitmap object. + /// + /// + /// If the bitmap properties are not specified, the following information is assumed: + /// + /// + /// The bitmap DPI is 96. + /// + /// + /// The pixel format matches that of the surface. + /// + /// + /// The returned bitmap will inherit the bind flags of the DXGI surface. + /// + /// + /// The color context is unknown. + /// + /// + /// The alpha mode of the bitmap will be premultiplied (common case) or straight (A8). + /// + /// + /// If the bitmap properties are specified, the bitmap properties will be used as follows: + /// + /// + /// The bitmap DPI will be specified by the bitmap properties. + /// + /// + /// If both dpiX and dpiY are 0, the bitmap DPI will be 96. + /// + /// + /// The pixel format must be compatible with the shader resource view or render target view of the surface. + /// + /// + /// + /// The bitmap options must be compatible with the bind flags of the DXGI surface. However, they may be a subset. This will + /// influence what resource views are created by the bitmap. + /// + /// + /// + /// The color context information will be used from the bitmap properties, if specified. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) + // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, + // ID2D1Bitmap1 **bitmap ); + ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + + /// Creates an effect for the specified class ID. + /// + /// Type: REFCLSID + /// The class ID of the effect to create. See Built-in Effects for a list of effect IDs. + /// + /// + /// Type: ID2D1Effect** + /// When this method returns, contains the address of a pointer to a new effect. + /// + /// + /// If the created effect is a custom effect that is implemented in a DLL, this doesn't increment the reference count for that + /// DLL. If the application deletes an effect while that effect is loaded, the resulting behavior is unpredictable. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createeffect HRESULT CreateEffect( + // REFCLSID effectId, ID2D1Effect **effect ); + ID2D1Effect CreateEffect(in Guid effectId); + + /// + /// Creates a gradient stop collection, enabling the gradient to contain color channels with values outside of [0,1] and also + /// enabling rendering to a high-color render target with interpolation in sRGB space. + /// + /// + /// Type: const D2D1_GRADIENT_STOP* + /// An array of color values and offsets. + /// + /// + /// Type: UINT + /// The number of elements in the gradientStops array. + /// + /// + /// Type: D2D1_COLOR_SPACE + /// Specifies both the input color space and the space in which the color interpolation occurs. + /// + /// + /// Type: D2D1_COLOR_SPACE + /// The color space that colors will be converted to after interpolation occurs. + /// + /// + /// Type: D2D1_BUFFER_PRECISION + /// The precision of the texture used to hold interpolated values. + /// + /// Note This method will fail if the underlying Direct3D device does not support the requested buffer precision. Use + /// ID2D1DeviceContext::IsBufferPrecisionSupported to determine what is supported. + /// + /// + /// + /// Type: D2D1_EXTEND_MODE + /// Defines how colors outside of the range defined by the stop collection are determined. + /// + /// + /// Type: D2D1_COLOR_INTERPOLATION_MODE + /// + /// Defines how colors are interpolated. D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED is the default, see Remarks for more info. + /// + /// + /// + /// Type: ID2D1GradientStopCollection1** + /// The new gradient stop collection. + /// + /// + /// + /// This method linearly interpolates between the color stops. An optional color space conversion is applied post-interpolation. + /// Whether and how this gamma conversion is applied is determined by the pre- and post-interpolation. This method will fail if + /// the device context does not support the requested buffer precision. + /// + /// In order to get the desired result, you need to ensure that the inputs are specified in the correct color space. + /// + /// You must always specify colors in straight alpha, regardless of interpolation mode being premultiplied or straight. The + /// interpolation mode only affects the interpolated values. Likewise, the stops returned by + /// ID2D1GradientStopCollection::GetGradientStops will always have straight alpha. + /// + /// + /// If you specify D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED, then all stops are premultiplied before interpolation, and then + /// un-premultiplied before color conversion. + /// + /// Starting with Windows 8, the interpolation behavior of this method has changed. + /// The table here shows the behavior in Windows 7 and earlier. + /// + /// + /// Gamma + /// Before Interpolation Behavior + /// After Interpolation Behavior + /// GetColorInteroplationGamma (output color space) + /// + /// + /// 1.0 + /// Clamps the inputs and then converts from sRGB to scRGB. + /// Converts from scRGB to sRGB post-interpolation. + /// 1.0 + /// + /// + /// 2.2 + /// Clamps the inputs. + /// No Operation + /// 2.2 + /// + /// + /// The table here shows the behavior in Windows 8 and later. + /// + /// + /// Gamma + /// Before Interpolation Behavior + /// After Interpolation Behavior + /// GetColorInteroplationGamma (output color space) + /// + /// + /// sRGB to scRGB + /// No Operation + /// Clamps the outputs and then converts from sRGB to scRGB. + /// 1.0 + /// + /// + /// scRGB to sRGB + /// No Operation + /// Clamps the outputs and then converts from sRGB to scRGB. + /// 2.2 + /// + /// + /// sRGB to sRGB + /// No Operation + /// No Operation + /// 2.2 + /// + /// + /// scRGB to scRGB + /// No Operation + /// No Operation + /// 1.0 + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-creategradientstopcollection HRESULT + // CreateGradientStopCollection( const D2D1_GRADIENT_STOP *straightAlphaGradientStops, UINT32 straightAlphaGradientStopsCount, + // D2D1_COLOR_SPACE preInterpolationSpace, D2D1_COLOR_SPACE postInterpolationSpace, D2D1_BUFFER_PRECISION bufferPrecision, + // D2D1_EXTEND_MODE extendMode, D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode, ID2D1GradientStopCollection1 + // **gradientStopCollection1 ); + ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] straightAlphaGradientStops, uint straightAlphaGradientStopsCount, + D2D1_COLOR_SPACE preInterpolationSpace, D2D1_COLOR_SPACE postInterpolationSpace, D2D1_BUFFER_PRECISION bufferPrecision, D2D1_EXTEND_MODE extendMode, D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode); + + /// Creates an image brush. The input image can be any type of image, including a bitmap, effect, or a command list. + /// + /// Type: ID2D1Image* + /// The image to be used as a source for the image brush. + /// + /// + /// Type: const D2D1_IMAGE_BRUSH_PROPERTIES + /// The properties specific to an image brush. + /// + /// + /// Type: const D2D1_BRUSH_PROPERTIES + /// Properties common to all brushes. + /// + /// + /// Type: ID2D1ImageBrush** + /// When this method returns, contains the address of a pointer to the input rectangles. + /// + /// + /// The image brush can be used to fill an arbitrary geometry, an opacity mask or text. + /// This sample illustrates drawing a rectangle with an image brush. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) + // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const + // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); + ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a bitmap brush, the input image is a Direct2D bitmap object. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to use as the brush. + /// + /// + /// Type: D2D1_BITMAP_BRUSH_PROPERTIES1* + /// A bitmap brush properties structure. + /// + /// + /// Type: D2D1_BRUSH_PROPERTIES* + /// A brush properties structure. + /// + /// + /// Type: ID2D1BitmapBrush1** + /// The address of the newly created bitmap brush object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 + // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); + ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a ID2D1CommandList object. + /// + /// Type: ID2D1CommandList** + /// When this method returns, contains the address of a pointer to a command list. + /// + /// + /// A ID2D1CommandList can store Direct2D commands to be displayed later through ID2D1DeviceContext::DrawImage or through an + /// image brush. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createcommandlist HRESULT + // CreateCommandList( ID2D1CommandList **commandList ); + ID2D1CommandList CreateCommandList(); + + /// + /// Indicates whether the format is supported by the device context. The formats supported are usually determined by the + /// underlying hardware. + /// + /// + /// Type: format + /// The DXGI format to check. + /// + /// + /// Type: BOOL + /// Returns TRUE if the format is supported. Returns FALSE if the format is not supported. + /// + /// + /// You can use supported formats in the D2D1_PIXEL_FORMAT structure to create bitmaps and render targets. + /// Direct2D doesn't support all DXGI formats, even though they may have some level of Direct3D support by the hardware. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-isdxgiformatsupported BOOL + // IsDxgiFormatSupported( DXGI_FORMAT format ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + bool IsDxgiFormatSupported(DXGI_FORMAT format); + + /// Indicates whether the buffer precision is supported by the underlying Direct3D device. + /// + /// Type: D2D1_BUFFER_PRECISION + /// The buffer precision to check. + /// + /// + /// Type: BOOL + /// Returns TRUE if the buffer precision is supported. Returns FALSE if the buffer precision is not supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-isbufferprecisionsupported BOOL + // IsBufferPrecisionSupported( D2D1_BUFFER_PRECISION bufferPrecision ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + bool IsBufferPrecisionSupported(D2D1_BUFFER_PRECISION bufferPrecision); + + /// Gets the bounds of an image without the world transform of the context applied. + /// + /// Type: ID2D1Image* + /// The image whose bounds will be calculated. + /// + /// + /// Type: D2D1_RECT_F[1] + /// + /// When this method returns, contains a pointer to the bounds of the image in device independent pixels (DIPs) and in local space. + /// + /// + /// + /// + /// The image bounds don't include multiplication by the world transform. They do reflect the current DPI, unit mode, and + /// interpolation mode of the context. To get the bounds that include the world transform, use ID2D1DeviceContext::GetImageWorldBounds. + /// + /// + /// The returned bounds reflect which pixels would be impacted by calling DrawImage with a target offset of (0,0) and an + /// identity world transform matrix. They do not reflect the current clip rectangle set on the device context or the extent of + /// the context's current target image. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getimagelocalbounds HRESULT + // GetImageLocalBounds( ID2D1Image *image, D2D1_RECT_F *localBounds ); + D2D_RECT_F GetImageLocalBounds(ID2D1Image image); + + /// Gets the bounds of an image with the world transform of the context applied. + /// + /// Type: ID2D1Image* + /// The image whose bounds will be calculated. + /// + /// + /// Type: D2D1_RECT_F[1] + /// When this method returns, contains a pointer to the bounds of the image in device independent pixels (DIPs). + /// + /// + /// + /// The image bounds reflect the current DPI, unit mode, and world transform of the context. To get bounds which don't include + /// the world transform, use ID2D1DeviceContext::GetImageLocalBounds. + /// + /// + /// The returned bounds reflect which pixels would be impacted by calling DrawImage with the same image and a target offset of + /// (0,0). They do not reflect the current clip rectangle set on the device context or the extent of the context’s current + /// target image. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getimageworldbounds HRESULT + // GetImageWorldBounds( ID2D1Image *image, D2D1_RECT_F *worldBounds ); + D2D_RECT_F GetImageWorldBounds(ID2D1Image image); + + /// Gets the world-space bounds in DIPs of the glyph run using the device context DPI. + /// + /// Type: D2D1_POINT_2F + /// The origin of the baseline for the glyph run. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyph run to render. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// The DirectWrite measuring mode that indicates how glyph metrics are used to measure text when it is formatted. + /// + /// + /// Type: D2D1_RECT_F* + /// The bounds of the glyph run in DIPs and in world space. + /// + /// The image bounds reflect the current DPI, unit mode, and world transform of the context. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getglyphrunworldbounds HRESULT + // GetGlyphRunWorldBounds( D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, DWRITE_MEASURING_MODE measuringMode, + // D2D1_RECT_F *bounds ); + D2D_RECT_F GetGlyphRunWorldBounds(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, DWRITE_MEASURING_MODE measuringMode); + + /// Gets the device associated with a device context. + /// + /// Type: ID2D1Device** + /// When this method returns, contains the address of a pointer to a Direct2D device associated with this device context. + /// + /// None + /// + /// The application can retrieve the device even if it is created from an earlier render target code-path. The application must + /// use an ID2D1DeviceContext interface and then call GetDevice. Some functionality for controlling all of the resources + /// for a set of device contexts is maintained only on an ID2D1Device object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getdevice void GetDevice( ID2D1Device + // **device ); + [PreserveSig] + void GetDevice(out ID2D1Device device); + + /// The bitmap or command list to which the Direct2D device context will now render. + /// + /// Type: ID2D1Image* + /// The surface or command list to which the Direct2D device context will render. + /// + /// None + /// + /// The target can be changed at any time, including while the context is drawing. + /// + /// The target can be either a bitmap created with the D2D1_BITMAP_OPTIONS_TARGET flag, or it can be a command list. Other kinds + /// of images cannot be set as a target. For example, you cannot set the output of an effect as target. If the target is not + /// valid the context will enter the D2DERR_INVALID_TARGET error state. + /// + /// + /// You cannot use SetTarget to render to a bitmap/command list from multiple device contexts simultaneously. An image is + /// considered “being rendered to” if it has ever been set on a device context within a BeginDraw/EndDraw timespan. If an + /// attempt is made to render to an image through multiple device contexts, all subsequent device contexts after the first will + /// enter an error state. + /// + /// Callers wishing to attach an image to a second device context should first call EndDraw on the first device context. + /// Here is an example of the correct calling order. + /// Here is an example of the incorrect calling order. + /// + /// Note Changing the target does not change the bitmap that an HWND render target presents from, nor does it change the + /// bitmap that a DC render target blts to/from. + /// + /// + /// This API makes it easy for an application to use a bitmap as a source (like in DrawBitmap) and as a destination at the same + /// time. Attempting to use a bitmap as a source on the same device context to which it is bound as a target will put the device + /// context into the D2DERR_BITMAP_BOUND_AS_TARGET error state. + /// + /// + /// It is acceptable to have a bitmap bound as a target bitmap on multiple render targets at once. Applications that do this + /// must properly synchronize rendering with Flush or EndDraw. + /// + /// You can change the target at any time, including while the context is drawing. + /// + /// You can set the target to NULL, in which case drawing calls will put the device context into an error state with + /// D2DERR_WRONG_STATE. Calling SetTarget with a NULL target does not restore the original target bitmap to the device context. + /// + /// + /// If the device context has an outstanding HDC, the context will enter the D2DERR_WRONG_STATE error state. The target + /// will not be changed. + /// + /// + /// If the bitmap and the device context are not in the same resource domain, the context will enter </b> error state. + /// The target will not be changed. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-settarget void SetTarget( ID2D1Image + // *image ); + [PreserveSig] + void SetTarget(ID2D1Image image); + + /// Gets the target currently associated with the device context. + /// + /// Type: ID2D1Image** + /// When this method returns, contains the address of a pointer to the target currently associated with the device context. + /// + /// None + /// + /// If a target is not associated with the device context, target will contain NULL when the methods returns. + /// + /// If the currently selected target is a bitmap rather than a command list, the application can gain access to the initial + /// bitmaps created by using one of the following methods: + /// + /// + /// + /// CreateHwndRenderTarget + /// + /// + /// CreateDxgiSurfaceRenderTarget + /// + /// + /// CreateWicBitmapRenderTarget + /// + /// + /// CreateDCRenderTarget + /// + /// + /// CreateCompatibleRenderTarget + /// + /// + /// + /// It is not possible for an application to destroy these bitmaps. All of these bitmaps are bindable as bitmap targets. However + /// not all of these bitmaps can be used as bitmap sources for ID2D1RenderTarget methods. + /// + /// + /// CreateDxgiSurfaceRenderTarget will create a bitmap that is usable as a bitmap source if the DXGI surface is bindable as a + /// shader resource view. + /// + /// CreateCompatibleRenderTarget will always create bitmaps that are usable as a bitmap source. + /// + /// ID2D1RenderTarget::BeginDraw will copy from the HDC to the original bitmap associated with it. ID2D1RenderTarget::EndDraw + /// will copy from the original bitmap to the HDC. + /// + /// IWICBitmap objects will be locked in the following circumstances: + /// + /// + /// BeginDraw has been called and the currently selected target bitmap is a WIC bitmap. + /// + /// + /// + /// A WIC bitmap is set as the target of a device context after BeginDraw has been called and before EndDraw has been called. + /// + /// + /// + /// Any of the ID2D1Bitmap::Copy* methods are called with a WIC bitmap as either the source or destination. + /// + /// + /// IWICBitmap objects will be unlocked in the following circumstances: + /// + /// + /// EndDraw is called and the currently selected target bitmap is a WIC bitmap. + /// + /// + /// A WIC bitmap is removed as the target of a device context between the calls to BeginDraw and EndDraw. + /// + /// + /// Any of the ID2D1Bitmap::Copy* methods are called with a WIC bitmap as either the source or destination. + /// + /// + /// Direct2D will only lock bitmaps that are not currently locked. + /// + /// Calling QueryInterface for ID2D1GdiInteropRenderTarget will always succeed. ID2D1GdiInteropRenderTarget::GetDC will return a + /// device context corresponding to the currently bound target bitmap. GetDC will fail if the target bitmap was not created with + /// the GDI_COMPATIBLE flag set. + /// + /// + /// ID2D1HwndRenderTarget::Resize will return DXGI_ERROR_INVALID_CALL if there are any outstanding references to the + /// original target bitmap associated with the render target. + /// + /// + /// Although the target can be a command list, it cannot be any other type of image. It cannot be the output image of an effect. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-gettarget void GetTarget( ID2D1Image + // **image ); + [PreserveSig] + void GetTarget(out ID2D1Image image); + + /// Sets the rendering controls for the given device context. + /// + /// Type: const D2D1_RENDERING_CONTROLS* + /// The rendering controls to be applied. + /// + /// None + /// + /// The rendering controls allow the application to tune the precision, performance, and resource usage of rendering operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-setrenderingcontrols(constd2d1_rendering_controls_) + // void SetRenderingControls( const D2D1_RENDERING_CONTROLS & renderingControls ); + [PreserveSig] + void SetRenderingControls(in D2D1_RENDERING_CONTROLS renderingControls); + + /// Gets the rendering controls that have been applied to the context. + /// + /// Type: D2D1_RENDERING_CONTROLS* + /// When this method returns, contains a pointer to the rendering controls for this context. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getrenderingcontrols void + // GetRenderingControls( D2D1_RENDERING_CONTROLS *renderingControls ); + [PreserveSig] + void GetRenderingControls(out D2D1_RENDERING_CONTROLS renderingControls); + + /// Changes the primitive blend mode that is used for all rendering operations in the device context. + /// + /// Type: D2D1_PRIMITIVE_BLEND + /// The primitive blend to use. + /// + /// None + /// + /// + /// The primitive blend will apply to all of the primitive drawn on the context, unless this is overridden with the + /// compositeMode parameter on the DrawImage API. + /// + /// + /// The primitive blend applies to the interior of any primitives drawn on the context. In the case of DrawImage, this will be + /// implied by the image rectangle, offset and world transform. + /// + /// + /// If the primitive blend is anything other than D2D1_PRIMITIVE_BLEND_SOURCE_OVER then ClearType rendering will be + /// turned off. If the application explicitly forces ClearType rendering in these modes, the drawing context will be placed in + /// an error state. D2DERR_WRONG_STATE will be returned from either EndDraw or Flush. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-setprimitiveblend void + // SetPrimitiveBlend( D2D1_PRIMITIVE_BLEND primitiveBlend ); + [PreserveSig] + void SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend); + + /// Returns the currently set primitive blend used by the device context. + /// + /// Type: D2D1_PRIMITIVE_BLEND + /// The current primitive blend. The default value is D2D1_PRIMITIVE_BLEND_SOURCE_OVER. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getprimitiveblend D2D1_PRIMITIVE_BLEND GetPrimitiveBlend(); + [PreserveSig] + D2D1_PRIMITIVE_BLEND GetPrimitiveBlend(); + + /// Sets what units will be used to interpret values passed into the device context. + /// + /// Type: D2D1_UNIT_MODE + /// An enumeration defining how passed-in units will be interpreted by the device context. + /// + /// None + /// + /// + /// This method will affect all properties and parameters affected by SetDpi and GetDpi. This affects all coordinates, lengths, + /// and other properties that are not explicitly defined as being in another unit. For example: + /// + /// + /// + /// + /// SetUnitMode will affect a coordinate passed into ID2D1DeviceContext::DrawLine, and the scaling of a geometry passed + /// into ID2D1DeviceContext::FillGeometry. + /// + /// + /// + /// SetUnitMode will not affect the value returned by ID2D1Bitmap::GetPixelSize. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-setunitmode void SetUnitMode( + // D2D1_UNIT_MODE unitMode ); + [PreserveSig] + void SetUnitMode(D2D1_UNIT_MODE unitMode); + + /// Gets the mode that is being used to interpret values by the device context. + /// + /// Type: D2D1_UNIT_MODE + /// The unit mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-getunitmode D2D1_UNIT_MODE GetUnitMode(); + [PreserveSig] + D2D1_UNIT_MODE GetUnitMode(); + + /// Draws a series of glyphs to the device context. + /// + /// Type: D2D1_POINT_2F + /// Origin of first glyph in the series. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: const DWRITE_GLYPH_RUN_DESCRIPTION* + /// Supplementary glyph series information. + /// + /// + /// Type: ID2D1Brush* + /// The brush that defines the text color. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// The measuring mode of the glyph series, used to determine the advances and offsets. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// The glyphRunDescription is ignored when rendering, but can be useful for printing and serialization of rendering commands, + /// such as to an XPS or SVG file. This extends ID2D1RenderTarget::DrawGlyphRun, which lacked the glyph run description. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawglyphrun void DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, + // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + + /// Draws an image to the device context. + /// + /// Type: ID2D1Image* + /// The image to be drawn to the device context. + /// + /// + /// Type: const D2D1_POINT_2F* + /// + /// The offset in the destination space that the image will be rendered to. The entire logical extent of the image will be + /// rendered to the corresponding destination. If not specified, the destination origin will be (0, 0). The top-left corner of + /// the image will be mapped to the target offset. This will not necessarily be the origin. This default value is NULL. + /// + /// + /// + /// Type: const D2D1_RECT_F* + /// + /// The corresponding rectangle in the image space will be mapped to the given origins when processing the image. This default + /// value is NULL. + /// + /// + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The interpolation mode that will be used to scale the image if necessary. + /// + /// + /// Type: D2D1_COMPOSITE_MODE + /// The composite mode that will be applied to the limits of the currently selected clip. The default value is D2D1_COMPOSITE_MODE_SOURCE_OVER + /// + /// None + /// + /// + /// If interpolationMode is D2D1_INTERPOLATION_MODE_HIGH_QUALITY, different scalers will be used depending on the scale + /// factor implied by the world transform. + /// + /// + /// Any invalid rectangles accumulated on any effect that is drawn by this call will be discarded regardless of which portion of + /// the image rectangle is drawn. + /// + /// + /// If compositeMode is D2D1_COMPOSITE_MODE_SOURCE_OVER, DrawImage will use the currently selected primitive blend + /// specified by ID2D1DeviceContext::SetPrimitiveBlend. If compositeMode is not D2D1_COMPOSITE_MODE_SOURCE_OVER, the + /// image will be extended to transparent up to the current axis-aligned clip. + /// + /// + /// If there is an image rectangle and a world transform, this is equivalent to inserting a clip effect to represent the image + /// rectangle and a 2D affine transform to take into account the world transform. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawimage(id2d1effect_constd2d1_point_2f_constd2d1_rect_f_d2d1_interpolation_mode_d2d1_composite_mode) + // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, + // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); + [PreserveSig] + void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + + /// Draw a metafile to the device context. + /// + /// Type: ID2D1GdiMetafile* + /// The metafile to draw. + /// + /// + /// Type: const D2D1_POINT_2F* + /// The offset from the upper left corner of the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) + // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); + [PreserveSig] + void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + + /// Draws a bitmap to the render target. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to draw. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// The destination rectangle. The default is the size of the bitmap and the location is the upper left corner of the render target. + /// + /// + /// + /// Type: FLOAT + /// The opacity of the bitmap. + /// + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The interpolation mode to use. + /// + /// + /// Type: const D2D1_RECT_F + /// An optional source rectangle. + /// + /// + /// Type: const D2D1_MATRIX_4X4_F + /// An optional perspective transform. + /// + /// None + /// + /// + /// The destinationRectangle parameter defines the rectangle in the target where the bitmap will appear (in device-independent + /// pixels (DIPs)). This is affected by the currently set transform and the perspective transform, if set. If NULL is specified, + /// then the destination rectangle is (left=0, top=0, right = width(sourceRectangle), bottom = height(sourceRectangle)). + /// + /// + /// The sourceRectangle parameter defines the sub-rectangle of the source bitmap (in DIPs). DrawBitmap will clip this + /// rectangle to the size of the source bitmap, thus making it impossible to sample outside of the bitmap. If NULL is specified, + /// then the source rectangle is taken to be the size of the source bitmap. + /// + /// If you specify perspectiveTransform it is applied to the rect in addition to the transform set on the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawbitmap(id2d1bitmap_constd2d1_rect_f__float_d2d1_interpolation_mode_constd2d1_rect_f_constd2d1_matrix_4x4_f) + // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE + // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); + [PreserveSig] + void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + + /// Push a layer onto the clip and layer stack of the device context. + /// + /// Type: const D2D1_LAYER_PARAMETERS1* + /// The parameters that defines the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer resource to push on the device context that receives subsequent drawing operations. + /// Note If a layer is not specified, Direct2D manages the layer resource automatically. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-pushlayer(constd2d1_layer_parameters1__id2d1layer) + // void PushLayer( const D2D1_LAYER_PARAMETERS1 & layerParameters, ID2D1Layer *layer ); + [PreserveSig] + void PushLayer(in D2D1_LAYER_PARAMETERS1 layerParameters, [In, Optional] ID2D1Layer layer); + + /// + /// This indicates that a portion of an effect's input is invalid. This method can be called many times. + /// + /// You can use this method to propagate invalid rectangles through an effect graph. You can query Direct2D using the + /// GetEffectInvalidRectangles method. + /// + /// + /// Note Direct2D does not automatically use these invalid rectangles to reduce the region of an effect that is rendered. + /// + /// + /// You can also use this method to invalidate caches that have accumulated while rendering effects that have the + /// D2D1_PROPERTY_CACHED property set to true. + /// + /// + /// + /// Type: ID2D1Effect* + /// The effect to invalidate. + /// + /// + /// Type: UINT32 + /// The input index. + /// + /// + /// Type: const D2D1_RECT_F* + /// The rect to invalidate. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-invalidateeffectinputrectangle HRESULT + // InvalidateEffectInputRectangle( ID2D1Effect *effect, UINT32 input, const D2D1_RECT_F *inputRectangle ); + void InvalidateEffectInputRectangle(ID2D1Effect effect, uint input, in D2D_RECT_F inputRectangle); + + /// Gets the number of invalid output rectangles that have accumulated on the effect. + /// + /// Type: ID2D1Effect* + /// The effect to count the invalid rectangles on. + /// + /// + /// Type: UINT32* + /// The returned rectangle count. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-geteffectinvalidrectanglecount HRESULT + // GetEffectInvalidRectangleCount( ID2D1Effect *effect, UINT32 *rectangleCount ); + uint GetEffectInvalidRectangleCount(ID2D1Effect effect); + + /// + /// Gets the invalid rectangles that have accumulated since the last time the effect was drawn and EndDraw was then called on + /// the device context. + /// + /// + /// Type: ID2D1Effect* + /// The effect to get the invalid rectangles from. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// An array of D2D1_RECT_F structures. You must allocate this to the correct size. You can get the count of the invalid + /// rectangles using the GetEffectInvalidRectangleCount method. + /// + /// + /// + /// Type: UINT32 + /// The number of rectangles to get. + /// + /// + /// + /// Note Direct2D does not automatically use these invalid rectangles to reduce the region of an effect that is rendered. + /// + /// + /// You can use the InvalidateEffectInputRectangle method to specify invalidated rectangles for Direct2D to propagate through an + /// effect graph. + /// + /// + /// If multiple invalid rectangles are requested, the rectangles that this method returns may overlap. When this is the case, + /// the rectangle count might be lower than the count that GetEffectInvalidRectangleCount. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-geteffectinvalidrectangles HRESULT + // GetEffectInvalidRectangles( ID2D1Effect *effect, D2D1_RECT_F *rectangles, UINT32 rectanglesCount ); + void GetEffectInvalidRectangles(ID2D1Effect effect, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] D2D_RECT_F[] rectangles, int rectanglesCount); + + /// Returns the input rectangles that are required to be supplied by the caller to produce the given output rectangle. + /// + /// Type: ID2D1Effect* + /// The image whose output is being rendered. + /// + /// + /// Type: const D2D1_RECT_F* + /// The portion of the output image whose inputs are being inspected. + /// + /// + /// Type: const D2D1_EFFECT_INPUT_DESCRIPTION* + /// A list of the inputs whos rectangles are being queried. + /// + /// + /// Type: D2D1_RECT_F* + /// The input rectangles returned to the caller. + /// + /// + /// Type: UINT32 + /// The number of inputs. + /// + /// + /// The caller should be very careful not to place a reliance on the required input rectangles returned. Small changes for + /// correctness to an effect's behavior can result in different rectangles being returned. In addition, different kinds of + /// optimization applied inside the render can also influence the result. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-geteffectrequiredinputrectangles + // HRESULT GetEffectRequiredInputRectangles( ID2D1Effect *renderEffect, const D2D1_RECT_F *renderImageRectangle, const + // D2D1_EFFECT_INPUT_DESCRIPTION *inputDescriptions, D2D1_RECT_F *requiredInputRects, UINT32 inputCount ); + void GetEffectRequiredInputRectangles(ID2D1Effect renderEffect, [In, Optional] IntPtr renderImageRectangle, + [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] D2D1_EFFECT_INPUT_DESCRIPTION[] inputDescriptions, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] D2D_RECT_F[] requiredInputRects, int inputCount); + + /// + /// Fill using the alpha channel of the supplied opacity mask bitmap. The brush opacity will be modulated by the mask. The + /// render target antialiasing mode must be set to aliased. + /// + /// + /// Type: ID2D1Bitmap* + /// The bitmap that acts as the opacity mask + /// + /// + /// Type: ID2D1Brush* + /// The brush to use for filling the primitive. + /// + /// + /// Type: const D2D1_RECT_F + /// The destination rectangle to output to in the render target + /// + /// + /// Type: const D2D1_RECT_F + /// The source rectangle from the opacity mask bitmap. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-fillopacitymask(id2d1bitmap_id2d1brush_constd2d1_rect_f__constd2d1_rect_f_) + // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F & destinationRectangle, const + // D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + void FillOpacityMask(ID2D1Bitmap opacityMask, ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + } + + /// Represents the drawing state of a render target: the antialiasing mode, transform, tags, and text-rendering options. + /// + /// Creating ID2D1DrawingStateBlock Objects + /// To create an ID2D1DrawingStateBlock, use the ID2D1Factory::CreateDrawingStateBlock method. + /// + /// A drawing state block is a device-independent resource; you can create it once and retain it for the life of your application. + /// For more information about resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1drawingstateblock + [PInvokeData("d2d1.h", MSDNShortId = "9a3d9146-0e1b-4642-ad5d-ff1d09a93d2b")] + [ComImport, Guid("28506e39-ebf6-46a1-bb47-fd85565ab957"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1DrawingStateBlock : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the antialiasing mode, transform, and tags portion of the drawing state. + /// + /// Type: D2D1_DRAWING_STATE_DESCRIPTION* + /// + /// When this method returns, contains the antialiasing mode, transform, and tags portion of the drawing state. You must + /// allocate storage for this parameter. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1drawingstateblock-getdescription void GetDescription( + // D2D1_DRAWING_STATE_DESCRIPTION *stateDescription ); + [PreserveSig] + void GetDescription(out D2D1_DRAWING_STATE_DESCRIPTION stateDescription); + + /// Specifies the antialiasing mode, transform, and tags portion of the drawing state. + /// + /// Type: const D2D1_DRAWING_STATE_DESCRIPTION + /// The antialiasing mode, transform, and tags portion of the drawing state. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1drawingstateblock-setdescription(constd2d1_drawing_state_description_) + // void SetDescription( const D2D1_DRAWING_STATE_DESCRIPTION & stateDescription ); + [PreserveSig] + void SetDescription(in D2D1_DRAWING_STATE_DESCRIPTION stateDescription); + + /// Specifies the text-rendering configuration of the drawing state. + /// + /// Type: IDWriteRenderingParams* + /// The text-rendering configuration of the drawing state, or NULL to use default settings. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1drawingstateblock-settextrenderingparams void + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + void SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Retrieves the text-rendering configuration of the drawing state. + /// + /// Type: IDWriteRenderingParams** + /// + /// When this method returns, contains the address of a pointer to an IDWriteRenderingParams object that describes the + /// text-rendering configuration of the drawing state. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1drawingstateblock-gettextrenderingparams void + // GetTextRenderingParams( IDWriteRenderingParams **textRenderingParams ); + [PreserveSig] + void GetTextRenderingParams(out IDWriteRenderingParams textRenderingParams); + } + + /// Represents an ellipse. + /// + /// Creating ID2D1EllipseGeometry Objects + /// To create an elipse geometry, use the ID2D1Factory::CreateEllipseGeometry method. + /// + /// Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1ellipsegeometry + [PInvokeData("d2d1.h", MSDNShortId = "4ab6452c-6df8-46c0-9e0d-0cebc19d84ba")] + [ComImport, Guid("2cd906a4-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1EllipseGeometry : ID2D1Geometry + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Gets the D2D1_ELLIPSE structure that describes this ellipse geometry. + /// + /// Type: D2D1_ELLIPSE* + /// + /// When this method returns, contains the D2D1_ELLIPSE that describes the size and position of the ellipse. You must allocate + /// storage for this parameter. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1ellipsegeometry-getellipse void GetEllipse( D2D1_ELLIPSE + // *ellipse ); + [PreserveSig] + void GetEllipse(out D2D1_ELLIPSE ellipse); + } + + /// Creates Direct2D resources. + /// + /// + /// The ID2D1Factory interface is the starting point for using Direct2D; it's what you use to create other Direct2D resources + /// that you can use to draw or describe shapes. + /// + /// A factory defines a set of CreateResource methods that can produce the following drawing resources: + /// + /// + /// Render targets: objects that render drawing commands. + /// + /// + /// + /// Drawing state blocks: objects that store drawing state information, such as the current transformation and antialiasing mode. + /// + /// + /// + /// Geometries: objects that represent simple and potentially complex shapes. + /// + /// + /// + /// To create an ID2D1Factory, you use one of the CreateFactory methods. You should retain the ID2D1Factory instance + /// for as long as you use Direct2D resources; in general, you shouldn't need to recreate it when the application is running. For + /// more information about Direct2D resources, see the Resources Overview. + /// + /// Singlethreaded and Multithreaded Factories + /// + /// When you create a factory, you can specify whether it is multithreaded or singlethreaded. A singlethreaded factory provides no + /// serialization against any other single threaded instance within Direct2D, so, this mechanism provides a very large degree of + /// scaling on the CPU. + /// + /// + /// You can also create a multithreaded factory instance. In this case, the factory and all derived objects can be used from any + /// thread and each render target can be rendered to independently. Direct2D serializes calls to these objects, so a single + /// multithreaded Direct2D instance won't scale as well on the CPU as many single threaded instances. However, the resources can be + /// shared within the multithreaded instance. + /// + /// + /// Note that the qualifier "On the CPU": GPUs generally take advantage of fine-grained parallelism more so than CPUs. For example, + /// multithreaded calls from the CPU might still end up being serialized when being sent to the GPU, however, a whole bank of pixel + /// and vertex shaders will run in parallel to perform the rendering. + /// + /// See Multithreaded Direct2D Apps for more info. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1factory + [PInvokeData("d2d1.h", MSDNShortId = "cef6115c-98e8-49e6-b419-271b43ce2938")] + [ComImport, Guid("06152247-6f50-465a-9245-118bfd3b6007"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Factory + { + /// Forces the factory to refresh any system defaults that it might have changed since factory creation. + /// You should call this method before calling the GetDesktopDpi method, to ensure that the system DPI is current. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-reloadsystemmetrics HRESULT ReloadSystemMetrics(); + void ReloadSystemMetrics(); + + /// Retrieves the current desktop dots per inch (DPI). To refresh this value, call ReloadSystemMetrics. + /// + /// Type: FLOAT* + /// When this method returns, contains the horizontal DPI of the desktop. You must allocate storage for this parameter. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the vertical DPI of the desktop. You must allocate storage for this parameter. + /// + /// None + /// + /// Use this method to obtain the system DPI when setting physical pixel values, such as when you specify the size of a window. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-getdesktopdpi void GetDesktopDpi( FLOAT *dpiX, + // FLOAT *dpiY ); + [PreserveSig, Obsolete] + void GetDesktopDpi(out float dpiX, out float dpiY); + + /// Creates an ID2D1RectangleGeometry. + /// + /// Type: [in] const D2D1_RECT_F* + /// The coordinates of the rectangle geometry. + /// + /// + /// Type: [out] ID2D1RectangleGeometry** + /// When this method returns, contains the address of the pointer to the rectangle geometry created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createrectanglegeometry%28constd2d1_rect_f_id2d1rectanglegeometry%29 + // HRESULT CreateRectangleGeometry( const D2D1_RECT_F *rectangle, ID2D1RectangleGeometry **rectangleGeometry ); + ID2D1RectangleGeometry CreateRectangleGeometry(in D2D_RECT_F rectangle); + + /// Creates an ID2D1RoundedRectangleGeometry. + /// + /// Type: [in] const D2D1_ROUNDED_RECT* + /// The coordinates and corner radii of the rounded rectangle geometry. + /// + /// + /// Type: [out] ID2D1RoundedRectangleGeometry** + /// When this method returns, contains the address of the pointer to the rounded rectangle geometry created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createroundedrectanglegeometry%28constd2d1_rounded_rect_id2d1roundedrectanglegeometry%29 + // HRESULT CreateRoundedRectangleGeometry( const D2D1_ROUNDED_RECT *roundedRectangle, ID2D1RoundedRectangleGeometry + // **roundedRectangleGeometry ); + ID2D1RoundedRectangleGeometry CreateRoundedRectangleGeometry(in D2D1_ROUNDED_RECT roundedRectangle); + + /// Creates an ID2D1EllipseGeometry. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// A value that describes the center point, x-radius, and y-radius of the ellipse geometry. + /// + /// + /// Type: [out] ID2D1EllipseGeometry** + /// When this method returns, contains the address of the pointer to the ellipse geometry created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createellipsegeometry%28constd2d1_ellipse__id2d1ellipsegeometry%29 + // HRESULT CreateEllipseGeometry( const D2D1_ELLIPSE & ellipse, ID2D1EllipseGeometry **ellipseGeometry ); + ID2D1EllipseGeometry CreateEllipseGeometry(in D2D1_ELLIPSE ellipse); + + /// Creates an ID2D1GeometryGroup, which is an object that holds other geometries. + /// + /// Type: D2D1_FILL_MODE + /// A value that specifies the rule that a composite shape uses to determine whether a given point is part of the geometry. + /// + /// + /// Type: ID2D1Geometry** + /// + /// An array containing the geometry objects to add to the geometry group. The number of elements in this array is indicated by + /// the geometriesCount parameter. + /// + /// + /// + /// Type: UINT + /// The number of elements in geometries. + /// + /// + /// Type: ID2D1GeometryGroup** + /// When this method returns, contains the address of a pointer to the geometry group created by this method. + /// + /// + /// Geometry groups are a convenient way to group several geometries simultaneously so all figures of several distinct + /// geometries are concatenated into one. To create a ID2D1GeometryGroup object, call the CreateGeometryGroup method on + /// the ID2D1Factory object, passing in the fillMode with possible values of D2D1_FILL_MODE_ALTERNATE (alternate) and + /// D2D1_FILL_MODE_WINDING, an array of geometry objects to add to the geometry group, and the number of elements in this array. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-creategeometrygroup HRESULT CreateGeometryGroup( + // D2D1_FILL_MODE fillMode, ID2D1Geometry **geometries, UINT32 geometriesCount, ID2D1GeometryGroup **geometryGroup ); + ID2D1GeometryGroup CreateGeometryGroup(D2D1_FILL_MODE fillMode, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 2)] ID2D1Geometry[] geometries, uint geometriesCount); + + /// Transforms the specified geometry and stores the result as an ID2D1TransformedGeometry object. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to transform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F* + /// The transformation to apply. + /// + /// + /// Type: [out] ID2D1TransformedGeometry** + /// + /// When this method returns, contains the address of the pointer to the new transformed geometry object. The transformed + /// geometry stores the result of transforming sourceGeometry by transform. + /// + /// + /// + /// + /// Like other resources, a transformed geometry inherits the resource space and threading policy of the factory that created + /// it. This object is immutable. + /// + /// + /// When stroking a transformed geometry with the DrawGeometry method, the stroke width is not affected by the transform applied + /// to the geometry. The stroke width is only affected by the world transform. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createtransformedgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_id2d1transformedgeometry%29 + // HRESULT CreateTransformedGeometry( ID2D1Geometry *sourceGeometry, const D2D1_MATRIX_3X2_F *transform, + // ID2D1TransformedGeometry **transformedGeometry ); + ID2D1TransformedGeometry CreateTransformedGeometry([In] ID2D1Geometry sourceGeometry, in D2D_MATRIX_3X2_F transform); + + /// Creates an empty ID2D1PathGeometry. + /// + /// Type: ID2D1PathGeometry** + /// When this method returns, contains the address to a pointer to the path geometry created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createpathgeometry HRESULT CreatePathGeometry( + // ID2D1PathGeometry **pathGeometry ); + ID2D1PathGeometry CreatePathGeometry(); + + /// Creates an ID2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke. + /// + /// Type: const D2D1_STROKE_STYLE_PROPERTIES + /// A structure that describes the stroke's line cap, dash offset, and other details of a stroke. + /// + /// + /// Type: const FLOAT* + /// + /// An array whose elements are set to the length of each dash and space in the dash pattern. The first element sets the length + /// of a dash, the second element sets the length of a space, the third element sets the length of a dash, and so on. The length + /// of each dash and space in the dash pattern is the product of the element value in the array and the stroke width. + /// + /// + /// + /// Type: UINT + /// The number of elements in the dashes array. + /// + /// + /// Type: ID2D1StrokeStyle** + /// When this method returns, contains the address of the pointer to the stroke style created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createstrokestyle%28constd2d1_stroke_style_properties__constfloat_uint32_id2d1strokestyle%29 + // HRESULT CreateStrokeStyle( const D2D1_STROKE_STYLE_PROPERTIES & strokeStyleProperties, const FLOAT *dashes, UINT32 + // dashesCount, ID2D1StrokeStyle **strokeStyle ); + ID2D1StrokeStyle CreateStrokeStyle(in D2D1_STROKE_STYLE_PROPERTIES strokeStyleProperties, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] float[] dashes, uint dashesCount); + + /// + /// Creates an ID2D1DrawingStateBlock that can be used with the SaveDrawingState and RestoreDrawingState methods of a render target. + /// + /// + /// Type: const D2D1_DRAWING_STATE_DESCRIPTION* + /// A structure that contains antialiasing, transform, and tags information. + /// + /// + /// Type: IDWriteRenderingParams* + /// Optional text parameters that indicate how text should be rendered. + /// + /// + /// Type: ID2D1DrawingStateBlock** + /// When this method returns, contains the address of a pointer to the new drawing state block created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 + // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams + // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); + ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: IWICBitmap* + /// The bitmap that receives the rendering output of the render target. + /// + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES + /// + /// The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware + /// rendering. For information about supported pixel formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: ID2D1RenderTarget** + /// When this method returns, contains the address of the pointer to the ID2D1RenderTarget object created by this method. + /// + /// + /// + /// You must use D2D1_FEATURE_LEVEL_DEFAULT for the minLevel member of the renderTargetProperties parameter with this method. + /// + /// + /// Your application should create render targets once and hold onto them for the life of the application or until the + /// D2DERR_RECREATE_TARGET error is received. When you receive this error, you need to recreate the render target (and any + /// resources it created). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createwicbitmaprendertarget%28iwicbitmap_constd2d1_render_target_properties__id2d1rendertarget%29 + // HRESULT CreateWicBitmapRenderTarget( IWICBitmap *target, const D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties, + // ID2D1RenderTarget **renderTarget ); + ID2D1RenderTarget CreateWicBitmapRenderTarget([In] IWICBitmap target, in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + + /// Creates an ID2D1HwndRenderTarget, a render target that renders to a window. + /// + /// [in] Type: D2D1_RENDER_TARGET_PROPERTIES* + /// + /// The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware + /// rendering. For information about supported pixel formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// [in] Type: D2D1_HWND_RENDER_TARGET_PROPERTIES* + /// The window handle, initial size (in pixels), and present options. + /// + /// + /// [out] Type: ID2D1HwndRenderTarget** + /// + /// When this method returns, contains the address of the pointer to the ID2D1HwndRenderTarget object created by this method. + /// + /// + /// + /// When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By + /// creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should + /// create render targets once and hold onto them for the life of the application or until the D2DERR_RECREATE_TARGET + /// error is received. When you receive this error, you need to recreate the render target (and any resources it created). + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/dd371275(v=vs.85) virtual HRESULT + // CreateHwndRenderTarget( [in] D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, [in] D2D1_HWND_RENDER_TARGET_PROPERTIES + // *hwndRenderTargetProperties, [out] ID2D1HwndRenderTarget **hwndRenderTarget ) = 0; + ID2D1HwndRenderTarget CreateHwndRenderTarget(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties, in D2D1_HWND_RENDER_TARGET_PROPERTIES hwndRenderTargetProperties); + + /// Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface. + /// + /// Type: IDXGISurface* + /// The IDXGISurface to which the render target will draw. + /// + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES & + /// + /// The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware + /// rendering. For information about supported pixel formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: ID2D1RenderTarget** + /// When this method returns, contains the address of the pointer to the ID2D1RenderTarget object created by this method. + /// + /// + /// + /// To write to a Direct3D surface, you obtain an IDXGISurface and pass it to the CreateDxgiSurfaceRenderTarget method to create + /// a DXGI surface render target; you can then use the DXGI surface render target to draw 2-D content to the DXGI surface. + /// + /// + /// A DXGI surface render target is a type of ID2D1RenderTarget. Like other Direct2D render targets, you can use it to create + /// resources and issue drawing commands. + /// + /// + /// The DXGI surface render target and the DXGI surface must use the same DXGI format. If you specify the DXGI_FORMAT_UNKOWN + /// format when you create the render target, it will automatically use the surface's format. + /// + /// The DXGI surface render target does not perform DXGI surface synchronization. + /// + /// For more information about creating and using DXGI surface render targets, see the Direct2D and Direct3D Interoperability Overview. + /// + /// + /// To work with Direct2D, the Direct3D device that provides the IDXGISurface must be created with the + /// D3D10_CREATE_DEVICE_BGRA_SUPPORT flag. + /// + /// + /// When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By + /// creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should + /// create render targets once and hold onto them for the life of the application or until the render target's EndDraw method + /// returns the D2DERR_RECREATE_TARGET error. When you receive this error, you need to recreate the render target (and any + /// resources it created). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdxgisurfacerendertarget%28idxgisurface_constd2d1_render_target_properties__id2d1rendertarget%29 + // HRESULT CreateDxgiSurfaceRenderTarget( IDXGISurface *dxgiSurface, const D2D1_RENDER_TARGET_PROPERTIES & + // renderTargetProperties, ID2D1RenderTarget **renderTarget ); + ID2D1RenderTarget CreateDxgiSurfaceRenderTarget([In] IDXGISurface dxgiSurface, in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + + /// Creates a render target that draws to a Windows Graphics Device Interface (GDI) device context. + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES* + /// + /// The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware + /// rendering. To enable the device context (DC) render target to work with GDI, set the DXGI format to + /// DXGI_FORMAT_B8G8R8A8_UNORM and the alpha mode to D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE. For more + /// information about pixel formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: ID2D1DCRenderTarget** + /// + /// When this method returns, dcRenderTarget contains the address of the pointer to the ID2D1DCRenderTarget created by the method. + /// + /// + /// + /// + /// Before you can render with a DC render target, you must use the render target's BindDC method to associate it with a GDI DC. + /// Do this for each different DC and whenever there is a change in the size of the area you want to draw to. + /// + /// + /// To enable the DC render target to work with GDI, set the render target's DXGI format to DXGI_FORMAT_B8G8R8A8_UNORM and alpha + /// mode to D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE. + /// + /// + /// Your application should create render targets once and hold on to them for the life of the application or until the render + /// target's EndDraw method returns the D2DERR_RECREATE_TARGET error. When you receive this error, recreate the render target + /// (and any resources it created). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdcrendertarget HRESULT + // CreateDCRenderTarget( const D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, ID2D1DCRenderTarget **dcRenderTarget ); + ID2D1DCRenderTarget CreateDCRenderTarget(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct2D/D2d1.Interfaces3.cs b/PInvoke/Graphics/Direct2D/D2d1.Interfaces3.cs new file mode 100644 index 00000000..1050e868 --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1.Interfaces3.cs @@ -0,0 +1,3053 @@ +using System; +using System.Runtime.InteropServices; +using static Vanara.PInvoke.Dwrite; +using static Vanara.PInvoke.WindowsCodecs; + +namespace Vanara.PInvoke +{ + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// + /// Represents a geometry resource and defines a set of helper methods for manipulating and measuring geometric shapes. Interfaces + /// that inherit from ID2D1Geometry define specific shapes. + /// + /// + /// + /// There are several types of Direct2D geometry objects: a simple geometry (ID2D1RectangleGeometry, ID2D1RoundedRectangleGeometry, + /// or ID2D1EllipseGeometry), a path geometry (ID2D1PathGeometry), or a composite geometry (ID2D1GeometryGroup and ID2D1TransformedGeometry). + /// + /// + /// Direct2D geometries enable you to describe two-dimensional figures and also offer many uses, such as defining hit-test regions, + /// clip regions, and even animation paths. + /// + /// + /// Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1geometry + [PInvokeData("d2d1.h", MSDNShortId = "be4ab801-64f6-48f9-8f62-d0492cc438b1")] + [ComImport, Guid("2cd906a1-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Geometry : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + } + + /// Represents a composite geometry, composed of other ID2D1Geometry objects. + /// + /// + /// Geometry groups are a convenient way to group several geometries simultaneously so all figures of several distinct geometries + /// are concatenated into one. + /// + /// Creating ID2D1GeometryGroup Objects + /// + /// To create a ID2D1GeometryGroup object, call the ID2D1Factory::CreateGeometryGroup method, passing in the fillMode with + /// possible values of D2D1_FILL_MODE_ALTERNATE (alternate) and D2D1_FILL_MODE_WINDING, an array of geometry objects to add + /// to the geometry group, and the number of elements in this array. + /// + /// + /// Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1geometrygroup + [PInvokeData("d2d1.h", MSDNShortId = "15c3800c-b57c-4c3c-995f-407beee4cc99")] + [ComImport, Guid("2cd906a6-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1GeometryGroup : ID2D1Geometry + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Indicates how the intersecting areas of the geometries contained in this geometry group are combined. + /// + /// Type: D2D1_FILL_MODE + /// A value that indicates how the intersecting areas of the geometries contained in this geometry group are combined. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrygroup-getfillmode D2D1_FILL_MODE GetFillMode(); + [PreserveSig] + D2D1_FILL_MODE GetFillMode(); + + /// Indicates the number of geometry objects in the geometry group. + /// + /// Type: UINT32 + /// The number of geometries in the ID2D1GeometryGroup. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrygroup-getsourcegeometrycount UINT32 GetSourceGeometryCount(); + [PreserveSig] + uint GetSourceGeometryCount(); + + /// Retrieves the geometries in the geometry group. + /// + /// Type: const ID2D1Geometry** + /// + /// When this method returns, contains the address of a pointer to an array of geometries to be filled by this method. The + /// length of the array is specified by the geometryCount parameter. If the array is NULL, then this method performs no + /// operation. You must allocate the memory for this array. + /// + /// + /// + /// Type: UINT + /// + /// A value indicating the number of geometries to return in the geometries array. If this value is less than the number of + /// geometries in the geometry group, the remaining geometries are omitted. If this value is larger than the number of + /// geometries in the geometry group, the extra geometries are set to NULL. To obtain the number of geometries currently + /// in the geometry group, use the GetSourceGeometryCount method. + /// + /// + /// None + /// The returned geometries are referenced and counted, and the caller must release them. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrygroup-getsourcegeometries void + // GetSourceGeometries( ID2D1Geometry **geometries, UINT32 geometriesCount ); + [PreserveSig] + void GetSourceGeometries([Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 1)] ID2D1Geometry[] geometries, uint geometriesCount); + } + + /// Describes a geometric path that can contain lines, arcs, cubic Bezier curves, and quadratic Bezier curves. + /// + /// + /// The ID2D1GeometrySink interface extends the ID2D1SimplifiedGeometrySink interface to add support for arcs and quadratic + /// beziers, as well as functions for adding single lines and cubic beziers. + /// + /// + /// A geometry sink consists of one or more figures. Each figure is made up of one or more line, curve, or arc segments. To create a + /// figure, call the BeginFigure method, specify the figure's start point, and then use its Add methods (such as AddLine and + /// AddBezier) to add segments. When you are finished adding segments, call the EndFigure method. You can repeat this sequence to + /// create additional figures. When you are finished creating figures, call the Close method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1geometrysink + [PInvokeData("d2d1.h", MSDNShortId = "6d2c1959-1309-45d8-8204-19ffea03375b")] + [ComImport, Guid("2cd9069f-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1GeometrySink : ID2D1SimplifiedGeometrySink + { + /// + /// Specifies the method used to determine which points are inside the geometry described by this geometry sink and which points + /// are outside. + /// + /// + /// Type: D2D1_FILL_MODE + /// The method used to determine whether a given point is part of the geometry. + /// + /// None + /// + /// The fill mode defaults to D2D1_FILL_MODE_ALTERNATE. To set the fill mode, call SetFillMode before the first call to + /// BeginFigure. Not doing will put the geometry sink in an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-setfillmode void SetFillMode( + // D2D1_FILL_MODE fillMode ); + [PreserveSig] + new void SetFillMode(D2D1_FILL_MODE fillMode); + + /// Specifies stroke and join options to be applied to new segments added to the geometry sink. + /// + /// Type: D2D1_PATH_SEGMENT + /// Stroke and join options to be applied to new segments added to the geometry sink. + /// + /// None + /// + /// After this method is called, the specified segment flags are applied to each segment subsequently added to the sink. The + /// segment flags are applied to every additional segment until this method is called again and a different set of segment flags + /// is specified. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-setsegmentflags void + // SetSegmentFlags( D2D1_PATH_SEGMENT vertexFlags ); + [PreserveSig] + new void SetSegmentFlags(D2D1_PATH_SEGMENT vertexFlags); + + /// Starts a new figure at the specified point. + /// + /// Type: D2D1_POINT_2F + /// The point at which to begin the new figure. + /// + /// + /// Type: D2D1_FIGURE_BEGIN + /// Whether the new figure should be hollow or filled. + /// + /// None + /// + /// If this method is called while a figure is currently in progress, the interface is invalidated and all future methods will fail. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-beginfigure void BeginFigure( + // D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin ); + [PreserveSig] + new void BeginFigure(D2D_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin); + + /// Creates a sequence of lines using the specified points and adds them to the geometry sink. + /// + /// Type: const D2D1_POINT_2F* + /// + /// A pointer to an array of one or more points that describe the lines to draw. A line is drawn from the geometry sink's + /// current point (the end point of the last segment drawn or the location specified by BeginFigure) to the first point in the + /// array. if the array contains additional points, a line is drawn from the first point to the second point in the array, from + /// the second point to the third point, and so on. + /// + /// + /// + /// Type: UINT + /// The number of points in the points array. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-addlines void AddLines( const + // D2D1_POINT_2F *points, UINT32 pointsCount ); + [PreserveSig] + new void AddLines([In] D2D_POINT_2F[] points, uint pointsCount); + + /// Creates a sequence of cubic Bezier curves and adds them to the geometry sink. + /// + /// Type: const D2D1_BEZIER_SEGMENT* + /// + /// A pointer to an array of Bezier segments that describes the Bezier curves to create. A curve is drawn from the geometry + /// sink's current point (the end point of the last segment drawn or the location specified by BeginFigure) to the end point of + /// the first Bezier segment in the array. if the array contains additional Bezier segments, each subsequent Bezier segment uses + /// the end point of the preceding Bezier segment as its start point. + /// + /// + /// + /// Type: UINT + /// The number of Bezier segments in the beziers array. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-addbeziers void AddBeziers( const + // D2D1_BEZIER_SEGMENT *beziers, UINT32 beziersCount ); + [PreserveSig] + new void AddBeziers([In] D2D1_BEZIER_SEGMENT[] beziers, uint beziersCount); + + /// Ends the current figure; optionally, closes it. + /// + /// Type: D2D1_FIGURE_END + /// + /// A value that indicates whether the current figure is closed. If the figure is closed, a line is drawn between the current + /// point and the start point specified by BeginFigure. + /// + /// + /// None + /// + /// Calling this method without a matching call to BeginFigure places the geometry sink in an error state; subsequent calls are + /// ignored, and the overall failure will be returned when the Close method is called. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-endfigure void EndFigure( + // D2D1_FIGURE_END figureEnd ); + [PreserveSig] + new void EndFigure(D2D1_FIGURE_END figureEnd); + + /// Closes the geometry sink, indicates whether it is in an error state, and resets the sink's error state. + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// Do not close the geometry sink while a figure is still in progress; doing so puts the geometry sink in an error state. For + /// the close operation to be successful, there must be one EndFigure call for each call to BeginFigure. + /// + /// + /// After calling this method, the geometry sink might not be usable. Direct2D implementations of this interface do not allow + /// the geometry sink to be modified after it is closed, but other implementations might not impose this restriction. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-close HRESULT Close(); + [PreserveSig] + new HRESULT Close(); + + /// Creates a line segment between the current point and the specified end point and adds it to the geometry sink. + /// + /// Type: D2D1_POINT_2F + /// The end point of the line to draw. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrysink-addline void AddLine( D2D1_POINT_2F point ); + [PreserveSig] + void AddLine(D2D_POINT_2F point); + + /// Creates a cubic Bezier curve between the current point and the specified end point. + /// + /// Type: [in] const D2D1_BEZIER_SEGMENT & + /// A structure that describes the control points and end point of the Bezier curve to add. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrysink-addbezier(constd2d1_bezier_segment_) void + // AddBezier( const D2D1_BEZIER_SEGMENT & bezier ); + [PreserveSig] + void AddBezier(in D2D1_BEZIER_SEGMENT bezier); + + /// Creates a quadratic Bezier curve between the current point and the specified end point. + /// + /// Type: [in] const D2D1_QUADRATIC_BEZIER_SEGMENT & + /// A structure that describes the control point and the end point of the quadratic Bezier curve to add. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrysink-addquadraticbezier(constd2d1_quadratic_bezier_segment_) + // void AddQuadraticBezier( const D2D1_QUADRATIC_BEZIER_SEGMENT & bezier ); + [PreserveSig] + void AddQuadraticBezier(in D2D1_QUADRATIC_BEZIER_SEGMENT bezier); + + /// Adds a sequence of quadratic Bezier segments as an array in a single call. + /// + /// Type: const D2D1_QUADRATIC_BEZIER_SEGMENT* + /// An array of a sequence of quadratic Bezier segments. + /// + /// + /// Type: UINT + /// A value indicating the number of quadratic Bezier segments in beziers. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrysink-addquadraticbeziers void + // AddQuadraticBeziers( const D2D1_QUADRATIC_BEZIER_SEGMENT *beziers, UINT32 beziersCount ); + [PreserveSig] + void AddQuadraticBeziers([In] D2D1_QUADRATIC_BEZIER_SEGMENT[] beziers, uint beziersCount); + + /// Adds a single arc to the path geometry. + /// + /// Type: [in] const D2D1_ARC_SEGMENT & + /// The arc segment to add to the figure. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometrysink-addarc(constd2d1_arc_segment_) void AddArc( + // const D2D1_ARC_SEGMENT & arc ); + [PreserveSig] + void AddArc(in D2D1_ARC_SEGMENT arc); + } + + /// Represents an collection of D2D1_GRADIENT_STOP objects for linear and radial gradient brushes. + /// + /// Creating ID2D1GradientStopCollection Objects + /// To create an ID2D1GradientStopCollection, use the ID2D1RenderTarget::CreateGradientStopCollection method. + /// + /// A gradient stop collection is a device-dependent resource: your application should create gradient stop collections after it + /// initializes the render target with which the gradient stop collection will be used, and recreate the gradient stop collection + /// whenever the render target needs recreated. (For more information about resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1gradientstopcollection + [PInvokeData("d2d1.h", MSDNShortId = "982abf9c-4778-4871-a494-5843f0c0addc")] + [ComImport, Guid("2cd906a7-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1GradientStopCollection : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the number of gradient stops in the collection. + /// + /// Type: UINT32 + /// The number of gradient stops in the collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getgradientstopcount UINT32 GetGradientStopCount(); + [PreserveSig] + uint GetGradientStopCount(); + + /// Copies the gradient stops from the collection into an array of D2D1_GRADIENT_STOP structures. + /// + /// Type: D2D1_GRADIENT_STOP* + /// + /// A pointer to a one-dimensional array of D2D1_GRADIENT_STOP structures. When this method returns, the array contains copies + /// of the collection's gradient stops. You must allocate the memory for this array. + /// + /// + /// + /// Type: UINT + /// + /// A value indicating the number of gradient stops to copy. If the value is less than the number of gradient stops in the + /// collection, the remaining gradient stops are omitted. If the value is larger than the number of gradient stops in the + /// collection, the extra gradient stops are set to NULL. To obtain the number of gradient stops in the collection, use + /// the GetGradientStopCount method. + /// + /// + /// None + /// + /// Gradient stops are copied in order of position, starting with the gradient stop with the smallest position value and + /// progressing to the gradient stop with the largest position value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getgradientstops void + // GetGradientStops( D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount ); + [PreserveSig] + void GetGradientStops([Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount); + + /// Indicates the gamma space in which the gradient stops are interpolated. + /// + /// Type: D2D1_GAMMA + /// The gamma space in which the gradient stops are interpolated. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getcolorinterpolationgamma + // D2D1_GAMMA GetColorInterpolationGamma(); + [PreserveSig] + D2D1_GAMMA GetColorInterpolationGamma(); + + /// Indicates the behavior of the gradient outside the normalized gradient range. + /// + /// Type: D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized gradient range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getextendmode D2D1_EXTEND_MODE GetExtendMode(); + [PreserveSig] + D2D1_EXTEND_MODE GetExtendMode(); + } + + /// Renders drawing instructions to a window. + /// + /// + /// As is the case with other render targets, you must call BeginDraw before issuing drawing commands. After you've finished + /// drawing, call EndDraw to indicate that drawing is finished and to release access to the buffer backing the render target. + /// + /// + /// For ID2D1HwndRenderTarget, the only side effect of BeginDraw is changing the state of the render target to allow + /// drawing commands to be issued. + /// + /// + /// EndDraw flushes any batched drawing commands. If no errors have occurred, then it also presents the buffer, causing it to + /// appear on the associated window. Finally, EndDraw returns the HRESULT of the first error that occurred in drawing or + /// presenting, as well as the tag state at the time the error occurred. + /// + /// + /// ID2D1HwndRenderTarget objects are double buffered, so drawing commands issued do not appear immediately, but rather are + /// performed on an offscreen surface. When EndDraw is called, if there have been no rendering errors, the offscreen buffer is + /// presented. If there have been rendering errors in the batch flushed by EndDraw, then the buffer is not presented, and the + /// application must call BeginDraw and re-draw the frame. Flush can be used to check for errors before calling EndDraw if an + /// application wants the frame to be presented regardless of errors. + /// + /// + /// A hardware render target's back-buffer is the size specified by GetPixelSize. If EndDraw presents the buffer, this bitmap is + /// stretched to cover the surface where it is presented: the entire client area of the window. This stretch is performed using + /// bilinear filtering if the render target is rendering in hardware and using nearest-neighbor filtering if the rendering target is + /// using software. (Typically, an application will call Resize to ensure the pixel size of the render target and the pixel size of + /// the destination match, and no scaling is necessary, though this is not a requirement.) + /// + /// + /// In the case where a window straddles adapters, Direct2D ensures that the portion of the off-screen render target is copied from + /// the adapter where rendering is occurring to the adapter that needs to display the contents. + /// + /// + /// If the adapter a render target is on has been removed or the driver upgraded while the application is running, this is returned + /// as an error in the EndDraw call. In this case, the application should create a new render target and resources as necessary. + /// + /// Creating ID2D1HwndRenderTarget Objects + /// To create an ID2D1HwndRenderTarget, use the ID2D1Factory::CreateHwndRenderTarget method. + /// + /// Your application should create render targets once and hold onto them for the life of the application or until the render + /// target's EndDraw method returns the D2DERR_RECREATE_TARGET error. When you receive this error, you need to recreate the render + /// target (and any resources it created). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1hwndrendertarget + [PInvokeData("d2d1.h", MSDNShortId = "860342cc-989c-4432-b879-07f3da07d50a")] + [ComImport, Guid("2cd90698-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1HwndRenderTarget : ID2D1RenderTarget + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Creates a Direct2D bitmap from a pointer to in-memory source data. + /// + /// Type: [in] D2D1_SIZE_U + /// The dimensions of the bitmap to create in pixels. + /// + /// + /// Type: [in, optional] const void* + /// A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap. + /// + /// + /// Type: [in] UINT32 + /// + /// The byte count of each scanline, which is equal to (the image width in pixels × the number of bytes per pixel) + memory + /// padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.) + /// + /// + /// + /// Type: [in] const D2D1_BITMAP_PROPERTIES & + /// The pixel format and dots per inch (DPI) of the bitmap to create. + /// + /// + /// Type: [out] ID2D1Bitmap** + /// When this method returns, contains a pointer to a pointer to the new bitmap. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmap(d2d1_size_u_constvoid_uint32_constd2d1_bitmap_properties__id2d1bitmap) + // HRESULT CreateBitmap( D2D1_SIZE_U size, const void *srcData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES & + // bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmap(D2D_SIZE_U size, [In, Optional] IntPtr srcData, uint pitch, in D2D1_BITMAP_PROPERTIES bitmapProperties); + + /// Creates an ID2D1Bitmap by copying the specified Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: [in] IWICBitmapSource* + /// The WIC bitmap to copy. + /// + /// + /// Type: [in, optional] const D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create. The pixel format must match the pixel format of wicBitmapSource, or the + /// method will fail. To prevent a mismatch, you can pass NULL or pass the value obtained from calling the + /// D2D1::PixelFormat helper function without specifying any parameter values. If both dpiX and dpiY are 0.0f, the default DPI, + /// 96, is used. DPI information embedded in wicBitmapSource is ignored. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// Before Direct2D can load a WIC bitmap, that bitmap must be converted to a supported pixel format and alpha mode. For a list + /// of supported pixel formats and alpha modes, see Supported Pixel Formats and Alpha Modes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) + // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, + // ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1Bitmap whose data is shared with another resource. + /// + /// Type: REFIID + /// The interface ID of the object supplying the source data. + /// + /// + /// Type: void* + /// + /// An ID2D1Bitmap, IDXGISurface, or an IWICBitmapLock that contains the data to share with the new ID2D1Bitmap. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create . The DXGI_FORMAT portion of the pixel format must match the DXGI_FORMAT of + /// data or the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or + /// the value obtained from the D2D1::PixelFormat helper function. The DPI settings do not have to match those of data. If both + /// dpiX and dpiY are 0.0f, the DPI of the render target is used. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// + /// The CreateSharedBitmap method is useful for efficiently reusing bitmap data and can also be used to provide + /// interoperability with Direct3D. + /// + /// Sharing an ID2D1Bitmap + /// + /// By passing an ID2D1Bitmap created by a render target that is resource-compatible, you can share a bitmap with that render + /// target; both the original ID2D1Bitmap and the new ID2D1Bitmap created by this method will point to the same + /// bitmap data. For more information about when render target resources can be shared, see the Sharing Render Target Resources + /// section of the Resources Overview. + /// + /// + /// You may also use this method to reinterpret the data of an existing bitmap and specify a new DPI or alpha mode. For example, + /// in the case of a bitmap atlas, an ID2D1Bitmap may contain multiple sub-images, each of which should be rendered with a + /// different D2D1_ALPHA_MODE ( D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE). You could use the + /// CreateSharedBitmap method to reinterpret the bitmap using the desired alpha mode without having to load a separate + /// copy of the bitmap into memory. + /// + /// Sharing an IDXGISurface + /// + /// When using a DXGI surface render target (an ID2D1RenderTarget object created by the CreateDxgiSurfaceRenderTarget method), + /// you can pass an IDXGISurface surface to the CreateSharedBitmap method to share video memory with Direct3D and + /// manipulate Direct3D content as an ID2D1Bitmap. As described in the Resources Overview, the render target and the + /// IDXGISurface must be using the same Direct3D device. + /// + /// + /// Note also that the IDXGISurface must use one of the supported pixel formats and alpha modes described in Supported Pixel + /// Formats and Alpha Modes. + /// + /// For more information about interoperability with Direct3D, see the Direct2D and Direct3D Interoperability Overview. + /// Sharing an IWICBitmapLock + /// + /// An IWICBitmapLock stores the content of a WIC bitmap and shields it from simultaneous accesses. By passing an + /// IWICBitmapLock to the CreateSharedBitmap method, you can create an ID2D1Bitmap that points to the bitmap data + /// already stored in the IWICBitmapLock. + /// + /// + /// To use an IWICBitmapLock with the CreateSharedBitmap method, the render target must use software rendering. To force + /// a render target to use software rendering, set to D2D1_RENDER_TARGET_TYPE_SOFTWARE the type field of the + /// D2D1_RENDER_TARGET_PROPERTIES structure that you use to create the render target. To check whether an existing render target + /// uses software rendering, use the IsSupported method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT + // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1BitmapBrush from the specified bitmap. + /// + /// Type: ID2D1Bitmap* + /// The bitmap contents of the new brush. + /// + /// + /// Type: D2D1_BITMAP_BRUSH_PROPERTIES* + /// + /// The extend modes and interpolation mode of the new brush, or NULL. If you set this parameter to NULL, the + /// brush defaults to the D2D1_EXTEND_MODE_CLAMP horizontal and vertical extend modes and the + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR interpolation mode. + /// + /// + /// + /// Type: D2D1_BRUSH_PROPERTIES* + /// + /// A structure that contains the opacity and transform of the new brush, or NULL. If you set this parameter to + /// NULL, the brush sets the opacity member to 1.0F and the transform member to the identity matrix. + /// + /// + /// + /// Type: ID2D1BitmapBrush** + /// + /// When this method returns, this output parameter contains a pointer to a pointer to the new brush. Pass this parameter uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) + // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The red, green, blue, and alpha values of the brush's color. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES & + /// The base opacity of the brush. + /// + /// + /// Type: [out] ID2D1SolidColorBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) + // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, + // ID2D1SolidColorBrush **solidColorBrush ); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + + /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. + /// + /// Type: [in] D2D1_GRADIENT_STOP* + /// A pointer to an array of D2D1_GRADIENT_STOP structures. + /// + /// + /// Type: [in] UINT + /// A value greater than or equal to 1 that specifies the number of gradient stops in the gradientStops array. + /// + /// + /// Type: [in] D2D1_GAMMA + /// The space in which color interpolation between the gradient stops is performed. + /// + /// + /// Type: [in] D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized range. + /// + /// + /// Type: [out] ID2D1GradientStopCollection** + /// When this method returns, contains a pointer to a pointer to the new gradient stop collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 + // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA + // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); + new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + + /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. + /// + /// Type: [in] const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES* + /// The start and end points of the gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the + /// gradient line. + /// + /// + /// + /// Type: [out] ID2D1LinearGradientBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlineargradientbrush%28constd2d1_linear_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1lineargradientbrush%29 + // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush + // **linearGradientBrush ); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. + /// + /// Type: const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES* + /// The center, gradient origin offset, and x-radius and y-radius of the brush's gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the gradient. + /// + /// + /// + /// Type: [out] ID2D1RadialGradientBrush** + /// When this method returns, contains a pointer to a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createradialgradientbrush%28constd2d1_radial_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1radialgradientbrush%29 + // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush + // **radialGradientBrush ); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// + /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. + /// + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// The desired size of the new render target (in device-independent pixels), if it should be different from the original render + /// target. For more info, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_SIZE_U* + /// + /// The desired size of the new render target in pixels if it should be different from the original render target. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_PIXEL_FORMAT* + /// + /// The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new + /// render target uses the same pixel format as the original render target. If the alpha mode is D2D1_ALPHA_MODE_UNKNOWN, the + /// alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel + /// formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: [in] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS + /// A value that specifies whether the new render target must be compatible with GDI. + /// + /// + /// Type: [out] ID2D1BitmapRenderTarget** + /// + /// When this method returns, contains a pointer to a pointer to a new bitmap render target. This parameter is passed uninitialized. + /// + /// + /// + /// The pixel size and DPI of the new render target can be altered by specifying values for desiredSize or desiredPixelSize: + /// + /// + /// + /// If desiredSize is specified but desiredPixelSize is not, the pixel size is computed from the desired size using the parent + /// target DPI. If the desiredSize maps to a integer-pixel size, the DPI of the compatible render target is the same as the DPI + /// of the parent target. If desiredSize maps to a fractional-pixel size, the pixel size is rounded up to the nearest integer + /// and the DPI for the compatible render target is slightly higher than the DPI of the parent render target. In all cases, the + /// coordinate (desiredSize.width, desiredSize.height) maps to the lower-right corner of the compatible render target. + /// + /// + /// + /// + /// If the desiredPixelSize is specified and desiredSize is not, the DPI of the new render target is the same as the original + /// render target. + /// + /// + /// + /// + /// If both desiredSize and desiredPixelSize are specified, the DPI of the new render target is computed to account for the + /// difference in scale. + /// + /// + /// + /// + /// If neither desiredSize nor desiredPixelSize is specified, the new render target size and DPI match the original render target. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) + // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const + // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + + /// Creates a layer resource that can be used with this render target and its compatible render targets. + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// If (0, 0) is specified, no backing store is created behind the layer resource. The layer resource is allocated to the + /// minimum size when PushLayer is called. + /// + /// + /// + /// Type: [out] ID2D1Layer** + /// When the method returns, contains a pointer to a pointer to the new layer. This parameter is passed uninitialized. + /// + /// The layer automatically resizes itself, as needed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) + // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); + new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + + /// Create a mesh that uses triangles to describe a shape. + /// + /// Type: ID2D1Mesh** + /// When this method returns, contains a pointer to a pointer to the new mesh. + /// + /// + /// To populate a mesh, use its Open method to obtain an ID2D1TessellationSink. To draw the mesh, use the render target's + /// FillMesh method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createmesh HRESULT CreateMesh( ID2D1Mesh + // **mesh ); + new ID2D1Mesh CreateMesh(); + + /// Draws a line between the specified points using the specified stroke style. + /// + /// Type: D2D1_POINT_2F + /// The start point of the line, in device-independent pixels. + /// + /// + /// Type: D2D1_POINT_2F + /// The end point of the line, in device-independent pixels. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the line's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid line. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline void DrawLine( D2D1_POINT_2F + // point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawLine(D2D_POINT_2F point0, D2D_POINT_2F point1, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Draws the outline of a rectangle that has the specified dimensions and stroke style. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimensions of the rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's stroke. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid stroke. + /// + /// None + /// + /// When this method fails, it does not return an error code. To determine whether a drawing method (such as DrawRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawrectangle(constd2d1_rect_f__id2d1brush_float_id2d1strokestyle) + // void DrawRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rectangle. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimension of the rectangle to paint, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's interior. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillrectangle(constd2d1_rect_f__id2d1brush) + // void FillRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified rounded rectangle using the specified stroke style. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rounded rectangle's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawroundedrectangle(constd2d1_rounded_rect__id2d1brush_float_id2d1strokestyle) + // void DrawRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle + // *strokeStyle ); + [PreserveSig] + new void DrawRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rounded rectangle. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to paint, in device independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the rounded rectangle. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// FillRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillroundedrectangle(constd2d1_rounded_rect__id2d1brush) + // void FillRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush ); + [PreserveSig] + new void FillRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified ellipse using the specified stroke style. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius of the ellipse to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the ellipse's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the ellipse's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// The DrawEllipse method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawEllipse) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawellipse(constd2d1_ellipse__id2d1brush_float_id2d1strokestyle) + // void DrawEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified ellipse. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius, in device-independent pixels, of the ellipse to paint. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the ellipse. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillEllipse) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillellipse(constd2d1_ellipse__id2d1brush) + // void FillEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush ); + [PreserveSig] + new void FillEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush); + + /// Draws the outline of the specified geometry using the specified stroke style. + /// + /// Type: ID2D1Geometry* + /// The geometry to draw. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawgeometry void DrawGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + new void DrawGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified geometry. + /// + /// Type: ID2D1Geometry* + /// The geometry to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's interior. + /// + /// + /// Type: ID2D1Brush* + /// + /// The opacity mask to apply to the geometry, or NULL for no opacity mask. If an opacity mask (the opacityBrush + /// parameter) is specified, brush must be an ID2D1BitmapBrush that has its x- and y-extend modes set to D2D1_EXTEND_MODE_CLAMP. + /// For more information, see the Remarks section. + /// + /// + /// None + /// + /// + /// If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to + /// determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush + /// is used for this processing; all other color information is ignored. + /// + /// + /// The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted + /// by brush. + /// + /// + /// When this method fails, it does not return an error code. To determine whether a drawing operation (such as + /// FillGeometry) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillgeometry void FillGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush ); + [PreserveSig] + new void FillGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, [In] ID2D1Brush opacityBrush = null); + + /// Paints the interior of the specified mesh. + /// + /// Type: ID2D1Mesh* + /// The mesh to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the mesh. + /// + /// None + /// + /// + /// The current antialias mode of the render target must be D2D1_ANTIALIAS_MODE_ALIASED when FillMesh is called. To + /// change the render target's antialias mode, use the SetAntialiasMode method. + /// + /// + /// FillMesh does not expect a particular winding order for the triangles in the ID2D1Mesh; both clockwise and + /// counter-clockwise will work. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillMesh) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillmesh void FillMesh( ID2D1Mesh *mesh, + // ID2D1Brush *brush ); + [PreserveSig] + new void FillMesh([In] ID2D1Mesh mesh, [In] ID2D1Brush brush); + + /// + /// Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target. + /// + /// + /// Type: ID2D1Bitmap* + /// + /// The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is + /// multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle. + /// + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the region of the render target specified by destinationRectangle. + /// + /// + /// Type: D2D1_OPACITY_MASK_CONTENT + /// + /// The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended. + /// + /// + /// Note Starting with Windows 8, the D2D1_OPACITY_MASK_CONTENT is not required. See the + /// ID2D1DeviceContext::FillOpacityMask method, which has no D2D1_OPACITY_MASK_CONTENT parameter. + /// + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the render target to paint, in device-independent pixels. + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the bitmap to use as the opacity mask, in device-independent pixels. + /// + /// None + /// + /// + /// For this method to work properly, the render target must be using the D2D1_ANTIALIAS_MODE_ALIASED antialiasing mode. You can + /// set the antialiasing mode by calling the ID2D1RenderTarget::SetAntialiasMode method. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillOpacityMask) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_) + // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & + // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + + /// Draws the specified bitmap after scaling it to the size of the specified rectangle. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to render. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap + /// is drawn. If the rectangle is not well-ordered, nothing is drawn, but the render target does not enter an error state. + /// + /// + /// + /// Type: FLOAT + /// + /// A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied + /// against the alpha values of the bitmap's contents. + /// + /// + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to draw. + /// + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawBitmap) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawbitmap(id2d1bitmap_constd2d1_rect_f__float_d2d1_bitmap_interpolation_mode_constd2d1_rect_f_) + // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, + // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + + /// Draws the specified text using the format information provided by an IDWriteTextFormat object. + /// + /// Type: WCHAR* + /// A pointer to an array of Unicode characters to draw. + /// + /// + /// Type: UINT + /// The number of characters in string. + /// + /// + /// Type: IDWriteTextFormat* + /// An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction. + /// + /// + /// Type: const D2D1_RECT_F + /// The size and position of the area in which the text is drawn. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the text. + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// To create an IDWriteTextFormat object, create an IDWriteFactory and call its CreateTextFormat method. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawText) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtext(constwchar_uint32_idwritetextformat_constd2d1_rect_f__id2d1brush_d2d1_draw_text_options_dwrite_measuring_mode) + // void DrawText( const WCHAR *string, UINT32 stringLength, IDWriteTextFormat *textFormat, const D2D1_RECT_F & layoutRect, + // ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + new void DrawText([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, in D2D_RECT_F layoutRect, + [In] ID2D1Brush defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// Draws the formatted text described by the specified IDWriteTextLayout object. + /// + /// Type: D2D1_POINT_2F + /// + /// The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn. + /// + /// + /// + /// Type: IDWriteTextLayout* + /// + /// The formatted text to draw. Any drawing effects that do not inherit from ID2D1Resource are ignored. If there are drawing + /// effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an + /// error state. + /// + /// + /// + /// Type: ID2D1Brush* + /// + /// The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect + /// (specified by the IDWriteTextLayout::SetDrawingEffect method). + /// + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// None + /// + /// + /// When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the DrawText + /// method because the text doesn't need to be formatted and the layout processed with each call. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawTextLayout) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtextlayout void DrawTextLayout( + // D2D1_POINT_2F origin, IDWriteTextLayout *textLayout, ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options ); + [PreserveSig] + new void DrawTextLayout(D2D_POINT_2F origin, [In] IDWriteTextLayout textLayout, [In] ID2D1Brush defaultFillBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE); + + /// Draws the specified glyphs. + /// + /// Type: D2D1_POINT_2F + /// The origin, in device-independent pixels, of the glyphs' baseline. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the specified glyphs. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGlyphRun) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawglyphrun void DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE + // measuringMode ); + [PreserveSig] + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In] ID2D1Brush foregroundBrush, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// + /// Applies the specified transform to the render target, replacing the existing transformation. All subsequent drawing + /// operations occur in the transformed space. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the current transform of the render target. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this returns, contains the current transform of the render target. This parameter is passed uninitialized. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettransform void GetTransform( + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// + /// Sets the antialiasing mode of the render target. The antialiasing mode applies to all subsequent drawing operations, + /// excluding text and glyph drawing operations. + /// + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode for future drawing operations. + /// + /// None + /// To specify the antialiasing mode for text and glyph operations, use the SetTextAntialiasMode method. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setantialiasmode void SetAntialiasMode( + // D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); + + /// Retrieves the current antialiasing mode for nontext drawing operations. + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The current antialiasing mode for nontext drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getantialiasmode D2D1_ANTIALIAS_MODE GetAntialiasMode(); + [PreserveSig] + new D2D1_ANTIALIAS_MODE GetAntialiasMode(); + + /// Specifies the antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextantialiasmode void + // SetTextAntialiasMode( D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode ); + [PreserveSig] + new void SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); + + /// Gets the current antialiasing mode for text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The current antialiasing mode for text and glyph drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextantialiasmode + // D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + [PreserveSig] + new D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + + /// Specifies text rendering options to be applied to all subsequent text and glyph drawing operations. + /// + /// Type: IDWriteRenderingParams* + /// + /// The text rendering options to be applied to all subsequent text and glyph drawing operations; NULL to clear current + /// text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextrenderingparams void + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + new void SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Retrieves the render target's current text rendering options. + /// + /// Type: IDWriteRenderingParams** + /// + /// When this method returns, textRenderingParamscontains the address of a pointer to the render target's current text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextrenderingparams void + // GetTextRenderingParams( IDWriteRenderingParams **textRenderingParams ); + [PreserveSig] + new void GetTextRenderingParams(out IDWriteRenderingParams textRenderingParams); + + /// Specifies a label for subsequent drawing operations. + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// None + /// + /// The labels specified by this method are printed by debug error messages. If no tag is set, the default value for each tag is 0. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settags void SetTags( ulong tag1, ulong + // tag2 ); + [PreserveSig] + new void SetTags(ulong tag1, ulong tag2); + + /// Gets the label for subsequent drawing operations. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the first label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the second label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// None + /// If the same address is passed for both parameters, both parameters receive the value of the second tag. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettags void GetTags( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + [PreserveSig] + new void GetTags(out ulong tag1, out ulong tag2); + + /// + /// Adds the specified layer to the render target so that it receives all subsequent drawing operations until PopLayer is called. + /// + /// + /// Type: const D2D1_LAYER_PARAMETERS + /// The content bounds, geometric mask, opacity, opacity mask, and antialiasing options for the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer that receives subsequent drawing operations. + /// + /// Note Starting with Windows 8, this parameter is optional. If a layer is not specified, Direct2D manages the layer + /// resource automatically. + /// + /// + /// None + /// + /// + /// The PushLayer method allows a caller to begin redirecting rendering to a layer. All rendering operations are valid in + /// a layer. The location of the layer is affected by the world transform set on the render target. + /// + /// + /// Each PushLayer must have a matching PopLayer call. If there are more PopLayer calls than PushLayer calls, the + /// render target is placed into an error state. If Flush is called before all outstanding layers are popped, the render target + /// is placed into an error state, and an error is returned. The error state can be cleared by a call to EndDraw. + /// + /// + /// A particular ID2D1Layer resource can be active only at one time. In other words, you cannot call a PushLayer method, + /// and then immediately follow with another PushLayer method with the same layer resource. Instead, you must call the + /// second PushLayer method with different layer resources. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushLayer) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushlayer(constd2d1_layer_parameters__id2d1layer) + // void PushLayer( const D2D1_LAYER_PARAMETERS & layerParameters, ID2D1Layer *layer ); + [PreserveSig] + new void PushLayer(in D2D1_LAYER_PARAMETERS layerParameters, [In, Optional] ID2D1Layer layer); + + /// Stops redirecting drawing operations to the layer that is specified by the last PushLayer call. + /// None + /// + /// A PopLayer must match a previous PushLayer call. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PopLayer) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-poplayer void PopLayer(); + [PreserveSig] + new void PopLayer(); + + /// Executes all pending drawing commands. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. If no error occurred, this method sets the error tag state to be (0,0). + /// + /// + /// + /// This command does not flush the Direct3D device context that is associated with the render target. + /// Calling this method resets the error state of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-flush HRESULT Flush( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void Flush(out ulong tag1, out ulong tag2); + + /// Saves the current drawing state to the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// + /// When this method returns, contains the current drawing state of the render target. This parameter must be initialized before + /// passing it to the method. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-savedrawingstate void SaveDrawingState( + // ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void SaveDrawingState([In, Out] ID2D1DrawingStateBlock drawingStateBlock); + + /// Sets the render target's drawing state to that of the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// The new drawing state of the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-restoredrawingstate void + // RestoreDrawingState( ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + new void RestoreDrawingState([In] ID2D1DrawingStateBlock drawingStateBlock); + + /// Specifies a rectangle to which all subsequent drawing operations are clipped. + /// + /// Type: [in] const D2D1_RECT_F & + /// The size and position of the clipping area, in device-independent pixels. + /// + /// + /// Type: [in] D2D1_ANTIALIAS_MODE + /// + /// The antialiasing mode that is used to draw the edges of clip rects that have subpixel boundaries, and to blend the clip with + /// the scene contents. The blending is performed once when the PopAxisAlignedClip method is called, and does not apply to each + /// primitive within the layer. + /// + /// + /// None + /// + /// + /// The clipRect is transformed by the current world transform set on the render target. After the transform is applied to the + /// clipRect that is passed in, the axis-aligned bounding box for the clipRect is computed. For efficiency, the contents are + /// clipped to this axis-aligned bounding box and not to the original clipRect that is passed in. + /// + /// + /// The following diagrams show how a rotation transform is applied to the render target, the resulting clipRect, and a + /// calculated axis-aligned bounding box. + /// + /// + /// + /// Assume the rectangle in the following illustration is a render target that is aligned to the screen pixels. + /// + /// + /// + /// Apply a rotation transform to the render target. In the following illustration, the black rectangle represents the original + /// render target and the red dashed rectangle represents the transformed render target. + /// + /// + /// + /// + /// After calling PushAxisAlignedClip, the rotation transform is applied to the clipRect. In the following illustration, + /// the blue rectangle represents the transformed clipRect. + /// + /// + /// + /// + /// The axis-aligned bounding box is calculated. The green dashed rectangle represents the bounding box in the following + /// illustration. All contents are clipped to this axis-aligned bounding box. + /// + /// + /// + /// + /// Note If rendering operations fail or if PopAxisAlignedClip is not called, clip rects may cause some artifacts on the + /// render target. PopAxisAlignedClip can be considered a drawing operation that is designed to fix the borders of a + /// clipping region. Without this call, the borders of a clipped area may be not antialiased or otherwise corrected. + /// + /// + /// The PushAxisAlignedClip and PopAxisAlignedClip must match. Otherwise, the error state is set. For the render target + /// to continue receiving new commands, you can call Flush to clear the error. + /// + /// + /// A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot + /// overlap. For example, the sequence of PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip is valid, + /// but the sequence of PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer is invalid. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushAxisAlignedClip) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushaxisalignedclip(constd2d1_rect_f__d2d1_antialias_mode) + // void PushAxisAlignedClip( const D2D1_RECT_F & clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + new void PushAxisAlignedClip(in D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode); + + /// + /// Removes the last axis-aligned clip from the render target. After this method is called, the clip is no longer applied to + /// subsequent drawing operations. + /// + /// None + /// + /// + /// A PushAxisAlignedClip/ PopAxisAlignedClip pair can occur around or within a PushLayer/PopLayer pair, but may not + /// overlap. For example, a PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip sequence is + /// valid, but a PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer sequence is not. + /// + /// PopAxisAlignedClip must be called once for every call to PushAxisAlignedClip. + /// For an example, see How to Clip with an Axis-Aligned Clip Rectangle. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// PopAxisAlignedClip) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-popaxisalignedclip void PopAxisAlignedClip(); + [PreserveSig] + new void PopAxisAlignedClip(); + + /// Clears the drawing area to the specified color. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The color to which the drawing area is cleared. + /// + /// None + /// + /// + /// Direct2D interprets the clearColor as straight alpha (not premultiplied). If the render target's alpha mode is + /// D2D1_ALPHA_MODE_IGNORE, the alpha channel of clearColor is ignored and replaced with 1.0f (fully opaque). + /// + /// + /// If the render target has an active clip (specified by PushAxisAlignedClip), the clear command is applied only to the area + /// within the clip region. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const + // D2D1_COLOR_F & clearColor ); + [PreserveSig] + new void Clear([In, Optional] IntPtr clearColor); + + /// Initiates drawing on this render target. + /// None + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are used to indicate that a render target is in use by the Direct2D system. Different implementations + /// of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget may be locked + /// between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on + /// EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing + /// of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success + /// of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw + /// method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-begindraw void BeginDraw(); + [PreserveSig] + new void BeginDraw(); + + /// Ends drawing operations on the render target and indicates the current error state and associated tags. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. + /// + /// + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different + /// implementations of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget + /// may be locked between BeginDraw/ EndDraw calls, a DXGI surface render target might be acquired on + /// BeginDraw and released on EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and + /// may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/ EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of + /// these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the + /// success of the operations and, optionally, the tag state of the render target at the time the error occurred. The + /// EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-enddraw HRESULT EndDraw( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + new void EndDraw(out ulong tag1, out ulong tag2); + + /// Retrieves the pixel format and alpha mode of the render target. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + new D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Sets the dots per inch (DPI) of the render target. + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the horizontal DPI of the render target. + /// + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the vertical DPI of the render target. + /// + /// None + /// + /// + /// This method specifies the mapping from pixel space to device-independent space for the render target. If both dpiX and dpiY + /// are 0, the factory-read system DPI is chosen. If one parameter is zero and the other unspecified, the DPI is not changed. + /// + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setdpi void SetDpi( FLOAT dpiX, FLOAT dpiY ); + [PreserveSig] + new void SetDpi(float dpiX, float dpiY); + + /// Return the render target's dots per inch (DPI). + /// + /// Type: FLOAT* + /// When this method returns, contains the horizontal DPI of the render target. This parameter is passed uninitialized. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the vertical DPI of the render target. This parameter is passed uninitialized. + /// + /// None + /// + /// This method indicates the mapping from pixel space to device-independent space for the render target. + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getdpi void GetDpi( FLOAT *dpiX, FLOAT + // *dpiY ); + [PreserveSig] + new void GetDpi(out float dpiX, out float dpiY); + + /// Returns the size of the render target in device-independent pixels. + /// + /// Type: D2D1_SIZE_F + /// The current size of the render target in device-independent pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + new D2D_SIZE_F GetSize(); + + /// Returns the size of the render target in device pixels. + /// + /// Type: D2D1_SIZE_U + /// The size of the render target in device pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + new D2D_SIZE_U GetPixelSize(); + + /// + /// Gets the maximum size, in device-dependent units (pixels), of any one bitmap dimension supported by the render target. + /// + /// + /// Type: UINT32 + /// The maximum size, in pixels, of any one bitmap dimension supported by the render target. + /// + /// + /// This method returns the maximum texture size of the Direct3D device. + /// + /// Note The software renderer and WARP devices return the value of 16 megapixels (16*1024*1024). You can create a + /// Direct2D texture that is this size, but not a Direct3D texture that is this size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getmaximumbitmapsize UINT32 GetMaximumBitmapSize(); + [PreserveSig] + new uint GetMaximumBitmapSize(); + + /// Indicates whether the render target supports the specified properties. + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES* + /// The render target properties to test. + /// + /// + /// Type: BOOL + /// TRUE if the specified render target properties are supported by this render target; otherwise, FALSE. + /// + /// This method does not evaluate the DPI settings specified by the renderTargetProperties parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-issupported(constd2d1_render_target_properties_) + // BOOL IsSupported( const D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + new bool IsSupported(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + + /// Indicates whether the HWND associated with this render target is occluded. + /// + /// Type: D2D1_WINDOW_STATE + /// A value that indicates whether the HWND associated with this render target is occluded. + /// + /// + /// Note If the window was occluded the last time that EndDraw was called, the next time that the render target calls + /// CheckWindowState, it will return D2D1_WINDOW_STATE_OCCLUDED regardless of the current window state. If you want to + /// use CheckWindowState to determine the current window state, you should call CheckWindowState after every + /// EndDraw call and ignore its return value. This call will ensure that your next call to CheckWindowState state + /// will return the actual window state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1hwndrendertarget-checkwindowstate D2D1_WINDOW_STATE CheckWindowState(); + [PreserveSig] + D2D1_WINDOW_STATE CheckWindowState(); + + /// Changes the size of the render target to the specified pixel size. + /// + /// Type: [in] const D2D1_SIZE_U & + /// The new size of the render target in device pixels. + /// + /// + /// After this method is called, the contents of the render target's back-buffer are not defined, even if the + /// D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS option was specified when the render target was created. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1hwndrendertarget-resize%28constd2d1_size_u_%29 HRESULT + // Resize( const D2D1_SIZE_U & pixelSize ); + void Resize(in D2D_SIZE_U pixelSize); + + /// Returns the HWND associated with this render target. + /// + /// Type: HWND + /// The HWND associated with this render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1hwndrendertarget-gethwnd HWND GetHwnd(); + [PreserveSig] + HWND GetHwnd(); + } + + /// Represents a producer of pixels that can fill an arbitrary 2D plane. + /// + /// An ID2D1Image is abstract. Concrete instances can be created through ID2D1DeviceContext::CreateEffect and ID2D1DeviceContext::CreateBitmap. + /// + /// Images are evaluated lazily. If the type of image passed in is concrete, then the image can be directly sampled from. Other + /// images can act only as a source of pixels and can produce content only as a result of calling ID2D1DeviceContext::DrawImage. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1image + [PInvokeData("d2d1.h", MSDNShortId = "9f7b4546-edbe-4000-a4ce-1a69563ebf9d")] + [ComImport, Guid("65019f75-8da2-497c-b32c-dfa34e48ede6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Image : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + } + + /// Represents the backing store required to render a layer. + /// + /// + /// To create a layer, call the CreateLayer method of the render target where the layer will be used. To draw to a layer, push the + /// layer to the render target stack by calling the PushLayer method. After you have finished drawing to the layer, call the + /// PopLayer method. + /// + /// Between PushLayer and PopLayer calls, the layer is in use and cannot be used by another render target. + /// + /// If the size of the layer is not specified, the corresponding PushLayer call determines the minimum layer size, based on the + /// layer content bounds and the geometric mask. The layer resource can be larger than the size required by PushLayer without + /// any rendering artifacts. + /// + /// + /// If the size of a layer is specified, or if the layer has been used and the required backing store size as calculated during + /// PushLayer is larger than the layer, then the layer resource is expanded on each axis monotonically to ensure that it is large + /// enough. The layer resource never shrinks in size. + /// + /// Creating ID2D1Layer Objects + /// To create a layer, call the CreateLayer method of the render target where the layer will be used. + /// + /// A layer is a device-dependent resource: your application should create layers after it initializes the render target with which + /// the layers will be used, and recreate the layers whenever the render target needs recreated. (For more information about + /// resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1layer + [PInvokeData("d2d1.h", MSDNShortId = "ce7b2345-f0e5-4e44-9146-b1f140bb00ca")] + [ComImport, Guid("2cd9069b-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Layer : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Gets the size of the layer in device-independent pixels. + /// + /// Type: D2D1_SIZE_F + /// The size of the layer in device-independent pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1layer-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + D2D_SIZE_F GetSize(); + } + + /// Paints an area with a linear gradient. + /// + /// + /// An ID2D1LinearGradientBrush paints an area with a linear gradient along a line between the brush start point and end + /// point. The gradient, defined by the brush ID2D1GradientStopCollection, is extruded perpendicular to this line, and then + /// transformed by a brush transform (if specified). + /// + /// + /// The start point and end point are described in the brush space and are mappped to the render target when the brush is used. Note + /// the starting and ending coordinates are absolute, not relative to the render target size. A value of (0, 0) maps to the + /// upper-left corner of the render target, while a value of (1, 1) maps one pixel diagonally away from (0, 0). If there is a + /// nonidentity brush transform or render target transform, the brush start point and end point are also transformed. + /// + /// + /// It is possible to specify a gradient axis that does not completely fill the area that is being painted. When this occurs, the + /// D2D1_EXTEND_MODE, specified by the ID2D1GradientStopCollection, determines how the remaining area is painted. + /// + /// Creating ID2D1LinearGradientBrush Objects + /// + /// To create a linear gradient brush, use the ID2D1RenderTarget::CreateLinearGradientBrush method of the render target on which the + /// brush will be used. The brush can only be used with the render target that created it or with the compatible targets for that + /// render target. + /// + /// + /// A linear gradient brush is a device-dependent resource: your application should create linear gradient brushes after it + /// initializes the render target with which the brushes will be used, and recreate the brushes whenever the render target needs + /// recreated. (For more information about resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1lineargradientbrush + [PInvokeData("d2d1.h", MSDNShortId = "bbb5e36a-d13d-448e-8686-d14ee99b1ccb")] + [ComImport, Guid("2cd906ab-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1LinearGradientBrush : ID2D1Brush + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + new void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + new float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// Sets the starting coordinates of the linear gradient in the brush's coordinate space. + /// + /// Type: D2D1_POINT_2F + /// The starting two-dimensional coordinates of the linear gradient, in the brush's coordinate space. + /// + /// None + /// + /// The start point and end point are described in the brush's space and are mapped to the render target when the brush is used. + /// If there is a non-identity brush transform or render target transform, the brush's start point and end point are also transformed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1lineargradientbrush-setstartpoint void SetStartPoint( + // D2D1_POINT_2F startPoint ); + [PreserveSig] + void SetStartPoint(D2D_POINT_2F startPoint); + + /// Sets the ending coordinates of the linear gradient in the brush's coordinate space. + /// + /// Type: D2D1_POINT_2F + /// The ending two-dimensional coordinates of the linear gradient, in the brush's coordinate space. + /// + /// None + /// + /// The start point and end point are described in the brush's space and are mapped to the render target when the brush is used. + /// If there is a non-identity brush transform or render target transform, the brush's start point and end point are also transformed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1lineargradientbrush-setendpoint void SetEndPoint( + // D2D1_POINT_2F endPoint ); + [PreserveSig] + void SetEndPoint(D2D_POINT_2F endPoint); + + /// Retrieves the starting coordinates of the linear gradient. + /// + /// Type: D2D1_POINT_2F + /// The starting two-dimensional coordinates of the linear gradient, in the brush's coordinate space. + /// + /// + /// The start point and end point are described in the brush's space and are mapped to the render target when the brush is used. + /// If there is a non-identity brush transform or render target transform, the brush's start point and end point are also transformed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1lineargradientbrush-getstartpoint D2D1_POINT_2F GetStartPoint(); + [PreserveSig] + D2D_POINT_2F GetStartPoint(); + + /// Retrieves the ending coordinates of the linear gradient. + /// + /// Type: D2D1_POINT_2F + /// The ending two-dimensional coordinates of the linear gradient, in the brush's coordinate space. + /// + /// + /// The start point and end point are described in the brush's space and are mapped to the render target when the brush is used. + /// If there is a non-identity brush transform or render target transform, the brush's start point and end point are also transformed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1lineargradientbrush-getendpoint D2D1_POINT_2F GetEndPoint(); + [PreserveSig] + D2D_POINT_2F GetEndPoint(); + + /// Retrieves the ID2D1GradientStopCollection associated with this linear gradient brush. + /// + /// Type: ID2D1GradientStopCollection** + /// + /// The ID2D1GradientStopCollection object associated with this linear gradient brush object. This parameter is passed uninitialized. + /// + /// + /// None + /// + /// ID2D1GradientStopCollection contains an array of D2D1_GRADIENT_STOP structures and information, such as the extend mode and + /// the color interpolation mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1lineargradientbrush-getgradientstopcollection void + // GetGradientStopCollection( ID2D1GradientStopCollection **gradientStopCollection ); + [PreserveSig] + void GetGradientStopCollection(out ID2D1GradientStopCollection gradientStopCollection); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct2D/D2d1.Interfaces4.cs b/PInvoke/Graphics/Direct2D/D2d1.Interfaces4.cs new file mode 100644 index 00000000..dbae8ea7 --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1.Interfaces4.cs @@ -0,0 +1,3376 @@ +using System; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using static Vanara.PInvoke.Dwrite; +using static Vanara.PInvoke.WindowsCodecs; + +namespace Vanara.PInvoke +{ + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// Represents a set of vertices that form a list of triangles. + /// + /// Creating ID2D1Mesh Objects + /// + /// To create a mesh, call the ID2D1RenderTarget::CreateMesh method on the render target with which the mesh will be used. A mesh + /// can only be used with the render target that created it and the render target's compatible targets. + /// + /// + /// A mesh is a device-dependent resource: your application should create meshes after it initializes the render target with which + /// the meshes will be used, and recreate the meshes whenever the render target needs recreated. (For more information about + /// resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1mesh + [PInvokeData("d2d1.h", MSDNShortId = "2a58fb5f-2281-4f73-a689-cc1350d13c8b")] + [ComImport, Guid("2cd906c2-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Mesh : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Opens the mesh for population. + /// + /// Type: ID2D1TessellationSink** + /// + /// When this method returns, contains a pointer to a pointer to an ID2D1TessellationSink that is used to populate the mesh. + /// This parameter is passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1mesh-open HRESULT Open( ID2D1TessellationSink + // **tessellationSink ); + ID2D1TessellationSink Open(); + } + + /// Represents a complex shape that may be composed of arcs, curves, and lines. + /// + /// + /// An ID2D1PathGeometry object enables you to describe a geometric path. To describe an ID2D1PathGeometry object's + /// path, use the object's Open method to retrieve an ID2D1GeometrySink. Use the sink to populate the path geometry with figures and segments. + /// + /// Creating ID2D1PathGeometry Objects + /// To create a path geometry, use the ID2D1Factory::CreatePathGeometry method. + /// + /// ID2D1PathGeometry objects are device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1pathgeometry + [PInvokeData("d2d1.h", MSDNShortId = "d200563c-d78e-4fa0-a8f2-242b24480e99")] + [ComImport, Guid("2cd906a5-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1PathGeometry : ID2D1Geometry + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Retrieves the geometry sink that is used to populate the path geometry with figures and segments. + /// + /// Type: ID2D1GeometrySink** + /// + /// When this method returns, geometrySink contains the address of a pointer to the geometry sink that is used to populate the + /// path geometry with figures and segments. This parameter is passed uninitialized. + /// + /// + /// + /// + /// Because path geometries are immutable and can only be populated once, it is an error to call Open on a path geometry + /// more than once. + /// + /// + /// Note that the fill mode defaults to D2D1_FILL_MODE_ALTERNATE. To set the fill mode, call SetFillMode before the first call + /// to BeginFigure. Failure to do so will put the geometry sink in an error state. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1pathgeometry-open HRESULT Open( ID2D1GeometrySink + // **geometrySink ); + ID2D1GeometrySink Open(); + + /// Copies the contents of the path geometry to the specified ID2D1GeometrySink. + /// + /// Type: ID2D1GeometrySink* + /// + /// The sink to which the path geometry's contents are copied. Modifying this sink does not change the contents of this path geometry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1pathgeometry-stream HRESULT Stream( ID2D1GeometrySink + // *geometrySink ); + void Stream([In] ID2D1GeometrySink geometrySink); + + /// Retrieves the number of segments in the path geometry. + /// + /// Type: UINT32* + /// + /// A pointer that receives the number of segments in the path geometry when this method returns. You must allocate storage for + /// this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1pathgeometry-getsegmentcount HRESULT GetSegmentCount( + // UINT32 *count ); + uint GetSegmentCount(); + + /// Retrieves the number of figures in the path geometry. + /// + /// Type: UINT32* + /// + /// A pointer that receives the number of figures in the path geometry when this method returns. You must allocate storage for + /// this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1pathgeometry-getfigurecount HRESULT GetFigureCount( + // UINT32 *count ); + uint GetFigureCount(); + } + + /// + /// Converts Direct2D primitives stored in an ID2D1CommandList into a fixed page representation. The print sub-system then consumes + /// the primitives. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1printcontrol + [ComImport, Guid("2c1d867d-c290-41c8-ae7e-34a98702e9a5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1PrintControl + { + /// + /// Converts Direct2D primitives in the passed-in command list into a fixed page representation for use by the print subsystem. + /// + /// + /// Type: ID2D1CommandList* + /// The command list that contains the rendering operations. + /// + /// + /// Type: D2D_SIZE_F + /// The size of the page to add. + /// + /// + /// Type: IStream* + /// The print ticket stream. + /// + /// + /// Type: ulong* + /// + /// Contains the first label for subsequent drawing operations. This parameter is passed uninitialized. If NULL is specified, no + /// value is retrieved for this parameter. + /// + /// + /// + /// Type: ulong* + /// + /// Contains the second label for subsequent drawing operations. This parameter is passed uninitialized. If NULL is specified, + /// no value is retrieved for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1printcontrol-addpage HRESULT AddPage( + // ID2D1CommandList *commandList, D2D_SIZE_F pageSize, IStream *pagePrintTicketStream, ulong *tag1, ulong *tag2 ); + void AddPage(ID2D1CommandList commandList, D2D_SIZE_F pageSize, [Optional] IStream pagePrintTicketStream, out ulong tag1, out ulong tag2); + + /// Passes all remaining resources to the print sub-system, then clean up and close the current print job. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1printcontrol-close HRESULT Close(); + void Close(); + } + + /// Paints an area with a radial gradient. + /// + /// + /// The ID2D1RadialGradientBrush is similar to the ID2D1LinearGradientBrush in that they both map a collection of gradient + /// stops to a gradient. However, the linear gradient has a start and an end point to define the gradient vector, while the radial + /// gradient uses an ellipse and a gradient origin to define its gradient behavior. To define the position and size of the ellipse, + /// use the SetCenter, SetRadiusX, and SetRadiusY methods to specify the center, x-radius, and y-radius of the ellipse. The gradient + /// origin is the center of the ellipse, unless a gradient offset is specified by using the SetGradientOriginOffset method. + /// + /// + /// The brush maps the gradient stop position 0.0f of the gradient origin, and the position 1.0f is mapped to the ellipse boundary. + /// When the gradient origin is within the ellipse, the contents of the ellipse enclose the entire [0, 1] range of the brush + /// gradient stops. If the gradient origin is outside the bounds of the ellipse, the brush still works, but its gradient is not well-defined. + /// + /// + /// The start point and end point are described in the brush space and are mappped to the render target when the brush is used. Note + /// the starting and ending coordinates are absolute, not relative to the render target size. A value of (0, 0) maps to the + /// upper-left corner of the render target, while a value of (1, 1) maps just one pixel diagonally away from (0, 0). If there is a + /// nonidentity brush transform or render target transform, the brush ellipse and gradient origin are also transformed. + /// + /// + /// It is possible to specify an ellipse that does not completely fill area being painted. When this occurs, the D2D1_EXTEND_MODE + /// and setting (specified by the brush ID2D1GradientStopCollection) determines how the remaining area is painted. + /// + /// Creating ID2D1RadialGradientBrush Objects + /// + /// To create a radial gradient brush, use the ID2D1RenderTarget::CreateRadialGradientBrush method of the render target on which the + /// brush will be used. The brush may be used only with the render target that created it or with the compatible targets for that + /// render target. + /// + /// + /// A radial gradient brush is a device-dependent resource: your application should create radial gradient brushes after it + /// initializes the render target with which the brushes will be used, and recreate the brushes whenever the render target needs + /// recreated. (For more information about resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1radialgradientbrush + [PInvokeData("d2d1.h", MSDNShortId = "21ed2286-e4df-4b77-ba31-e5d5927e16f5")] + [ComImport, Guid("2cd906ac-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1RadialGradientBrush : ID2D1Brush + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + new void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + new float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// Specifies the center of the gradient ellipse in the brush's coordinate space. + /// + /// Type: D2D1_POINT_2F + /// The center of the gradient ellipse, in the brush's coordinate space. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-setcenter void SetCenter( + // D2D1_POINT_2F center ); + [PreserveSig] + void SetCenter(D2D_POINT_2F center); + + /// Specifies the offset of the gradient origin relative to the gradient ellipse's center. + /// + /// Type: D2D1_POINT_2F + /// The offset of the gradient origin from the center of the gradient ellipse. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-setgradientoriginoffset void + // SetGradientOriginOffset( D2D1_POINT_2F gradientOriginOffset ); + [PreserveSig] + void SetGradientOriginOffset(D2D_POINT_2F gradientOriginOffset); + + /// Specifies the x-radius of the gradient ellipse, in the brush's coordinate space. + /// + /// Type: FLOAT + /// The x-radius of the gradient ellipse. This value is in the brush's coordinate space. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-setradiusx void SetRadiusX( FLOAT + // radiusX ); + [PreserveSig] + void SetRadiusX(float radiusX); + + /// Specifies the y-radius of the gradient ellipse, in the brush's coordinate space. + /// + /// Type: FLOAT + /// The y-radius of the gradient ellipse. This value is in the brush's coordinate space. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-setradiusy void SetRadiusY( FLOAT + // radiusY ); + [PreserveSig] + void SetRadiusY(float radiusY); + + /// Retrieves the center of the gradient ellipse. + /// + /// Type: D2D1_POINT_2F + /// The center of the gradient ellipse. This value is expressed in the brush's coordinate space. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-getcenter D2D1_POINT_2F GetCenter(); + [PreserveSig] + D2D_POINT_2F GetCenter(); + + /// Retrieves the offset of the gradient origin relative to the gradient ellipse's center. + /// + /// Type: D2D1_POINT_2F + /// + /// The offset of the gradient origin from the center of the gradient ellipse. This value is expressed in the brush's coordinate space. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-getgradientoriginoffset + // D2D1_POINT_2F GetGradientOriginOffset(); + [PreserveSig] + D2D_POINT_2F GetGradientOriginOffset(); + + /// Retrieves the x-radius of the gradient ellipse. + /// + /// Type: FLOAT + /// The x-radius of the gradient ellipse. This value is expressed in the brush's coordinate space. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-getradiusx FLOAT GetRadiusX(); + [PreserveSig] + float GetRadiusX(); + + /// Retrieves the y-radius of the gradient ellipse. + /// + /// Type: FLOAT + /// The y-radius of the gradient ellipse. This value is expressed in the brush's coordinate space. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-getradiusy FLOAT GetRadiusY(); + [PreserveSig] + float GetRadiusY(); + + /// Retrieves the ID2D1GradientStopCollection associated with this radial gradient brush object. + /// + /// Type: ID2D1GradientStopCollection** + /// + /// The ID2D1GradientStopCollection object associated with this linear gradient brush object. This parameter is passed uninitialized. + /// + /// + /// None + /// + /// ID2D1GradientStopCollection contains an array of D2D1_GRADIENT_STOP structures and additional information, such as the + /// extend mode and the color interpolation mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1radialgradientbrush-getgradientstopcollection void + // GetGradientStopCollection( ID2D1GradientStopCollection **gradientStopCollection ); + [PreserveSig] + void GetGradientStopCollection(out ID2D1GradientStopCollection gradientStopCollection); + } + + /// Describes a two-dimensional rectangle. + /// + /// Creating ID2D1RectangleGeometry Objects + /// To create a rectangle geometry, use the ID2D1Factory::CreateRectangleGeometry method. + /// + /// Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1rectanglegeometry + [PInvokeData("d2d1.h", MSDNShortId = "bb5f65ba-34d4-418b-863c-2431046bce8e")] + [ComImport, Guid("2cd906a2-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1RectangleGeometry : ID2D1Geometry + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Retrieves the rectangle that describes the rectangle geometry's dimensions. + /// + /// Type: D2D1_RECT_F* + /// + /// Contains a pointer to a rectangle that describes the rectangle geometry's dimensions when this method returns. You must + /// allocate storage for this parameter. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rectanglegeometry-getrect void GetRect( D2D1_RECT_F + // *rect ); + [PreserveSig] + void GetRect(out D2D_RECT_F rect); + } + + /// + /// Represents an object that can receive drawing commands. Interfaces that inherit from ID2D1RenderTarget render the drawing + /// commands they receive in different ways. + /// + /// + /// Your application should create render targets once and hold onto them for the life of the application or until the render + /// target's EndDraw method returns the D2DERR_RECREATE_TARGET error. When you receive this error, you need to recreate the render + /// target (and any resources it created). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1rendertarget + [PInvokeData("d2d1.h", MSDNShortId = "40629be9-5840-4bde-b369-56bbfd791775")] + [ComImport, Guid("2cd90694-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1RenderTarget : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Creates a Direct2D bitmap from a pointer to in-memory source data. + /// + /// Type: [in] D2D1_SIZE_U + /// The dimensions of the bitmap to create in pixels. + /// + /// + /// Type: [in, optional] const void* + /// A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap. + /// + /// + /// Type: [in] UINT32 + /// + /// The byte count of each scanline, which is equal to (the image width in pixels × the number of bytes per pixel) + memory + /// padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.) + /// + /// + /// + /// Type: [in] const D2D1_BITMAP_PROPERTIES & + /// The pixel format and dots per inch (DPI) of the bitmap to create. + /// + /// + /// Type: [out] ID2D1Bitmap** + /// When this method returns, contains a pointer to a pointer to the new bitmap. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmap(d2d1_size_u_constvoid_uint32_constd2d1_bitmap_properties__id2d1bitmap) + // HRESULT CreateBitmap( D2D1_SIZE_U size, const void *srcData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES & + // bitmapProperties, ID2D1Bitmap **bitmap ); + ID2D1Bitmap CreateBitmap(D2D_SIZE_U size, [In, Optional] IntPtr srcData, uint pitch, in D2D1_BITMAP_PROPERTIES bitmapProperties); + + /// Creates an ID2D1Bitmap by copying the specified Microsoft Windows Imaging Component (WIC) bitmap. + /// + /// Type: [in] IWICBitmapSource* + /// The WIC bitmap to copy. + /// + /// + /// Type: [in, optional] const D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create. The pixel format must match the pixel format of wicBitmapSource, or the + /// method will fail. To prevent a mismatch, you can pass NULL or pass the value obtained from calling the + /// D2D1::PixelFormat helper function without specifying any parameter values. If both dpiX and dpiY are 0.0f, the default DPI, + /// 96, is used. DPI information embedded in wicBitmapSource is ignored. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// Before Direct2D can load a WIC bitmap, that bitmap must be converted to a supported pixel format and alpha mode. For a list + /// of supported pixel formats and alpha modes, see Supported Pixel Formats and Alpha Modes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) + // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, + // ID2D1Bitmap **bitmap ); + ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1Bitmap whose data is shared with another resource. + /// + /// Type: REFIID + /// The interface ID of the object supplying the source data. + /// + /// + /// Type: void* + /// + /// An ID2D1Bitmap, IDXGISurface, or an IWICBitmapLock that contains the data to share with the new ID2D1Bitmap. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: D2D1_BITMAP_PROPERTIES* + /// + /// The pixel format and DPI of the bitmap to create . The DXGI_FORMAT portion of the pixel format must match the DXGI_FORMAT of + /// data or the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or + /// the value obtained from the D2D1::PixelFormat helper function. The DPI settings do not have to match those of data. If both + /// dpiX and dpiY are 0.0f, the DPI of the render target is used. + /// + /// + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// + /// The CreateSharedBitmap method is useful for efficiently reusing bitmap data and can also be used to provide + /// interoperability with Direct3D. + /// + /// Sharing an ID2D1Bitmap + /// + /// By passing an ID2D1Bitmap created by a render target that is resource-compatible, you can share a bitmap with that render + /// target; both the original ID2D1Bitmap and the new ID2D1Bitmap created by this method will point to the same + /// bitmap data. For more information about when render target resources can be shared, see the Sharing Render Target Resources + /// section of the Resources Overview. + /// + /// + /// You may also use this method to reinterpret the data of an existing bitmap and specify a new DPI or alpha mode. For example, + /// in the case of a bitmap atlas, an ID2D1Bitmap may contain multiple sub-images, each of which should be rendered with a + /// different D2D1_ALPHA_MODE ( D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE). You could use the + /// CreateSharedBitmap method to reinterpret the bitmap using the desired alpha mode without having to load a separate + /// copy of the bitmap into memory. + /// + /// Sharing an IDXGISurface + /// + /// When using a DXGI surface render target (an ID2D1RenderTarget object created by the CreateDxgiSurfaceRenderTarget method), + /// you can pass an IDXGISurface surface to the CreateSharedBitmap method to share video memory with Direct3D and + /// manipulate Direct3D content as an ID2D1Bitmap. As described in the Resources Overview, the render target and the + /// IDXGISurface must be using the same Direct3D device. + /// + /// + /// Note also that the IDXGISurface must use one of the supported pixel formats and alpha modes described in Supported Pixel + /// Formats and Alpha Modes. + /// + /// For more information about interoperability with Direct3D, see the Direct2D and Direct3D Interoperability Overview. + /// Sharing an IWICBitmapLock + /// + /// An IWICBitmapLock stores the content of a WIC bitmap and shields it from simultaneous accesses. By passing an + /// IWICBitmapLock to the CreateSharedBitmap method, you can create an ID2D1Bitmap that points to the bitmap data + /// already stored in the IWICBitmapLock. + /// + /// + /// To use an IWICBitmapLock with the CreateSharedBitmap method, the render target must use software rendering. To force + /// a render target to use software rendering, set to D2D1_RENDER_TARGET_TYPE_SOFTWARE the type field of the + /// D2D1_RENDER_TARGET_PROPERTIES structure that you use to create the render target. To check whether an existing render target + /// uses software rendering, use the IsSupported method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT + // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); + ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + + /// Creates an ID2D1BitmapBrush from the specified bitmap. + /// + /// Type: ID2D1Bitmap* + /// The bitmap contents of the new brush. + /// + /// + /// Type: D2D1_BITMAP_BRUSH_PROPERTIES* + /// + /// The extend modes and interpolation mode of the new brush, or NULL. If you set this parameter to NULL, the + /// brush defaults to the D2D1_EXTEND_MODE_CLAMP horizontal and vertical extend modes and the + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR interpolation mode. + /// + /// + /// + /// Type: D2D1_BRUSH_PROPERTIES* + /// + /// A structure that contains the opacity and transform of the new brush, or NULL. If you set this parameter to + /// NULL, the brush sets the opacity member to 1.0F and the transform member to the identity matrix. + /// + /// + /// + /// Type: ID2D1BitmapBrush** + /// + /// When this method returns, this output parameter contains a pointer to a pointer to the new brush. Pass this parameter uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) + // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); + ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + + /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The red, green, blue, and alpha values of the brush's color. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES & + /// The base opacity of the brush. + /// + /// + /// Type: [out] ID2D1SolidColorBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) + // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, + // ID2D1SolidColorBrush **solidColorBrush ); + ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + + /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. + /// + /// Type: [in] D2D1_GRADIENT_STOP* + /// A pointer to an array of D2D1_GRADIENT_STOP structures. + /// + /// + /// Type: [in] UINT + /// A value greater than or equal to 1 that specifies the number of gradient stops in the gradientStops array. + /// + /// + /// Type: [in] D2D1_GAMMA + /// The space in which color interpolation between the gradient stops is performed. + /// + /// + /// Type: [in] D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized range. + /// + /// + /// Type: [out] ID2D1GradientStopCollection** + /// When this method returns, contains a pointer to a pointer to the new gradient stop collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 + // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA + // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); + ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + + /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. + /// + /// Type: [in] const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES* + /// The start and end points of the gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the + /// gradient line. + /// + /// + /// + /// Type: [out] ID2D1LinearGradientBrush** + /// When this method returns, contains the address of a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlineargradientbrush%28constd2d1_linear_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1lineargradientbrush%29 + // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush + // **linearGradientBrush ); + ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. + /// + /// Type: const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES* + /// The center, gradient origin offset, and x-radius and y-radius of the brush's gradient. + /// + /// + /// Type: [in] const D2D1_BRUSH_PROPERTIES* + /// The transform and base opacity of the new brush. + /// + /// + /// Type: [in] ID2D1GradientStopCollection* + /// + /// A collection of D2D1_GRADIENT_STOP structures that describe the colors in the brush's gradient and their locations along the gradient. + /// + /// + /// + /// Type: [out] ID2D1RadialGradientBrush** + /// When this method returns, contains a pointer to a pointer to the new brush. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createradialgradientbrush%28constd2d1_radial_gradient_brush_properties_constd2d1_brush_properties_id2d1gradientstopcollection_id2d1radialgradientbrush%29 + // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const + // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush + // **radialGradientBrush ); + ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + + /// + /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. + /// + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// The desired size of the new render target (in device-independent pixels), if it should be different from the original render + /// target. For more info, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_SIZE_U* + /// + /// The desired size of the new render target in pixels if it should be different from the original render target. For more + /// information, see the Remarks section. + /// + /// + /// + /// Type: [in] const D2D1_PIXEL_FORMAT* + /// + /// The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new + /// render target uses the same pixel format as the original render target. If the alpha mode is D2D1_ALPHA_MODE_UNKNOWN, the + /// alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel + /// formats, see Supported Pixel Formats and Alpha Modes. + /// + /// + /// + /// Type: [in] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS + /// A value that specifies whether the new render target must be compatible with GDI. + /// + /// + /// Type: [out] ID2D1BitmapRenderTarget** + /// + /// When this method returns, contains a pointer to a pointer to a new bitmap render target. This parameter is passed uninitialized. + /// + /// + /// + /// The pixel size and DPI of the new render target can be altered by specifying values for desiredSize or desiredPixelSize: + /// + /// + /// + /// If desiredSize is specified but desiredPixelSize is not, the pixel size is computed from the desired size using the parent + /// target DPI. If the desiredSize maps to a integer-pixel size, the DPI of the compatible render target is the same as the DPI + /// of the parent target. If desiredSize maps to a fractional-pixel size, the pixel size is rounded up to the nearest integer + /// and the DPI for the compatible render target is slightly higher than the DPI of the parent render target. In all cases, the + /// coordinate (desiredSize.width, desiredSize.height) maps to the lower-right corner of the compatible render target. + /// + /// + /// + /// + /// If the desiredPixelSize is specified and desiredSize is not, the DPI of the new render target is the same as the original + /// render target. + /// + /// + /// + /// + /// If both desiredSize and desiredPixelSize are specified, the DPI of the new render target is computed to account for the + /// difference in scale. + /// + /// + /// + /// + /// If neither desiredSize nor desiredPixelSize is specified, the new render target size and DPI match the original render target. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) + // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const + // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); + ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + + /// Creates a layer resource that can be used with this render target and its compatible render targets. + /// + /// Type: [in] const D2D1_SIZE_F* + /// + /// If (0, 0) is specified, no backing store is created behind the layer resource. The layer resource is allocated to the + /// minimum size when PushLayer is called. + /// + /// + /// + /// Type: [out] ID2D1Layer** + /// When the method returns, contains a pointer to a pointer to the new layer. This parameter is passed uninitialized. + /// + /// The layer automatically resizes itself, as needed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) + // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); + ID2D1Layer CreateLayer([In, Optional] IntPtr size); + + /// Create a mesh that uses triangles to describe a shape. + /// + /// Type: ID2D1Mesh** + /// When this method returns, contains a pointer to a pointer to the new mesh. + /// + /// + /// To populate a mesh, use its Open method to obtain an ID2D1TessellationSink. To draw the mesh, use the render target's + /// FillMesh method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createmesh HRESULT CreateMesh( ID2D1Mesh + // **mesh ); + ID2D1Mesh CreateMesh(); + + /// Draws a line between the specified points using the specified stroke style. + /// + /// Type: D2D1_POINT_2F + /// The start point of the line, in device-independent pixels. + /// + /// + /// Type: D2D1_POINT_2F + /// The end point of the line, in device-independent pixels. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the line's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid line. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline void DrawLine( D2D1_POINT_2F + // point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + void DrawLine(D2D_POINT_2F point0, D2D_POINT_2F point1, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Draws the outline of a rectangle that has the specified dimensions and stroke style. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimensions of the rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's stroke. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to paint, or NULL to paint a solid stroke. + /// + /// None + /// + /// When this method fails, it does not return an error code. To determine whether a drawing method (such as DrawRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawrectangle(constd2d1_rect_f__id2d1brush_float_id2d1strokestyle) + // void DrawRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + void DrawRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rectangle. + /// + /// Type: [in] const D2D1_RECT_F & + /// The dimension of the rectangle to paint, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rectangle's interior. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillRectangle) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillrectangle(constd2d1_rect_f__id2d1brush) + // void FillRectangle( const D2D1_RECT_F & rect, ID2D1Brush *brush ); + [PreserveSig] + void FillRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified rounded rectangle using the specified stroke style. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the rounded rectangle's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawroundedrectangle(constd2d1_rounded_rect__id2d1brush_float_id2d1strokestyle) + // void DrawRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle + // *strokeStyle ); + [PreserveSig] + void DrawRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified rounded rectangle. + /// + /// Type: [in] const D2D1_ROUNDED_RECT & + /// The dimensions of the rounded rectangle to paint, in device independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the rounded rectangle. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// FillRoundedRectangle) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillroundedrectangle(constd2d1_rounded_rect__id2d1brush) + // void FillRoundedRectangle( const D2D1_ROUNDED_RECT & roundedRect, ID2D1Brush *brush ); + [PreserveSig] + void FillRoundedRectangle(in D2D1_ROUNDED_RECT roundedRect, [In] ID2D1Brush brush); + + /// Draws the outline of the specified ellipse using the specified stroke style. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius of the ellipse to draw, in device-independent pixels. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the ellipse's outline. + /// + /// + /// Type: [in] FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the ellipse's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// The DrawEllipse method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawEllipse) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawellipse(constd2d1_ellipse__id2d1brush_float_id2d1strokestyle) + // void DrawEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + void DrawEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified ellipse. + /// + /// Type: [in] const D2D1_ELLIPSE & + /// The position and radius, in device-independent pixels, of the ellipse to paint. + /// + /// + /// Type: [in] ID2D1Brush* + /// The brush used to paint the interior of the ellipse. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillEllipse) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillellipse(constd2d1_ellipse__id2d1brush) + // void FillEllipse( const D2D1_ELLIPSE & ellipse, ID2D1Brush *brush ); + [PreserveSig] + void FillEllipse(in D2D1_ELLIPSE ellipse, [In] ID2D1Brush brush); + + /// Draws the outline of the specified geometry using the specified stroke style. + /// + /// Type: ID2D1Geometry* + /// The geometry to draw. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's stroke. + /// + /// + /// Type: FLOAT + /// + /// The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter + /// isn't specified, it defaults to 1.0f. The stroke is centered on the line. + /// + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry's outline, or NULL to paint a solid stroke. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawgeometry void DrawGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + void DrawGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, float strokeWidth = 1.0f, [In] ID2D1StrokeStyle strokeStyle = null); + + /// Paints the interior of the specified geometry. + /// + /// Type: ID2D1Geometry* + /// The geometry to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the geometry's interior. + /// + /// + /// Type: ID2D1Brush* + /// + /// The opacity mask to apply to the geometry, or NULL for no opacity mask. If an opacity mask (the opacityBrush + /// parameter) is specified, brush must be an ID2D1BitmapBrush that has its x- and y-extend modes set to D2D1_EXTEND_MODE_CLAMP. + /// For more information, see the Remarks section. + /// + /// + /// None + /// + /// + /// If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to + /// determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush + /// is used for this processing; all other color information is ignored. + /// + /// + /// The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted + /// by brush. + /// + /// + /// When this method fails, it does not return an error code. To determine whether a drawing operation (such as + /// FillGeometry) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillgeometry void FillGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush ); + [PreserveSig] + void FillGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, [In] ID2D1Brush opacityBrush = null); + + /// Paints the interior of the specified mesh. + /// + /// Type: ID2D1Mesh* + /// The mesh to paint. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the mesh. + /// + /// None + /// + /// + /// The current antialias mode of the render target must be D2D1_ANTIALIAS_MODE_ALIASED when FillMesh is called. To + /// change the render target's antialias mode, use the SetAntialiasMode method. + /// + /// + /// FillMesh does not expect a particular winding order for the triangles in the ID2D1Mesh; both clockwise and + /// counter-clockwise will work. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillMesh) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillmesh void FillMesh( ID2D1Mesh *mesh, + // ID2D1Brush *brush ); + [PreserveSig] + void FillMesh([In] ID2D1Mesh mesh, [In] ID2D1Brush brush); + + /// + /// Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target. + /// + /// + /// Type: ID2D1Bitmap* + /// + /// The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is + /// multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle. + /// + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the region of the render target specified by destinationRectangle. + /// + /// + /// Type: D2D1_OPACITY_MASK_CONTENT + /// + /// The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended. + /// + /// + /// Note Starting with Windows 8, the D2D1_OPACITY_MASK_CONTENT is not required. See the + /// ID2D1DeviceContext::FillOpacityMask method, which has no D2D1_OPACITY_MASK_CONTENT parameter. + /// + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the render target to paint, in device-independent pixels. + /// + /// + /// Type: const D2D1_RECT_F + /// The region of the bitmap to use as the opacity mask, in device-independent pixels. + /// + /// None + /// + /// + /// For this method to work properly, the render target must be using the D2D1_ANTIALIAS_MODE_ALIASED antialiasing mode. You can + /// set the antialiasing mode by calling the ID2D1RenderTarget::SetAntialiasMode method. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillOpacityMask) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_) + // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & + // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + + /// Draws the specified bitmap after scaling it to the size of the specified rectangle. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to render. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap + /// is drawn. If the rectangle is not well-ordered, nothing is drawn, but the render target does not enter an error state. + /// + /// + /// + /// Type: FLOAT + /// + /// A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied + /// against the alpha values of the bitmap's contents. + /// + /// + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. + /// + /// + /// Type: const D2D1_RECT_F + /// + /// The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to draw. + /// + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawBitmap) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawbitmap(id2d1bitmap_constd2d1_rect_f__float_d2d1_bitmap_interpolation_mode_constd2d1_rect_f_) + // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, + // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); + [PreserveSig] + void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + + /// Draws the specified text using the format information provided by an IDWriteTextFormat object. + /// + /// Type: WCHAR* + /// A pointer to an array of Unicode characters to draw. + /// + /// + /// Type: UINT + /// The number of characters in string. + /// + /// + /// Type: IDWriteTextFormat* + /// An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction. + /// + /// + /// Type: const D2D1_RECT_F + /// The size and position of the area in which the text is drawn. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the text. + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// To create an IDWriteTextFormat object, create an IDWriteFactory and call its CreateTextFormat method. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawText) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtext(constwchar_uint32_idwritetextformat_constd2d1_rect_f__id2d1brush_d2d1_draw_text_options_dwrite_measuring_mode) + // void DrawText( const WCHAR *string, UINT32 stringLength, IDWriteTextFormat *textFormat, const D2D1_RECT_F & layoutRect, + // ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + void DrawText([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, in D2D_RECT_F layoutRect, + [In] ID2D1Brush defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// Draws the formatted text described by the specified IDWriteTextLayout object. + /// + /// Type: D2D1_POINT_2F + /// + /// The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn. + /// + /// + /// + /// Type: IDWriteTextLayout* + /// + /// The formatted text to draw. Any drawing effects that do not inherit from ID2D1Resource are ignored. If there are drawing + /// effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an + /// error state. + /// + /// + /// + /// Type: ID2D1Brush* + /// + /// The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect + /// (specified by the IDWriteTextLayout::SetDrawingEffect method). + /// + /// + /// + /// Type: D2D1_DRAW_TEXT_OPTIONS + /// + /// A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the + /// layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel + /// boundaries and it should not be clipped to the layout rectangle. + /// + /// + /// None + /// + /// + /// When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the DrawText + /// method because the text doesn't need to be formatted and the layout processed with each call. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// DrawTextLayout) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawtextlayout void DrawTextLayout( + // D2D1_POINT_2F origin, IDWriteTextLayout *textLayout, ID2D1Brush *defaultFillBrush, D2D1_DRAW_TEXT_OPTIONS options ); + [PreserveSig] + void DrawTextLayout(D2D_POINT_2F origin, [In] IDWriteTextLayout textLayout, [In] ID2D1Brush defaultFillBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE); + + /// Draws the specified glyphs. + /// + /// Type: D2D1_POINT_2F + /// The origin, in device-independent pixels, of the glyphs' baseline. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to paint the specified glyphs. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL. + /// + /// None + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGlyphRun) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawglyphrun void DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE + // measuringMode ); + [PreserveSig] + void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In] ID2D1Brush foregroundBrush, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL); + + /// + /// Applies the specified transform to the render target, replacing the existing transformation. All subsequent drawing + /// operations occur in the transformed space. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the current transform of the render target. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this returns, contains the current transform of the render target. This parameter is passed uninitialized. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettransform void GetTransform( + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// + /// Sets the antialiasing mode of the render target. The antialiasing mode applies to all subsequent drawing operations, + /// excluding text and glyph drawing operations. + /// + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode for future drawing operations. + /// + /// None + /// To specify the antialiasing mode for text and glyph operations, use the SetTextAntialiasMode method. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setantialiasmode void SetAntialiasMode( + // D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + void SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); + + /// Retrieves the current antialiasing mode for nontext drawing operations. + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The current antialiasing mode for nontext drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getantialiasmode D2D1_ANTIALIAS_MODE GetAntialiasMode(); + [PreserveSig] + D2D1_ANTIALIAS_MODE GetAntialiasMode(); + + /// Specifies the antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode to use for subsequent text and glyph drawing operations. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextantialiasmode void + // SetTextAntialiasMode( D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode ); + [PreserveSig] + void SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); + + /// Gets the current antialiasing mode for text and glyph drawing operations. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The current antialiasing mode for text and glyph drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextantialiasmode + // D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + [PreserveSig] + D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); + + /// Specifies text rendering options to be applied to all subsequent text and glyph drawing operations. + /// + /// Type: IDWriteRenderingParams* + /// + /// The text rendering options to be applied to all subsequent text and glyph drawing operations; NULL to clear current + /// text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settextrenderingparams void + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + void SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Retrieves the render target's current text rendering options. + /// + /// Type: IDWriteRenderingParams** + /// + /// When this method returns, textRenderingParamscontains the address of a pointer to the render target's current text rendering options. + /// + /// + /// None + /// + /// If the settings specified by textRenderingParams are incompatible with the render target's text antialiasing mode (specified + /// by SetTextAntialiasMode), subsequent text and glyph drawing operations will fail and put the render target into an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettextrenderingparams void + // GetTextRenderingParams( IDWriteRenderingParams **textRenderingParams ); + [PreserveSig] + void GetTextRenderingParams(out IDWriteRenderingParams textRenderingParams); + + /// Specifies a label for subsequent drawing operations. + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// + /// Type: ulong + /// A label to apply to subsequent drawing operations. + /// + /// None + /// + /// The labels specified by this method are printed by debug error messages. If no tag is set, the default value for each tag is 0. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-settags void SetTags( ulong tag1, ulong + // tag2 ); + [PreserveSig] + void SetTags(ulong tag1, ulong tag2); + + /// Gets the label for subsequent drawing operations. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the first label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the second label for subsequent drawing operations. This parameter is passed + /// uninitialized. If NULL is specified, no value is retrieved for this parameter. + /// + /// + /// None + /// If the same address is passed for both parameters, both parameters receive the value of the second tag. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-gettags void GetTags( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + [PreserveSig] + void GetTags(out ulong tag1, out ulong tag2); + + /// + /// Adds the specified layer to the render target so that it receives all subsequent drawing operations until PopLayer is called. + /// + /// + /// Type: const D2D1_LAYER_PARAMETERS + /// The content bounds, geometric mask, opacity, opacity mask, and antialiasing options for the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer that receives subsequent drawing operations. + /// + /// Note Starting with Windows 8, this parameter is optional. If a layer is not specified, Direct2D manages the layer + /// resource automatically. + /// + /// + /// None + /// + /// + /// The PushLayer method allows a caller to begin redirecting rendering to a layer. All rendering operations are valid in + /// a layer. The location of the layer is affected by the world transform set on the render target. + /// + /// + /// Each PushLayer must have a matching PopLayer call. If there are more PopLayer calls than PushLayer calls, the + /// render target is placed into an error state. If Flush is called before all outstanding layers are popped, the render target + /// is placed into an error state, and an error is returned. The error state can be cleared by a call to EndDraw. + /// + /// + /// A particular ID2D1Layer resource can be active only at one time. In other words, you cannot call a PushLayer method, + /// and then immediately follow with another PushLayer method with the same layer resource. Instead, you must call the + /// second PushLayer method with different layer resources. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushLayer) failed, + /// check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushlayer(constd2d1_layer_parameters__id2d1layer) + // void PushLayer( const D2D1_LAYER_PARAMETERS & layerParameters, ID2D1Layer *layer ); + [PreserveSig] + void PushLayer(in D2D1_LAYER_PARAMETERS layerParameters, [In, Optional] ID2D1Layer layer); + + /// Stops redirecting drawing operations to the layer that is specified by the last PushLayer call. + /// None + /// + /// A PopLayer must match a previous PushLayer call. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PopLayer) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-poplayer void PopLayer(); + [PreserveSig] + void PopLayer(); + + /// Executes all pending drawing commands. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. If no error occurred, this method sets the error tag state to be (0,0). + /// + /// + /// + /// This command does not flush the Direct3D device context that is associated with the render target. + /// Calling this method resets the error state of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-flush HRESULT Flush( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + void Flush(out ulong tag1, out ulong tag2); + + /// Saves the current drawing state to the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// + /// When this method returns, contains the current drawing state of the render target. This parameter must be initialized before + /// passing it to the method. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-savedrawingstate void SaveDrawingState( + // ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + void SaveDrawingState([In, Out] ID2D1DrawingStateBlock drawingStateBlock); + + /// Sets the render target's drawing state to that of the specified ID2D1DrawingStateBlock. + /// + /// Type: ID2D1DrawingStateBlock* + /// The new drawing state of the render target. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-restoredrawingstate void + // RestoreDrawingState( ID2D1DrawingStateBlock *drawingStateBlock ); + [PreserveSig] + void RestoreDrawingState([In] ID2D1DrawingStateBlock drawingStateBlock); + + /// Specifies a rectangle to which all subsequent drawing operations are clipped. + /// + /// Type: [in] const D2D1_RECT_F & + /// The size and position of the clipping area, in device-independent pixels. + /// + /// + /// Type: [in] D2D1_ANTIALIAS_MODE + /// + /// The antialiasing mode that is used to draw the edges of clip rects that have subpixel boundaries, and to blend the clip with + /// the scene contents. The blending is performed once when the PopAxisAlignedClip method is called, and does not apply to each + /// primitive within the layer. + /// + /// + /// None + /// + /// + /// The clipRect is transformed by the current world transform set on the render target. After the transform is applied to the + /// clipRect that is passed in, the axis-aligned bounding box for the clipRect is computed. For efficiency, the contents are + /// clipped to this axis-aligned bounding box and not to the original clipRect that is passed in. + /// + /// + /// The following diagrams show how a rotation transform is applied to the render target, the resulting clipRect, and a + /// calculated axis-aligned bounding box. + /// + /// + /// + /// Assume the rectangle in the following illustration is a render target that is aligned to the screen pixels. + /// + /// + /// + /// Apply a rotation transform to the render target. In the following illustration, the black rectangle represents the original + /// render target and the red dashed rectangle represents the transformed render target. + /// + /// + /// + /// + /// After calling PushAxisAlignedClip, the rotation transform is applied to the clipRect. In the following illustration, + /// the blue rectangle represents the transformed clipRect. + /// + /// + /// + /// + /// The axis-aligned bounding box is calculated. The green dashed rectangle represents the bounding box in the following + /// illustration. All contents are clipped to this axis-aligned bounding box. + /// + /// + /// + /// + /// Note If rendering operations fail or if PopAxisAlignedClip is not called, clip rects may cause some artifacts on the + /// render target. PopAxisAlignedClip can be considered a drawing operation that is designed to fix the borders of a + /// clipping region. Without this call, the borders of a clipped area may be not antialiased or otherwise corrected. + /// + /// + /// The PushAxisAlignedClip and PopAxisAlignedClip must match. Otherwise, the error state is set. For the render target + /// to continue receiving new commands, you can call Flush to clear the error. + /// + /// + /// A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot + /// overlap. For example, the sequence of PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip is valid, + /// but the sequence of PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer is invalid. + /// + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PushAxisAlignedClip) + /// failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushaxisalignedclip(constd2d1_rect_f__d2d1_antialias_mode) + // void PushAxisAlignedClip( const D2D1_RECT_F & clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + void PushAxisAlignedClip(in D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode); + + /// + /// Removes the last axis-aligned clip from the render target. After this method is called, the clip is no longer applied to + /// subsequent drawing operations. + /// + /// None + /// + /// + /// A PushAxisAlignedClip/ PopAxisAlignedClip pair can occur around or within a PushLayer/PopLayer pair, but may not + /// overlap. For example, a PushAxisAlignedClip, PushLayer, PopLayer, PopAxisAlignedClip sequence is + /// valid, but a PushAxisAlignedClip, PushLayer, PopAxisAlignedClip, PopLayer sequence is not. + /// + /// PopAxisAlignedClip must be called once for every call to PushAxisAlignedClip. + /// For an example, see How to Clip with an Axis-Aligned Clip Rectangle. + /// + /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as + /// PopAxisAlignedClip) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-popaxisalignedclip void PopAxisAlignedClip(); + [PreserveSig] + void PopAxisAlignedClip(); + + /// Clears the drawing area to the specified color. + /// + /// Type: [in] const D2D1_COLOR_F & + /// The color to which the drawing area is cleared. + /// + /// None + /// + /// + /// Direct2D interprets the clearColor as straight alpha (not premultiplied). If the render target's alpha mode is + /// D2D1_ALPHA_MODE_IGNORE, the alpha channel of clearColor is ignored and replaced with 1.0f (fully opaque). + /// + /// + /// If the render target has an active clip (specified by PushAxisAlignedClip), the clear command is applied only to the area + /// within the clip region. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const + // D2D1_COLOR_F & clearColor ); + [PreserveSig] + void Clear([In, Optional] IntPtr clearColor); + + /// Initiates drawing on this render target. + /// None + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are used to indicate that a render target is in use by the Direct2D system. Different implementations + /// of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget may be locked + /// between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on + /// EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing + /// of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success + /// of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw + /// method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-begindraw void BeginDraw(); + [PreserveSig] + void BeginDraw(); + + /// Ends drawing operations on the render target and indicates the current error state and associated tags. + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: D2D1_TAG* + /// + /// When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This + /// parameter is passed uninitialized. + /// + /// + /// + /// Type: HRESULT + /// + /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to + /// the tags that were active when the error occurred. + /// + /// + /// + /// Drawing operations can only be issued between a BeginDraw and EndDraw call. + /// + /// BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different + /// implementations of ID2D1RenderTarget might behave differently when BeginDraw is called. An ID2D1BitmapRenderTarget + /// may be locked between BeginDraw/ EndDraw calls, a DXGI surface render target might be acquired on + /// BeginDraw and released on EndDraw, while an ID2D1HwndRenderTarget may begin batching at BeginDraw and + /// may present on EndDraw, for example. + /// + /// + /// The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval + /// operations can be performed even outside of BeginDraw/ EndDraw. + /// + /// + /// After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of + /// these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The + /// EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the + /// success of the operations and, optionally, the tag state of the render target at the time the error occurred. The + /// EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. + /// + /// + /// If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must + /// be called before EndDraw. + /// + /// + /// Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and + /// returns an appropriate HRESULT and error information when EndDraw is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-enddraw HRESULT EndDraw( D2D1_TAG *tag1, + // D2D1_TAG *tag2 ); + void EndDraw(out ulong tag1, out ulong tag2); + + /// Retrieves the pixel format and alpha mode of the render target. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the render target. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Sets the dots per inch (DPI) of the render target. + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the horizontal DPI of the render target. + /// + /// + /// Type: FLOAT + /// A value greater than or equal to zero that specifies the vertical DPI of the render target. + /// + /// None + /// + /// + /// This method specifies the mapping from pixel space to device-independent space for the render target. If both dpiX and dpiY + /// are 0, the factory-read system DPI is chosen. If one parameter is zero and the other unspecified, the DPI is not changed. + /// + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-setdpi void SetDpi( FLOAT dpiX, FLOAT dpiY ); + [PreserveSig] + void SetDpi(float dpiX, float dpiY); + + /// Return the render target's dots per inch (DPI). + /// + /// Type: FLOAT* + /// When this method returns, contains the horizontal DPI of the render target. This parameter is passed uninitialized. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the vertical DPI of the render target. This parameter is passed uninitialized. + /// + /// None + /// + /// This method indicates the mapping from pixel space to device-independent space for the render target. + /// + /// For ID2D1HwndRenderTarget, the DPI defaults to the most recently factory-read system DPI. The default value for all other + /// render targets is 96 DPI. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getdpi void GetDpi( FLOAT *dpiX, FLOAT + // *dpiY ); + [PreserveSig] + void GetDpi(out float dpiX, out float dpiY); + + /// Returns the size of the render target in device-independent pixels. + /// + /// Type: D2D1_SIZE_F + /// The current size of the render target in device-independent pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + D2D_SIZE_F GetSize(); + + /// Returns the size of the render target in device pixels. + /// + /// Type: D2D1_SIZE_U + /// The size of the render target in device pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + D2D_SIZE_U GetPixelSize(); + + /// + /// Gets the maximum size, in device-dependent units (pixels), of any one bitmap dimension supported by the render target. + /// + /// + /// Type: UINT32 + /// The maximum size, in pixels, of any one bitmap dimension supported by the render target. + /// + /// + /// This method returns the maximum texture size of the Direct3D device. + /// + /// Note The software renderer and WARP devices return the value of 16 megapixels (16*1024*1024). You can create a + /// Direct2D texture that is this size, but not a Direct3D texture that is this size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-getmaximumbitmapsize UINT32 GetMaximumBitmapSize(); + [PreserveSig] + uint GetMaximumBitmapSize(); + + /// Indicates whether the render target supports the specified properties. + /// + /// Type: const D2D1_RENDER_TARGET_PROPERTIES* + /// The render target properties to test. + /// + /// + /// Type: BOOL + /// TRUE if the specified render target properties are supported by this render target; otherwise, FALSE. + /// + /// This method does not evaluate the DPI settings specified by the renderTargetProperties parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-issupported(constd2d1_render_target_properties_) + // BOOL IsSupported( const D2D1_RENDER_TARGET_PROPERTIES & renderTargetProperties ); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + bool IsSupported(in D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties); + } + + /// Represents a Direct2D drawing resource. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1resource + [PInvokeData("d2d1.h", MSDNShortId = "8f19e74a-f010-4082-a4da-d1dc3cfe3192")] + [ComImport, Guid("2cd90691-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + void GetFactory(out ID2D1Factory factory); + } + + /// Describes a rounded rectangle. + /// + /// Creating ID2D1RoundedRectangleGeometry Objects + /// To create a rectangle geometry, use the ID2D1Factory::CreateRoundedRectangleGeometry method. + /// + /// Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1roundedrectanglegeometry + [PInvokeData("d2d1.h", MSDNShortId = "e49e9be7-155a-4487-9931-035f18771c04")] + [ComImport, Guid("2cd906a3-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Retrieves a rounded rectangle that describes this rounded rectangle geometry. + /// + /// Type: D2D1_ROUNDED_RECT* + /// + /// A pointer that receives a rounded rectangle that describes this rounded rectangle geometry. You must allocate storage for + /// this parameter. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1roundedrectanglegeometry-getroundedrect void + // GetRoundedRect( D2D1_ROUNDED_RECT *roundedRect ); + [PreserveSig] + void GetRoundedRect(out D2D1_ROUNDED_RECT roundedRect); + } + + /// Describes a geometric path that does not contain quadratic bezier curves or arcs. + /// + /// + /// A geometry sink consists of one or more figures. Each figure is made up of one or more line or Bezier curve segments. To create + /// a figure, call the BeginFigure method and specify the figure's start point, then use AddLines and AddBeziers to add line and + /// Bezier segments. When you are finished adding segments, call the EndFigure method. You can repeat this sequence to create + /// additional figures. When you are finished creating figures, call the Close method. + /// + /// To create geometry paths that can contain arcs and quadratic Bezier curves, use an ID2D1GeometrySink. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1simplifiedgeometrysink + [PInvokeData("d2d1.h", MSDNShortId = "cf877a25-7b9f-4db0-ac53-b4a350795a86")] + [ComImport, Guid("2cd9069e-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1SimplifiedGeometrySink + { + /// + /// Specifies the method used to determine which points are inside the geometry described by this geometry sink and which points + /// are outside. + /// + /// + /// Type: D2D1_FILL_MODE + /// The method used to determine whether a given point is part of the geometry. + /// + /// None + /// + /// The fill mode defaults to D2D1_FILL_MODE_ALTERNATE. To set the fill mode, call SetFillMode before the first call to + /// BeginFigure. Not doing will put the geometry sink in an error state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-setfillmode void SetFillMode( + // D2D1_FILL_MODE fillMode ); + [PreserveSig] + void SetFillMode(D2D1_FILL_MODE fillMode); + + /// Specifies stroke and join options to be applied to new segments added to the geometry sink. + /// + /// Type: D2D1_PATH_SEGMENT + /// Stroke and join options to be applied to new segments added to the geometry sink. + /// + /// None + /// + /// After this method is called, the specified segment flags are applied to each segment subsequently added to the sink. The + /// segment flags are applied to every additional segment until this method is called again and a different set of segment flags + /// is specified. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-setsegmentflags void + // SetSegmentFlags( D2D1_PATH_SEGMENT vertexFlags ); + [PreserveSig] + void SetSegmentFlags(D2D1_PATH_SEGMENT vertexFlags); + + /// Starts a new figure at the specified point. + /// + /// Type: D2D1_POINT_2F + /// The point at which to begin the new figure. + /// + /// + /// Type: D2D1_FIGURE_BEGIN + /// Whether the new figure should be hollow or filled. + /// + /// None + /// + /// If this method is called while a figure is currently in progress, the interface is invalidated and all future methods will fail. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-beginfigure void BeginFigure( + // D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin ); + [PreserveSig] + void BeginFigure(D2D_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin); + + /// Creates a sequence of lines using the specified points and adds them to the geometry sink. + /// + /// Type: const D2D1_POINT_2F* + /// + /// A pointer to an array of one or more points that describe the lines to draw. A line is drawn from the geometry sink's + /// current point (the end point of the last segment drawn or the location specified by BeginFigure) to the first point in the + /// array. if the array contains additional points, a line is drawn from the first point to the second point in the array, from + /// the second point to the third point, and so on. + /// + /// + /// + /// Type: UINT + /// The number of points in the points array. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-addlines void AddLines( const + // D2D1_POINT_2F *points, UINT32 pointsCount ); + [PreserveSig] + void AddLines([In] D2D_POINT_2F[] points, uint pointsCount); + + /// Creates a sequence of cubic Bezier curves and adds them to the geometry sink. + /// + /// Type: const D2D1_BEZIER_SEGMENT* + /// + /// A pointer to an array of Bezier segments that describes the Bezier curves to create. A curve is drawn from the geometry + /// sink's current point (the end point of the last segment drawn or the location specified by BeginFigure) to the end point of + /// the first Bezier segment in the array. if the array contains additional Bezier segments, each subsequent Bezier segment uses + /// the end point of the preceding Bezier segment as its start point. + /// + /// + /// + /// Type: UINT + /// The number of Bezier segments in the beziers array. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-addbeziers void AddBeziers( const + // D2D1_BEZIER_SEGMENT *beziers, UINT32 beziersCount ); + [PreserveSig] + void AddBeziers([In] D2D1_BEZIER_SEGMENT[] beziers, uint beziersCount); + + /// Ends the current figure; optionally, closes it. + /// + /// Type: D2D1_FIGURE_END + /// + /// A value that indicates whether the current figure is closed. If the figure is closed, a line is drawn between the current + /// point and the start point specified by BeginFigure. + /// + /// + /// None + /// + /// Calling this method without a matching call to BeginFigure places the geometry sink in an error state; subsequent calls are + /// ignored, and the overall failure will be returned when the Close method is called. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-endfigure void EndFigure( + // D2D1_FIGURE_END figureEnd ); + [PreserveSig] + void EndFigure(D2D1_FIGURE_END figureEnd); + + /// Closes the geometry sink, indicates whether it is in an error state, and resets the sink's error state. + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// Do not close the geometry sink while a figure is still in progress; doing so puts the geometry sink in an error state. For + /// the close operation to be successful, there must be one EndFigure call for each call to BeginFigure. + /// + /// + /// After calling this method, the geometry sink might not be usable. Direct2D implementations of this interface do not allow + /// the geometry sink to be modified after it is closed, but other implementations might not impose this restriction. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1simplifiedgeometrysink-close HRESULT Close(); + [PreserveSig] + HRESULT Close(); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct2D/D2d1.Interfaces5.cs b/PInvoke/Graphics/Direct2D/D2d1.Interfaces5.cs new file mode 100644 index 00000000..15f0aa9c --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1.Interfaces5.cs @@ -0,0 +1,777 @@ +using System; +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// Paints an area with a solid color. + /// + /// Creating ID2D1SolidColorBrush Objects + /// + /// To create a solid color brush, use the ID2D1RenderTarget::CreateSolidColorBrush method of the render target on which the brush + /// will be used. The brush can only be used with the render target that created it or with the compatible targets for that render target. + /// + /// A solid color brush is a device-dependent resource. (For more information about resources, see Resources Overview.) + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1solidcolorbrush + [PInvokeData("d2d1.h", MSDNShortId = "a15c2696-3122-461e-806e-2195a50a3e92")] + [ComImport, Guid("2cd906a9-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1SolidColorBrush : ID2D1Brush + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + new void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + new float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// Specifies the color of this solid-color brush. + /// + /// Type: const D2D1_COLOR_F + /// The color of this solid-color brush. + /// + /// None + /// + /// To help create colors, Direct2D provides the ColorF class. It offers several helper methods for creating colors and provides + /// a set or predefined colors. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1solidcolorbrush-setcolor(constd2d1_color_f_) void + // SetColor( const D2D1_COLOR_F & color ); + [PreserveSig] + void SetColor(in D3DCOLORVALUE color); + + /// Retrieves the color of the solid color brush. + /// + /// Type: D2D1_COLOR_F + /// The color of this solid color brush. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1solidcolorbrush-getcolor D2D1_COLOR_F GetColor(); + [PreserveSig] + D3DCOLORVALUE GetColor(); + } + + /// Describes the caps, miter limit, line join, and dash information for a stroke. + /// + /// Creating ID2D1StrokeStyle Objects + /// To create a stroke style, use the ID2D1Factory::CreateStrokeStyle method. + /// + /// A stroke style is a device-indenpendent resource; you can create it once then retain it for the life of your application. For + /// more information about resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1strokestyle + [PInvokeData("d2d1.h", MSDNShortId = "2cdf66dc-f34f-4132-8c06-7464648d3cef")] + [ComImport, Guid("2cd9069d-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1StrokeStyle : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the type of shape used at the beginning of a stroke. + /// + /// Type: D2D1_CAP_STYLE + /// The type of shape used at the beginning of a stroke. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getstartcap D2D1_CAP_STYLE GetStartCap(); + [PreserveSig] + D2D1_CAP_STYLE GetStartCap(); + + /// Retrieves the type of shape used at the end of a stroke. + /// + /// Type: D2D1_CAP_STYLE + /// The type of shape used at the end of a stroke. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getendcap D2D1_CAP_STYLE GetEndCap(); + [PreserveSig] + D2D1_CAP_STYLE GetEndCap(); + + /// Gets a value that specifies how the ends of each dash are drawn. + /// + /// Type: D2D1_CAP_STYLE + /// A value that specifies how the ends of each dash are drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getdashcap D2D1_CAP_STYLE GetDashCap(); + [PreserveSig] + D2D1_CAP_STYLE GetDashCap(); + + /// Retrieves the limit on the ratio of the miter length to half the stroke's thickness. + /// + /// Type: FLOAT + /// + /// A positive number greater than or equal to 1.0f that describes the limit on the ratio of the miter length to half the + /// stroke's thickness. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getmiterlimit FLOAT GetMiterLimit(); + [PreserveSig] + float GetMiterLimit(); + + /// Retrieves the type of joint used at the vertices of a shape's outline. + /// + /// Type: D2D1_LINE_JOIN + /// A value that specifies the type of joint used at the vertices of a shape's outline. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getlinejoin D2D1_LINE_JOIN GetLineJoin(); + [PreserveSig] + D2D1_LINE_JOIN GetLineJoin(); + + /// Retrieves a value that specifies how far in the dash sequence the stroke will start. + /// + /// Type: FLOAT + /// A value that specifies how far in the dash sequence the stroke will start. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getdashoffset FLOAT GetDashOffset(); + [PreserveSig] + float GetDashOffset(); + + /// Gets a value that describes the stroke's dash pattern. + /// + /// Type: D2D1_DASH_STYLE + /// A value that describes the predefined dash pattern used, or D2D1_DASH_STYLE_CUSTOM if a custom dash style is used. + /// + /// + /// If a custom dash style is specified, the dash pattern is described by the dashes array, which can be retrieved by calling + /// the GetDashes method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getdashstyle D2D1_DASH_STYLE GetDashStyle(); + [PreserveSig] + D2D1_DASH_STYLE GetDashStyle(); + + /// Retrieves the number of entries in the dashes array. + /// + /// Type: UINT32 + /// The number of entries in the dashes array if the stroke is dashed; otherwise, 0. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getdashescount UINT32 GetDashesCount(); + [PreserveSig] + uint GetDashesCount(); + + /// Copies the dash pattern to the specified array. + /// + /// Type: FLOAT* + /// + /// A pointer to an array that will receive the dash pattern. The array must be able to contain at least as many elements as + /// specified by dashesCount. You must allocate storage for this array. + /// + /// + /// + /// Type: UINT + /// + /// The number of dashes to copy. If this value is less than the number of dashes in the stroke style's dashes array, the + /// returned dashes are truncated to dashesCount. If this value is greater than the number of dashes in the stroke style's + /// dashes array, the extra dashes are set to 0.0f. To obtain the actual number of dashes in the stroke style's dashes array, + /// use the GetDashesCount method. + /// + /// + /// None + /// + /// The dashes are specified in units that are a multiple of the stroke width, with subsequent members of the array indicating + /// the dashes and gaps between dashes: the first entry indicates a filled dash, the second a gap, and so on. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1strokestyle-getdashes void GetDashes( FLOAT *dashes, + // UINT32 dashesCount ); + [PreserveSig] + void GetDashes([Out] float[] dashes, uint dashesCount); + } + + /// Populates an ID2D1Mesh object with triangles. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1tessellationsink + [PInvokeData("d2d1.h", MSDNShortId = "967c702f-d16f-4a8e-ac77-a8bb35afe0a1")] + [ComImport, Guid("2cd906c1-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1TessellationSink + { + /// Copies the specified triangles to the sink. + /// + /// Type: const D2D1_TRIANGLE* + /// An array of D2D1_TRIANGLE structures that describe the triangles to add to the sink. + /// + /// + /// Type: UINT + /// The number of triangles to copy from the triangles array. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1tessellationsink-addtriangles void AddTriangles( const + // D2D1_TRIANGLE *triangles, UINT32 trianglesCount ); + [PreserveSig] + void AddTriangles([In] D2D1_TRIANGLE[] triangles, uint trianglesCount); + + /// Closes the sink and returns its error status. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1tessellationsink-close HRESULT Close(); + void Close(); + } + + /// Represents a geometry that has been transformed. + /// + /// + /// Using an ID2D1TransformedGeometry rather than transforming a geometry by using a render target's transform enables you to + /// transform a geometry without transforming its stroke. + /// + /// Creating ID2D1TransformedGeometry Objects + /// To create an ID2D1TransformedGeometry, call the ID2D1Factory::CreateTransformedGeometry method. + /// + /// Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create + /// geometries once and retain them for the life of the application, or until they need to be modified. For more information about + /// device-independent and device-dependent resources, see the Resources Overview. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1transformedgeometry + [PInvokeData("d2d1.h", MSDNShortId = "5d48eab6-1229-4e54-bfab-602b471b23a4")] + [ComImport, Guid("2cd906bb-12e2-11dc-9fed-001143a055f9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1TransformedGeometry : ID2D1Geometry + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the bounds of the geometry. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry before calculating its bounds, or NULL. + /// + /// + /// Type: D2D1_RECT_F* + /// + /// When this method returns, contains the bounds of this geometry. If the bounds are empty, this parameter will be a rect where + /// bounds.left > bounds.right. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) + // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + + /// + /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the + /// specified matrix. + /// + /// + /// Type: FLOAT + /// The amount by which to widen the geometry by stroking its outline. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke that widens the geometry. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// + /// A transform to apply to the geometry after the geometry is transformed and after the geometry has been stroked, or NULL. + /// + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the bounds of the widened geometry. You must allocate storage for this parameter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 + // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, D2D1_RECT_F *bounds ); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. + /// + /// + /// Type: [in] D2D1_POINT_2F + /// The point to test for containment. + /// + /// + /// Type: [in] FLOAT + /// The thickness of the stroke to apply. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the stroked geometry. + /// + /// + /// Type: [in] FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the stroke by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] BOOL* + /// + /// When this method returns, contains a boolean value set to true if the geometry's stroke contains the specified point; + /// otherwise, false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-strokecontainspoint%28d2d1_point_2f_float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_bool%29 + // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F + // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. + /// + /// + /// Type: D2D1_POINT_2F + /// The point to test. + /// + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transform to apply to the geometry prior to testing for containment. + /// + /// + /// Type: FLOAT + /// + /// The numeric accuracy with which the precise geometric path and path intersection is calculated. Points missing the fill by + /// less than the tolerance are still considered inside. Smaller values produce more accurate results but cause slower execution. + /// + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains a bool value that is true if the area filled by the geometry contains point; otherwise, + /// false. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-fillcontainspoint(d2d1_point_2f_constd2d1_matrix_3x2_f__float_bool) + // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL + // *contains ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the + /// specified flattening tolerance. + /// + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to test. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to inputGeometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] D2D1_GEOMETRY_RELATION* + /// + /// When this method returns, contains a pointer to a value that describes how this geometry is related to inputGeometry. You + /// must allocate storage for this parameter. + /// + /// + /// + /// + /// When interpreting the returned relation value, it is important to remember that the member + /// D2D1_GEOMETRY_RELATION_IS_CONTAINED of the D2D1_GEOMETRY_RELATION enumeration type means that this geometry is + /// contained inside inputGeometry, not that this geometry contains inputGeometry. + /// + /// For more information about how to interpret other possible return values, see D2D1_GEOMETRY_RELATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 + // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT + // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + + /// + /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the + /// result to an ID2D1SimplifiedGeometrySink. + /// + /// + /// Type: [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION + /// A value that specifies whether the simplified geometry should contain curves. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to the simplified geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the simplified geometry is appended. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix + /// and flattened using the specified tolerance. + /// + /// + /// Type: [in, optional] const D2D1_MATRIX_3X2_F* + /// The transform to apply to this geometry, or NULL. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1TessellationSink* + /// The ID2D1TessellationSink to which the tessellated is appended. + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 + // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink + // *tessellationSink ); + new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + + /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. + /// + /// Type: [in] ID2D1Geometry* + /// The geometry to combine with this instance. + /// + /// + /// Type: [in] D2D1_COMBINE_MODE + /// The type of combine operation to perform. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to inputGeometry before combining. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The result of the combine operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & + // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to apply to the geometry outline, or NULL. + /// + /// + /// Type: FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the geometry's transformed outline is appended. + /// + /// + /// + /// The Outline method allows the caller to produce a geometry with an equivalent fill to the input geometry, with the following + /// additional properties: + /// + /// + /// + /// The output geometry contains no transverse intersections; that is, segments may touch, but they never cross. + /// + /// + /// The outermost figures in the output geometry are all oriented counterclockwise. + /// + /// + /// + /// The output geometry is fill-mode invariant; that is, the fill of the geometry does not depend on the choice of the fill + /// mode. For more information about the fill mode, see D2D1_FILL_MODE. + /// + /// + /// + /// + /// Additionally, the Outline method can be useful in removing redundant portions of said geometries to simplify complex + /// geometries. It can also be useful in combination with ID2D1GeometryGroup to create unions among several geometries simultaneously. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 + // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink + // *geometrySink ); + new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// + /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to this geometry before computing its area. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the area of the transformed, flattened version of this geometry. You must + /// allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); + new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// Calculates the length of the geometry as though each segment were unrolled into a line. + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating its length. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out] FLOAT* + /// + /// When this method returns, contains a pointer to the length of the geometry. For closed geometries, the length includes an + /// implicit closing segment. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) + // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); + new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + + /// + /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the + /// specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// + /// The distance along the geometry of the point and tangent to find. If this distance is less than 0, this method calculates + /// the first point in the geometry. If this distance is greater than the length of the geometry, this method calculates the + /// last point in the geometry. + /// + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry before calculating the specified point and tangent. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// The location at the specified distance along the geometry. If the geometry is empty, this point contains NaN as its x and y values. + /// + /// + /// + /// Type: [out, optional] D2D1_POINT_2F* + /// + /// When this method returns, contains a pointer to the tangent vector at the specified distance along the geometry. If the + /// geometry is empty, this vector contains NaN as its x and y values. You must allocate storage for this parameter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) + // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, + // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); + new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + + /// + /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been + /// transformed by the specified matrix and flattened using the specified tolerance. + /// + /// + /// Type: [in] FLOAT + /// The amount by which to widen the geometry. + /// + /// + /// Type: [in, optional] ID2D1StrokeStyle* + /// The style of stroke to apply to the geometry, or NULL. + /// + /// + /// Type: [in] const D2D1_MATRIX_3X2_F & + /// The transform to apply to the geometry after widening it. + /// + /// + /// Type: [in] FLOAT + /// + /// The maximum error allowed when constructing a polygonal approximation of the geometry. No point in the polygonal + /// representation will diverge from the original geometry by more than the flattening tolerance. Smaller values produce more + /// accurate results but cause slower execution. + /// + /// + /// + /// Type: [in] ID2D1SimplifiedGeometrySink* + /// The ID2D1SimplifiedGeometrySink to which the widened geometry is appended. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) + // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT + // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + + /// Retrieves the source geometry of this transformed geometry object. + /// + /// Type: ID2D1Geometry** + /// + /// When this method returns, contains a pointer to a pointer to the source geometry for this transformed geometry object. This + /// parameter is passed uninitialized. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1transformedgeometry-getsourcegeometry void + // GetSourceGeometry( ID2D1Geometry **sourceGeometry ); + [PreserveSig] + void GetSourceGeometry(out ID2D1Geometry sourceGeometry); + + /// Retrieves the matrix used to transform the ID2D1TransformedGeometry object's source geometry. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// + /// A pointer that receives the matrix used to transform the ID2D1TransformedGeometry object's source geometry. You must + /// allocate storage for this parameter. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1transformedgeometry-gettransform void GetTransform( + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + void GetTransform(out D2D_MATRIX_3X2_F transform); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct2D/D2d1.cs b/PInvoke/Graphics/Direct2D/D2d1.cs new file mode 100644 index 00000000..1eeb5407 --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1.cs @@ -0,0 +1,2389 @@ +using System; +using System.Runtime.InteropServices; +using Vanara.InteropServices; +using static Vanara.PInvoke.DXGI; + +namespace Vanara.PInvoke +{ + // TODO: Move once D2d1 lib is done + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// Specifies how the alpha value of a bitmap or render target should be treated. + /// + /// + /// The D2D1_ALPHA_MODE enumeration is used with the D2D1_PIXEL_FORMAT enumeration to specify the alpha mode of a render + /// target or bitmap. Different render targets and bitmaps support different alpha modes. For a list, see Supported Pixel Formats + /// and Alpha Modes. + /// + /// The Differences Between Straight and Premultiplied Alpha + /// + /// When describing an RGBA color using straight alpha, the alpha value of the color is stored in the alpha channel. For example, to + /// describe a red color that is 60% opaque, you'd use the following values: (255, 0, 0, 255 * 0.6) = (255, 0, 0, 153). The 255 + /// value indicates full red, and 153 (which is 60 percent of 255) indicates that the color should have an opacity of 60 percent. + /// + /// + /// When describing an RGBA color using premultiplied alpha, each color is multiplied by the alpha value: (255 * 0.6, 0 * 0.6, 0 * + /// 0.6, 255 * 0.6) = (153, 0, 0, 153). + /// + /// + /// Regardless of the alpha mode of the render target, D2D1_COLOR_F values are always interpreted as straight alpha. For example, + /// when specifying the color of an ID2D1SolidColorBrush for use with a bitmap that uses the premultiplied alpha mode, you'd specify + /// the color just as you would if the bitmap used straight alpha. When you paint with the brush, Direct2D translates the color to + /// the destination format for you. + /// + /// Alpha Mode for Render Targets + /// + /// Regardless of the alpha mode setting, a render target's contents support transparency. For example, if you draw a partially + /// transparent red rectangle with a render target with an alpha mode of D2D1_ALPHA_MODE_IGNORE, the rectangle will appear + /// pink (if the background is white), as you might expect. + /// + /// + /// If you draw a partially transparent red rectangle when the alpha mode is CreateCompatibleRenderTarget method) to create a bitmap + /// that supports transparency. + /// + /// ClearType and Alpha Modes + /// + /// If you specify an alpha mode other than D2D1_ALPHA_MODE_IGNORE for a render target, the text antialiasing mode + /// automatically changes from D2D1_TEXT_ANTIALIAS_MODE CLEARTYPE to D2D1_TEXT_ANTIALIAS_MODE GRAYSCALE. (When you specify an + /// alpha mode of D2D1_ALPHA_MODE_UNKNOWN, Direct2D sets the alpha for you depending on the type of render target. For a list + /// of what the D2D1_ALPHA_MODE_UNKNOWN setting resolves to for each render target, see the Supported Pixel Formats and Alpha + /// Modes overview.) + /// + /// + /// You can use the SetTextAntialiasMode method to change the text antialias mode back to D2D1_TEXT_ANTIALIAS_MODE CLEARTYPE, but + /// rendering ClearType text to a transparent surface can create unpredictable results. If you want to render ClearType text to an + /// transparent render target, we recommend that you use one of the following two techniques. + /// + /// + /// + /// + /// Use the PushAxisAlignedClip method to clip the render target to the area where the text will be rendered, then call the Clear + /// method and specify an opaque color, then render your text. + /// + /// + /// + /// Use DrawRectangle to draw an opaque rectangle behind the area where the text will be rendered. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ne-dcommon-d2d1_alpha_mode typedef enum D2D1_ALPHA_MODE { + // D2D1_ALPHA_MODE_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED, D2D1_ALPHA_MODE_STRAIGHT, D2D1_ALPHA_MODE_IGNORE, + // D2D1_ALPHA_MODE_FORCE_DWORD } ; + [PInvokeData("dcommon.h", MSDNShortId = "f1b1e735-2e89-4dc1-9fee-dfb4626ef453")] + public enum D2D1_ALPHA_MODE : uint + { + /// The alpha value might not be meaningful. + D2D1_ALPHA_MODE_UNKNOWN, + + /// + /// The alpha value has been premultiplied. Each color is first scaled by the alpha value. The alpha value itself is the same in + /// both straight and premultiplied alpha. Typically, no color channel value is greater than the alpha channel value. If a color + /// channel value in a premultiplied format is greater than the alpha channel, the standard source-over blending math results in + /// an additive blend. + /// + D2D1_ALPHA_MODE_PREMULTIPLIED, + + /// The alpha value has not been premultiplied. The alpha channel indicates the transparency of the color. + D2D1_ALPHA_MODE_STRAIGHT, + + /// The alpha value is ignored. + D2D1_ALPHA_MODE_IGNORE, + + /// + D2D1_ALPHA_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how the edges of nontext primitives are rendered. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_antialias_mode typedef enum D2D1_ANTIALIAS_MODE { + // D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_ANTIALIAS_MODE_ALIASED, D2D1_ANTIALIAS_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "3ca12155-6dd0-41bb-8778-3387422c4ffe")] + public enum D2D1_ANTIALIAS_MODE : uint + { + /// Edges are antialiased using the Direct2D per-primitive method of high-quality antialiasing. + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + + /// + /// Objects are aliased in most cases. Objects are antialiased only when they are drawn to a render target created by the + /// CreateDxgiSurfaceRenderTarget method and Direct3D multisampling has been enabled on the backing DirectX Graphics + /// Infrastructure (DXGI) surface. + /// + D2D1_ANTIALIAS_MODE_ALIASED, + + /// + D2D1_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies whether an arc should be greater than 180 degrees. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_arc_size typedef enum D2D1_ARC_SIZE { D2D1_ARC_SIZE_SMALL, + // D2D1_ARC_SIZE_LARGE, D2D1_ARC_SIZE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "c471716d-c2cc-4f79-8011-46690812b848")] + public enum D2D1_ARC_SIZE : uint + { + /// An arc's sweep should be 180 degrees or less. + D2D1_ARC_SIZE_SMALL = 0, + + /// An arc's sweep should be 180 degrees or greater. + D2D1_ARC_SIZE_LARGE = 1, + + /// + D2D1_ARC_SIZE_FORCE_DWORD = 0xffffffff + } + + /// + /// Specifies the algorithm that is used when images are scaled or rotated. + /// Note Starting in Windows 8, more interpolations modes are available. See D2D1_INTERPOLATION_MODE for more info. + /// + /// + /// To stretch an image, each pixel in the original image must be mapped to a group of pixels in the larger image. To shrink an + /// image, groups of pixels in the original image must be mapped to single pixels in the smaller image. The effectiveness of the + /// algorithms that perform these mappings determines the quality of a scaled image. Algorithms that produce higher-quality scaled + /// images tend to require more processing time. D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR provides faster but + /// lower-quality interpolation, while D2D1_BITMAP_INTERPOLATION_MODE_LINEAR provides higher-quality interpolation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_bitmap_interpolation_mode typedef enum + // D2D1_BITMAP_INTERPOLATION_MODE { D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + // D2D1_BITMAP_INTERPOLATION_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "b53b7e0a-aa8b-4788-896c-9825c9e6cceb")] + public enum D2D1_BITMAP_INTERPOLATION_MODE : uint + { + /// Use the exact color of the nearest bitmap pixel to the current rendering pixel. + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, + + /// Interpolate a color from the four bitmap pixels that are the nearest to the rendering pixel. + D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + + /// + D2D1_BITMAP_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Describes the shape at the end of a line or segment. + /// + /// The following illustration shows the available cap styles for lines or segments. The red portion of the line shows the extra + /// area added by the line cap setting. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_cap_style typedef enum D2D1_CAP_STYLE { D2D1_CAP_STYLE_FLAT, + // D2D1_CAP_STYLE_SQUARE, D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_TRIANGLE, D2D1_CAP_STYLE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "acf4365e-b9df-459e-a746-016339cd09ac")] + public enum D2D1_CAP_STYLE : uint + { + /// A cap that does not extend past the last point of the line. Comparable to cap used for objects other than lines. + D2D1_CAP_STYLE_FLAT, + + /// Half of a square that has a length equal to the line thickness. + D2D1_CAP_STYLE_SQUARE, + + /// A semicircle that has a diameter equal to the line thickness. + D2D1_CAP_STYLE_ROUND, + + /// An isosceles right triangle whose hypotenuse is equal in length to the thickness of the line. + D2D1_CAP_STYLE_TRIANGLE, + + /// + D2D1_CAP_STYLE_FORCE_DWORD = 0xffffffff, + } + + /// Defines options that should be applied to the color space. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_color_space typedef enum D2D1_COLOR_SPACE { + // D2D1_COLOR_SPACE_CUSTOM, D2D1_COLOR_SPACE_SRGB, D2D1_COLOR_SPACE_SCRGB, D2D1_COLOR_SPACE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "2c90978b-8a5a-4e5d-9ced-e0ec917271ff")] + public enum D2D1_COLOR_SPACE : uint + { + /// The color space is otherwise described, such as with a color profile. + D2D1_COLOR_SPACE_CUSTOM, + + /// The color space is sRGB. + D2D1_COLOR_SPACE_SRGB, + + /// The color space is scRGB. + D2D1_COLOR_SPACE_SCRGB, + + /// + D2D1_COLOR_SPACE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies the different methods by which two geometries can be combined. + /// The following illustration shows the different geometry combine modes. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_combine_mode typedef enum D2D1_COMBINE_MODE { + // D2D1_COMBINE_MODE_UNION, D2D1_COMBINE_MODE_INTERSECT, D2D1_COMBINE_MODE_XOR, D2D1_COMBINE_MODE_EXCLUDE, + // D2D1_COMBINE_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "7526379a-5f57-4a9f-b85d-415f131528e2")] + public enum D2D1_COMBINE_MODE : uint + { + /// + /// The two regions are combined by taking the union of both. Given two geometries, A and B, the resulting geometry is geometry + /// A + geometry B. + /// + D2D1_COMBINE_MODE_UNION = 0, + + /// + /// The two regions are combined by taking their intersection. The new area consists of the overlapping region between the two geometries. + /// + D2D1_COMBINE_MODE_INTERSECT, + + /// + /// The two regions are combined by taking the area that exists in the first region but not the second and the area that exists + /// in the second region but not the first. Given two geometries, A and B, the new region consists of (A-B) + (B-A). + /// + D2D1_COMBINE_MODE_XOR, + + /// + /// The second region is excluded from the first. Given two geometries, A and B, the area of geometry B is removed from the area + /// of geometry A, producing a region that is A-B. + /// + D2D1_COMBINE_MODE_EXCLUDE, + + /// + D2D1_COMBINE_MODE_FORCE_DWORD = 0xffffffff + } + + /// + /// Specifies additional features supportable by a compatible render target when it is created. This enumeration allows a bitwise + /// combination of its member values. + /// + /// + /// + /// Use this enumeration when creating a compatible render target with the CreateCompatibleRenderTarget method. For more information + /// about compatible render targets, see the Render Targets Overview. + /// + /// + /// The D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE option may only be requested if the parent render target was + /// created with D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE (for most render targets) or + /// D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE (for render targets created by the CreateCompatibleRenderTarget method). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_compatible_render_target_options typedef enum + // D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS { D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, + // D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "c20bf016-2304-4bd3-88ad-42d81e69c302")] + [Flags] + public enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS : uint + { + /// The render target supports no additional features. + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000, + + /// The render target supports interoperability with the Windows Graphics Device Interface (GDI). + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001, + + /// + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// Describes the sequence of dashes and gaps in a stroke. + /// The following illustration shows several available dash styles. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_dash_style typedef enum D2D1_DASH_STYLE { + // D2D1_DASH_STYLE_SOLID, D2D1_DASH_STYLE_DASH, D2D1_DASH_STYLE_DOT, D2D1_DASH_STYLE_DASH_DOT, D2D1_DASH_STYLE_DASH_DOT_DOT, + // D2D1_DASH_STYLE_CUSTOM, D2D1_DASH_STYLE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "0c1807e3-51e6-440a-bd80-9b43ed7a39f5")] + public enum D2D1_DASH_STYLE : uint + { + /// A solid line with no breaks. + D2D1_DASH_STYLE_SOLID, + + /// + /// A dash followed by a gap of equal length. The dash and the gap are each twice as long as the stroke thickness.The equivalent + /// dash array for D2D1_DASH_STYLE_DASH is {2, 2}. + /// + D2D1_DASH_STYLE_DASH, + + /// A dot followed by a longer gap.The equivalent dash array for D2D1_DASH_STYLE_DOT is {0, 2}. + D2D1_DASH_STYLE_DOT, + + /// + /// A dash, followed by a gap, followed by a dot, followed by another gap.The equivalent dash array for D2D1_DASH_STYLE_DASH_DOT + /// is {2, 2, 0, 2}. + /// + D2D1_DASH_STYLE_DASH_DOT, + + /// + /// A dash, followed by a gap, followed by a dot, followed by another gap, followed by another dot, followed by another gap.The + /// equivalent dash array for D2D1_DASH_STYLE_DASH_DOT_DOT is {2, 2, 0, 2, 0, 2}. + /// + D2D1_DASH_STYLE_DASH_DOT_DOT, + + /// The dash pattern is specified by an array of floating-point values. + D2D1_DASH_STYLE_CUSTOM, + + /// + D2D1_DASH_STYLE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how a device context is initialized for GDI rendering when it is retrieved from the render target. + /// + /// Use this enumeration with the ID2D1GdiInteropRenderTarget::GetDC method to specify how the device context is initialized for GDI rendering. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_dc_initialize_mode typedef enum D2D1_DC_INITIALIZE_MODE { + // D2D1_DC_INITIALIZE_MODE_COPY, D2D1_DC_INITIALIZE_MODE_CLEAR, D2D1_DC_INITIALIZE_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "a7837fe4-6e11-42a0-8a85-cba42e0f123a")] + public enum D2D1_DC_INITIALIZE_MODE : uint + { + /// The current contents of the render target are copied to the device context when it is initialized. + D2D1_DC_INITIALIZE_MODE_COPY = 0, + + /// The device context is cleared to transparent black when it is initialized. + D2D1_DC_INITIALIZE_MODE_CLEAR, + + /// + D2D1_DC_INITIALIZE_MODE_FORCE_DWORD = 0xffffffff + } + + /// Indicates the type of information provided by the Direct2D Debug Layer. + /// To receive debugging messages, you must install the Direct2D Debug Layer. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_debug_level typedef enum D2D1_DEBUG_LEVEL { + // D2D1_DEBUG_LEVEL_NONE, D2D1_DEBUG_LEVEL_ERROR, D2D1_DEBUG_LEVEL_WARNING, D2D1_DEBUG_LEVEL_INFORMATION, + // D2D1_DEBUG_LEVEL_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "3f1b4127-12d4-4472-ae26-0b69fdbb35a7")] + public enum D2D1_DEBUG_LEVEL : uint + { + /// Direct2D does not produce any debugging output. + D2D1_DEBUG_LEVEL_NONE, + + /// Direct2D sends error messages to the debug layer. + D2D1_DEBUG_LEVEL_ERROR, + + /// Direct2D sends error messages and warnings to the debug layer. + D2D1_DEBUG_LEVEL_WARNING, + + /// + /// Direct2D sends error messages, warnings, and additional diagnostic information that can help improve performance to the + /// debug layer. + /// + D2D1_DEBUG_LEVEL_INFORMATION, + + /// + D2D1_DEBUG_LEVEL_FORCE_DWORD = 0xffffffff + } + + /// This specifies options that apply to the device context for its lifetime. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_device_context_options typedef enum + // D2D1_DEVICE_CONTEXT_OPTIONS { D2D1_DEVICE_CONTEXT_OPTIONS_NONE, D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, + // D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "be4e6eb7-0767-4faf-9f27-eeb3bed48244")] + public enum D2D1_DEVICE_CONTEXT_OPTIONS : uint + { + /// The device context is created with default options. + D2D1_DEVICE_CONTEXT_OPTIONS_NONE, + + /// + /// Distribute rendering work across multiple threads. Refer to Improving the performance of Direct2D apps for additional notes + /// on the use of this flag. + /// + D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, + + /// + D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// + /// Specifies whether text snapping is suppressed or clipping to the layout rectangle is enabled. This enumeration allows a bitwise + /// combination of its member values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_draw_text_options typedef enum D2D1_DRAW_TEXT_OPTIONS { + // D2D1_DRAW_TEXT_OPTIONS_NO_SNAP, D2D1_DRAW_TEXT_OPTIONS_CLIP, D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT, + // D2D1_DRAW_TEXT_OPTIONS_DISABLE_COLOR_BITMAP_SNAPPING, D2D1_DRAW_TEXT_OPTIONS_NONE, D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "30f5be4a-83c2-4039-8e09-00e842fc5eb2")] + [Flags] + public enum D2D1_DRAW_TEXT_OPTIONS : uint + { + /// Text is not vertically snapped to pixel boundaries. This setting is recommended for text that is being animated. + D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001, + + /// Text is clipped to the layout rectangle. + D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002, + + /// In Windows 8.1 and later, text is rendered using color versions of glyphs, if defined by the font. + D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004, + + /// Bitmap origins of color glyph bitmaps are not snapped. + D2D1_DRAW_TEXT_OPTIONS_DISABLE_COLOR_BITMAP_SNAPPING = 0x00000008, + + /// Text is vertically snapped to pixel boundaries and is not clipped to the layout rectangle. + D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000, + + /// + D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how a brush paints areas outside of its normal content area. + /// + /// For an ID2D1BitmapBrush, the brush's content is the brush's bitmap. For an ID2D1LinearGradientBrush, the brush's content area is + /// the gradient axis. For an ID2D1RadialGradientBrush, the brush's content is the area within the gradient ellipse. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_extend_mode typedef enum D2D1_EXTEND_MODE { + // D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_MIRROR, D2D1_EXTEND_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "6b6e1fe1-d43a-46cf-904d-5266b9bd6bf4")] + public enum D2D1_EXTEND_MODE : uint + { + /// Repeat the edge pixels of the brush's content for all regions outside the normal content area. + D2D1_EXTEND_MODE_CLAMP, + + /// Repeat the brush's content. + D2D1_EXTEND_MODE_WRAP, + + /// + /// The same as D2D1_EXTEND_MODE_WRAP, except that alternate tiles of the brush's content are flipped. (The brush's normal + /// content is drawn untransformed.) + /// + D2D1_EXTEND_MODE_MIRROR, + + /// + D2D1_EXTEND_MODE_FORCE_DWORD = 0xffffffff, + } + + /// + /// Specifies whether Direct2D provides synchronization for an ID2D1Factory and the resources it creates, so that they may be safely + /// accessed from multiple threads. + /// + /// + /// + /// When you create a factory, you can specify whether it is multithreaded or singlethreaded. A singlethreaded factory provides no + /// serialization against any other single threaded instance within Direct2D, so this mechanism provides a very large degree of + /// scaling on the CPU. + /// + /// + /// You can also create a multithreaded factory instance. In this case, the factory and all derived objects can be used from any + /// thread, and each render target can be rendered to independently. Direct2D serializes calls to these objects, so a single + /// multithreaded Direct2D instance won't scale as well on the CPU as many single threaded instances. However, the resources can be + /// shared within the multithreaded instance. + /// + /// + /// Note the qualifier "On the CPU": GPUs generally take advantage of fine-grained parallelism more so than CPUs. For example, + /// multithreaded calls from the CPU might still end up being serialized when being sent to the GPU; however, a whole bank of pixel + /// and vertex shaders will run in parallel to perform the rendering. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_factory_type typedef enum D2D1_FACTORY_TYPE { + // D2D1_FACTORY_TYPE_SINGLE_THREADED, D2D1_FACTORY_TYPE_MULTI_THREADED, D2D1_FACTORY_TYPE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "428053d3-7ea0-4b01-9924-4a31d8e018fb")] + public enum D2D1_FACTORY_TYPE : uint + { + /// + /// No synchronization is provided for accessing or writing to the factory or the objects it creates. If the factory or the + /// objects are called from multiple threads, it is up to the application to provide access locking. + /// + D2D1_FACTORY_TYPE_SINGLE_THREADED = 0, + + /// + /// Direct2D provides synchronization for accessing and writing to the factory and the objects it creates, enabling safe access + /// from multiple threads. + /// + D2D1_FACTORY_TYPE_MULTI_THREADED, + + /// + D2D1_FACTORY_TYPE_FORCE_DWORD = 0xffffffff + } + + /// Describes the minimum DirectX support required for hardware rendering by a render target. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_feature_level typedef enum D2D1_FEATURE_LEVEL { + // D2D1_FEATURE_LEVEL_DEFAULT, D2D1_FEATURE_LEVEL_9, D2D1_FEATURE_LEVEL_10, D2D1_FEATURE_LEVEL_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "d9604c37-7345-40e3-850c-2e2c99353ba5")] + public enum D2D1_FEATURE_LEVEL : uint + { + /// Direct2D determines whether the video card provides adequate hardware rendering support. + D2D1_FEATURE_LEVEL_DEFAULT, + + /// The video card must support DirectX 9. + D2D1_FEATURE_LEVEL_9, + + /// The video card must support DirectX 10. + D2D1_FEATURE_LEVEL_10, + + /// + D2D1_FEATURE_LEVEL_FORCE_DWORD = 0xffffffff, + } + + /// Indicates whether a specific ID2D1SimplifiedGeometrySink figure is filled or hollow. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_figure_begin typedef enum D2D1_FIGURE_BEGIN { + // D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_BEGIN_HOLLOW, D2D1_FIGURE_BEGIN_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "c29aa79e-b978-4318-a8e1-5a321cd66327")] + // public enum D2D1_FIGURE_BEGIN{D2D1_FIGURE_BEGIN_FILLED, D2D1_FIGURE_BEGIN_HOLLOW, D2D1_FIGURE_BEGIN_FORCE_DWORD, } + public enum D2D1_FIGURE_BEGIN : uint + { + /// + /// Indicates the figure will be filled by the FillGeometry (ID2D1CommandSink::FillGeometry or ID2D1RenderTarget::FillGeometry) method. + /// + D2D1_FIGURE_BEGIN_FILLED = 0, + + /// + /// Indicates the figure will not be filled by the FillGeometry (ID2D1CommandSink::FillGeometry or + /// ID2D1RenderTarget::FillGeometry) method and will only consist of an outline. Moreover, the bounds of a hollow figure are + /// zero. D2D1_FIGURE_BEGIN_HOLLOW should be used for stroking, or for other geometry operations. + /// + D2D1_FIGURE_BEGIN_HOLLOW = 1, + + /// + D2D1_FIGURE_BEGIN_FORCE_DWORD = 0xffffffff + } + + /// Indicates whether a specific ID2D1SimplifiedGeometrySink figure is open or closed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_figure_end typedef enum D2D1_FIGURE_END { + // D2D1_FIGURE_END_OPEN, D2D1_FIGURE_END_CLOSED, D2D1_FIGURE_END_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "44821eef-7ecf-44c1-bbfb-df259c0489dd")] + // public enum D2D1_FIGURE_END{D2D1_FIGURE_END_OPEN, D2D1_FIGURE_END_CLOSED, D2D1_FIGURE_END_FORCE_DWORD, } + public enum D2D1_FIGURE_END : uint + { + /// The figure is open. + D2D1_FIGURE_END_OPEN = 0, + + /// The figure is closed. + D2D1_FIGURE_END_CLOSED = 1, + + /// + D2D1_FIGURE_END_FORCE_DWORD = 0xffffffff + } + + /// Specifies how the intersecting areas of geometries or figures are combined to form the area of the composite geometry. + /// + /// + /// Use the D2D1_FILL_MODE enumeration when creating an ID2D1GeometryGroup with the CreateGeometryGroup method, or when + /// modifying the fill mode of an ID2D1SimplifiedGeometrySink with the ID2D1SimplifiedGeometrySink::SetFillMode method. + /// + /// + /// Direct2D fills the interior of a path by using one of the two fill modes specified by this enumeration: + /// D2D1_FILL_MODE_ALTERNATE (alternate) or D2D1_FILL_MODE_WINDING (winding). Because the modes determine how to fill + /// the interior of a closed shape, all shapes are treated as closed when they are filled. If there is a gap in a segment in a + /// shape, draw an imaginary line to close it. + /// + /// + /// To see the difference between the winding and alternate fill modes, assume that you have four circles with the same center and a + /// different radius, as shown in the following illustration. The first one has the radius of 25, the second 50, the third 75, and + /// the fourth 100. + /// + /// + /// The following illustration shows the shape filled by using the alternate fill mode. Notice that the center and third ring are + /// not filled. This is because a ray drawn from any point in either of those two rings passes through an even number of segments. + /// + /// The following illustration explains this process. + /// The following illustration shows how the same shape is filled when the winding fill mode is specified. + /// + /// Notice that all the rings are filled. This is because all the segments run in the same direction, so a ray drawn from any point + /// will cross one or more segments, and the sum of the crossings will not equal zero. + /// + /// + /// The following illustration explains this process. The red arrows represent the direction in which the segments are drawn and the + /// black arrow represents an arbitrary ray that runs from a point in the innermost ring. Starting with a value of zero, for each + /// segment that the ray crosses, a value of one is added for every clockwise intersection. All points lie in the fill region in + /// this illustration, because the count does not equal zero. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_fill_mode typedef enum D2D1_FILL_MODE { + // D2D1_FILL_MODE_ALTERNATE, D2D1_FILL_MODE_WINDING, D2D1_FILL_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "f1a14447-39fa-4a48-9516-ff5b03abc3a6")] + public enum D2D1_FILL_MODE + { + /// + /// Determines whether a point is in the fill region by drawing a ray from that point to infinity in any direction, and then + /// counting the number of path segments within the given shape that the ray crosses. If this number is odd, the point is in the + /// fill region; if even, the point is outside the fill region. + /// + D2D1_FILL_MODE_ALTERNATE, + + /// + /// Determines whether a point is in the fill region of the path by drawing a ray from that point to infinity in any direction, + /// and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time + /// a segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left, + /// as long as left and right are seen from the perspective of the ray. After counting the crossings, if the result is zero, + /// then the point is outside the path. Otherwise, it is inside the path. + /// + D2D1_FILL_MODE_WINDING, + + /// + D2D1_FILL_MODE_FORCE_DWORD, + } + + /// Specifies which gamma is used for interpolation. + /// + /// + /// Interpolating in a linear gamma space ( D2D1_GAMMA_1_0) can avoid changes in perceived brightness caused by the effect of + /// gamma correction in spaces where the gamma is not 1.0, such as the default sRGB color space, where the gamma is 2.2. For an + /// example of the differences between these two blending modes, consider the following illustration, which shows two gradients, + /// each of which blends from red to blue to green: + /// + /// + /// The first gradient is interpolated linearly in the space of the render target (sRGB in this case), and one can see the dark + /// bands between each color. The second gradient uses a gamma-correct linear interpolation, and thus does not exhibit the same + /// variations in brightness. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_gamma typedef enum D2D1_GAMMA { D2D1_GAMMA_2_2, + // D2D1_GAMMA_1_0, D2D1_GAMMA_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "c84c66c6-5f4a-41de-938c-76a409145971")] + public enum D2D1_GAMMA : uint + { + /// Interpolation is performed in the standard RGB (sRGB) gamma. + D2D1_GAMMA_2_2, + + /// Interpolation is performed in the linear-gamma color space. + D2D1_GAMMA_1_0, + + /// + D2D1_GAMMA_FORCE_DWORD = 0xffffffff, + } + + /// Describes how one geometry object is spatially related to another geometry object. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_geometry_relation typedef enum D2D1_GEOMETRY_RELATION { + // D2D1_GEOMETRY_RELATION_UNKNOWN, D2D1_GEOMETRY_RELATION_DISJOINT, D2D1_GEOMETRY_RELATION_IS_CONTAINED, + // D2D1_GEOMETRY_RELATION_CONTAINS, D2D1_GEOMETRY_RELATION_OVERLAP, D2D1_GEOMETRY_RELATION_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "6c7290c8-9363-414b-af2c-0f2a79da99f9")] + public enum D2D1_GEOMETRY_RELATION : uint + { + /// The relationship between the two geometries cannot be determined. This value is never returned by any D2D method. + D2D1_GEOMETRY_RELATION_UNKNOWN = 0, + + /// The two geometries do not intersect at all. + D2D1_GEOMETRY_RELATION_DISJOINT, + + /// The instance geometry is entirely contained by the passed-in geometry. + D2D1_GEOMETRY_RELATION_IS_CONTAINED, + + /// The instance geometry entirely contains the passed-in geometry. + D2D1_GEOMETRY_RELATION_CONTAINS, + + /// The two geometries overlap but neither completely contains the other. + D2D1_GEOMETRY_RELATION_OVERLAP, + + /// + D2D1_GEOMETRY_RELATION_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how a geometry is simplified to an ID2D1SimplifiedGeometrySink. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_geometry_simplification_option typedef enum + // D2D1_GEOMETRY_SIMPLIFICATION_OPTION { D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES, + // D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "cda5968b-843b-4759-ae0f-cb83e9990590")] + public enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION : uint + { + /// The output can contain cubic Bezier curves and line segments. + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, + + /// The output is flattened so that it contains only line segments. + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES, + + /// + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD = 0xffffffff + } + + /// + /// Specifies options that can be applied when a layer resource is applied to create a layer. + /// + /// Note Starting in Windows 8, the D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE option is no longer supported. See + /// D2D1_LAYER_OPTIONS1 for Windows 8 layer options. + /// + /// + /// + /// + /// ClearType antialiasing must use the current contents of the render target to blend properly. When a pushed layer requests + /// initializing for ClearType, Direct2D copies the current contents of the render target into the layer so that ClearType + /// antialiasing can be performed. Rendering ClearType text into a transparent layer does not produce the desired results. + /// + /// A small performance hit from re-copying content occurs when ID2D1RenderTarget::Clear is called. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_layer_options typedef enum D2D1_LAYER_OPTIONS { + // D2D1_LAYER_OPTIONS_NONE, D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE, D2D1_LAYER_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "d278211a-e99c-429d-9752-45c305f52ed8")] + [Flags] + public enum D2D1_LAYER_OPTIONS : uint + { + /// The text in this layer does not use ClearType antialiasing. + D2D1_LAYER_OPTIONS_NONE = 0x00000000, + + /// + /// The layer renders correctly for ClearType text. If the render target is set to ClearType, the layer continues to render + /// ClearType. If the render target is set to ClearType and this option is not specified, the render target will be set to + /// render gray-scale until the layer is popped. The caller can override this default by calling SetTextAntialiasMode while + /// within the layer. This flag is slightly slower than the default. + /// + D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001, + + /// + D2D1_LAYER_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// Describes the shape that joins two lines or segments. + /// + /// + /// A miter limit affects how sharp miter joins are allowed to be. If the line join style is D2D1_LINE_JOIN_MITER_OR_BEVEL, + /// then the join will be mitered with regular angular vertices if it doesn't extend beyond the miter limit; otherwise, the line + /// join will be beveled. + /// + /// The following illustration shows different line join settings for the same stroked path geometry. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_line_join typedef enum D2D1_LINE_JOIN { + // D2D1_LINE_JOIN_MITER, D2D1_LINE_JOIN_BEVEL, D2D1_LINE_JOIN_ROUND, D2D1_LINE_JOIN_MITER_OR_BEVEL, D2D1_LINE_JOIN_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "4368e93e-af69-4555-ac2b-c9c576c81372")] + public enum D2D1_LINE_JOIN : uint + { + /// Regular angular vertices. + D2D1_LINE_JOIN_MITER, + + /// Beveled vertices. + D2D1_LINE_JOIN_BEVEL, + + /// Rounded vertices. + D2D1_LINE_JOIN_ROUND, + + /// Regular angular vertices unless the join would extend beyond the miter limit; otherwise, beveled vertices. + D2D1_LINE_JOIN_MITER_OR_BEVEL, + + /// + D2D1_LINE_JOIN_FORCE_DWORD = 0xffffffff, + } + + /// + /// Describes whether an opacity mask contains graphics or text. Direct2D uses this information to determine which gamma space to + /// use when blending the opacity mask. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_opacity_mask_content typedef enum D2D1_OPACITY_MASK_CONTENT + // { D2D1_OPACITY_MASK_CONTENT_GRAPHICS, D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL, D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE, + // D2D1_OPACITY_MASK_CONTENT_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "ea14d7eb-b8cc-4ab8-8f51-9174748ee6a2")] + public enum D2D1_OPACITY_MASK_CONTENT : uint + { + /// The opacity mask contains graphics. The opacity mask is blended in the gamma 2.2 color space. + D2D1_OPACITY_MASK_CONTENT_GRAPHICS, + + /// + /// The opacity mask contains non-GDI text. The gamma space used for blending is obtained from the render target's text + /// rendering parameters. (ID2D1RenderTarget::SetTextRenderingParams). + /// + D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL, + + /// + /// The opacity mask contains text rendered using the GDI-compatible rendering mode. The opacity mask is blended using the gamma + /// for GDI rendering. + /// + D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE, + + /// + D2D1_OPACITY_MASK_CONTENT_FORCE_DWORD = 0xffffffff, + } + + /// + /// Indicates whether a segment should be stroked and whether the join between this segment and the previous one should be smooth. + /// This enumeration allows a bitwise combination of its member values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_path_segment typedef enum D2D1_PATH_SEGMENT { + // D2D1_PATH_SEGMENT_NONE, D2D1_PATH_SEGMENT_FORCE_UNSTROKED, D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN, D2D1_PATH_SEGMENT_FORCE_DWORD + // } ; + [PInvokeData("d2d1.h", MSDNShortId = "375a0a40-ec98-4f41-9c15-d284f8b17a73")] + [Flags] + public enum D2D1_PATH_SEGMENT : uint + { + /// The segment is joined as specified by the ID2D1StrokeStyle interface, and it is stroked. + D2D1_PATH_SEGMENT_NONE = 0x00000000, + + /// The segment is not stroked. + D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001, + + /// + /// The segment is always joined with the one preceding it using a round line join, regardless of which + /// D2D1_LINE_JOINenumeration is specified by the ID2D1StrokeStyle interface. If this segment is the first segment and the + /// figure is closed, a round line join is used to connect the closing segment with the first segment. If the figure is not + /// closed, this setting has no effect on the first segment of the figure. If ID2D1SimplifiedGeometrySink::SetSegmentFlags is + /// called just before ID2D1SimplifiedGeometrySink::EndFigure, the join between the closing segment and the last explicitly + /// specified segment is affected. + /// + D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002, + + /// + D2D1_PATH_SEGMENT_FORCE_DWORD = 0xffffffff + } + + /// + /// Describes how a render target behaves when it presents its content. This enumeration allows a bitwise combination of its member values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_present_options typedef enum D2D1_PRESENT_OPTIONS { + // D2D1_PRESENT_OPTIONS_NONE, D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS, D2D1_PRESENT_OPTIONS_IMMEDIATELY, + // D2D1_PRESENT_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "56178ee9-7d35-42e1-97f8-62835010f277")] + [Flags] + public enum D2D1_PRESENT_OPTIONS : uint + { + /// The render target waits until the display refreshes to present and discards the frame upon presenting. + D2D1_PRESENT_OPTIONS_NONE, + + /// The render target does not discard the frame upon presenting. + D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS, + + /// The render target does not wait until the display refreshes to present. + D2D1_PRESENT_OPTIONS_IMMEDIATELY, + + /// + D2D1_PRESENT_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// Defines when font resources should be subset during printing. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_print_font_subset_mode typedef enum + // D2D1_PRINT_FONT_SUBSET_MODE { D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE, + // D2D1_PRINT_FONT_SUBSET_MODE_NONE, D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "B8361117-6018-48EE-AD3D-2A37F6B71293")] + public enum D2D1_PRINT_FONT_SUBSET_MODE : uint + { + /// + D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, + + /// + D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE, + + /// + D2D1_PRINT_FONT_SUBSET_MODE_NONE, + + /// + D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD = 0xffffffff, + } + + /// + /// Describes whether a render target uses hardware or software rendering, or if Direct2D should select the rendering mode. + /// + /// Not every render target supports hardware rendering. For more information, see the Render Targets Overview. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_render_target_type typedef enum D2D1_RENDER_TARGET_TYPE { + // D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1_RENDER_TARGET_TYPE_SOFTWARE, D2D1_RENDER_TARGET_TYPE_HARDWARE, + // D2D1_RENDER_TARGET_TYPE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "4ae6e4cf-e1c9-476e-a7b5-31cdad9cf321")] + public enum D2D1_RENDER_TARGET_TYPE : uint + { + /// The render target uses hardware rendering, if available; otherwise, it uses software rendering. + D2D1_RENDER_TARGET_TYPE_DEFAULT, + + /// The render target uses software rendering only. + D2D1_RENDER_TARGET_TYPE_SOFTWARE, + + /// The render target uses hardware rendering only. + D2D1_RENDER_TARGET_TYPE_HARDWARE, + + /// + D2D1_RENDER_TARGET_TYPE_FORCE_DWORD = 0xffffffff, + } + + /// + /// Describes how a render target is remoted and whether it should be GDI-compatible. This enumeration allows a bitwise combination + /// of its member values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_render_target_usage typedef enum D2D1_RENDER_TARGET_USAGE { + // D2D1_RENDER_TARGET_USAGE_NONE, D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING, D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE, + // D2D1_RENDER_TARGET_USAGE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "12d717c4-5f81-4bbf-a693-042e51913081")] + public enum D2D1_RENDER_TARGET_USAGE : uint + { + /// + /// The render target attempts to use Direct3D command-stream remoting and uses bitmap remoting if stream remoting fails. The + /// render target is not GDI-compatible. + /// + D2D1_RENDER_TARGET_USAGE_NONE, + + /// The render target renders content locally and sends it to the terminal services client as a bitmap. + D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING, + + /// The render target can be used efficiently with GDI. + D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE, + + /// + D2D1_RENDER_TARGET_USAGE_FORCE_DWORD = 0xffffffff, + } + + /// Defines the direction that an elliptical arc is drawn. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_sweep_direction typedef enum D2D1_SWEEP_DIRECTION { + // D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_SWEEP_DIRECTION_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "97e6f384-7a42-4852-b948-66010bffed22")] + public enum D2D1_SWEEP_DIRECTION : uint + { + /// Arcs are drawn in a counterclockwise (negative-angle) direction. + D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0, + + /// Arcs are drawn in a clockwise (positive-angle) direction. + D2D1_SWEEP_DIRECTION_CLOCKWISE = 1, + + /// + D2D1_SWEEP_DIRECTION_FORCE_DWORD = 0xffffffff + } + + /// Describes the antialiasing mode used for drawing text. + /// + /// This enumeration is used with the SetTextAntialiasMode of an ID2D1RenderTarget to specify how text and glyphs are antialiased. + /// By default, Direct2D renders text in ClearType mode. Factors that + /// can downgrade the default quality to grayscale or aliased: + /// + /// + /// + /// If the DWRITE_RENDERING_MODE value is DWRITE_RENDERING_MODE_ALIASED, then the default text antialiasing mode is aliased. + /// To change the DirectWrite rendering mode of an ID2D1RenderTarget, use the ID2D1RenderTarget::SetTextRenderingParams method. + /// + /// + /// + /// + /// If the render target has an alpha channel and is not set to D2D1_ALPHA_MODE_IGNORE, then the default text antialiasing mode is grayscale. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_text_antialias_mode typedef enum D2D1_TEXT_ANTIALIAS_MODE { + // D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE, D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE, + // D2D1_TEXT_ANTIALIAS_MODE_ALIASED, D2D1_TEXT_ANTIALIAS_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "d2c829d7-9892-4cbb-9993-12bb7d77fc25")] + public enum D2D1_TEXT_ANTIALIAS_MODE : uint + { + /// Use the system default. See Remarks. + D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, + + /// Use ClearType antialiasing. + D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE, + + /// Use grayscale antialiasing. + D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE, + + /// Do not use antialiasing. + D2D1_TEXT_ANTIALIAS_MODE_ALIASED, + + /// + D2D1_TEXT_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Describes whether a window is occluded. + /// + /// If the window was occluded the last time EndDraw was called, the next time the render target calls CheckWindowState, it returns + /// D2D1_WINDOW_STATE_OCCLUDED regardless of the current window state. If you want to use CheckWindowState to check + /// the current window state, call CheckWindowState after every EndDraw call and ignore its return value. This will + /// ensure that your next call to CheckWindowState state returns the actual window state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_window_state typedef enum D2D1_WINDOW_STATE { + // D2D1_WINDOW_STATE_NONE, D2D1_WINDOW_STATE_OCCLUDED, D2D1_WINDOW_STATE_FORCE_DWORD } ; + [PInvokeData("d2d1.h", MSDNShortId = "79d3a903-f29e-4d0d-9918-85fbfc846517")] + [Flags] + public enum D2D1_WINDOW_STATE : uint + { + /// The window is not occluded. + D2D1_WINDOW_STATE_NONE = 0x0000000, + + /// The window is occluded. + D2D1_WINDOW_STATE_OCCLUDED = 0x0000001, + + /// + D2D1_WINDOW_STATE_FORCE_DWORD = 0xffffffff + } + + /// Computes the maximum factor by which a given transform can stretch any vector. + /// The input transform matrix. + /// The scale factor. + /// + /// + /// Formally, if M is the input matrix, this method will return the maximum value of |V * M| / |V| for all vectors V, where |.| + /// denotes length. + /// + /// + /// Note Since this describes how M affects vectors (rather than points), the translation components (_31 and _32) of M are ignored. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_2/nf-d2d1_2-d2d1computemaximumscalefactor FLOAT + // D2D1ComputeMaximumScaleFactor( const D2D1_MATRIX_3X2_F *matrix ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_2.h", MSDNShortId = "5BC10305-436F-4528-9647-E70713130505")] + public static extern float D2D1ComputeMaximumScaleFactor(in D2D_MATRIX_3X2_F matrix); + + /// Converts the given color from one colorspace to another. + /// + /// Type: D2D1_COLOR_SPACE + /// The source color space. + /// + /// + /// Type: D2D1_COLOR_SPACE + /// The destination color space. + /// + /// + /// Type: const D2D1_COLOR_F* + /// The source color. + /// + /// + /// Type: D2D1_COLOR_F + /// The converted color. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-d2d1convertcolorspace D2D1_COLOR_F D2D1ConvertColorSpace( + // D2D1_COLOR_SPACE sourceColorSpace, D2D1_COLOR_SPACE destinationColorSpace, const D2D1_COLOR_F *color ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_1.h", MSDNShortId = "ECFE9F50-290D-4E6C-90AB-A46B9E413A48")] + public static extern D3DCOLORVALUE D2D1ConvertColorSpace(D2D1_COLOR_SPACE sourceColorSpace, D2D1_COLOR_SPACE destinationColorSpace, in D3DCOLORVALUE color); + + /// Creates a new Direct2D device associated with the provided DXGI device. + /// The DXGI device the Direct2D device is associated with. + /// The properties to apply to the Direct2D device. + /// When this function returns, contains the address of a pointer to a Direct2D device. + /// + /// The function returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// E_OUTOFMEMORY + /// Direct2D could not allocate sufficient memory to complete the call. + /// + /// + /// E_INVALIDARG + /// An invalid value was passed to the method. + /// + /// + /// + /// + /// This function will also create a new ID2D1Factory1 that can be retrieved through ID2D1Resource::GetFactory. + /// + /// If the creation properties are not specified, then d2dDevice will inherit its threading mode from dxgiDevice and debug tracing + /// will not be enabled. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-d2d1createdevice HRESULT D2D1CreateDevice( IDXGIDevice + // *dxgiDevice, const D2D1_CREATION_PROPERTIES *creationProperties, ID2D1Device **d2dDevice ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_1.h", MSDNShortId = "5ed3ec21-b609-41b6-9568-6ede460bc395")] + public static extern HRESULT D2D1CreateDevice(IDXGIDevice dxgiDevice, in D2D1_CREATION_PROPERTIES creationProperties, out ID2D1Device d2dDevice); + + /// Creates a new Direct2D device context associated with a DXGI surface. + /// The DXGI surface the Direct2D device context is associated with. + /// The properties to apply to the Direct2D device context. + /// When this function returns, contains the address of a pointer to a Direct2D device context. + /// + /// The function returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// E_OUTOFMEMORY + /// Direct2D could not allocate sufficient memory to complete the call. + /// + /// + /// E_INVALIDARG + /// An invalid value was passed to the method. + /// + /// + /// + /// + /// This function will also create a new ID2D1Factory1 that can be retrieved through ID2D1Resource::GetFactory. + /// This function will also create a new ID2D1Device that can be retrieved through ID2D1DeviceContext::GetDevice. + /// The DXGI device will be specified implicitly through dxgiSurface. + /// + /// If creationProperties are not specified, the Direct2D device will inherit its threading mode from the DXGI device implied by + /// dxgiSurface and debug tracing will not be enabled. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-d2d1createdevicecontext HRESULT D2D1CreateDeviceContext( + // IDXGISurface *dxgiSurface, const D2D1_CREATION_PROPERTIES *creationProperties, ID2D1DeviceContext **d2dDeviceContext ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_1.h", MSDNShortId = "0e56d057-20a5-47b7-aec9-63c8e31f349b")] + public static extern HRESULT D2D1CreateDeviceContext(IDXGISurface dxgiSurface, in D2D1_CREATION_PROPERTIES creationProperties, out ID2D1DeviceContext d2dDeviceContext); + + /// Creates a factory object that can be used to create Direct2D resources. + /// + /// Type: D2D1_FACTORY_TYPE + /// The threading model of the factory and the resources it creates. + /// + /// + /// Type: REFIID + /// A reference to the IID of ID2D1Factory that is obtained by using . + /// + /// + /// Type: const D2D1_FACTORY_OPTIONS* + /// The level of detail provided to the debugging layer. + /// + /// + /// Type: void** + /// When this method returns, contains the address to a pointer to the new factory. + /// + /// + /// Type: HRESULT + /// If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// The ID2D1Factory interface provides the starting point for Direct2D. In general, an object created from a single instance of a + /// factory object can be used with other resources created from that instance, but not with resources created by other factory instances. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-d2d1createfactory HRESULT D2D1CreateFactory( D2D1_FACTORY_TYPE + // factoryType, REFIID riid, const D2D1_FACTORY_OPTIONS *pFactoryOptions, void **ppIFactory ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1.h", MSDNShortId = "8c0a685a-8f33-4072-a715-bb423cb44f03")] + public static extern HRESULT D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, in Guid riid, [In, Optional] IntPtr pFactoryOptions, [MarshalAs(UnmanagedType.IUnknown)] out object ppIFactory); + + /// Creates a factory object that can be used to create Direct2D resources. + /// The type of the factory interface to create. + /// + /// Type: D2D1_FACTORY_TYPE + /// The threading model of the factory and the resources it creates. + /// + /// + /// Type: D2D1_FACTORY_OPTIONS? + /// Optional level of detail provided to the debugging layer. + /// + /// When this method returns, contains the new factory interface specified in . + [PInvokeData("d2d1.h", MSDNShortId = "8c0a685a-8f33-4072-a715-bb423cb44f03")] + public static T D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType = D2D1_FACTORY_TYPE.D2D1_FACTORY_TYPE_SINGLE_THREADED, [In] D2D1_FACTORY_OPTIONS? pFactoryOptions = null) where T : class + { + using SafeCoTaskMemStruct opts = pFactoryOptions; + D2D1CreateFactory(factoryType, typeof(T).GUID, opts, out var ppv).ThrowIfFailed(); + return (T)ppv; + } + + /// + /// Returns the interior points for a gradient mesh patch based on the points defining a Coons patch. + /// Note + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 0. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 1. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 2. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 3. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 4. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 5. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 6. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 7. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 8. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 9. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 10. + /// + /// + /// Type: D2D1_POINT_2F* + /// The coordinate-space location of the control point at position 11. + /// + /// + /// Type: D2D1_POINT_2F* + /// Returns the interior point for the gradient mesh corresponding to point11 in the D2D1_GRADIENT_MESH_PATCH structure. + /// + /// + /// Type: D2D1_POINT_2F* + /// Returns the interior point for the gradient mesh corresponding to point12 in the D2D1_GRADIENT_MESH_PATCH structure. + /// + /// + /// Type: D2D1_POINT_2F* + /// Returns the interior point for the gradient mesh corresponding to point21 in the D2D1_GRADIENT_MESH_PATCH structure. + /// + /// + /// Type: D2D1_POINT_2F* + /// Returns the interior point for the gradient mesh corresponding to point22 in the D2D1_GRADIENT_MESH_PATCH structure. + /// + /// None + /// This function is called by the GradientMeshPatchFromCoonsPatch function and is not intended to be used directly. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_3/nf-d2d1_3-d2d1getgradientmeshinteriorpointsfromcoonspatch void + // D2D1GetGradientMeshInteriorPointsFromCoonsPatch( const D2D1_POINT_2F *pPoint0, const D2D1_POINT_2F *pPoint1, const D2D1_POINT_2F + // *pPoint2, const D2D1_POINT_2F *pPoint3, const D2D1_POINT_2F *pPoint4, const D2D1_POINT_2F *pPoint5, const D2D1_POINT_2F *pPoint6, + // const D2D1_POINT_2F *pPoint7, const D2D1_POINT_2F *pPoint8, const D2D1_POINT_2F *pPoint9, const D2D1_POINT_2F *pPoint10, const + // D2D1_POINT_2F *pPoint11, D2D1_POINT_2F *pTensorPoint11, D2D1_POINT_2F *pTensorPoint12, D2D1_POINT_2F *pTensorPoint21, + // D2D1_POINT_2F *pTensorPoint22 ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_3.h", MSDNShortId = "388d5cbf-cb15-f0c9-3f3b-897f68519a4c")] + public static extern void D2D1GetGradientMeshInteriorPointsFromCoonsPatch(in D2D_POINT_2F pPoint0, in D2D_POINT_2F pPoint1, in D2D_POINT_2F pPoint2, in D2D_POINT_2F pPoint3, + in D2D_POINT_2F pPoint4, in D2D_POINT_2F pPoint5, in D2D_POINT_2F pPoint6, in D2D_POINT_2F pPoint7, in D2D_POINT_2F pPoint8, in D2D_POINT_2F pPoint9, + in D2D_POINT_2F pPoint10, in D2D_POINT_2F pPoint11, out D2D_POINT_2F pTensorPoint11, out D2D_POINT_2F pTensorPoint12, out D2D_POINT_2F pTensorPoint21, out D2D_POINT_2F pTensorPoint22); + + /// Tries to invert the specified matrix. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The matrix to invert. + /// + /// + /// Type: BOOL + /// true if the matrix was inverted; otherwise, false. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-d2d1invertmatrix BOOL D2D1InvertMatrix( D2D1_MATRIX_3X2_F *matrix ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1.h", MSDNShortId = "af01b6df-ada9-4e21-98f0-356b96d1017a")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool D2D1InvertMatrix(ref D2D_MATRIX_3X2_F matrix); + + /// Indicates whether the specified matrix is invertible. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The matrix to test. + /// + /// + /// Type: BOOL + /// true if the matrix was inverted; otherwise, false. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-d2d1ismatrixinvertible BOOL D2D1IsMatrixInvertible( const + // D2D1_MATRIX_3X2_F *matrix ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1.h", MSDNShortId = "c8ba9c60-dfc4-4872-81e0-e68dfd13f00e")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool D2D1IsMatrixInvertible(in D2D_MATRIX_3X2_F matrix); + + /// Creates a rotation transformation that rotates by the specified angle about the specified point. + /// + /// Type: FLOAT + /// The clockwise rotation angle, in degrees. + /// + /// + /// Type: D2D1_POINT_2F + /// The point about which to rotate. + /// + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this method returns, contains the new rotation transformation. You must allocate storage for this parameter. + /// + /// None + /// Rotation occurs in the plane of the 2-D surface. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-d2d1makerotatematrix void D2D1MakeRotateMatrix( FLOAT angle, + // D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1.h", MSDNShortId = "5e066328-5b0f-4e7a-9bf4-df55521fcc2b")] + public static extern void D2D1MakeRotateMatrix(float angle, D2D_POINT_2F center, out D2D_MATRIX_3X2_F matrix); + + /// Creates a skew transformation that has the specified x-axis angle, y-axis angle, and center point. + /// + /// Type: FLOAT + /// The x-axis skew angle, which is measured in degrees counterclockwise from the y-axis. + /// + /// + /// Type: FLOAT + /// The y-axis skew angle, which is measured in degrees counterclockwise from the x-axis. + /// + /// + /// Type: D2D1_POINT_2F + /// The center point of the skew operation. + /// + /// + /// Type: D2D1_MATRIX_3X2_F* + /// When this method returns, contains the rotation transformation. You must allocate storate for this parameter. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-d2d1makeskewmatrix void D2D1MakeSkewMatrix( FLOAT angleX, FLOAT + // angleY, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1.h", MSDNShortId = "9f29488c-37f0-4d53-9e3b-3b27e841c8b4")] + public static extern void D2D1MakeSkewMatrix(float angleX, float angleY, D2D_POINT_2F center, out D2D_MATRIX_3X2_F matrix); + + /// Returns the sine and cosine of an angle. + /// + /// Type: FLOAT + /// The angle to calculate. + /// + /// + /// Type: FLOAT* + /// The sine of the angle. + /// + /// + /// Type: FLOAT* + /// The cosine of the angle. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-d2d1sincos void D2D1SinCos( FLOAT angle, FLOAT *s, FLOAT *c ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_1.h", MSDNShortId = "CE5899A8-B70F-492E-9A16-849FB64830AC")] + public static extern void D2D1SinCos(float angle, out float s, out float c); + + /// Returns the tangent of an angle. + /// + /// Type: FLOAT + /// The angle to calculate the tangent for. + /// + /// + /// Type: FLOAT + /// The tangent of the angle. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-d2d1tan FLOAT D2D1Tan( FLOAT angle ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_1.h", MSDNShortId = "2BC66DEA-5C40-4EBA-8CDB-B48036E8A85F")] + public static extern float D2D1Tan(float angle); + + /// Returns the length of a 3 dimensional vector. + /// + /// Type: FLOAT + /// The x value of the vector. + /// + /// + /// Type: FLOAT + /// The y value of the vector. + /// + /// + /// Type: FLOAT + /// The z value of the vector. + /// + /// + /// Type: FLOAT + /// The length of the vector. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-d2d1vec3length FLOAT D2D1Vec3Length( FLOAT x, FLOAT y, FLOAT + // z ); + [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] + [PInvokeData("d2d1_1.h", MSDNShortId = "0E305151-63EA-4865-B9C4-5F685D17FD5A")] + public static extern float D2D1Vec3Length(float x, float y, float z); + + /// Represents a 3-by-2 matrix. + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_matrix_3x2_f typedef struct D2D_MATRIX_3X2_F { union { + // struct { FLOAT m11; FLOAT m12; FLOAT m21; FLOAT m22; FLOAT dx; FLOAT dy; }; struct { FLOAT _11; FLOAT _12; FLOAT _21; FLOAT _22; + // FLOAT _31; FLOAT _32; }; FLOAT m[3][2]; }; } D2D_MATRIX_3X2_F; + [PInvokeData("dcommon.h", MSDNShortId = "c8a54bad-4376-479b-8529-1e407623e473")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D_MATRIX_3X2_F + { + /// Horizontal scaling / cosine of rotation + public float m11; + + /// Vertical shear / sine of rotation + public float m12; + + /// Horizontal shear / negative sine of rotation + public float m21; + + /// Vertical scaling / cosine of rotation + public float m22; + + /// Horizontal shift (always orthogonal regardless of rotation) + public float dx; + + /// Vertical shift (always orthogonal regardless of rotation) + public float dy; + +#pragma warning disable IDE1006 // Naming Styles + + /// Gets or sets the values as a multidimensional (3x2) array. + /// The array value. + /// m - Value must a 3x2 array. + public float[,] m + { + get => new[,] { { m11, m12 }, { m21, m22 }, { dx, dy } }; + set + { + if (value.GetLength(0) != 3 || value.GetLength(1) != 2) + throw new ArgumentOutOfRangeException(nameof(m), "Value must a 3x2 array."); + m11 = value[0, 0]; + m12 = value[0, 1]; + m21 = value[1, 0]; + m22 = value[1, 1]; + dx = value[2, 0]; + dy = value[2, 1]; + } + } + +#pragma warning restore IDE1006 // Naming Styles + } + + /// Represents an x-coordinate and y-coordinate pair, expressed as floating-point values, in two-dimensional space. + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_point_2f typedef struct D2D_POINT_2F { FLOAT x; FLOAT + // y; } D2D_POINT_2F; + [PInvokeData("dcommon.h", MSDNShortId = "2ee55d63-594b-482d-9e31-2378369c6c30")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D_POINT_2F + { + /// + /// Type: FLOAT + /// The x-coordinate of the point. + /// + public float x; + + /// + /// Type: FLOAT + /// The y-coordinate of the point. + /// + public float y; + } + + /// + /// Represents a rectangle defined by the coordinates of the upper-left corner (left, top) and the coordinates of the lower-right + /// corner (right, bottom). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_rect_f typedef struct D2D_RECT_F { FLOAT left; FLOAT + // top; FLOAT right; FLOAT bottom; } D2D_RECT_F; + [PInvokeData("dcommon.h", MSDNShortId = "84bd7ab0-f273-46f8-b261-86cd1d7f3868")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D_RECT_F + { + /// + /// Type: FLOAT + /// The x-coordinate of the upper-left corner of the rectangle. + /// + public float left; + + /// + /// Type: FLOAT + /// The y-coordinate of the upper-left corner of the rectangle. + /// + public float top; + + /// + /// Type: FLOAT + /// The x-coordinate of the lower-right corner of the rectangle. + /// + public float right; + + /// + /// Type: FLOAT + /// The y-coordinate of the lower-right corner of the rectangle. + /// + public float bottom; + } + + /// Stores an ordered pair of floating-point values, typically the width and height of a rectangle. + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_size_f typedef struct D2D_SIZE_F { FLOAT width; FLOAT + // height; } D2D_SIZE_F; + [PInvokeData("dcommon.h", MSDNShortId = "9d519bb9-3eb8-4d7e-ba00-b6cf5a428a04")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D_SIZE_F + { + /// + /// Type: FLOAT + /// The horizontal component of this size. + /// + public float width; + + /// + /// Type: FLOAT + /// The vertical component of this size. + /// + public float height; + } + + /// Stores an ordered pair of integers, typically the width and height of a rectangle. + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_size_u typedef struct D2D_SIZE_U { UINT32 width; UINT32 + // height; } D2D_SIZE_U; + [PInvokeData("dcommon.h", MSDNShortId = "d9ea9df5-7c5f-4afa-9859-14d77b017904")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D_SIZE_U + { + /// + /// Type: UINT32 + /// The horizontal component of this size. + /// + public uint width; + + /// + /// Type: UINT32 + /// The vertical component of this size. + /// + public uint height; + } + + /// Describes an elliptical arc between two points. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_arc_segment typedef struct D2D1_ARC_SEGMENT { D2D1_POINT_2F + // point; D2D1_SIZE_F size; FLOAT rotationAngle; D2D1_SWEEP_DIRECTION sweepDirection; D2D1_ARC_SIZE arcSize; } D2D1_ARC_SEGMENT; + [PInvokeData("d2d1.h", MSDNShortId = "3f391265-20b4-4897-aa0b-d14b71cd5f0a")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_ARC_SEGMENT + { + /// + /// Type: D2D1_POINT_2F + /// The end point of the arc. + /// + public D2D_POINT_2F point; + + /// + /// Type: D2D1_SIZE_F + /// The x-radius and y-radius of the arc. + /// + public D2D_SIZE_F size; + + /// + /// Type: FLOAT + /// + /// A value that specifies how many degrees in the clockwise direction the ellipse is rotated relative to the current coordinate system. + /// + /// + public float rotationAngle; + + /// + /// Type: D2D1_SWEEP_DIRECTION + /// A value that specifies whether the arc sweep is clockwise or counterclockwise. + /// + public D2D1_SWEEP_DIRECTION sweepDirection; + + /// + /// Type: D2D1_ARC_SIZE + /// A value that specifies whether the given arc is larger than 180 degrees. + /// + public D2D1_ARC_SIZE arcSize; + } + + /// Represents a cubic bezier segment drawn between two points. + /// + /// + /// A cubic Bezier curve is defined by four points: a start point, an end point (point3), and two control points (point1 and + /// point2). A Bezier segment does not contain a property for the starting point of the curve; it defines only the end point. The + /// beginning point of the curve is the current point of the path to which the Bezier curve is added. + /// + /// + /// The two control points of a cubic Bezier curve behave like magnets, attracting portions of what would otherwise be a straight + /// line toward themselves and producing a curve. The first control point, point1, affects the beginning portion of the curve; the + /// second control point, point2, affects the ending portion of the curve. + /// + /// + /// Note The curve doesn't necessarily pass through either of the control points; each control point moves its portion of the + /// line toward itself, but not through itself. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_bezier_segment typedef struct D2D1_BEZIER_SEGMENT { + // D2D1_POINT_2F point1; D2D1_POINT_2F point2; D2D1_POINT_2F point3; } D2D1_BEZIER_SEGMENT; + [PInvokeData("d2d1.h", MSDNShortId = "cf8df7d2-c4fe-4a46-a4b2-7e0eed67df2a")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_BEZIER_SEGMENT + { + /// + /// Type: D2D1_POINT_2F + /// The first control point for the Bezier segment. + /// + public D2D_POINT_2F point1; + + /// + /// Type: D2D1_POINT_2F + /// The second control point for the Bezier segment. + /// + public D2D_POINT_2F point2; + + /// + /// Type: D2D1_POINT_2F + /// The end point for the Bezier segment. + /// + public D2D_POINT_2F point3; + } + + /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_bitmap_brush_properties typedef struct + // D2D1_BITMAP_BRUSH_PROPERTIES { D2D1_EXTEND_MODE extendModeX; D2D1_EXTEND_MODE extendModeY; D2D1_BITMAP_INTERPOLATION_MODE + // interpolationMode; } D2D1_BITMAP_BRUSH_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "e252d1b4-2f34-4479-94fc-636d4115b00c")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_BITMAP_BRUSH_PROPERTIES + { + /// + /// Type: D2D1_EXTEND_MODE + /// A value that describes how the brush horizontally tiles those areas that extend past its bitmap. + /// + public D2D1_EXTEND_MODE extendModeX; + + /// + /// Type: D2D1_EXTEND_MODE + /// A value that describes how the brush vertically tiles those areas that extend past its bitmap. + /// + public D2D1_EXTEND_MODE extendModeY; + + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// A value that specifies how the bitmap is interpolated when it is scaled or rotated. + /// + public D2D1_BITMAP_INTERPOLATION_MODE interpolationMode; + } + + /// Describes the pixel format and dpi of a bitmap. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_bitmap_properties typedef struct D2D1_BITMAP_PROPERTIES { + // D2D1_PIXEL_FORMAT pixelFormat; FLOAT dpiX; FLOAT dpiY; } D2D1_BITMAP_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "050246fd-f91a-4a2a-858a-5f0447e3ecbf")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_BITMAP_PROPERTIES + { + /// + /// Type: D2D1_PIXEL_FORMAT + /// The bitmap's pixel format and alpha mode. + /// + public D2D1_PIXEL_FORMAT pixelFormat; + + /// + /// Type: FLOAT + /// The horizontal dpi of the bitmap. + /// + public float dpiX; + + /// + /// Type: FLOAT + /// The vertical dpi of the bitmap. + /// + public float dpiY; + } + + /// Describes the opacity and transformation of a brush. + /// + /// + /// This structure is used when creating a brush. For convenience, Direct2D provides the D2D1::BrushProperties function for creating + /// D2D1_BRUSH_PROPERTIES structures. + /// + /// After creating a brush, you can change its opacity or transform by calling the SetOpacity or SetTransform methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_brush_properties typedef struct D2D1_BRUSH_PROPERTIES { + // FLOAT opacity; D2D1_MATRIX_3X2_F transform; } D2D1_BRUSH_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "37b2fc18-a320-41c0-8717-dcd561a2f2df")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_BRUSH_PROPERTIES + { + /// + /// Type: FLOAT + /// A value between 0.0f and 1.0f, inclusive, that specifies the degree of opacity of the brush. + /// + public float opacity; + + /// + /// Type: D2D1_MATRIX_3X2_F + /// The transformation that is applied to the brush. + /// + public D2D_MATRIX_3X2_F transform; + } + + /// Describes the drawing state of a render target. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_drawing_state_description typedef struct + // D2D1_DRAWING_STATE_DESCRIPTION { D2D1_ANTIALIAS_MODE antialiasMode; D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; ulong tag1; ulong + // tag2; D2D1_MATRIX_3X2_F transform; } D2D1_DRAWING_STATE_DESCRIPTION; + [PInvokeData("d2d1.h", MSDNShortId = "ba4adc4b-4d86-40c4-8911-1c800d3c6f3e")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_DRAWING_STATE_DESCRIPTION + { + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode for subsequent nontext drawing operations. + /// + public D2D1_ANTIALIAS_MODE antialiasMode; + + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode for subsequent text and glyph drawing operations. + /// + public D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; + + /// + /// Type: ulong + /// A label for subsequent drawing operations. + /// + public ulong tag1; + + /// + /// Type: ulong + /// A label for subsequent drawing operations. + /// + public ulong tag2; + + /// + /// Type: D2D1_MATRIX_3X2_F + /// The transformation to apply to subsequent drawing operations. + /// + public D2D_MATRIX_3X2_F transform; + } + + /// Contains the center point, x-radius, and y-radius of an ellipse. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_ellipse typedef struct D2D1_ELLIPSE { D2D1_POINT_2F point; + // FLOAT radiusX; FLOAT radiusY; } D2D1_ELLIPSE; + [PInvokeData("d2d1.h", MSDNShortId = "6fed6c49-ba83-4c2b-af8a-04156ee317f0")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_ELLIPSE + { + /// + /// Type: D2D1_POINT_2F + /// The center point of the ellipse. + /// + public D2D_POINT_2F point; + + /// + /// Type: FLOAT + /// The X-radius of the ellipse. + /// + public float radiusX; + + /// + /// Type: FLOAT + /// The Y-radius of the ellipse. + /// + public float radiusY; + } + + /// Contains the debugging level of an ID2D1Factory object. + /// To enable debugging, you must install the Direct2D Debug Layer. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_factory_options typedef struct D2D1_FACTORY_OPTIONS { + // D2D1_DEBUG_LEVEL debugLevel; } D2D1_FACTORY_OPTIONS; + [PInvokeData("d2d1.h", MSDNShortId = "2765d34e-978c-4121-82c9-2780d54e2850")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_FACTORY_OPTIONS + { + /// + /// Type: D2D1_DEBUG_LEVEL + /// The debugging level of the ID2D1Factory object. + /// + public D2D1_DEBUG_LEVEL debugLevel; + } + + /// Contains the position and color of a gradient stop. + /// + /// + /// Gradient stops can be specified in any order if they are at different positions. Two stops may share a position. In this case, + /// the first stop specified is treated as the "low" stop (nearer 0.0f) and subsequent stops are treated as "higher" (nearer 1.0f). + /// This behavior is useful if a caller wants an instant transition in the middle of a stop. + /// + /// + /// Typically, there are at least two points in a collection, although creation with only one stop is permitted. For example, one + /// point is at position 0.0f, another point is at position 1.0f, and additional points are distributed in the [0, 1] range. Where + /// the gradient progression is beyond the range of [0, 1], the stops are stored, but may affect the gradient. + /// + /// + /// When drawn, the [0, 1] range of positions is mapped to the brush, in a brush-dependent way. For details, see + /// ID2D1LinearGradientBrush and ID2D1RadialGradientBrush. + /// + /// + /// Gradient stops with a position outside the [0, 1] range cannot be seen explicitly, but they can still affect the colors produced + /// in the [0, 1] range. For example, a two-stop gradient {{0.0f, Black}, {2.0f, White}} is indistinguishable visually from {{0.0f, + /// Black}, {1.0f, Mid-level gray}}. Also, the colors are clamped before interpolation. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_gradient_stop typedef struct D2D1_GRADIENT_STOP { FLOAT + // position; D2D1_COLOR_F color; } D2D1_GRADIENT_STOP; + [PInvokeData("d2d1.h", MSDNShortId = "f6798542-382a-4074-bbe1-707bc00b3575")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_GRADIENT_STOP + { + /// + /// Type: FLOAT + /// + /// A value that indicates the relative position of the gradient stop in the brush. This value must be in the [0.0f, 1.0f] range + /// if the gradient stop is to be seen explicitly. + /// + /// + public float position; + + /// + /// Type: D2D1_COLOR_F + /// The color of the gradient stop. + /// + public D3DCOLORVALUE color; + } + + /// Contains the HWND, pixel size, and presentation options for an ID2D1HwndRenderTarget. + /// + /// Use this structure when you call the CreateHwndRenderTarget method to create a new ID2D1HwndRenderTarget. + /// + /// For convenience, Direct2D provides the D2D1::HwndRenderTargetProperties function for creating new + /// D2D1_HWND_RENDER_TARGET_PROPERTIES structures. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_hwnd_render_target_properties typedef struct + // D2D1_HWND_RENDER_TARGET_PROPERTIES { HWND hwnd; D2D1_SIZE_U pixelSize; D2D1_PRESENT_OPTIONS presentOptions; } D2D1_HWND_RENDER_TARGET_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "4300843a-a24f-4f9e-a396-67172f083638")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_HWND_RENDER_TARGET_PROPERTIES + { + /// + /// Type: HWND + /// The HWND to which the render target issues the output from its drawing commands. + /// + public HWND hwnd; + + /// + /// Type: D2D1_SIZE_U + /// The size of the render target, in pixels. + /// + public D2D_SIZE_U pixelSize; + + /// + /// Type: D2D1_PRESENT_OPTIONS + /// + /// A value that specifies whether the render target retains the frame after it is presented and whether the render target waits + /// for the device to refresh before presenting. + /// + /// + public D2D1_PRESENT_OPTIONS presentOptions; + } + + /// Contains the content bounds, mask information, opacity settings, and other options for a layer resource. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_layer_parameters typedef struct D2D1_LAYER_PARAMETERS { + // D2D1_RECT_F contentBounds; ID2D1Geometry *geometricMask; D2D1_ANTIALIAS_MODE maskAntialiasMode; D2D1_MATRIX_3X2_F maskTransform; + // FLOAT opacity; ID2D1Brush *opacityBrush; D2D1_LAYER_OPTIONS layerOptions; } D2D1_LAYER_PARAMETERS; + [PInvokeData("d2d1.h", MSDNShortId = "ce575df6-9464-4672-9a0e-ff7e016d9354")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_LAYER_PARAMETERS + { + /// + /// Type: D2D1_RECT_F + /// The content bounds of the layer. Content outside these bounds is not guaranteed to render. + /// + public D2D_RECT_F contentBounds; + + /// + /// Type: ID2D1Geometry* + /// The geometric mask specifies the area of the layer that is composited into the render target. + /// + public IntPtr geometricMask; + + /// + /// Type: D2D1_ANTIALIAS_MODE + /// A value that specifies the antialiasing mode for the geometricMask. + /// + public D2D1_ANTIALIAS_MODE maskAntialiasMode; + + /// + /// Type: D2D1_MATRIX_3X2_F + /// A value that specifies the transform that is applied to the geometric mask when composing the layer. + /// + public D2D_MATRIX_3X2_F maskTransform; + + /// + /// Type: FLOAT + /// An opacity value that is applied uniformly to all resources in the layer when compositing to the target. + /// + public float opacity; + + /// + /// Type: ID2D1Brush* + /// + /// A brush that is used to modify the opacity of the layer. The brush is mapped to the layer, and the alpha channel of each + /// mapped brush pixel is multiplied against the corresponding layer pixel. + /// + /// + public IntPtr opacityBrush; + + /// + /// Type: D2D1_LAYER_OPTIONS + /// A value that specifies whether the layer intends to render text with ClearType antialiasing. + /// + public D2D1_LAYER_OPTIONS layerOptions; + } + + /// Contains the starting point and endpoint of the gradient axis for an ID2D1LinearGradientBrush. + /// + /// + /// Use this method when creating new ID2D1LinearGradientBrush objects with the CreateLinearGradientBrush method. For convenience, + /// Direct2D provides the D2D1::LinearGradientBrushProperties helper function for creating new + /// D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES structures. + /// + /// + /// The following illustration shows how a linear gradient changes as you change its start and end points. For the first gradient, + /// the start point is set to (0,0) and the end point to (150, 50); this creates a diagonal gradient that starts at the upper-left + /// corner and extends to the lower-right corner of the area being painted. When you set the start point to (0, 25) and the end + /// point to (150, 25), a horizontal gradient is created. Similarly, setting the start point to (75, 0) and the end point to (75, + /// 50) creates a vertical gradient. Setting the start point to (0, 50) and the end point to (150, 0) creates a diagonal gradient + /// that starts at the lower-left corner and extends to the upper-right corner of the area being painted. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_linear_gradient_brush_properties typedef struct + // D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES { D2D1_POINT_2F startPoint; D2D1_POINT_2F endPoint; } D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "753278f0-d8a1-4dc5-b976-a00f8aab357e")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES + { + /// + /// Type: D2D1_POINT_2F + /// In the brush's coordinate space, the starting point of the gradient axis. + /// + public D2D_POINT_2F startPoint; + + /// + /// Type: D2D1_POINT_2F + /// In the brush's coordinate space, the endpoint of the gradient axis. + /// + public D2D_POINT_2F endPoint; + } + + /// Contains the data format and alpha mode for a bitmap or render target. + /// + /// + /// For more information about the pixel formats and alpha modes supported by each render target, see Supported Pixel Formats and + /// Alpha Modes. + /// + /// Examples + /// + /// The following example creates a D2D1_PIXEL_FORMAT structure and uses it to specify the pixel format and alpha mode of an ID2D1HwndRenderTarget. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d1_pixel_format typedef struct D2D1_PIXEL_FORMAT { + // DXGI_FORMAT format; D2D1_ALPHA_MODE alphaMode; } D2D1_PIXEL_FORMAT; + [PInvokeData("dcommon.h", MSDNShortId = "e95afd9c-5793-4cb7-bcb8-aae4d28b6532")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_PIXEL_FORMAT + { + /// + /// Type: DXGI_FORMAT + /// A value that specifies the size and arrangement of channels in each pixel. + /// + public DXGI_FORMAT format; + + /// + /// Type: D2D1_ALPHA_MODE + /// + /// A value that specifies whether the alpha channel is using pre-multiplied alpha, straight alpha, whether it should be ignored + /// and considered opaque, or whether it is unkown. + /// + /// + public D2D1_ALPHA_MODE alphaMode; + } + + /// The creation properties for a ID2D1PrintControl object. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_print_control_properties typedef struct + // D2D1_PRINT_CONTROL_PROPERTIES { D2D1_PRINT_FONT_SUBSET_MODE fontSubset; FLOAT rasterDPI; D2D1_COLOR_SPACE colorSpace; } D2D1_PRINT_CONTROL_PROPERTIES; + [PInvokeData("d2d1_1.h", MSDNShortId = "5A4D4DDC-4161-44A2-9EB6-E4C14696B810")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_PRINT_CONTROL_PROPERTIES + { + /// + /// Type: D2D1_PRINT_FONT_SUBSET_MODE + /// The mode to use for subsetting fonts for printing, defaults to D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT. + /// + public D2D1_PRINT_FONT_SUBSET_MODE fontSubset; + + /// + /// Type: FLOAT + /// DPI for rasterization of all unsupported Direct2D commands or options, defaults to 150.0. + /// + public float rasterDPI; + + /// + /// Type: D2D1_COLOR_SPACE + /// Color space for vector graphics, defaults to D2D1_COLOR_SPACE_SRGB. + /// + public D2D1_COLOR_SPACE colorSpace; + } + + /// Contains the control point and end point for a quadratic Bezier segment. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_quadratic_bezier_segment typedef struct + // D2D1_QUADRATIC_BEZIER_SEGMENT { D2D1_POINT_2F point1; D2D1_POINT_2F point2; } D2D1_QUADRATIC_BEZIER_SEGMENT; + [PInvokeData("d2d1.h", MSDNShortId = "5060cb17-b6f4-4796-b91d-602fd81591c2")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_QUADRATIC_BEZIER_SEGMENT + { + /// + /// Type: D2D1_POINT_2F + /// The control point of the quadratic Bezier segment. + /// + public D2D_POINT_2F point1; + + /// + /// Type: D2D1_POINT_2F + /// The end point of the quadratic Bezier segment. + /// + public D2D_POINT_2F point2; + } + + /// Contains the gradient origin offset and the size and position of the gradient ellipse for an ID2D1RadialGradientBrush. + /// + /// + /// Different values for center, gradientOriginOffset, radiusX and/or radiusY produce different gradients. The following + /// illustration shows several radial gradients that have different gradient origin offsets, creating the appearance of the light + /// illuminating the circles from different angles. + /// + /// + /// For convenience, Direct2D provides the D2D1::RadialGradientBrushProperties function for creating new + /// D2D1_RADIAL_GRADIENT_BRUSH structures. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_radial_gradient_brush_properties typedef struct + // D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES { D2D1_POINT_2F center; D2D1_POINT_2F gradientOriginOffset; FLOAT radiusX; FLOAT radiusY; } D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "194f7624-ac3b-4054-8d6f-5b4c99ef6546")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES + { + /// + /// Type: D2D1_POINT_2F + /// In the brush's coordinate space, the center of the gradient ellipse. + /// + public D2D_POINT_2F center; + + /// + /// Type: D2D1_POINT_2F + /// In the brush's coordinate space, the offset of the gradient origin relative to the gradient ellipse's center. + /// + public D2D_POINT_2F gradientOriginOffset; + + /// + /// Type: FLOAT + /// In the brush's coordinate space, the x-radius of the gradient ellipse. + /// + public float radiusX; + + /// + /// Type: FLOAT + /// In the brush's coordinate space, the y-radius of the gradient ellipse. + /// + public float radiusY; + } + + /// + /// Contains rendering options (hardware or software), pixel format, DPI information, remoting options, and Direct3D support + /// requirements for a render target. + /// + /// + /// + /// Use this structure when creating a render target, or use it with the ID2D1RenderTarget::IsSupported method to check the + /// properties supported by an existing render target. + /// + /// + /// As a convenience, Direct2D provides the D2D1::RenderTargetProperties helper function for creating + /// D2D1_RENDER_TARGET_PROPERTIES structures. An easy way to create a D2D1_RENDER_TARGET_PROPERTIES structure that + /// works for most render targets is to call the function without specifying any parameters. Doing so creates a + /// D2D1_RENDER_TARGET_PROPERTIES structure that has its fields set to default values. For more information, see D2D1::RenderTargetProperties. + /// + /// Not all render targets support hardware rendering. For a list, see the Render Targets Overview. + /// Using Default DPI Settings + /// To use the default DPI, set dpiX and dpiY to 0. The default DPI varies depending on the render target: + /// + /// + /// For a compatible render target, the default DPI is the DPI of the parent render target. + /// + /// + /// For a ID2D1HwndRenderTarget, the default DPI is the system DPI obtained from the render target's ID2D1Factory. + /// + /// + /// For other render targets, the default DPI is 96. + /// + /// + /// + /// To use the default DPI setting, both dpiX and dpiY must be set to 0. Setting only one value to 0 causes an E_INVALIDARG error + /// when attempting to create a render target. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_render_target_properties typedef struct + // D2D1_RENDER_TARGET_PROPERTIES { D2D1_RENDER_TARGET_TYPE type; D2D1_PIXEL_FORMAT pixelFormat; FLOAT dpiX; FLOAT dpiY; + // D2D1_RENDER_TARGET_USAGE usage; D2D1_FEATURE_LEVEL minLevel; } D2D1_RENDER_TARGET_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "360900bd-1353-4a92-865c-ad34d5e98123")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_RENDER_TARGET_PROPERTIES + { + /// + /// Type: D2D1_RENDER_TARGET_TYPE + /// + /// A value that specifies whether the render target should force hardware or software rendering. A value of + /// D2D1_RENDER_TARGET_TYPE_DEFAULT specifies that the render target should use hardware rendering if it is available; + /// otherwise, it uses software rendering. Note that WIC bitmap render targets do not support hardware rendering. + /// + /// + public D2D1_RENDER_TARGET_TYPE type; + + /// + /// Type: D2D1_PIXEL_FORMAT + /// + /// The pixel format and alpha mode of the render target. You can use the D2D1::PixelFormat function to create a pixel format + /// that specifies that Direct2D should select the pixel format and alpha mode for you. For a list of pixel formats and alpha + /// modes supported by each render target, see Supported Pixel Formats and Alpha Modes. + /// + /// + public D2D1_PIXEL_FORMAT pixelFormat; + + /// + /// Type: FLOAT + /// + /// The horizontal DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the + /// Remarks section. + /// + /// + public float dpiX; + + /// + /// Type: FLOAT + /// + /// The vertical DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section. + /// + /// + public float dpiY; + + /// + /// Type: D2D1_RENDER_TARGET_USAGE + /// + /// A value that specifies how the render target is remoted and whether it should be GDI-compatible. Set to + /// D2D1_RENDER_TARGET_USAGE_NONE to create a render target that is not compatible with GDI and uses Direct3D command-stream + /// remoting if it is available. + /// + /// + public D2D1_RENDER_TARGET_USAGE usage; + + /// + /// Type: D2D1_FEATURE_LEVEL + /// + /// A value that specifies the minimum Direct3D feature level required for hardware rendering. If the specified minimum level is + /// not available, the render target uses software rendering if the type member is set to + /// D2D1_RENDER_TARGET_TYPE_DEFAULT; if type is set to to D2D1_RENDER_TARGET_TYPE_HARDWARE, render target creation + /// fails. A value of D2D1_FEATURE_LEVEL_DEFAULT indicates that Direct2D should determine whether the Direct3D feature level of + /// the device is adequate. This field is used only when creating ID2D1HwndRenderTarget and ID2D1DCRenderTarget objects. + /// + /// + public D2D1_FEATURE_LEVEL minLevel; + } + + /// Contains the dimensions and corner radii of a rounded rectangle. + /// + /// + /// Each corner of the rectangle specified by the rect is replaced with a quarter ellipse, with a radius in each direction specified + /// by radiusX and radiusY. + /// + /// + /// If the radiusX is greater than or equal to half the width of the rectangle, and the radiusY is greater than or equal to one-half + /// the height, the rounded rectangle is an ellipse with the same width and height of the rect. + /// + /// + /// Even when both radiuX and radiusY are zero, the rounded rectangle is different from a rectangle., When stroked, the corners of + /// the rounded rectangle are roundly joined, not mitered (square). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_rounded_rect typedef struct D2D1_ROUNDED_RECT { D2D1_RECT_F + // rect; FLOAT radiusX; FLOAT radiusY; } D2D1_ROUNDED_RECT; + [PInvokeData("d2d1.h", MSDNShortId = "7069ca65-170e-42fc-8c1a-849a2f25c36f")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_ROUNDED_RECT + { + /// + /// Type: D2D1_RECT_F + /// The coordinates of the rectangle. + /// + public D2D_RECT_F rect; + + /// + /// Type: FLOAT + /// The x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle. + /// + public float radiusX; + + /// + /// Type: FLOAT + /// The y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle. + /// + public float radiusY; + } + + /// Describes the stroke that outlines a shape. + /// The following illustration shows different dashOffset values for the same custom dash style. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_stroke_style_properties typedef struct + // D2D1_STROKE_STYLE_PROPERTIES { D2D1_CAP_STYLE startCap; D2D1_CAP_STYLE endCap; D2D1_CAP_STYLE dashCap; D2D1_LINE_JOIN lineJoin; + // FLOAT miterLimit; D2D1_DASH_STYLE dashStyle; FLOAT dashOffset; } D2D1_STROKE_STYLE_PROPERTIES; + [PInvokeData("d2d1.h", MSDNShortId = "67f3701f-febd-4afe-803e-c5d9dbcd1b21")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_STROKE_STYLE_PROPERTIES + { + /// + /// Type: D2D1_CAP_STYLE + /// The cap applied to the start of all the open figures in a stroked geometry. + /// + public D2D1_CAP_STYLE startCap; + + /// + /// Type: D2D1_CAP_STYLE + /// The cap applied to the end of all the open figures in a stroked geometry. + /// + public D2D1_CAP_STYLE endCap; + + /// + /// Type: D2D1_CAP_STYLE + /// The shape at either end of each dash segment. + /// + public D2D1_CAP_STYLE dashCap; + + /// + /// Type: D2D1_LINE_JOIN + /// + /// A value that describes how segments are joined. This value is ignored for a vertex if the segment flags specify that the + /// segment should have a smooth join. + /// + /// + public D2D1_LINE_JOIN lineJoin; + + /// + /// Type: FLOAT + /// + /// The limit of the thickness of the join on a mitered corner. This value is always treated as though it is greater than or + /// equal to 1.0f. + /// + /// + public float miterLimit; + + /// + /// Type: D2D1_DASH_STYLE + /// A value that specifies whether the stroke has a dash pattern and, if so, the dash style. + /// + public D2D1_DASH_STYLE dashStyle; + + /// + /// Type: FLOAT + /// + /// A value that specifies an offset in the dash sequence. A positive dash offset value shifts the dash pattern, in units of + /// stroke width, toward the start of the stroked geometry. A negative dash offset value shifts the dash pattern, in units of + /// stroke width, toward the end of the stroked geometry. + /// + /// + public float dashOffset; + } + + /// Contains the three vertices that describe a triangle. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ns-d2d1-d2d1_triangle typedef struct D2D1_TRIANGLE { D2D1_POINT_2F + // point1; D2D1_POINT_2F point2; D2D1_POINT_2F point3; } D2D1_TRIANGLE; + [PInvokeData("d2d1.h", MSDNShortId = "6978bfff-05ca-44b6-8694-c4741f7987f6")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_TRIANGLE + { + /// + /// Type: D2D1_POINT_2F + /// The first vertex of a triangle. + /// + public D2D_POINT_2F point1; + + /// + /// Type: D2D1_POINT_2F + /// The second vertex of a triangle. + /// + public D2D_POINT_2F point2; + + /// + /// Type: D2D1_POINT_2F + /// The third vertex of a triangle. + /// + public D2D_POINT_2F point3; + } + + /// Describes color values. + /// + /// You can set the members of this structure to values outside the range of 0 through 1 to implement some unusual effects. Values + /// greater than 1 produce strong lights that tend to wash out a scene. Negative values produce dark lights that actually remove + /// light from a scene. + /// + // https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dcolorvalue typedef struct _D3DCOLORVALUE { float r; float g; float b; + // float a; } D3DCOLORVALUE; + [PInvokeData("", MSDNShortId = "6af8c2ec-bc79-4dc6-b56d-7a7676a50b39")] + [StructLayout(LayoutKind.Sequential)] + public struct D3DCOLORVALUE + { + /// Type: float + public float r; + + /// Type: float + public float g; + + /// Type: float + public float b; + + /// Type: float + public float a; + } + + /// + /// Contains the information needed by renderers to draw glyph runs. All coordinates are in device independent pixels (DIPs). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_glyph_run struct DWRITE_GLYPH_RUN { IDWriteFontFace + // *fontFace; FLOAT fontEmSize; UINT32 glyphCount; UINT16 const *glyphIndices; FLOAT const *glyphAdvances; DWRITE_GLYPH_OFFSET const + // *glyphOffsets; BOOL isSideways; UINT32 bidiLevel; }; + [PInvokeData("dwrite.h", MSDNShortId = "2997d63f-8d33-44c3-9617-cfffe5f61f7d")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_GLYPH_RUN + { + /// + /// Type: IDWriteFontFace* + /// The physical font face object to draw with. + /// + public IntPtr fontFace; + + /// + /// Type: FLOAT + /// The logical size of the font in DIPs (equals 1/96 inch), not points. + /// + public float fontEmSize; + + /// + /// Type: UINT32 + /// The number of glyphs in the glyph run. + /// + public uint glyphCount; + + /// + /// Type: const UINT16* + /// A pointer to an array of indices to render for the glyph run. + /// + public IntPtr glyphIndices; + + /// + /// Type: const FLOAT* + /// A pointer to an array containing glyph advance widths for the glyph run. + /// + public IntPtr glyphAdvances; + + /// + /// Type: const DWRITE_GLYPH_OFFSET* + /// A pointer to an array containing glyph offsets for the glyph run. + /// + public IntPtr glyphOffsets; + + /// + /// Type: BOOL + /// + /// If true, specifies that glyphs are rotated 90 degrees to the left and vertical metrics are used. Vertical writing is + /// achieved by specifying isSideways = true and rotating the entire run 90 degrees to the right via a rotate transform. + /// + /// + [MarshalAs(UnmanagedType.Bool)] public bool isSideways; + + /// + /// Type: UINT32 + /// + /// The implicit resolved bidi level of the run. Odd levels indicate right-to-left languages like Hebrew and Arabic, while even + /// levels indicate left-to-right languages like English and Japanese (when written horizontally). For right-to-left languages, + /// the text origin is on the right, and text should be drawn to the left. + /// + /// + public uint bidiLevel; + } + + /// Describes a JPEG AC huffman table. + // https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-jpeg-ac-huffman-table typedef struct DXGI_JPEG_AC_HUFFMAN_TABLE + // { BYTE CodeCounts[16]; BYTE CodeValues[162]; } DXGI_JPEG_AC_HUFFMAN_TABLE; + [PInvokeData("dxgitype.h", MSDNShortId = "E1923FFA-E7E5-4158-9793-3E7F5A6EA7FA")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_JPEG_AC_HUFFMAN_TABLE + { + /// The number of codes for each code length. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] CodeCounts; + + /// The Huffman code values, in order of increasing code length. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 162)] + public byte[] CodeValues; + } + + /// Describes a JPEG DC huffman table. + // https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-jpeg-dc-huffman-table typedef struct DXGI_JPEG_DC_HUFFMAN_TABLE + // { BYTE CodeCounts[12]; BYTE CodeValues[12]; } DXGI_JPEG_DC_HUFFMAN_TABLE; + [PInvokeData("dxgitype.h", MSDNShortId = "9D6C18C3-F75C-41E0-9EFA-E882E89DE713")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_JPEG_DC_HUFFMAN_TABLE + { + /// The number of codes for each code length. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] CodeCounts; + + /// The Huffman code values, in order of increasing code length. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] CodeValues; + } + + /// Describes a JPEG quantization table. + // https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-jpeg-quantization-table typedef struct + // DXGI_JPEG_QUANTIZATION_TABLE { BYTE Elements[64]; } DXGI_JPEG_QUANTIZATION_TABLE; + [PInvokeData("dxgitype.h", MSDNShortId = "DE1AAB15-B0B8-4594-BBCE-5F8EE5CE0AF7")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_JPEG_QUANTIZATION_TABLE + { + /// An array of bytes containing the elements of the quantization table. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] Elements; + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct2D/D2d1_1.cs b/PInvoke/Graphics/Direct2D/D2d1_1.cs new file mode 100644 index 00000000..ad62724b --- /dev/null +++ b/PInvoke/Graphics/Direct2D/D2d1_1.cs @@ -0,0 +1,3434 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; +using static Vanara.PInvoke.Dwrite; +using static Vanara.PInvoke.DXGI; + +namespace Vanara.PInvoke +{ + // TODO: Move once D2d1 lib is done + /// Items from the D2d1.dll + public static partial class D2d1 + { + /// Specifies how a bitmap can be used. + /// + /// + /// D2D1_BITMAP_OPTIONS_NONE implies that none of the flags are set. This means that the bitmap can be used for drawing from, + /// cannot be set as a target and cannot be read from by the CPU. + /// + /// + /// D2D1_BITMAP_OPTIONS_TARGET means that the bitmap can be specified as a target in ID2D1DeviceContext::SetTarget. If you + /// also specify the D2D1_BITMAP_OPTIONS_CANNOT_DRAW flag the bitmap can be used a target but, it cannot be drawn from. + /// Attempting to draw with a bitmap that has both flags set will result in the device context being put into an error state with D2DERR_BITMAP_CANNOT_DRAW. + /// + /// + /// D2D1_BITMAP_OPTIONS_CPU_READ means that the bitmap can be mapped by using ID2D1Bitmap1::Map. This flag requires + /// D2D1_BITMAP_OPTIONS_CANNOT_DRAW and cannot be combined with any other flags. The bitmap must be updated with the + /// CopyFromBitmap or CopyFromRenderTarget methods. + /// + /// + /// Note You should only use D2D1_BITMAP_OPTIONS_CANNOT_DRAW is when the purpose of the bitmap is to be a target only + /// or when the bitmap will be mapped . + /// + /// + /// D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE means that it is possible to get a DC associated with this bitmap. This must be used + /// in conjunction with D2D1_BITMAP_OPTIONS_TARGET. The DXGI_FORMAT must be either DXGI_FORMAT_B8G8R8A8_UNORM or DXGI_FORMAT_B8G8R8A8_UNORM_SRGB. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_bitmap_options typedef enum D2D1_BITMAP_OPTIONS { + // D2D1_BITMAP_OPTIONS_NONE, D2D1_BITMAP_OPTIONS_TARGET, D2D1_BITMAP_OPTIONS_CANNOT_DRAW, D2D1_BITMAP_OPTIONS_CPU_READ, + // D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE, D2D1_BITMAP_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "c080e23e-99c4-46ed-8b21-be26dec288af")] + [Flags] + public enum D2D1_BITMAP_OPTIONS : uint + { + /// The bitmap is created with default properties. + D2D1_BITMAP_OPTIONS_NONE = 0x00000000, + + /// The bitmap can be used as a device context target. + D2D1_BITMAP_OPTIONS_TARGET = 0x00000001, + + /// The bitmap cannot be used as an input. + D2D1_BITMAP_OPTIONS_CANNOT_DRAW = 0x00000002, + + /// The bitmap can be read from the CPU. + D2D1_BITMAP_OPTIONS_CPU_READ = 0x00000004, + + /// The bitmap works with ID2D1GdiInteropRenderTarget::GetDC. + D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = 0x00000008, + + /// + D2D1_BITMAP_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// Represents the bit depth of the imaging pipeline in Direct2D. + /// Note Feature level 9 may or may not support precision types other than 8BPC. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_buffer_precision typedef enum D2D1_BUFFER_PRECISION { + // D2D1_BUFFER_PRECISION_UNKNOWN, D2D1_BUFFER_PRECISION_8BPC_UNORM, D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB, + // D2D1_BUFFER_PRECISION_16BPC_UNORM, D2D1_BUFFER_PRECISION_16BPC_FLOAT, D2D1_BUFFER_PRECISION_32BPC_FLOAT, + // D2D1_BUFFER_PRECISION_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "a2a4b4fd-685d-4068-b1f5-609e6ab024e2")] + public enum D2D1_BUFFER_PRECISION : uint + { + /// The buffer precision is not specified. + D2D1_BUFFER_PRECISION_UNKNOWN = 0, + + /// Use 8-bit normalized integer per channel. + D2D1_BUFFER_PRECISION_8BPC_UNORM, + + /// Use 8-bit normalized integer standard RGB data per channel. + D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB, + + /// Use 16-bit normalized integer per channel. + D2D1_BUFFER_PRECISION_16BPC_UNORM, + + /// Use 16-bit floats per channel. + D2D1_BUFFER_PRECISION_16BPC_FLOAT, + + /// Use 32-bit floats per channel. + D2D1_BUFFER_PRECISION_32BPC_FLOAT, + + /// + /// Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to + /// compile to a size other than 32 bits.Do not use this value. + /// + D2D1_BUFFER_PRECISION_FORCE_DWORD = 0xffffffff, + } + + /// Defines how to interpolate between colors. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_color_interpolation_mode typedef enum + // D2D1_COLOR_INTERPOLATION_MODE { D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT, D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED, + // D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "E3E9FB4C-5E77-451B-ABED-39D9C7AE567A")] + public enum D2D1_COLOR_INTERPOLATION_MODE : uint + { + /// Colors are interpolated with straight alpha. + D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT = 0, + + /// Colors are interpolated with premultiplied alpha. + D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED, + + /// + D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Used to specify the blend mode for all of the Direct2D blending operations. + /// + /// The figure here shows an example of each of the modes with images that have an opacity of 1.0 or 0.5. + /// There can be slightly different interpretations of these enumeration values depending on where the value is used. + /// + /// + /// + /// With a composite effect: D2D1_COMPOSITE_MODE_DESTINATION_COPY is equivalent to D2D1_COMPOSITE_MODE_SOURCE_COPY + /// with the inputs inverted. + /// + /// + /// + /// + /// As a parameter to ID2D1DeviceContext::DrawImage: D2D1_COMPOSITE_MODE_DESTINATION_COPY is a no-op since the destination is + /// already in the selected target. + /// + /// + /// + /// Sample code + /// For an example that uses composite modes, download the Direct2D composite effect modes sample. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_composite_mode typedef enum D2D1_COMPOSITE_MODE { + // D2D1_COMPOSITE_MODE_SOURCE_OVER, D2D1_COMPOSITE_MODE_DESTINATION_OVER, D2D1_COMPOSITE_MODE_SOURCE_IN, + // D2D1_COMPOSITE_MODE_DESTINATION_IN, D2D1_COMPOSITE_MODE_SOURCE_OUT, D2D1_COMPOSITE_MODE_DESTINATION_OUT, + // D2D1_COMPOSITE_MODE_SOURCE_ATOP, D2D1_COMPOSITE_MODE_DESTINATION_ATOP, D2D1_COMPOSITE_MODE_XOR, D2D1_COMPOSITE_MODE_PLUS, + // D2D1_COMPOSITE_MODE_SOURCE_COPY, D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY, D2D1_COMPOSITE_MODE_MASK_INVERT, + // D2D1_COMPOSITE_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "4f01e805-aed7-4bfc-9793-42a9fdde3473")] + public enum D2D1_COMPOSITE_MODE : uint + { + /// The standard source-over-destination blend mode. + D2D1_COMPOSITE_MODE_SOURCE_OVER = 0, + + /// The destination is rendered over the source. + D2D1_COMPOSITE_MODE_DESTINATION_OVER, + + /// Performs a logical clip of the source pixels against the destination pixels. + D2D1_COMPOSITE_MODE_SOURCE_IN, + + /// The inverse of the D2D1_COMPOSITE_MODE_SOURCE_IN operation. + D2D1_COMPOSITE_MODE_DESTINATION_IN, + + /// This is the logical inverse to D2D1_COMPOSITE_MODE_SOURCE_IN. + D2D1_COMPOSITE_MODE_SOURCE_OUT, + + /// The is the logical inverse to D2D1_COMPOSITE_MODE_DESTINATION_IN. + D2D1_COMPOSITE_MODE_DESTINATION_OUT, + + /// Writes the source pixels over the destination where there are destination pixels. + D2D1_COMPOSITE_MODE_SOURCE_ATOP, + + /// The logical inverse of D2D1_COMPOSITE_MODE_SOURCE_ATOP. + D2D1_COMPOSITE_MODE_DESTINATION_ATOP, + + /// The source is inverted with the destination. + D2D1_COMPOSITE_MODE_XOR, + + /// The channel components are summed. + D2D1_COMPOSITE_MODE_PLUS, + + /// The source is copied to the destination; the destination pixels are ignored. + D2D1_COMPOSITE_MODE_SOURCE_COPY, + + /// Equivalent to D2D1_COMPOSITE_MODE_SOURCE_COPY, but pixels outside of the source bounds are unchanged. + D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY, + + /// Destination colors are inverted according to a source mask. + D2D1_COMPOSITE_MODE_MASK_INVERT, + + /// + D2D1_COMPOSITE_MODE_FORCE_DWORD = 0xffffffff, + } + + /// + /// This is used to specify the quality of image scaling with ID2D1DeviceContext::DrawImage and with the 2D affine transform effect. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_interpolation_mode typedef enum D2D1_INTERPOLATION_MODE + // { D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, D2D1_INTERPOLATION_MODE_LINEAR, D2D1_INTERPOLATION_MODE_CUBIC, + // D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR, D2D1_INTERPOLATION_MODE_ANISOTROPIC, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC, + // D2D1_INTERPOLATION_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "7a32f551-afad-4eb2-953f-a9acc71d7776")] + public enum D2D1_INTERPOLATION_MODE : uint + { + /// + /// Samples the nearest single point and uses that exact color. This mode uses less processing time, but outputs the lowest + /// quality image. + /// + D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, + + /// + /// Uses a four point sample and linear interpolation. This mode uses more processing time than the nearest neighbor mode, but + /// outputs a higher quality image. + /// + D2D1_INTERPOLATION_MODE_LINEAR, + + /// + /// Uses a 16 sample cubic kernel for interpolation. This mode uses the most processing time, but outputs a higher quality image. + /// + D2D1_INTERPOLATION_MODE_CUBIC, + + /// + /// Uses 4 linear samples within a single pixel for good edge anti-aliasing. This mode is good for scaling down by small amounts + /// on images with few pixels. + /// + D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR, + + /// Uses anisotropic filtering to sample a pattern according to the transformed shape of the bitmap. + D2D1_INTERPOLATION_MODE_ANISOTROPIC, + + /// + /// Uses a variable size high quality cubic kernel to perform a pre-downscale the image if downscaling is involved in the + /// transform matrix. Then uses the cubic interpolation mode for the final output. + /// + D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC, + + /// + D2D1_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how the layer contents should be prepared. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_layer_options1 typedef enum D2D1_LAYER_OPTIONS1 { + // D2D1_LAYER_OPTIONS1_NONE, D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND, D2D1_LAYER_OPTIONS1_IGNORE_ALPHA, + // D2D1_LAYER_OPTIONS1_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "13C9EDE7-A1D0-4359-8EF3-77FF763B9244")] + public enum D2D1_LAYER_OPTIONS1 : uint + { + /// Default layer behavior. A premultiplied layer target is pushed and its contents are cleared to transparent black. + D2D1_LAYER_OPTIONS1_NONE = 0, + + /// The layer is not cleared to transparent black. + D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND, + + /// The layer is always created as ignore alpha. All content rendered into the layer will be treated as opaque. + D2D1_LAYER_OPTIONS1_IGNORE_ALPHA, + + /// + D2D1_LAYER_OPTIONS1_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how the memory to be mapped from the corresponding ID2D1Bitmap1 should be treated. + /// + /// + /// The D2D1_MAP_OPTIONS_READ option can be used only if the bitmap was created with the D2D1_BITMAP_OPTIONS_CPU_READ flag. + /// + /// + /// These flags will be not be able to be used on bitmaps created by the ID2D1DeviceContext. However, the ID2D1SourceTransform will + /// receive bitmaps for which these flags are valid. + /// + /// + /// D2D1_MAP_OPTIONS_DISCARD can only be used with D2D1_MAP_OPTIONS_WRITE. Both of these options are only available + /// through the effect author API, not through the Direct2D rendering API. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_map_options typedef enum D2D1_MAP_OPTIONS { + // D2D1_MAP_OPTIONS_NONE, D2D1_MAP_OPTIONS_READ, D2D1_MAP_OPTIONS_WRITE, D2D1_MAP_OPTIONS_DISCARD, D2D1_MAP_OPTIONS_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "8706c3e3-eb29-4760-bdfd-f19afc6f2bf7")] + [Flags] + public enum D2D1_MAP_OPTIONS : uint + { + /// + D2D1_MAP_OPTIONS_NONE = 0x00, + + /// Allow CPU Read access. + D2D1_MAP_OPTIONS_READ = 0x01, + + /// Allow CPU Write access. + D2D1_MAP_OPTIONS_WRITE = 0x02, + + /// Discard the previous contents of the resource when it is mapped. + D2D1_MAP_OPTIONS_DISCARD = 0x04, + + /// + D2D1_MAP_OPTIONS_FORCE_DWORD = 0xffffffff, + } + + /// Used to specify the geometric blend mode for all Direct2D primitives. + /// + /// Blend modes + /// + /// For aliased rendering (except for MIN mode), the output value O is computed by linearly interpolating the value blend(S, D) with + /// the destination pixel value, based on the amount that the primitive covers the destination pixel. + /// + /// + /// The table here shows the primitive blend modes for both aliased and antialiased blending. The equations listed in the table use + /// these elements: + /// + /// + /// + /// O = Output + /// + /// + /// S = Source + /// + /// + /// SA = Source Alpha + /// + /// + /// D = Destination + /// + /// + /// DA = Destination Alpha + /// + /// + /// C = Pixel coverage + /// + /// + /// + /// + /// Primitive blend mode + /// Aliased blending + /// Antialiased blending + /// Description + /// + /// + /// D2D1_PRIMITIVE_BLEND_SOURCE_OVER + /// O = (S + (1 – SA) * D) * C + D * (1 – C) + /// O = S * C + D *(1 – SA *C) + /// The standard source-over-destination blend mode. + /// + /// + /// D2D1_PRIMITIVE_BLEND_COPY + /// O = S * C + D * (1 – C) + /// O = S * C + D * (1 – C) + /// The source is copied to the destination; the destination pixels are ignored. + /// + /// + /// D2D1_PRIMITIVE_BLEND_MIN + /// O = Min(S + 1-SA, D) + /// O = Min(S * C + 1 – SA *C, D) + /// The resulting pixel values use the minimum of the source and destination pixel values. Available in Windows 8.1 and later. + /// + /// + /// D2D1_PRIMITIVE_BLEND_ADD + /// O = (S + D) * C + D * (1 – C) + /// O = S * C + D + /// The resulting pixel values are the sum of the source and destination pixel values. Available in Windows 8.1 and later. + /// + /// + /// An illustration of the primitive blend modes with varying opacity and backgrounds. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_primitive_blend typedef enum D2D1_PRIMITIVE_BLEND { + // D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_PRIMITIVE_BLEND_COPY, D2D1_PRIMITIVE_BLEND_MIN, D2D1_PRIMITIVE_BLEND_ADD, + // D2D1_PRIMITIVE_BLEND_MAX, D2D1_PRIMITIVE_BLEND_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "411a42c9-f8d7-46f3-a6e6-51afc83375ad")] + public enum D2D1_PRIMITIVE_BLEND : uint + { + /// The standard source-over-destination blend mode. + D2D1_PRIMITIVE_BLEND_SOURCE_OVER = 0, + + /// The source is copied to the destination; the destination pixels are ignored. + D2D1_PRIMITIVE_BLEND_COPY, + + /// + /// The resulting pixel values use the minimum of the source and destination pixel values. Available in Windows 8 and later. + /// + D2D1_PRIMITIVE_BLEND_MIN, + + /// + /// The resulting pixel values are the sum of the source and destination pixel values. Available in Windows 8 and later. + /// + D2D1_PRIMITIVE_BLEND_ADD, + + /// + /// The resulting pixel values use the maximum of the source and destination pixel values. Available in Windows 10 and later + /// (set using ID21CommandSink4::SetPrimitiveBlend2). + /// + D2D1_PRIMITIVE_BLEND_MAX, + + /// + D2D1_PRIMITIVE_BLEND_FORCE_DWORD = 0xffffffff, + } + + /// Specifies the types of properties supported by the Direct2D property interface. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_property_type typedef enum D2D1_PROPERTY_TYPE { + // D2D1_PROPERTY_TYPE_UNKNOWN, D2D1_PROPERTY_TYPE_STRING, D2D1_PROPERTY_TYPE_BOOL, D2D1_PROPERTY_TYPE_UINT32, + // D2D1_PROPERTY_TYPE_INT32, D2D1_PROPERTY_TYPE_FLOAT, D2D1_PROPERTY_TYPE_VECTOR2, D2D1_PROPERTY_TYPE_VECTOR3, + // D2D1_PROPERTY_TYPE_VECTOR4, D2D1_PROPERTY_TYPE_BLOB, D2D1_PROPERTY_TYPE_IUNKNOWN, D2D1_PROPERTY_TYPE_ENUM, + // D2D1_PROPERTY_TYPE_ARRAY, D2D1_PROPERTY_TYPE_CLSID, D2D1_PROPERTY_TYPE_MATRIX_3X2, D2D1_PROPERTY_TYPE_MATRIX_4X3, + // D2D1_PROPERTY_TYPE_MATRIX_4X4, D2D1_PROPERTY_TYPE_MATRIX_5X4, D2D1_PROPERTY_TYPE_COLOR_CONTEXT, D2D1_PROPERTY_TYPE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "6535d71a-c76c-462c-9972-4db7e4ef383d")] + public enum D2D1_PROPERTY_TYPE : uint + { + /// An unknown property. + D2D1_PROPERTY_TYPE_UNKNOWN, + + /// An arbitrary-length string. + D2D1_PROPERTY_TYPE_STRING, + + /// A 32-bit integer value constrained to be either 0 or 1. + D2D1_PROPERTY_TYPE_BOOL, + + /// An unsigned 32-bit integer. + D2D1_PROPERTY_TYPE_UINT32, + + /// A signed 32-bit integer. + D2D1_PROPERTY_TYPE_INT32, + + /// A 32-bit float. + D2D1_PROPERTY_TYPE_FLOAT, + + /// Two 32-bit float values. + D2D1_PROPERTY_TYPE_VECTOR2, + + /// Three 32-bit float values. + D2D1_PROPERTY_TYPE_VECTOR3, + + /// Four 32-bit float values. + D2D1_PROPERTY_TYPE_VECTOR4, + + /// An arbitrary number of bytes. + D2D1_PROPERTY_TYPE_BLOB, + + /// A returned COM or nano-COM interface. + D2D1_PROPERTY_TYPE_IUNKNOWN, + + /// + /// An enumeration. The value should be treated as a UINT32 with a defined array of fields to specify the bindings to + /// human-readable strings. + /// + D2D1_PROPERTY_TYPE_ENUM, + + /// + /// An enumeration. The value is the count of sub-properties in the array. The set of array elements will be contained in the sub-property. + /// + D2D1_PROPERTY_TYPE_ARRAY, + + /// A CLSID. + D2D1_PROPERTY_TYPE_CLSID, + + /// A 3x2 matrix of float values. + D2D1_PROPERTY_TYPE_MATRIX_3X2, + + /// A 4x2 matrix of float values. + D2D1_PROPERTY_TYPE_MATRIX_4X3, + + /// A 4x4 matrix of float values. + D2D1_PROPERTY_TYPE_MATRIX_4X4, + + /// A 5x4 matrix of float values. + D2D1_PROPERTY_TYPE_MATRIX_5X4, + + /// A nano-COM color context interface pointer. + D2D1_PROPERTY_TYPE_COLOR_CONTEXT, + + /// + D2D1_PROPERTY_TYPE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies the threading mode used while simultaneously creating the device, factory, and device context. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_threading_mode typedef enum D2D1_THREADING_MODE { + // D2D1_THREADING_MODE_SINGLE_THREADED, D2D1_THREADING_MODE_MULTI_THREADED, D2D1_THREADING_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "21fba5ee-3d31-4142-b66a-94b343e1c6eb")] + public enum D2D1_THREADING_MODE : uint + { + /// Resources may only be invoked serially. Device context state is not protected from multi-threaded access. + D2D1_THREADING_MODE_SINGLE_THREADED = 0, + + /// Resources may be invoked from multiple threads. Resources use interlocked reference counting and their state is protected. + D2D1_THREADING_MODE_MULTI_THREADED = 1, + + /// + D2D1_THREADING_MODE_FORCE_DWORD = 0xffffffff, + } + + /// Specifies how units in Direct2D will be interpreted. + /// + /// Setting the unit mode to D2D1_UNIT_MODE_PIXELS is similar to setting the ID2D1DeviceContext dots per inch (dpi) to 96. + /// However, Direct2D still checks the dpi to determine the threshold for enabling vertical antialiasing for text, and when the unit + /// mode is restored, the dpi will be remembered. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_unit_mode typedef enum D2D1_UNIT_MODE { + // D2D1_UNIT_MODE_DIPS, D2D1_UNIT_MODE_PIXELS, D2D1_UNIT_MODE_FORCE_DWORD } ; + [PInvokeData("d2d1_1.h", MSDNShortId = "1ba11761-f3e9-4996-8494-384db5bddc99")] + public enum D2D1_UNIT_MODE : uint + { + /// Units will be interpreted as device-independent pixels (1/96"). + D2D1_UNIT_MODE_DIPS = 0, + + /// Units will be interpreted as pixels. + D2D1_UNIT_MODE_PIXELS, + + /// + D2D1_UNIT_MODE_FORCE_DWORD = 0xffffffff, + } + + /// + /// Represents a bitmap that can be used as a surface for an ID2D1DeviceContext or mapped into system memory, and can contain + /// additional color context information. + /// + /// + /// Creating ID2D1Bitmap Objects + /// Use one of these methods to create an ID2D1Bitmap object. + /// + /// + /// ID2D1DeviceContext::CreateBitmap + /// + /// + /// ID2D1DeviceContext::CreateBitmapFromWicBitmap + /// + /// + /// For information about the pixel formats supported by Direct2D bitmaps, see Supported Pixel Formats and Alpha Modes. + /// + /// An ID2D1Bitmap is a device-dependent resource: your application should create bitmaps after it initializes the render target + /// with which the bitmap will be used, and recreate the bitmap whenever the render target needs recreated. (For more information + /// about resources, see Resources Overview.) + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1bitmap1 + [PInvokeData("d2d1_1.h", MSDNShortId = "669a9377-248c-4a86-b447-ed117fff43a6")] + [ComImport, Guid("a898a84c-3873-4588-b08b-ebbf978df041"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Bitmap1 : ID2D1Bitmap + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Returns the size, in device-independent pixels (DIPs), of the bitmap. + /// + /// Type: D2D1_SIZE_F + /// The size, in DIPs, of the bitmap. + /// + /// A DIP is 1/96 of an inch. To retrieve the size in device pixels, use the ID2D1Bitmap::GetPixelSizemethod. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getsize D2D1_SIZE_F GetSize(); + [PreserveSig] + new D2D_SIZE_F GetSize(); + + /// Returns the size, in device-dependent units (pixels), of the bitmap. + /// + /// Type: D2D1_SIZE_U + /// The size, in pixels, of the bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getpixelsize D2D1_SIZE_U GetPixelSize(); + [PreserveSig] + new D2D_SIZE_U GetPixelSize(); + + /// Retrieves the pixel format and alpha mode of the bitmap. + /// + /// Type: D2D1_PIXEL_FORMAT + /// The pixel format and alpha mode of the bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getpixelformat D2D1_PIXEL_FORMAT GetPixelFormat(); + [PreserveSig] + new D2D1_PIXEL_FORMAT GetPixelFormat(); + + /// Return the dots per inch (DPI) of the bitmap. + /// + /// Type: FLOAT* + /// The horizontal DPI of the image. You must allocate storage for this parameter. + /// + /// + /// Type: FLOAT* + /// The vertical DPI of the image. You must allocate storage for this parameter. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-getdpi void GetDpi( FLOAT *dpiX, FLOAT *dpiY ); + [PreserveSig] + new void GetDpi(out float dpiX, out float dpiY); + + /// Copies the specified region from the specified bitmap into the current bitmap. + /// + /// Type: const D2D1_POINT_2U* + /// In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied. + /// + /// + /// Type: ID2D1Bitmap* + /// The bitmap to copy from. + /// + /// + /// Type: const D2D1_RECT_U* + /// The area of bitmap to copy. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current + /// bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap + /// formats do not match. + /// + /// + /// Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed + /// does not complete successfully, this method fails. However, this method does not clear the error state of the render target + /// on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush. + /// + /// + /// Starting with Windows 8.1, this method supports block compressed bitmaps. If you are using a block compressed format, the + /// end coordinates of the srcRect parameter must be multiples of 4 or the method returns E_INVALIDARG. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrombitmap HRESULT CopyFromBitmap( const + // D2D1_POINT_2U *destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect ); + new void CopyFromBitmap([In, Optional] IntPtr destPoint, [In] ID2D1Bitmap bitmap, [In, Optional] IntPtr srcRect); + + /// Copies the specified region from the specified render target into the current bitmap. + /// + /// Type: const D2D1_POINT_2U* + /// In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied. + /// + /// + /// Type: ID2D1RenderTarget* + /// The render target that contains the region to copy. + /// + /// + /// Type: const D2D1_RECT_U* + /// The area of renderTarget to copy. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current + /// bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap + /// formats do not match. + /// + /// + /// Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed + /// does not complete successfully, this method fails. However, this method does not clear the error state of the render target + /// on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush. + /// + /// + /// All clips and layers must be popped off of the render target before calling this method. The method returns + /// D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT if any clips or layers are currently applied to the render target. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfromrendertarget HRESULT + // CopyFromRenderTarget( const D2D1_POINT_2U *destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect ); + new void CopyFromRenderTarget([In, Optional] IntPtr destPoint, [In] ID2D1RenderTarget renderTarget, [In, Optional] IntPtr srcRect); + + /// Copies the specified region from memory into the current bitmap. + /// + /// Type: const D2D1_RECT_U* + /// In the current bitmap, the rectangle to which the region specified by srcRect is copied. + /// + /// + /// Type: const void* + /// The data to copy. + /// + /// + /// Type: UINT32 + /// + /// The stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels + /// in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current + /// bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. + /// + /// + /// If this method is passed invalid input (such as an invalid destination rectangle), can produce unpredictable results, such + /// as a distorted image or device failure. + /// + /// + /// Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed + /// does not complete successfully, this method fails. However, this method does not clear the error state of the render target + /// on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush. + /// + /// + /// Starting with Windows 8.1, this method supports block compressed bitmaps. If you are using a block compressed format, the + /// end coordinates of the srcRect parameter must be multiples of 4 or the method returns E_INVALIDARG. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrommemory HRESULT CopyFromMemory( const + // D2D1_RECT_U *dstRect, const void *srcData, UINT32 pitch ); + new void CopyFromMemory([In, Optional] IntPtr dstRect, [In] IntPtr srcData, uint pitch); + + /// Gets the color context information associated with the bitmap. + /// + /// Type: ID2D1ColorContext** + /// When this method returns, contains the address of a pointer to the color context interface associated with the bitmap. + /// + /// None + /// If the bitmap was created without specifying a color context, the returned context is NULL. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmap1-getcolorcontext void GetColorContext( + // ID2D1ColorContext **colorContext ); + [PreserveSig] + void GetColorContext(out ID2D1ColorContext colorContext); + + /// Gets the options used in creating the bitmap. + /// + /// Type: D2D1_BITMAP_OPTIONS + /// This method returns the options used. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmap1-getoptions D2D1_BITMAP_OPTIONS GetOptions(); + [PreserveSig] + D2D1_BITMAP_OPTIONS GetOptions(); + + /// + /// Gets either the surface that was specified when the bitmap was created, or the default surface created when the bitmap was created. + /// + /// + /// Type: IDXGISurface** + /// The underlying DXGI surface for the bitmap. + /// + /// + /// + /// The bitmap used must have been created from a DXGI surface render target, a derived render target, or a device context + /// created from an ID2D1Device. + /// + /// + /// The returned surface can be used with Microsoft Direct3D or any other API that interoperates with shared surfaces. The + /// application must transitively ensure that the surface is usable on the Direct3D device that is used in this context. For + /// example, if using the surface with Direct2D then the Direct2D render target must have been created through + /// ID2D1Factory::CreateDxgiSurfaceRenderTarget or on a device context created on the same device. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmap1-getsurface HRESULT GetSurface( IDXGISurface + // **dxgiSurface ); + IDXGISurface GetSurface(); + + /// Maps the given bitmap into memory. + /// + /// Type: D2D1_MAP_OPTIONS + /// The options used in mapping the bitmap into memory. + /// + /// + /// Type: D2D1_MAPPED_RECT* + /// When this method returns, contains a reference to the rectangle that is mapped into memory. + /// + /// + /// + /// Note You can't use bitmaps for some purposes while mapped. Particularly, the ID2D1Bitmap::CopyFromBitmap method + /// doesn't work if either the source or destination bitmap is mapped. + /// + /// The bitmap must have been created with the D2D1_BITMAP_OPTIONS_CPU_READ flag specified. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmap1-map HRESULT Map( D2D1_MAP_OPTIONS options, + // D2D1_MAPPED_RECT *mappedRect ); + D2D1_MAPPED_RECT Map(D2D1_MAP_OPTIONS options); + + /// Unmaps the bitmap from memory. + /// + /// + /// Any memory returned from the Map call is now invalid and may be reclaimed by the operating system or used for other purposes. + /// + /// The bitmap must have been previously mapped. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmap1-unmap HRESULT Unmap(); + void Unmap(); + } + + /// Paints an area with a bitmap. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1bitmapbrush1 + [PInvokeData("d2d1_1.h", MSDNShortId = "5EF60CF5-DB7E-4453-80A2-F248A82A37E3")] + [ComImport, Guid("41343a53-e41a-49a2-91cd-21793bbb62e5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1BitmapBrush1 : ID2D1BitmapBrush + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + new void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + new float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// Specifies how the brush horizontally tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush horizontally tiles those areas that extend past its bitmap. + /// + /// None + /// + /// + /// Sometimes, the bitmap for a bitmap brush doesn't completely fill the area being painted. When this happens, Direct2D uses + /// the brush's horizontal ( SetExtendModeX) and vertical (SetExtendModeY) extend mode settings to determine how to fill + /// the remaining area. + /// + /// + /// The following illustration shows the results from every possible combination of the extend modes for an ID2D1BitmapBrush: + /// D2D1_EXTEND_MODE_CLAMP (CLAMP), D2D1_EXTEND_MODE_WRAP (WRAP), and D2D1_EXTEND_MIRROR (MIRROR). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setextendmodex void SetExtendModeX( + // D2D1_EXTEND_MODE extendModeX ); + [PreserveSig] + new void SetExtendModeX(D2D1_EXTEND_MODE extendModeX); + + /// Specifies how the brush vertically tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush vertically tiles those areas that extend past its bitmap. + /// + /// None + /// + /// + /// Sometimes, the bitmap for a bitmap brush doesn't completely fill the area being painted. When this happens, Direct2D uses + /// the brush's horizontal (SetExtendModeX) and vertical ( SetExtendModeY) extend mode settings to determine how to fill + /// the remaining area. + /// + /// + /// The following illustration shows the results from every possible combination of the extend modes for an ID2D1BitmapBrush: + /// D2D1_EXTEND_MODE_CLAMP (CLAMP), D2D1_EXTEND_MODE_WRAP (WRAP), and D2D1_EXTEND_MIRROR (MIRROR). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setextendmodey void SetExtendModeY( + // D2D1_EXTEND_MODE extendModeY ); + [PreserveSig] + new void SetExtendModeY(D2D1_EXTEND_MODE extendModeY); + + /// Specifies the interpolation mode used when the brush bitmap is scaled or rotated. + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation mode used when the brush bitmap is scaled or rotated. + /// + /// None + /// + /// + /// This method sets the interpolation mode for a bitmap, which is an enum value that is specified in the + /// D2D1_BITMAP_INTERPOLATION_MODE enumeration type. D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR represents nearest neighbor + /// filtering. It looks up the nearest bitmap pixel to the current rendering pixel and chooses its exact color. + /// D2D1_BITMAP_INTERPOLATION_MODE_LINEAR represents linear filtering, and interpolates a color from the four nearest bitmap pixels. + /// + /// + /// The interpolation mode of a bitmap also affects subpixel translations. In a subpixel translation, bilinear interpolation + /// positions the bitmap more precisely to the application requests, but blurs the bitmap in the process. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setinterpolationmode void + // SetInterpolationMode( D2D1_BITMAP_INTERPOLATION_MODE interpolationMode ); + [PreserveSig] + new void SetInterpolationMode(D2D1_BITMAP_INTERPOLATION_MODE interpolationMode); + + /// Specifies the bitmap source that this brush uses to paint. + /// + /// Type: ID2D1Bitmap* + /// The bitmap source used by the brush. + /// + /// None + /// + /// + /// This method specifies the bitmap source that this brush uses to paint. The bitmap is not resized or rescaled automatically + /// to fit the geometry that it fills. The bitmap stays at its native size. To resize or translate the bitmap, use the + /// SetTransform method to apply a transform to the brush. + /// + /// + /// The native size of a bitmap is the width and height in bitmap pixels, divided by the bitmap DPI. This native size forms the + /// base tile of the brush. To tile a subregion of the bitmap, you must generate a new bitmap containing this subregion and use + /// SetBitmap to apply it to the brush. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-setbitmap void SetBitmap( ID2D1Bitmap + // *bitmap ); + [PreserveSig] + new void SetBitmap([In, Optional] ID2D1Bitmap bitmap); + + /// Gets the method by which the brush horizontally tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush horizontally tiles those areas that extend past its bitmap. + /// + /// + /// Like all brushes, ID2D1BitmapBrush defines an infinite plane of content. Because bitmaps are finite, it relies on an extend + /// mode to determine how the plane is filled horizontally and vertically. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getextendmodex D2D1_EXTEND_MODE GetExtendModeX(); + [PreserveSig] + new D2D1_EXTEND_MODE GetExtendModeX(); + + /// Gets the method by which the brush vertically tiles those areas that extend past its bitmap. + /// + /// Type: D2D1_EXTEND_MODE + /// A value that specifies how the brush vertically tiles those areas that extend past its bitmap. + /// + /// + /// Like all brushes, ID2D1BitmapBrush defines an infinite plane of content. + /// Because bitmaps are finite, it relies on an extend mode to determine how the plane is filled horizontally and vertically. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getextendmodey D2D1_EXTEND_MODE GetExtendModeY(); + [PreserveSig] + new D2D1_EXTEND_MODE GetExtendModeY(); + + /// Gets the interpolation method used when the brush bitmap is scaled or rotated. + /// + /// Type: D2D1_BITMAP_INTERPOLATION_MODE + /// The interpolation method used when the brush bitmap is scaled or rotated. + /// + /// + /// + /// This method gets the interpolation mode of a bitmap, which is specified by the D2D1_BITMAP_INTERPOLATION_MODE enumeration + /// type. D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR represents nearest neighbor filtering. It looks up the bitmap + /// pixel nearest to the current rendering pixel and chooses its exact color. D2D1_BITMAP_INTERPOLATION_MODE_LINEAR + /// represents linear filtering, and interpolates a color from the four nearest bitmap pixels. + /// + /// + /// The interpolation mode of a bitmap also affects subpixel translations. In a subpixel translation, linear interpolation + /// positions the bitmap more precisely to the application request, but blurs the bitmap in the process. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getinterpolationmode + // D2D1_BITMAP_INTERPOLATION_MODE GetInterpolationMode(); + [PreserveSig] + new D2D1_BITMAP_INTERPOLATION_MODE GetInterpolationMode(); + + /// Gets the bitmap source that this brush uses to paint. + /// + /// Type: ID2D1Bitmap** + /// When this method returns, contains the address to a pointer to the bitmap with which this brush paints. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmapbrush-getbitmap void GetBitmap( ID2D1Bitmap + // **bitmap ); + [PreserveSig] + new void GetBitmap(out ID2D1Bitmap bitmap); + + /// Sets the interpolation mode for the brush. + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The mode to use. + /// + /// + /// Note If interpolationMode is not a valid member of D2D1_INTERPOLATION_MODE, then this method silently ignores the call. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmapbrush1-setinterpolationmode1 void + // SetInterpolationMode1( D2D1_INTERPOLATION_MODE interpolationMode ); + [PreserveSig] + void SetInterpolationMode1(D2D1_INTERPOLATION_MODE interpolationMode); + + /// Returns the current interpolation mode of the brush. + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The current interpolation mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1bitmapbrush1-getinterpolationmode1 + // D2D1_INTERPOLATION_MODE GetInterpolationMode1(); + [PreserveSig] + D2D1_INTERPOLATION_MODE GetInterpolationMode1(); + } + + /// Represents a color context that can be used with an ID2D1Bitmap1 object. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1colorcontext + [PInvokeData("d2d1_1.h", MSDNShortId = "acdda11e-eb3f-4258-b24e-daa3b7a23fd6")] + [ComImport, Guid("1c4820bb-5771-4518-a581-2fe4dd0ec657"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1ColorContext : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Gets the color space of the color context. + /// + /// Type: D2D1_COLOR_SPACE + /// This method returns the color space of the contained ICC profile. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1colorcontext-getcolorspace D2D1_COLOR_SPACE GetColorSpace(); + [PreserveSig] + D2D1_COLOR_SPACE GetColorSpace(); + + /// Gets the size of the color profile associated with the bitmap. + /// + /// Type: UINT32 + /// This method returns the size of the profile in bytes. + /// + /// This can be used to allocate a buffer to receive the color profile bytes associated with the context. + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1colorcontext-getprofilesize UINT32 GetProfileSize(); + [PreserveSig] + uint GetProfileSize(); + + /// Gets the color profile bytes for an ID2D1ColorContext. + /// + /// Type: BYTE* + /// When this method returns, contains the color profile. + /// + /// + /// Type: UINT32 + /// The size of the profile buffer. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INSUFFICIENT_BUFFER + /// The supplied buffer was too small to accomodate the data. + /// + /// + /// + /// If profileSize is insufficient to store the entire profile, profile is zero-initialized before this method fails. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1colorcontext-getprofile HRESULT GetProfile( BYTE + // *profile, UINT32 profileSize ); + void GetProfile([Out] byte[] profile, uint profileSize); + } + + /// Represents a sequence of commands that can be recorded and played back. + /// + /// + /// The command list does not include static copies of resources with the recorded set of commands. All bitmaps, effects, and + /// geometries are stored as references to the actual resource and all the brushes are stored by value. All the resource creation + /// and destruction happens outside of the command list. The following table lists resources and how they are treated inside of a + /// command list. + /// + /// + /// + /// Resource + /// How it is treated by the command list + /// + /// + /// Solid-color brush + /// Passed by value. + /// + /// + /// Bitmap brush + /// The brush is passed by value but the bitmap that is used to create the brush is in fact referenced. + /// + /// + /// Gradient brushes – both linear and radial gradient + /// + /// The brush is passed by value but the gradient stop collection itself is referenced. The gradient stop collection object is immutable. + /// + /// + /// + /// Bitmaps + /// Passed by reference. + /// + /// + /// Drawing state block + /// The actual state on the device context is converted into set functions like set transform and is passed by value. + /// + /// + /// Geometry + /// Immutable object passed by value. + /// + /// + /// Stroke style + /// Immutable object passed by value. + /// + /// + /// Mesh + /// Immutable object passed by value. + /// + /// + /// Using a CommandList as a Target + /// The following pseudocode illustrates the different cases where a target is set as either a command list or as a bitmap. + /// + /// + /// + /// Set the bitmap as the target: In this case, all contents rendered to the bitmap are rasterized. If this bitmap is used + /// somewhere else, it will not be resolution independent and if a transformation like High Quality Scale is used, it will not + /// maintain fidelity. + /// + /// + /// + /// + /// Set the command list as the target: In this case, instead of the scene being rasterized, all of the commands are + /// recorded. When the command list is used later for screen drawing using ID2D1DeviceContext::DrawImage or passed to an XPS print + /// control, the vector content is replayed with no loss of fidelity. + /// + /// + /// + /// + /// Drawing a command list to a bitmap target: In this case because the target is a bitmap, the command list is drawn to the + /// bitmap and is no longer resolution independent. + /// + /// + /// + /// + /// The only way to retain vector content for later playback with full fidelity is to set the target type as a command list. When a + /// bitmap is set as a target, any drawing on that target will get rasterized. + /// + /// Using a CommandList to Create a Brush + /// + /// Command lists are a good way to support pattern brushes, because they are capable of retaining fidelity on replay. The desired + /// pattern can be stored as a command list, which can be used to create an image brush. This brush can then be used to paint paths. + /// + /// The type of brush that supports filling a path with a command list is called an image brush. + /// The following psuedocode illustrates the process of using a command list with an image brush. + /// Because the brush accepts an image, it has the following other benefits as well: + /// + /// + /// + /// Because the output of an effect graph is an image, this image can be used to create an image brush, which effectively provides + /// the capability of using an effect as a fill. + /// + /// + /// + /// + /// Because the command list is a type of image, vector content can be inserted into an effect graph and can also be tiled or + /// operated on. For example, a large copyright notice can be inserted over a graph with a virtualized image and then encoded. + /// + /// + /// + /// Using a CommandList as a Replacement for a Compatible Render Target + /// + /// Compatible render targets are used very often for off-screen rendering to an intermediate bitmap that is later composited with + /// the actual scene. Especially in the case of printing, using compatible render targets will increase the memory footprint because + /// everything will be rasterized and sent to XPS instead of retaining the actual primitives. In this scenario, a developer is + /// better off replacing the compatible render target with an intermediate command list. The following pseudo code illustrates this point. + /// + /// Working with Other APIs + /// + /// Direct2D employs a simple model when interoperating with GDI and Direct3D/DXGI APIs. The command list does not record these + /// commands. It instead rasterizes the contents in place and stores them as an ID2D1Bitmap. Because the contents are rasterized, + /// these interop points do not maintain high fidelity. + /// + /// + /// GDI: The command sink interface does not support Get/ReleaseDC() calls. When a call to + /// ID2D1GdiInteropRenderTarget::ReleaseDC is made, Direct2D renders the contents of the updated region into a D2D1Bitmap. This will + /// be replayed as an aliased DrawBitmap call with a copy composite mode. To rasterize the bitmap at the correct DPI, at the time of + /// playback of the commands, whatever DPI value is set using the SetDPI() function is used. This is the only case where the sink + /// respects the SetDPI() call. + /// + /// + /// DX: Direct3D cannot render directly to the command list. To render Direct3D content in this case, the application can + /// call DrawBitmap with the ID2D1Bitmap backed by a Direct3D surface. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1commandlist + [ComImport, Guid("b4f34a19-2383-4d76-94f6-ec343657c3dc"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1CommandList : ID2D1Image + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Streams the contents of the command list to the specified command sink. + /// + /// Type: ID2D1CommandSink* + /// The sink into which the command list will be streamed. + /// + /// + /// The command sink can be implemented by any caller of the API. + /// + /// If the caller makes any design-time failure calls while a command list is selected as a target, the command list is placed + /// in an error state. The stream call fails without making any calls to the passed in sink. + /// + /// Sample use: + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandlist-stream HRESULT Stream( ID2D1CommandSink + // *sink ); + void Stream([In] ID2D1CommandSink sink); + + /// + /// Instructs the command list to stop accepting commands so that you can use it as an input to an effect or in a call to + /// ID2D1DeviceContext::DrawImage. You should call the method after it has been attached to an ID2D1DeviceContext and written to + /// but before the command list is used. + /// + /// + /// + /// This method returns D2DERR_WRONG_STATE if it has already been called on the command list. If an error occurred on the device + /// context during population, the method returns that error. Otherwise, the method returns S_OK. + /// + /// If the Close method returns an error, any future use of the command list results in the same error. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandlist-close HRESULT Close(); + void Close(); + } + + /// + /// + /// The command sink is implemented by you for an application when you want to receive a playback of the commands recorded in a + /// command list. A typical usage will be for transforming the command list into another format such as XPS when some degree of + /// conversion between the Direct2D primitives and the target format is required. + /// + /// + /// The command sink interface doesn't have any resource creation methods on it. The resources are still logically bound to the + /// Direct2D device on which the command list was created and will be passed in to the command sink implementation. + /// + /// + /// + /// + /// The ID2D1CommandSink can be implemented to receive a play-back of the commands recorded in a command list. This interface + /// is typically used for transforming the command list into another format where some degree of conversion between the Direct2D + /// primitives and the target format is required. + /// + /// + /// The ID2D1CommandSink interface does not have any resource creation methods. The resources are logically bound to the + /// Direct2D device on which the ID2D1CommandList was created and will be passed in to the ID2D1CommandSink implementation. + /// + /// Not all methods implemented by ID2D1DeviceContext are present. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1commandsink + [PInvokeData("d2d1_1.h", MSDNShortId = "4e0ce837-7f4e-4b93-8dd7-68f60cfb1105")] + [ComImport, Guid("54d7898a-a061-40a7-bec7-e465bcba2c4f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1CommandSink + { + /// Notifies the implementation of the command sink that drawing is about to commence. + /// + /// Type: HRESULT + /// This method always returns S_OK. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-begindraw HRESULT BeginDraw(); + [PreserveSig] + HRESULT BeginDraw(); + + /// Indicates when ID2D1CommandSink processing has completed. + /// + /// Type: HRESULT + /// If the method/function succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// + /// The HRESULT active at the end of the command list will be returned. + /// It allows the calling function or method to indicate a failure back to the stream implementation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-enddraw HRESULT EndDraw(); + [PreserveSig] + HRESULT EndDraw(); + + /// Sets the antialiasing mode that will be used to render any subsequent geometry. + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialiasing mode selected for the command list. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-setantialiasmode HRESULT + // SetAntialiasMode( D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + HRESULT SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); + + /// Sets the tags that correspond to the tags in the command sink. + /// + /// Type: D2D1_TAG + /// The first tag to associate with the primitive. + /// + /// + /// Type: D2D1_TAG + /// The second tag to associate with the primitive. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-settags HRESULT SetTags( D2D1_TAG tag1, + // D2D1_TAG tag2 ); + [PreserveSig] + HRESULT SetTags(ulong tag1, ulong tag2); + + /// Indicates the new default antialiasing mode for text. + /// + /// Type: D2D1_TEXT_ANTIALIAS_MODE + /// The antialiasing mode for the text. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-settextantialiasmode HRESULT + // SetTextAntialiasMode( D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode ); + [PreserveSig] + HRESULT SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); + + /// Indicates more detailed text rendering parameters. + /// + /// Type: IDWriteRenderingParams* + /// The parameters to use for text rendering. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-settextrenderingparams HRESULT + // SetTextRenderingParams( IDWriteRenderingParams *textRenderingParams ); + [PreserveSig] + HRESULT SetTextRenderingParams([In, Optional] IDWriteRenderingParams textRenderingParams); + + /// Sets a new transform. + /// + /// Type: const D2D1_MATRIX_3X2_F* + /// The transform to be set. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// The transform will be applied to the corresponding device context. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-settransform HRESULT SetTransform( const + // D2D1_MATRIX_3X2_F *transform ); + [PreserveSig] + HRESULT SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Sets a new primitive blend mode. + /// + /// Type: D2D1_PRIMITIVE_BLEND + /// The primitive blend that will apply to subsequent primitives. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-setprimitiveblend HRESULT + // SetPrimitiveBlend( D2D1_PRIMITIVE_BLEND primitiveBlend ); + [PreserveSig] + HRESULT SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend); + + /// + /// The unit mode changes the meaning of subsequent units from device-independent pixels (DIPs) to pixels or the other way. The + /// command sink does not record a DPI, this is implied by the playback context or other playback interface such as ID2D1PrintControl. + /// + /// + /// Type: D2D1_UNIT_MODE + /// The enumeration that specifies how units are to be interpreted. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// The unit mode changes the interpretation of units from DIPs to pixels or vice versa. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-setunitmode HRESULT SetUnitMode( + // D2D1_UNIT_MODE unitMode ); + [PreserveSig] + HRESULT SetUnitMode(D2D1_UNIT_MODE unitMode); + + /// Clears the drawing area to the specified color. + /// + /// Type: const D2D1_COLOR_F* + /// The color to which the command sink should be cleared. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// + /// The clear color is restricted by the currently selected clip and layer bounds. + /// If no color is specified, the color should be interpreted by context. Examples include but are not limited to: + /// + /// + /// Transparent black for a premultiplied bitmap target. + /// + /// + /// Opaque black for an ignore bitmap target. + /// + /// + /// Containing no content (or white) for a printer page. + /// + /// + /// + // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F + // *color ); + [PreserveSig] + HRESULT Clear([In, Optional] IntPtr color); + + /// Indicates the glyphs to be drawn. + /// + /// Type: D2D1_POINT_2F + /// The upper left corner of the baseline. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The glyphs to render. + /// + /// + /// Type: const DWRITE_GLYPH_RUN_DESCRIPTION* + /// Additional non-rendering information about the glyphs. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to fill the glyphs. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// The measuring mode to apply to the glyphs. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// + /// DrawText and DrawTextLayout are broken down into glyph runs and rectangles by the time the command sink is processed. So, + /// these methods aren't available on the command sink. Since the application may require additional callback processing when + /// calling DrawTextLayout, this semantic can't be easily preserved in the command list. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawglyphrun HRESULT DrawGlyphRun( + // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, + // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); + [PreserveSig] + HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + + /// Draws a line drawn between two points. + /// + /// Type: D2D1_POINT_2F + /// The start point of the line. + /// + /// + /// Type: D2D1_POINT_2F + /// The end point of the line. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to fill the line. + /// + /// + /// Type: FLOAT + /// The width of the stroke to fill the line. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke. If not specified, the stroke is solid. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// Additional References + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawline HRESULT DrawLine( D2D1_POINT_2F + // point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + HRESULT DrawLine(D2D_POINT_2F point0, D2D_POINT_2F point1, [In] ID2D1Brush brush, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle); + + /// Indicates the geometry to be drawn to the command sink. + /// + /// Type: ID2D1Geometry * + /// The geometry to be stroked. + /// + /// + /// Type: ID2D1Brush* + /// The brush that will be used to fill the stroked geometry. + /// + /// + /// Type: FLOAT + /// The width of the stroke. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke. + /// + /// + /// Type: HRESULT + /// An HRESULT. + /// + /// + /// Ellipses and rounded rectangles are converted to the corresponding ellipse and rounded rectangle geometries before calling + /// into the DrawGeometry method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgeometry HRESULT DrawGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + HRESULT DrawGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle); + + /// Draws a rectangle. + /// + /// Type: const D2D1_RECT_F* + /// The rectangle to be drawn to the command sink. + /// + /// + /// Type: ID2D1Brush* + /// The brush used to stroke the geometry. + /// + /// + /// Type: FLOAT + /// The width of the stroke. + /// + /// + /// Type: ID2D1StrokeStyle* + /// The style of the stroke. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawrectangle HRESULT DrawRectangle( + // const D2D1_RECT_F *rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle ); + [PreserveSig] + HRESULT DrawRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush, float strokeWidth, [In, Optional] ID2D1StrokeStyle strokeStyle); + + /// Draws a bitmap to the render target. + /// + /// Type: ID2D1Bitmap* + /// The bitmap to draw. + /// + /// + /// Type: D2D1_RECT_F + /// + /// The destination rectangle. The default is the size of the bitmap and the location is the upper left corner of the render target. + /// + /// + /// + /// Type: FLOAT + /// The opacity of the bitmap. + /// + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The interpolation mode to use. + /// + /// + /// Type: const D2D1_RECT_F + /// An optional source rectangle. + /// + /// + /// Type: const D2D1_MATRIX_4X4_F + /// An optional perspective transform. + /// + /// This method does not return a value. + /// + /// + /// The destinationRectangle parameter defines the rectangle in the target where the bitmap will appear (in device-independent + /// pixels (DIPs)). This is affected by the currently set transform and the perspective transform, if set. If you specify NULL, + /// then the destination rectangle is (left=0, top=0, right = width(sourceRectangle), bottom = height(sourceRectangle). + /// + /// + /// The sourceRectangle defines the sub-rectangle of the source bitmap (in DIPs). DrawBitmap clips this rectangle to the + /// size of the source bitmap, so it's impossible to sample outside of the bitmap. If you specify NULL, then the source + /// rectangle is taken to be the size of the source bitmap. + /// + /// The perspectiveTransform is specified in addition to the transform on device context. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawbitmap HRESULT DrawBitmap( + // ID2D1Bitmap *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const + // D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); + [PreserveSig] + HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + + /// Draws the provided image to the command sink. + /// + /// Type: ID2D1Image* + /// The image to be drawn to the command sink. + /// + /// + /// Type: const D2D1_POINT_2F* + /// + /// This defines the offset in the destination space that the image will be rendered to. The entire logical extent of the image + /// will be rendered to the corresponding destination. If not specified, the destination origin will be (0, 0). The top-left + /// corner of the image will be mapped to the target offset. This will not necessarily be the origin. + /// + /// + /// + /// Type: const D2D1_RECT_F* + /// The corresponding rectangle in the image space will be mapped to the provided origins when processing the image. + /// + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The interpolation mode to use to scale the image if necessary. + /// + /// + /// Type: D2D1_COMPOSITE_MODE + /// If specified, the composite mode that will be applied to the limits of the currently selected clip. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// + /// Because the image can itself be a command list or contain an effect graph that in turn contains a command list, this method + /// can result in recursive processing. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawimage HRESULT DrawImage( ID2D1Image + // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, + // D2D1_COMPOSITE_MODE compositeMode ); + [PreserveSig] + HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + + /// Draw a metafile to the device context. + /// + /// Type: ID2D1GdiMetafile* + /// The metafile to draw. + /// + /// + /// Type: const D2D1_POINT_2F* + /// The offset from the upper left corner of the render target. + /// + /// This method does not return a value. + /// + /// The targetOffset defines the offset in the destination space that the image will be rendered to. The entire logical extent + /// of the image is rendered to the corresponding destination. If you don't specify the offset, the destination origin will be + /// (0, 0). The top, left corner of the image will be mapped to the target offset. This will not necessarily be the origin. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( + // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); + [PreserveSig] + HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + + /// Indicates a mesh to be filled by the command sink. + /// + /// Type: ID2D1Mesh* + /// The mesh object to be filled. + /// + /// + /// Type: ID2D1Brush* + /// The brush with which to fill the mesh. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillmesh HRESULT FillMesh( ID2D1Mesh + // *mesh, ID2D1Brush *brush ); + [PreserveSig] + HRESULT FillMesh([In] ID2D1Mesh mesh, [In] ID2D1Brush brush); + + /// Fills an opacity mask on the command sink. + /// + /// Type: ID2D1Bitmap* + /// The bitmap whose alpha channel will be sampled to define the opacity mask. + /// + /// + /// Type: ID2D1Brush* + /// The brush with which to fill the mask. + /// + /// + /// Type: const D2D1_RECT_F* + /// The destination rectangle in which to fill the mask. If not specified, this is the origin. + /// + /// + /// Type: const D2D1_RECT_F* + /// The source rectangle within the opacity mask. If not specified, this is the entire mask. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// The opacity mask bitmap must be considered to be clamped on each axis. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( + // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); + [PreserveSig] + HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + + /// Indicates to the command sink a geometry to be filled. + /// + /// Type: ID2D1Geometry* + /// The geometry that should be filled. + /// + /// + /// Type: ID2D1Brush* + /// The primary brush used to fill the geometry. + /// + /// + /// Type: ID2D1Brush* + /// A brush whose alpha channel is used to modify the opacity of the primary fill brush. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// + /// If the opacity brush is specified, the primary brush will be a bitmap brush fixed on both the x-axis and the y-axis. + /// Ellipses and rounded rectangles are converted to the corresponding geometry before being passed to FillGeometry. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillgeometry HRESULT FillGeometry( + // ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush ); + [PreserveSig] + HRESULT FillGeometry([In] ID2D1Geometry geometry, [In] ID2D1Brush brush, [In, Optional] ID2D1Brush opacityBrush); + + /// Indicates to the command sink a rectangle to be filled. + /// + /// Type: const D2D1_RECT_F* + /// The rectangle to fill. + /// + /// + /// Type: ID2D1Brush* + /// The brush with which to fill the rectangle. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillrectangle HRESULT FillRectangle( + // const D2D1_RECT_F *rect, ID2D1Brush *brush ); + [PreserveSig] + HRESULT FillRectangle(in D2D_RECT_F rect, [In] ID2D1Brush brush); + + /// Pushes a clipping rectangle onto the clip and layer stack. + /// + /// Type: const D2D1_RECT_F* + /// The rectangle that defines the clip. + /// + /// + /// Type: D2D1_ANTIALIAS_MODE + /// The antialias mode for the clip. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + /// + /// If the current world transform is not preserving the axis, clipRectangle is transformed and the bounds of the transformed + /// rectangle are used instead. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-pushaxisalignedclip HRESULT + // PushAxisAlignedClip( const D2D1_RECT_F *clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); + [PreserveSig] + HRESULT PushAxisAlignedClip(in D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode); + + /// Pushes a layer onto the clip and layer stack. + /// + /// Type: const D2D1_LAYER_PARAMETERS1* + /// The parameters that define the layer. + /// + /// + /// Type: ID2D1Layer* + /// The layer resource that receives subsequent drawing operations. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-pushlayer HRESULT PushLayer( const + // D2D1_LAYER_PARAMETERS1 *layerParameters1, ID2D1Layer *layer ); + [PreserveSig] + HRESULT PushLayer(in D2D1_LAYER_PARAMETERS1 layerParameters1, [In, Optional] ID2D1Layer layer); + + /// Removes an axis-aligned clip from the layer and clip stack. + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-popaxisalignedclip HRESULT PopAxisAlignedClip(); + [PreserveSig] + HRESULT PopAxisAlignedClip(); + + /// Removes a layer from the layer and clip stack. + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-poplayer HRESULT PopLayer(); + [PreserveSig] + HRESULT PopLayer(); + } + + /// Represents a basic image-processing construct in Direct2D. + /// + /// An effect takes zero or more input images, and has an output image. The images that are input into and output from an effect are + /// lazily evaluated. This definition is sufficient to allow an arbitrary graph of effects to be created from the application by + /// feeding output images into the input image of the next effect in the chain. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1effect + [PInvokeData("d2d1_1.h", MSDNShortId = "e90d1830-c356-48f1-ac7b-1d94c8c26569")] + [ComImport, Guid("28211a43-7d89-476f-8181-2d6159b220ad"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Effect : ID2D1Properties + { + /// Gets the number of top-level properties. + /// + /// Type: UINT32 + /// This method returns the number of custom (non-system) properties that can be accessed by the object. + /// + /// + /// This method returns the number of custom properties on the ID2D1Properties interface. System properties and sub-properties + /// are part of a closed set, and are enumerable by iterating over this closed set. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertycount UINT32 GetPropertyCount(); + [PreserveSig] + new uint GetPropertyCount(); + + /// Gets the property name that corresponds to the given index. + /// + /// Type: UINT32 + /// The index of the property for which the name is being returned. + /// + /// + /// Type: PWSTR + /// When this method returns, contains the name being retrieved. + /// + /// + /// Type: UINT32 + /// The number of characters in the name buffer. + /// + /// + /// This method returns an empty string if index is invalid. If the method returns + /// RESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), name will still be filled and truncated. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertyname(uint32_pwstr_uint32) + // HRESULT GetPropertyName( UINT32 index, PWSTR name, UINT32 nameCount ); + new void GetPropertyName(uint index, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder name, uint nameCount); + + /// Gets the number of characters for the given property name. This is a template overload. See Remarks. + /// + /// Type: U + /// The index of the property name to retrieve. + /// + /// + /// Type: UINT32 + /// + /// This method returns the size in characters of the name corresponding to the given property index, or zero if the property + /// index does not exist. + /// + /// + /// + /// The value returned by this method can be used to ensure that the buffer size for GetPropertyName is appropriate. + /// template<typename U> UINT32 GetPropertyNameLength( U index ) CONST; + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertynamelength%28u%29 UINT32 + // GetPropertyNameLength( U index ); + [PreserveSig] + new uint GetPropertyNameLength(uint index); + + /// Gets the D2D1_PROPERTY_TYPE of the selected property. + /// + /// Type: UINT32 + /// The index of the property for which the type will be retrieved. + /// + /// + /// Type: D2D1_PROPERTY_TYPE + /// This method returns a D2D1_PROPERTY_TYPE-typed value for the type of the selected property. + /// + /// If the property does not exist, the method returns D2D1_PROPERTY_TYPE_UNKNOWN. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-gettype%28uint32%29 D2D1_PROPERTY_TYPE + // GetType( UINT32 index ); + [PreserveSig] + new D2D1_PROPERTY_TYPE GetType(uint index); + + /// Gets the index corresponding to the given property name. + /// + /// Type: PCWSTR + /// The name of the property to retrieve. + /// + /// + /// Type: UINT32 + /// The index of the corresponding property name. + /// + /// + /// If the property doesn't exist, then this method returns D2D1_INVALID_PROPERTY_INDEX. This reserved value will never map to a + /// valid index, and will cause NULL or sentinel values to be returned from other parts of the property interface. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertyindex UINT32 GetPropertyIndex( + // PCWSTR name ); + [PreserveSig] + new uint GetPropertyIndex([MarshalAs(UnmanagedType.LPWStr)] string name); + + /// Sets the named property to the given value. + /// + /// Type: PCWSTR + /// The name of the property to set. + /// + /// TBD + /// + /// Type: const BYTE* + /// The data to set. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to set. + /// + /// + /// If the property does not exist, the request is ignored and the method returns D2DERR_INVALID_PROPERTY. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvaluebyname%28pcwstr_d2d1_property_type_constbyte_uint32%29 + // HRESULT SetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + new void SetValueByName([MarshalAs(UnmanagedType.LPWStr)] string name, D2D1_PROPERTY_TYPE type, [In] IntPtr data, uint dataSize); + + /// Sets the corresponding property by index. + /// + /// Type: UINT32 + /// The index of the property to set. + /// + /// TBD + /// + /// Type: const BYTE* + /// The data to set. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to set. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INVALID_PROPERTY + /// The specified property does not exist. + /// + /// + /// E_OUTOFMEMORY + /// Failed to allocate necessary memory. + /// + /// + /// D3DERR_OUT_OF_VIDEO_MEMORY + /// Failed to allocate required video memory. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_FAIL + /// Unspecified failure. + /// + /// + /// + /// + /// If the property does not exist, the request is ignored and D2DERR_INVALID_PROPERTY is returned. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32) + // HRESULT SetValue( UINT32 index, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + new void SetValue(uint index, D2D1_PROPERTY_TYPE type, [In] IntPtr data, uint dataSize); + + /// Gets the property value by name. + /// + /// Type: PCWSTR + /// The property name to get. + /// + /// TBD + /// + /// Type: BYTE* + /// When this method returns, contains the buffer with the data value. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to be retrieved. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INVALID_PROPERTY + /// The specified property does not exist. + /// + /// + /// E_OUTOFMEMORY + /// Failed to allocate necessary memory. + /// + /// + /// D3DERR_OUT_OF_VIDEO_MEMORY + /// Failed to allocate required video memory. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_FAIL + /// Unspecified failure. + /// + /// + /// + /// + /// If name does not exist, no information is retrieved. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvaluebyname(pcwstr_d2d1_property_type_byte_uint32) + // HRESULT GetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize ); + new void GetValueByName([MarshalAs(UnmanagedType.LPWStr)] string name, D2D1_PROPERTY_TYPE type, [Out] IntPtr data, uint dataSize); + + /// Gets the value of the specified property by index. + /// + /// Type: UINT32 + /// The index of the property from which the data is to be obtained. + /// + /// TBD + /// + /// Type: BYTE* + /// When this method returns, contains a pointer to the data requested. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to be retrieved. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INVALID_PROPERTY + /// The specified property does not exist. + /// + /// + /// E_OUTOFMEMORY + /// Failed to allocate necessary memory. + /// + /// + /// D3DERR_OUT_OF_VIDEO_MEMORY + /// Failed to allocate required video memory. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_FAIL + /// Unspecified failure. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvalue(uint32_d2d1_property_type_byte_uint32) + // HRESULT GetValue( UINT32 index, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize ); + new void GetValue(uint index, D2D1_PROPERTY_TYPE type, [Out] IntPtr data, uint dataSize); + + /// Gets the size of the property value in bytes, using the property index. This is a template overload. See Remarks. + /// + /// Type: U + /// The index of the property. + /// + /// + /// Type: UINT32 + /// This method returns size of the value in bytes, using the property index + /// + /// + /// This method returns zero if index does not exist. + /// template<typename U> UINT32 GetValueSize( U index ) CONST; + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvaluesize%28u%29 UINT32 GetValueSize( + // U index ); + [PreserveSig] + new uint GetValueSize(uint index); + + /// Gets the sub-properties of the provided property by index. + /// + /// Type: UINT32 + /// The index of the sub-properties to be retrieved. + /// + /// + /// Type: ID2D1Properties** + /// When this method returns, contains the address of a pointer to the sub-properties. + /// + /// + /// If there are no sub-properties, subProperties will be NULL, and D2DERR_NO_SUBPROPERTIES will be returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getsubproperties%28uint32_id2d1properties%29 + // HRESULT GetSubProperties( UINT32 index, ID2D1Properties **subProperties ); + new ID2D1Properties GetSubProperties(uint index); + + /// Sets the given input image by index. + /// + /// Type: UINT32 + /// The index of the image to set. + /// + /// + /// Type: ID2D1Image* + /// The input image to set. + /// + /// + /// Type: BOOL + /// Whether to invalidate the graph at the location of the effect input + /// + /// None + /// If the input index is out of range, the input image is ignored. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1effect-setinput void SetInput( UINT32 index, + // ID2D1Image *input, BOOL invalidate ); + [PreserveSig] + void SetInput(uint index, [In, Optional] ID2D1Image input, [MarshalAs(UnmanagedType.Bool)] bool invalidate = true); + + /// Allows the application to change the number of inputs to an effect. + /// + /// Type: UINT32 + /// The number of inputs to the effect. + /// + /// + /// + /// Most effects do not support a variable number of inputs. Use ID2D1Properties::GetValue with the + /// D2D1_PROPERTY_MIN_INPUTS and D2D1_PROPERTY_MAX_INPUTS values to determine the number of inputs supported by an effect. + /// + /// If the input count is less than the minimum or more than the maximum supported inputs, the call will fail. + /// If the input count is unchanged, the call will succeed with S_OK. + /// + /// Any inputs currently selected on the effect will be unaltered by this call unless the number of inputs is made smaller. If + /// the number of inputs is made smaller, inputs beyond the selected range will be released. + /// + /// If the method fails, the existing input and input count will remain unchanged. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1effect-setinputcount HRESULT SetInputCount( UINT32 + // inputCount ); + void SetInputCount(uint inputCount); + + /// Gets the given input image by index. + /// + /// Type: UINT32 + /// The index of the image to retrieve. + /// + /// + /// Type: ID2D1Image** + /// When this method returns, contains the address of a pointer to the image that is identified by Index. + /// + /// None + /// If the input index is out of range, the returned image will be NULL. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1effect-getinput void GetInput( UINT32 index, + // ID2D1Image **input ); + [PreserveSig] + void GetInput(uint index, out ID2D1Image input); + + /// Gets the number of inputs to the effect. + /// + /// Type: UINT32 + /// This method returns the number of inputs to the effect. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1effect-getinputcount UINT32 GetInputCount(); + [PreserveSig] + uint GetInputCount(); + + /// Gets the output image from the effect. + /// + /// Type: ID2D1Image** + /// When this method returns, contains the address of a pointer to the output image for the effect. + /// + /// None + /// + /// + /// The output image can be set as an input to another effect, or can be directly passed into the ID2D1DeviceContext in order to + /// render the effect. + /// + /// It is also possible to use QueryInterface to retrieve the same output image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1effect-getoutput void GetOutput( ID2D1Image + // **outputImage ); + [PreserveSig] + void GetOutput(out ID2D1Image outputImage); + } + + /// A Direct2D resource that wraps a WMF, EMF, or EMF+ metafile. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1gdimetafile + [PInvokeData("d2d1_1.h", MSDNShortId = "36A454EC-7DE0-4610-B49C-7FBBD21C425C")] + [ComImport, Guid("2f543dc3-cfc1-4211-864f-cfd91c6f3395"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1GdiMetafile : ID2D1Resource + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// This method streams the contents of the command to the given metafile sink. + /// + /// Type: ID2D1GdiMetafileSink + /// The sink into which Direct2D will call back. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// E_OUTOFMEMORY + /// Direct2D could not allocate sufficient memory to complete the call. + /// + /// + /// E_INVALIDARG + /// An invalid value was passed to the method. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gdimetafile-stream HRESULT Stream( + // ID2D1GdiMetafileSink *sink ); + void Stream([In] ID2D1GdiMetafileSink sink); + + /// Gets the bounds of the metafile, in device-independent pixels (DIPs), as reported in the metafile’s header. + /// + /// Type: D2D1_RECT_F* + /// The bounds, in DIPs, of the metafile. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gdimetafile-getbounds HRESULT GetBounds( D2D1_RECT_F + // *bounds ); + D2D_RECT_F GetBounds(); + } + + /// A developer implemented interface that allows a metafile to be replayed. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1gdimetafilesink + [PInvokeData("d2d1_1.h", MSDNShortId = "1E9866C3-2A07-48C2-A4C5-F9AE3C7B2272")] + [ComImport, Guid("82237326-8111-4f7c-bcf4-b5c1175564fe"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1GdiMetafileSink + { + /// This method is called once for each record stored in a metafile. + /// + /// Type: DWORD + /// The type of the record. + /// + /// + /// Type: void* + /// The data for the record. + /// + /// + /// Type: UINT + /// The byte size of the record data. + /// + /// + /// Type: BOOL + /// Return true if the record is successfully. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gdimetafilesink-processrecord HRESULT ProcessRecord( + // DWORD recordType, const void *recordData, DWORD recordDataSize ); + [PreserveSig] + HRESULT ProcessRecord(uint recordType, [In, Optional] IntPtr recordData, uint recordDataSize); + } + + /// + /// Represents a collection of D2D1_GRADIENT_STOP objects for linear and radial gradient brushes. It provides get methods for all + /// the new parameters added to the gradient stop collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1gradientstopcollection1 + [PInvokeData("d2d1_1.h", MSDNShortId = "aa423e18-c6b5-4587-b044-deda00a84615")] + [ComImport, Guid("ae1572f4-5dd0-4777-998b-9279472ae63b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1GradientStopCollection1 : ID2D1GradientStopCollection + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Retrieves the number of gradient stops in the collection. + /// + /// Type: UINT32 + /// The number of gradient stops in the collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getgradientstopcount UINT32 GetGradientStopCount(); + [PreserveSig] + new uint GetGradientStopCount(); + + /// Copies the gradient stops from the collection into an array of D2D1_GRADIENT_STOP structures. + /// + /// Type: D2D1_GRADIENT_STOP* + /// + /// A pointer to a one-dimensional array of D2D1_GRADIENT_STOP structures. When this method returns, the array contains copies + /// of the collection's gradient stops. You must allocate the memory for this array. + /// + /// + /// + /// Type: UINT + /// + /// A value indicating the number of gradient stops to copy. If the value is less than the number of gradient stops in the + /// collection, the remaining gradient stops are omitted. If the value is larger than the number of gradient stops in the + /// collection, the extra gradient stops are set to NULL. To obtain the number of gradient stops in the collection, use + /// the GetGradientStopCount method. + /// + /// + /// None + /// + /// Gradient stops are copied in order of position, starting with the gradient stop with the smallest position value and + /// progressing to the gradient stop with the largest position value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getgradientstops void + // GetGradientStops( D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount ); + [PreserveSig] + new void GetGradientStops([Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount); + + /// Indicates the gamma space in which the gradient stops are interpolated. + /// + /// Type: D2D1_GAMMA + /// The gamma space in which the gradient stops are interpolated. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getcolorinterpolationgamma + // D2D1_GAMMA GetColorInterpolationGamma(); + [PreserveSig] + new D2D1_GAMMA GetColorInterpolationGamma(); + + /// Indicates the behavior of the gradient outside the normalized gradient range. + /// + /// Type: D2D1_EXTEND_MODE + /// The behavior of the gradient outside the [0,1] normalized gradient range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1gradientstopcollection-getextendmode D2D1_EXTEND_MODE GetExtendMode(); + [PreserveSig] + new D2D1_EXTEND_MODE GetExtendMode(); + + /// Copies the gradient stops from the collection into memory. + /// + /// Type: D2D1_GRADIENT_STOP* + /// When this method returns, contains a pointer to a one-dimensional array of D2D1_GRADIENT_STOP structures. + /// + /// + /// Type: UINT + /// The number of gradient stops to copy. + /// + /// None + /// + /// + /// If the ID2D1DeviceContext::CreateGradientStopCollection, this method returns the same values specified in the creation + /// method. If the ID2D1GradientStopCollection1 object was created using + /// ID2D1RenderTarget::CreateGradientStopCollection, the stops returned here will first be transformed into the gamma + /// space specified by the colorInterpolationGamma parameter. See the ID2D1DeviceContext::CreateGradientStopCollection method + /// for more info about color space and gamma space. + /// + /// + /// If gradientStopsCount is less than the number of gradient stops in the collection, the remaining gradient stops are omitted. + /// If gradientStopsCount is larger than the number of gradient stops in the collection, the extra gradient stops are set to + /// NULL. To obtain the number of gradient stops in the collection, use the GetGradientStopCount method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gradientstopcollection1-getgradientstops1 void + // GetGradientStops1( D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount ); + [PreserveSig] + void GetGradientStops1([Out] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount); + + /// Gets the color space of the input colors as well as the space in which gradient stops are interpolated. + /// + /// Type: D2D1_COLOR_SPACE + /// This method returns the color space. + /// + /// + /// If this object was created using ID2D1RenderTarget::CreateGradientStopCollection, this method returns the color space + /// related to the color interpolation gamma. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gradientstopcollection1-getpreinterpolationspace + // D2D1_COLOR_SPACE GetPreInterpolationSpace(); + [PreserveSig] + D2D1_COLOR_SPACE GetPreInterpolationSpace(); + + /// Gets the color space after interpolation has occurred. + /// + /// Type: D2D1_COLOR_SPACE + /// This method returns the color space. + /// + /// If you create using ID2D1RenderTarget::CreateGradientStopCollection, this method returns D2D1_COLOR_SPACE_SRGB. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gradientstopcollection1-getpostinterpolationspace + // D2D1_COLOR_SPACE GetPostInterpolationSpace(); + [PreserveSig] + D2D1_COLOR_SPACE GetPostInterpolationSpace(); + + /// Gets the precision of the gradient buffer. + /// + /// Type: D2D1_BUFFER_PRECISION + /// The buffer precision of the gradient buffer. + /// + /// If this object was created using ID2D1RenderTarget::CreateGradientStopCollection, this method returns D2D1_BUFFER_PRECISION_8BPC_UNORM. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gradientstopcollection1-getbufferprecision + // D2D1_BUFFER_PRECISION GetBufferPrecision(); + [PreserveSig] + D2D1_BUFFER_PRECISION GetBufferPrecision(); + + /// Retrieves the color interpolation mode that the gradient stop collection uses. + /// + /// Type: D2D1_COLOR_INTERPOLATION_MODE + /// The color interpolation mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1gradientstopcollection1-getcolorinterpolationmode + // D2D1_COLOR_INTERPOLATION_MODE GetColorInterpolationMode(); + [PreserveSig] + D2D1_COLOR_INTERPOLATION_MODE GetColorInterpolationMode(); + } + + /// Represents a brush based on an ID2D1Image. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1imagebrush + [PInvokeData("d2d1_1.h", MSDNShortId = "c5088ce2-5744-4061-957b-25831478a714")] + [ComImport, Guid("fe9e984d-3f95-407c-b5db-cb94d4e8f87c"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1ImageBrush : ID2D1Brush + { + /// Retrieves the factory associated with this resource. + /// + /// Type: ID2D1Factory** + /// + /// When this method returns, contains a pointer to a pointer to the factory that created this resource. This parameter is + /// passed uninitialized. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1resource-getfactory void GetFactory( ID2D1Factory + // **factory ); + [PreserveSig] + new void GetFactory(out ID2D1Factory factory); + + /// Sets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-setopacity void SetOpacity( FLOAT opacity ); + [PreserveSig] + new void SetOpacity(float opacity); + + /// Sets the transformation applied to the brush. + /// + /// Type: const D2D1_MATRIX_3X2_F + /// The transformation to apply to this brush. + /// + /// None + /// + /// + /// When you paint with a brush, it paints in the coordinate space of the render target. Brushes do not automatically position + /// themselves to align with the object being painted; by default, they begin painting at the origin (0, 0) of the render target. + /// + /// + /// You can "move" the gradient defined by an ID2D1LinearGradientBrush to a target area by setting its start point and end + /// point. Likewise, you can move the gradient defined by an ID2D1RadialGradientBrush by changing its center and radii. + /// + /// + /// To align the content of an ID2D1BitmapBrush to the area being painted, you can use the SetTransform method to translate the + /// bitmap to the desired location. This transform only affects the brush; it does not affect any other content drawn by the + /// render target. + /// + /// + /// The following illustrations show the effect of using an ID2D1BitmapBrush to fill a rectangle located at (100, 100). The + /// illustration on the left illustration shows the result of filling the rectangle without transforming the brush: the bitmap + /// is drawn at the render target's origin. As a result, only a portion of the bitmap appears in the rectangle. + /// + /// + /// The illustration on the right shows the result of transforming the ID2D1BitmapBrush so that its content is shifted 50 pixels + /// to the right and 50 pixels down. The bitmap now fills the rectangle. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-settransform(constd2d1_matrix_3x2_f_) void + // SetTransform( const D2D1_MATRIX_3X2_F & transform ); + [PreserveSig] + new void SetTransform(in D2D_MATRIX_3X2_F transform); + + /// Gets the degree of opacity of this brush. + /// + /// Type: FLOAT + /// + /// A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales + /// the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0–1 before they are multipled together. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-getopacity FLOAT GetOpacity(); + [PreserveSig] + new float GetOpacity(); + + /// Gets the transform applied to this brush. + /// + /// Type: D2D1_MATRIX_3X2_F* + /// The transform applied to this brush. + /// + /// None + /// + /// When the brush transform is the identity matrix, the brush appears in the same coordinate space as the render target in + /// which it is drawn. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1brush-gettransform void GetTransform( D2D1_MATRIX_3X2_F + // *transform ); + [PreserveSig] + new void GetTransform(out D2D_MATRIX_3X2_F transform); + + /// Sets the image associated with the provided image brush. + /// + /// Type: ID2D1Image* + /// The image to be associated with the image brush. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-setimage void SetImage( ID2D1Image *image ); + [PreserveSig] + void SetImage([In, Optional] ID2D1Image image); + + /// Sets how the content inside the source rectangle in the image brush will be extended on the x-axis. + /// + /// Type: D2D1_EXTEND_MODE + /// The extend mode on the x-axis of the image. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-setextendmodex void SetExtendModeX( + // D2D1_EXTEND_MODE extendModeX ); + [PreserveSig] + void SetExtendModeX(D2D1_EXTEND_MODE extendModeX); + + /// Sets the extend mode on the y-axis. + /// + /// Type: D2D1_EXTEND_MODE + /// The extend mode on the y-axis of the image. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-setextendmodey void SetExtendModeY( + // D2D1_EXTEND_MODE extendModeY ); + [PreserveSig] + void SetExtendModeY(D2D1_EXTEND_MODE extendModeY); + + /// Sets the interpolation mode for the image brush. + /// + /// Type: D2D1_INTERPOLATION_MODE + /// How the contents of the image will be interpolated to handle the brush transform. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-setinterpolationmode void + // SetInterpolationMode( D2D1_INTERPOLATION_MODE interpolationMode ); + [PreserveSig] + void SetInterpolationMode(D2D1_INTERPOLATION_MODE interpolationMode); + + /// Sets the source rectangle in the image brush. + /// + /// Type: const D2D1_RECT_F* + /// The source rectangle that defines the portion of the image to tile. + /// + /// None + /// + /// + /// The top left corner of the sourceRectangle parameter maps to the brush space origin. That is, if the brush and world + /// transforms are both identity, the portion of the image in the top left corner of the source rectangle will be rendered at + /// (0,0) in the render target. + /// + /// + /// The source rectangle will be expanded differently depending on whether the input image is based on pixels (a bitmap or + /// effect) or by a command list. + /// + /// + /// + /// + /// If the input image is a bitmap or an effect, the rectangle will be expanded to encapsulate a full input pixel before being + /// additionally down-scaled to ensure that the projected rectangle will be correct in the final scene-space. + /// + /// + /// + /// If the input image is a command list, the command list will be slightly expanded to encapsulate a full input pixel. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-setsourcerectangle void + // SetSourceRectangle( const D2D1_RECT_F *sourceRectangle ); + [PreserveSig] + void SetSourceRectangle(in D2D_RECT_F sourceRectangle); + + /// Gets the image associated with the image brush. + /// + /// Type: ID2D1Image** + /// When this method returns, contains the address of a pointer to the image associated with this brush. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-getimage void GetImage( ID2D1Image + // **image ); + [PreserveSig] + void GetImage(out ID2D1Image image); + + /// Gets the extend mode of the image brush on the x-axis. + /// + /// Type: D2D1_EXTEND_MODE + /// This method returns the x-extend mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-getextendmodex D2D1_EXTEND_MODE GetExtendModeX(); + [PreserveSig] + D2D1_EXTEND_MODE GetExtendModeX(); + + /// Gets the extend mode of the image brush on the y-axis of the image. + /// + /// Type: D2D1_EXTEND_MODE + /// This method returns the y-extend mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-getextendmodey D2D1_EXTEND_MODE GetExtendModeY(); + [PreserveSig] + D2D1_EXTEND_MODE GetExtendModeY(); + + /// Gets the interpolation mode of the image brush. + /// + /// Type: D2D1_INTERPOLATION_MODE + /// This method returns the interpolation mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-getinterpolationmode + // D2D1_INTERPOLATION_MODE GetInterpolationMode(); + [PreserveSig] + D2D1_INTERPOLATION_MODE GetInterpolationMode(); + + /// Gets the rectangle that will be used as the bounds of the image when drawn as an image brush. + /// + /// Type: D2D1_RECT_F* + /// When this method returns, contains the address of the output source rectangle. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1imagebrush-getsourcerectangle void + // GetSourceRectangle( D2D1_RECT_F *sourceRectangle ); + [PreserveSig] + void GetSourceRectangle(out D2D_RECT_F sourceRectangle); + } + + /// + /// Represents a set of run-time bindable and discoverable properties that allow a data-driven application to modify the state of a + /// Direct2D effect. + /// + /// + /// + /// This interface supports access through either indices or property names. In addition to top-level properties, each property in + /// an ID2D1Properties object may contain an ID2D1Properties object, which stores metadata describing the parent property. + /// + /// Overview + /// + /// The ID2D1Properties interface exposes a set of run-time bindable and discoverable properties that allow a data-driven + /// application such as an effect graph authoring tool or an animation system to modify the state of a Direct2D effect. + /// + /// + /// The interface supports access through either indices or property names. In addition to top-level properties, each property in an + /// ID2D1Properties may contain a sub- ID2D1Properties interface, which stores metadata describing its parent + /// property. Sub-properties are accessed by requesting this sub-interface by property index, or by using a property name string + /// separated by a dot (.). + /// + /// + /// The interface is intentionally designed to avoid dependencies on a run-time basis. All allocation is done by the caller of the + /// API and VARIANT types are not used. The property interface generally is designed not to return failures where the + /// application could trivially change their calling sequence in order to avoid the condition. For example, since the number of + /// properties supported by the instance is returned by the GetPropertyCount method, other methods that take a property index do not + /// return a failure, unless they also use the plug-in effect's property system. + /// + /// + /// The interface is primarily based upon an index-based access model, and it supports nested sub-properties within properties. + /// Unlike a directory structure, the property itself has a value and a type and might optionally support sub-properties + /// (directories are not files). These are normally metadata that describe the property, but, this is also used to specify arrays of + /// objects. In order to simplify accessing sub-properties and to allow name-based access, two helper methods – GetValueByName – are + /// defined. These use a "dotted" notation in order to allow sub-properties to be directly specified, for example: + /// + /// Or: + /// Standard Effect Properties + /// + /// + /// Property name/index + /// Property type + /// Property description + /// + /// + /// CLSID / D2D1_PROPERTY_CLSID + /// D2D1_PROPERTY_TYPE_CLSID + /// The CLSID of the effect. + /// + /// + /// DisplayName / D2D1_PROPERTY_DISPLAYNAME + /// D2D1_PROPERTY_TYPE_STRING + /// A displayable, localized name for the effect. + /// + /// + /// Author / D2D1_PROPERTY_AUTHOR + /// D2D1_PROPERTY_TYPE_STRING + /// The author of the effect. + /// + /// + /// Category / D2D1_PROPERTY_CATEGORY + /// D2D1_PROPERTY_TYPE_STRING + /// The category of the effect. + /// + /// + /// Description / D2D1_PROPERTY_DESCRIPTION + /// D2D1_PROPERTY_TYPE_STRING + /// A description of the effect. + /// + /// + /// Inputs / D2D1_PROPERTY_INPUTS + /// D2D1_PROPERTY_TYPE_ARRAY + /// An array of names for the effect’s inputs. Each element of the array is a localized string specifying the name of an input. + /// + /// + /// Standard Sub-Properties + /// + /// The following are standard sub-properties that can be used for meta-data access, and may be available on both system and custom + /// properties. Please see the D2D1_SUBPROPERTY and D2D1_PROPERTY_TYPE enumerations for more information. + /// + /// + /// + /// Property name/index + /// Property type + /// Property description + /// + /// + /// DisplayName / D2D1_SUBPROPERTY_DISPLAYNAME + /// D2D1_PROPERTY_TYPE_STRING + /// A displayable, localized name for the parent property. This sub-property is present on all top-level properties. + /// + /// + /// IsReadOnly / D2D1_SUBPROPERTY_ISREADONLY + /// D2D1_PROPERTY_TYPE_BOOL + /// A value indicating whether the parent property can be written to. This sub-property is present on all top-level properties. + /// + /// + /// Default / D2D1_SUBPROPERTY_DEFAULT + /// Same as parent property. + /// The default value for the property. This sub-property is optionally present on all properties. + /// + /// + /// Min / D2D1_SUBPROPERTY_MIN + /// Same as parent property. + /// The minimum value that the parent property supports being set to. + /// + /// + /// Max / D2D1_SUBPROPERTY_MIN + /// Same as parent property. + /// The maximum value that the parent property supports being set to. + /// + /// + /// Fields / D2D1_SUBPROPERTY_FIELDS + /// Array / D2D1_PROPERTY_TYPE_ARRAY + /// + /// The set of valid values that can be set to the parent property. Each value in this array is a name/index pair. The indices can + /// be set to the parent and the names are localized values designed for consumption by UI. See the following section for more details. + /// + /// + /// + /// Array-Type Sub-Properties + /// + /// See ID2D1Properties::GetType and D2D1_PROPERTY_TYPE for more information. If the property type is + /// D2D1_PROPERTY_TYPE_ARRAY, the value of the property will be considered to be a UINT that has the count of array + /// elements. The next sub-property will directly map the index to the requested property value. For example: + /// + /// + /// The above example makes use of the following sub-properties, which will appear on ARRAY-type properties. Note that the + /// numbered properties are not system properties, and are in the normal (0x0 – 0x80000000) range. + /// + /// + /// + /// Property name + /// Property index + /// Property description + /// + /// + /// Property.0 + /// 0 + /// First element of the property array. + /// + /// + /// ... + /// ... + /// ... + /// + /// + /// Property.N + /// N + /// Nth element of the property array. + /// + /// + /// The type of each sub-element will be whatever the type of the array is. In the example above, this was an array of strings. + /// Enum-Type Sub-Poperties + /// + /// If the property has type D2D1_PROPERTY_TYPE_ENUM then the property will have the value of the corresponding enumeration. + /// There will be a sub-array of fields that will conform to the general rules for array sub-properties and consist of the + /// name/value pairs. For example: + /// + /// + /// The above example makes use of the following sub-properties. Please see the D2D1_SUBPROPERTY and D2D1_PROPERTY_TYPE enumerations + /// for more information. + /// + /// + /// + /// Property name + /// Property index + /// Property description + /// + /// + /// Property.Fields + /// D2D1_SUBPROPERTY_FIELDS + /// An array type property that gives information about each field in the enumeration. + /// + /// + /// Property.Fields.N + /// N + /// An array element that gives the name of the Nth enumeration value. + /// + /// + /// Property.Fields.N.Index + /// D2D1_SUBPROPERTY_INDEX + /// The index which corresponds to the Nth enumeration value. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nn-d2d1_1-id2d1properties + [ComImport, Guid("483473d7-cd46-4f9d-9d3a-3112aa80159d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ID2D1Properties + { + /// Gets the number of top-level properties. + /// + /// Type: UINT32 + /// This method returns the number of custom (non-system) properties that can be accessed by the object. + /// + /// + /// This method returns the number of custom properties on the ID2D1Properties interface. System properties and sub-properties + /// are part of a closed set, and are enumerable by iterating over this closed set. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertycount UINT32 GetPropertyCount(); + [PreserveSig] + uint GetPropertyCount(); + + /// Gets the property name that corresponds to the given index. + /// + /// Type: UINT32 + /// The index of the property for which the name is being returned. + /// + /// + /// Type: PWSTR + /// When this method returns, contains the name being retrieved. + /// + /// + /// Type: UINT32 + /// The number of characters in the name buffer. + /// + /// + /// This method returns an empty string if index is invalid. If the method returns + /// RESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), name will still be filled and truncated. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertyname(uint32_pwstr_uint32) + // HRESULT GetPropertyName( UINT32 index, PWSTR name, UINT32 nameCount ); + void GetPropertyName(uint index, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder name, uint nameCount); + + /// Gets the number of characters for the given property name. This is a template overload. See Remarks. + /// + /// Type: U + /// The index of the property name to retrieve. + /// + /// + /// Type: UINT32 + /// + /// This method returns the size in characters of the name corresponding to the given property index, or zero if the property + /// index does not exist. + /// + /// + /// + /// The value returned by this method can be used to ensure that the buffer size for GetPropertyName is appropriate. + /// template<typename U> UINT32 GetPropertyNameLength( U index ) CONST; + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertynamelength%28u%29 UINT32 + // GetPropertyNameLength( U index ); + [PreserveSig] + uint GetPropertyNameLength(uint index); + + /// Gets the D2D1_PROPERTY_TYPE of the selected property. + /// + /// Type: UINT32 + /// The index of the property for which the type will be retrieved. + /// + /// + /// Type: D2D1_PROPERTY_TYPE + /// This method returns a D2D1_PROPERTY_TYPE-typed value for the type of the selected property. + /// + /// If the property does not exist, the method returns D2D1_PROPERTY_TYPE_UNKNOWN. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-gettype%28uint32%29 D2D1_PROPERTY_TYPE + // GetType( UINT32 index ); + [PreserveSig] + D2D1_PROPERTY_TYPE GetType(uint index); + + /// Gets the index corresponding to the given property name. + /// + /// Type: PCWSTR + /// The name of the property to retrieve. + /// + /// + /// Type: UINT32 + /// The index of the corresponding property name. + /// + /// + /// If the property doesn't exist, then this method returns D2D1_INVALID_PROPERTY_INDEX. This reserved value will never map to a + /// valid index, and will cause NULL or sentinel values to be returned from other parts of the property interface. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertyindex UINT32 GetPropertyIndex( + // PCWSTR name ); + [PreserveSig] + uint GetPropertyIndex([MarshalAs(UnmanagedType.LPWStr)] string name); + + /// Sets the named property to the given value. + /// + /// Type: PCWSTR + /// The name of the property to set. + /// + /// TBD + /// + /// Type: const BYTE* + /// The data to set. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to set. + /// + /// + /// If the property does not exist, the request is ignored and the method returns D2DERR_INVALID_PROPERTY. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvaluebyname%28pcwstr_d2d1_property_type_constbyte_uint32%29 + // HRESULT SetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + void SetValueByName([MarshalAs(UnmanagedType.LPWStr)] string name, D2D1_PROPERTY_TYPE type, [In] IntPtr data, uint dataSize); + + /// Sets the corresponding property by index. + /// + /// Type: UINT32 + /// The index of the property to set. + /// + /// TBD + /// + /// Type: const BYTE* + /// The data to set. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to set. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INVALID_PROPERTY + /// The specified property does not exist. + /// + /// + /// E_OUTOFMEMORY + /// Failed to allocate necessary memory. + /// + /// + /// D3DERR_OUT_OF_VIDEO_MEMORY + /// Failed to allocate required video memory. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_FAIL + /// Unspecified failure. + /// + /// + /// + /// + /// If the property does not exist, the request is ignored and D2DERR_INVALID_PROPERTY is returned. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32) + // HRESULT SetValue( UINT32 index, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + void SetValue(uint index, D2D1_PROPERTY_TYPE type, [In] IntPtr data, uint dataSize); + + /// Gets the property value by name. + /// + /// Type: PCWSTR + /// The property name to get. + /// + /// TBD + /// + /// Type: BYTE* + /// When this method returns, contains the buffer with the data value. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to be retrieved. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INVALID_PROPERTY + /// The specified property does not exist. + /// + /// + /// E_OUTOFMEMORY + /// Failed to allocate necessary memory. + /// + /// + /// D3DERR_OUT_OF_VIDEO_MEMORY + /// Failed to allocate required video memory. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_FAIL + /// Unspecified failure. + /// + /// + /// + /// + /// If name does not exist, no information is retrieved. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvaluebyname(pcwstr_d2d1_property_type_byte_uint32) + // HRESULT GetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize ); + void GetValueByName([MarshalAs(UnmanagedType.LPWStr)] string name, D2D1_PROPERTY_TYPE type, [Out] IntPtr data, uint dataSize); + + /// Gets the value of the specified property by index. + /// + /// Type: UINT32 + /// The index of the property from which the data is to be obtained. + /// + /// TBD + /// + /// Type: BYTE* + /// When this method returns, contains a pointer to the data requested. + /// + /// + /// Type: UINT32 + /// The number of bytes in the data to be retrieved. + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table. + /// + /// + /// HRESULT + /// Description + /// + /// + /// S_OK + /// No error occurred. + /// + /// + /// D2DERR_INVALID_PROPERTY + /// The specified property does not exist. + /// + /// + /// E_OUTOFMEMORY + /// Failed to allocate necessary memory. + /// + /// + /// D3DERR_OUT_OF_VIDEO_MEMORY + /// Failed to allocate required video memory. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_FAIL + /// Unspecified failure. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvalue(uint32_d2d1_property_type_byte_uint32) + // HRESULT GetValue( UINT32 index, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize ); + void GetValue(uint index, D2D1_PROPERTY_TYPE type, [Out] IntPtr data, uint dataSize); + + /// Gets the size of the property value in bytes, using the property index. This is a template overload. See Remarks. + /// + /// Type: U + /// The index of the property. + /// + /// + /// Type: UINT32 + /// This method returns size of the value in bytes, using the property index + /// + /// + /// This method returns zero if index does not exist. + /// template<typename U> UINT32 GetValueSize( U index ) CONST; + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvaluesize%28u%29 UINT32 GetValueSize( + // U index ); + [PreserveSig] + uint GetValueSize(uint index); + + /// Gets the sub-properties of the provided property by index. + /// + /// Type: UINT32 + /// The index of the sub-properties to be retrieved. + /// + /// + /// Type: ID2D1Properties** + /// When this method returns, contains the address of a pointer to the sub-properties. + /// + /// + /// If there are no sub-properties, subProperties will be NULL, and D2DERR_NO_SUBPROPERTIES will be returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getsubproperties%28uint32_id2d1properties%29 + // HRESULT GetSubProperties( UINT32 index, ID2D1Properties **subProperties ); + ID2D1Properties GetSubProperties(uint index); + } + + /// This structure allows a ID2D1Bitmap1 to be created with bitmap options and color context information available. + /// + /// If both dpiX and dpiY are 0, the dpi of the bitmap will be set to the desktop dpi if the device context is a + /// windowed context, or 96 dpi for any other device context. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_bitmap_properties1 typedef struct + // D2D1_BITMAP_PROPERTIES1 { D2D1_PIXEL_FORMAT pixelFormat; FLOAT dpiX; FLOAT dpiY; D2D1_BITMAP_OPTIONS bitmapOptions; + // ID2D1ColorContext *colorContext; } D2D1_BITMAP_PROPERTIES1; + [PInvokeData("d2d1_1.h", MSDNShortId = "c9371ce3-f6fc-4fe6-ada6-0aa64a8f29a2")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_BITMAP_PROPERTIES1 + { + /// + /// Type: D2D1_PIXEL_FORMAT + /// The DXGI format and alpha mode to create the bitmap with. + /// + public D2D1_PIXEL_FORMAT pixelFormat; + + /// + /// Type: FLOAT + /// The bitmap dpi in the x direction. + /// + public float dpiX; + + /// + /// Type: FLOAT + /// The bitmap dpi in the y direction. + /// + public float dpiY; + + /// + /// Type: D2D1_BITMAP_OPTIONS + /// The special creation options of the bitmap. + /// + public D2D1_BITMAP_OPTIONS bitmapOptions; + + /// + /// Type: ID2D1ColorContext* + /// The optionally specified color context information. + /// + public IntPtr colorContext; + } + + /// Specifies the options with which the Direct2D device, factory, and device context are created. + /// The root objects referred to here are the Direct2D device, Direct2D factory and the Direct2D device context. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_creation_properties + // typedef struct D2D1_CREATION_PROPERTIES { D2D1_THREADING_MODE threadingMode; D2D1_DEBUG_LEVEL debugLevel; D2D1_DEVICE_CONTEXT_OPTIONS options; } D2D1_CREATION_PROPERTIES; + [PInvokeData("d2d1_1.h", MSDNShortId = "657439fe-dc17-42af-9e2c-2f3cb769a5a3")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_CREATION_PROPERTIES + { + /// The threading mode with which the corresponding root objects will be created. + public D2D1_THREADING_MODE threadingMode; + + /// The debug level that the root objects should be created with. + public D2D1_DEBUG_LEVEL debugLevel; + + /// The device context options that the root objects should be created with. + public D2D1_DEVICE_CONTEXT_OPTIONS options; + } + + /// Describes features of an effect. + /// + /// Note The caller should not rely heavily on the input rectangles returned by this structure. They can change due to subtle + /// changes in effect implementations and due to optimization changes in the effect rendering system. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_effect_input_description typedef struct + // D2D1_EFFECT_INPUT_DESCRIPTION { ID2D1Effect *effect; UINT32 inputIndex; D2D1_RECT_F inputRectangle; } D2D1_EFFECT_INPUT_DESCRIPTION; + [PInvokeData("d2d1_1.h", MSDNShortId = "2ce9405a-e36d-4b9e-b9d2-2a58b78696ac")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_EFFECT_INPUT_DESCRIPTION + { + /// + public IntPtr effect; + + /// The input index of the effect that is being considered. + public uint inputIndex; + + /// + /// The amount of data that would be available on the input. This can be used to query this information when the data is not yet available. + /// + public D2D_RECT_F inputRectangle; + } + + /// Describes image brush features. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_image_brush_properties typedef struct + // D2D1_IMAGE_BRUSH_PROPERTIES { D2D1_RECT_F sourceRectangle; D2D1_EXTEND_MODE extendModeX; D2D1_EXTEND_MODE extendModeY; + // D2D1_INTERPOLATION_MODE interpolationMode; } D2D1_IMAGE_BRUSH_PROPERTIES; + [PInvokeData("d2d1_1.h", MSDNShortId = "c7bcae4d-cdef-4bfc-aa5a-68b85497a7f6")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_IMAGE_BRUSH_PROPERTIES + { + /// + /// Type: D2D1_RECT_F + /// The source rectangle in the image space from which the image will be tiled or interpolated. + /// + public D2D_RECT_F sourceRectangle; + + /// + /// Type: D2D1_EXTEND_MODE + /// The extend mode in the image x-axis. + /// + public D2D1_EXTEND_MODE extendModeX; + + /// + /// Type: D2D1_EXTEND_MODE + /// The extend mode in the image y-axis. + /// + public D2D1_EXTEND_MODE extendModeY; + + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The interpolation mode to use when scaling the image brush. + /// + public D2D1_INTERPOLATION_MODE interpolationMode; + } + + /// Contains the content bounds, mask information, opacity settings, and other options for a layer resource. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_layer_parameters1 typedef struct D2D1_LAYER_PARAMETERS1 + // { D2D1_RECT_F contentBounds; ID2D1Geometry *geometricMask; D2D1_ANTIALIAS_MODE maskAntialiasMode; D2D1_MATRIX_3X2_F + // maskTransform; FLOAT opacity; ID2D1Brush *opacityBrush; D2D1_LAYER_OPTIONS1 layerOptions; } D2D1_LAYER_PARAMETERS1; + [PInvokeData("d2d1_1.h", MSDNShortId = "D7CC93F8-D871-4DFC-84A3-CA60EB52FF0A")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_LAYER_PARAMETERS1 + { + /// + /// Type: D2D1_RECT_F + /// The content bounds of the layer. Content outside these bounds is not guaranteed to render. + /// + public D2D_RECT_F contentBounds; + + /// + /// Type: ID2D1Geometry* + /// The geometric mask specifies the area of the layer that is composited into the render target. + /// + public IntPtr geometricMask; + + /// + /// Type: D2D1_ANTIALIAS_MODE + /// A value that specifies the antialiasing mode for the geometricMask. + /// + public D2D1_ANTIALIAS_MODE maskAntialiasMode; + + /// + /// Type: D2D1_MATRIX_3X2_F + /// A value that specifies the transform that is applied to the geometric mask when composing the layer. + /// + public D2D_MATRIX_3X2_F maskTransform; + + /// + /// Type: FLOAT + /// An opacity value that is applied uniformly to all resources in the layer when compositing to the target. + /// + public float opacity; + + /// + /// Type: ID2D1Brush* + /// + /// A brush that is used to modify the opacity of the layer. The brush is mapped to the layer, and the alpha channel of each + /// mapped brush pixel is multiplied against the corresponding layer pixel. + /// + /// + public IntPtr opacityBrush; + + /// + /// Type: D2D1_LAYER_OPTIONS1 + /// Additional options for the layer creation. + /// + public D2D1_LAYER_OPTIONS1 layerOptions; + } + + /// Describes mapped memory from the ID2D1Bitmap1::Map API. + /// The mapped rectangle is used to map a rectangle into the caller's address space. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_mapped_rect typedef struct D2D1_MAPPED_RECT { UINT32 + // pitch; BYTE *bits; } D2D1_MAPPED_RECT; + [PInvokeData("d2d1_1.h", MSDNShortId = "1cd81f1a-c39b-4975-a801-aa9444dde172")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_MAPPED_RECT + { + /// The size in bytes of an individual scanline in the bitmap. + public uint pitch; + + /// The data inside the bitmap. + public IntPtr bits; + } + + /// Describes limitations to be applied to an imaging effect renderer. + /// + /// + /// The renderer can allocate tiles larger than the minimum tile allocation. The allocated tiles will be powers of two of the + /// minimum size on each axis, except that the size on each axis will not exceed the guaranteed maximum texture size for the device + /// feature level. + /// + /// + /// The "minimum pixel render extent" is the size of the square tile below which the renderer will expand the tile allocation rather + /// than attempting to subdivide the rendering tile any further. When this threshold is reached, the allocation tile size is + /// expanded. This might occur repeatedly until either rendering can proceed, or it is determined that the graph can't be rendered. + /// + /// + /// The buffer precision is used for intermediate buffers if it is otherwise unspecified by the effects (for example, through + /// calling SetValue on the effect with the D2D1_PROPERTY_PRECISION property) or the internal effect topology if required. If the + /// buffer type on the context is D2D1_BUFFER_PRECISION_UNKNOWN, and otherwise not specified by the effect or transform, then the + /// precision of the output will be the maximum precision of the inputs to the transform. The buffer precision does not affect the + /// number of channels used. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_rendering_controls typedef struct + // D2D1_RENDERING_CONTROLS { D2D1_BUFFER_PRECISION bufferPrecision; D2D1_SIZE_U tileSize; } D2D1_RENDERING_CONTROLS; + [PInvokeData("d2d1_1.h", MSDNShortId = "e563cbb0-2ee0-43d8-978c-0bde1950a926")] + [StructLayout(LayoutKind.Sequential)] + public struct D2D1_RENDERING_CONTROLS + { + /// + /// The buffer precision used by default if the buffer precision is not otherwise specified by the effect or by the transform. + /// + public D2D1_BUFFER_PRECISION bufferPrecision; + + /// The tile allocation size to be used by the imaging effect renderer. + public D2D_SIZE_U tileSize; + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct3D/DXGI/DXGI.Interfaces.cs b/PInvoke/Graphics/Direct3D/DXGI/DXGI.Interfaces.cs new file mode 100644 index 00000000..c8d64db0 --- /dev/null +++ b/PInvoke/Graphics/Direct3D/DXGI/DXGI.Interfaces.cs @@ -0,0 +1,3138 @@ +using System; +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + // TODO: Move once DXGI lib is done + /// Items from the DXGI.dll + public static partial class DXGI + { + /// The IDXGIAdapter interface represents a display subsystem (including one or more GPUs, DACs and video memory). + /// + /// + /// A display subsystem is often referred to as a video card, however, on some machines the display subsystem is part of the motherboard. + /// + /// To enumerate the display subsystems, use IDXGIFactory::EnumAdapters. + /// To get an interface to the adapter for a particular device, use IDXGIDevice::GetAdapter. + /// To create a software adapter, use IDXGIFactory::CreateSoftwareAdapter. + /// Windows Phone 8: This API is supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiadapter + [PInvokeData("dxgi.h")] + [ComImport, Guid("2411e7e1-12ac-4ccf-bd14-9798e8534dc0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIAdapter : IDXGIObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Enumerate adapter (video card) outputs. + /// + /// Type: UINT + /// The index of the output. + /// + /// + /// Type: IDXGIOutput** + /// The address of a pointer to an IDXGIOutput interface at the position specified by the Output parameter. + /// + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// When the EnumOutputs method succeeds and fills the ppOutput parameter with the address of the pointer to the output + /// interface, EnumOutputs increments the output interface's reference count. To avoid a memory leak, when you finish + /// using the output interface, call the Release method to decrement the reference count. + /// + /// + /// EnumOutputs first returns the output on which the desktop primary is displayed. This output corresponds with an index + /// of zero. EnumOutputs then returns other outputs. + /// + /// Examples + /// Enumerating Outputs + /// Here is an example of how to use EnumOutputs to enumerate all the outputs on an adapter: + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-enumoutputs HRESULT EnumOutputs( UINT Output, + // IDXGIOutput **ppOutput ); + IDXGIOutput EnumOutputs(uint Output); + + /// Gets a DXGI 1.0 description of an adapter (or video card). + /// + /// Type: DXGI_ADAPTER_DESC* + /// + /// A pointer to a DXGI_ADAPTER_DESC structure that describes the adapter. This parameter must not be NULL. On feature + /// level 9 graphics hardware, GetDesc returns zeros for the PCI ID in the VendorId, DeviceId, + /// SubSysId, and Revision members of DXGI_ADAPTER_DESC and “Software Adapter” for the description string + /// in the Description member. + /// + /// + /// + /// + /// Graphics apps can use the DXGI API to retrieve an accurate set of graphics memory values on systems that have Windows + /// Display Driver Model (WDDM) drivers. The following are the critical steps involved. + /// + /// + /// + /// + /// Graphics driver model determination —Because DXGI is only available on systems with WDDM drivers, the app must first confirm + /// the driver model by using the following API. + /// + /// + /// + /// + /// Retrieval of graphics memory values.—After the app determines the driver model to be WDDM, the app can use the Direct3D 10 + /// or later API and DXGI to get the amount of graphics memory. After you create a Direct3D device, use this code to obtain a + /// DXGI_ADAPTER_DESC structure that contains the amount of available graphics memory. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-getdesc HRESULT GetDesc( DXGI_ADAPTER_DESC + // *pDesc ); + DXGI_ADAPTER_DESC GetDesc(); + + /// Checks whether the system supports a device interface for a graphics component. + /// + /// Type: REFGUID + /// The GUID of the interface of the device version for which support is being checked. For example, __uuidof(ID3D10Device). + /// + /// + /// Type: LARGE_INTEGER* + /// + /// The user mode driver version of InterfaceName. This is returned only if the interface is supported, otherwise this parameter + /// will be NULL. + /// + /// + /// + /// Type: HRESULT + /// + /// S_OK indicates that the interface is supported, otherwise DXGI_ERROR_UNSUPPORTED is returned (For more information, see DXGI_ERROR). + /// + /// + /// + /// Note You can use CheckInterfaceSupport only to check whether a Direct3D 10.x interface is supported, and only + /// on Windows Vista SP1 and later versions of the operating system. If you try to use CheckInterfaceSupport to check + /// whether a Direct3D 11.x and later version interface is supported, CheckInterfaceSupport returns + /// DXGI_ERROR_UNSUPPORTED. Therefore, do not use CheckInterfaceSupport. Instead, to verify whether the operating system + /// supports a particular interface, try to create the interface. For example, if you call the ID3D11Device::CreateBlendState + /// method and it fails, the operating system does not support the ID3D11BlendState interface. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-checkinterfacesupport HRESULT + // CheckInterfaceSupport( REFGUID InterfaceName, LARGE_INTEGER *pUMDVersion ); + [PreserveSig] + HRESULT CheckInterfaceSupport(in Guid InterfaceName, out long pUMDVersion); + } + + /// + /// The IDXGIAdapter1 interface represents a display sub-system (including one or more GPU's, DACs and video memory). + /// + /// + /// + /// This interface is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is + /// required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 (SP2) + /// (KB 971644) and Windows Server 2008 (KB 971512). + /// + /// + /// A display sub-system is often referred to as a video card, however, on some machines the display sub-system is part of the + /// mother board. + /// + /// + /// To enumerate the display sub-systems, use IDXGIFactory1::EnumAdapters1. To get an interface to the adapter for a particular + /// device, use IDXGIDevice::GetAdapter. To create a software adapter, use IDXGIFactory::CreateSoftwareAdapter. + /// + /// Windows Phone 8: This API is supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiadapter1 + [PInvokeData("dxgi.h", MSDNShortId = "003d5a10-e978-481f-8ca6-9e5ab69bfec0")] + [ComImport, Guid("29038f61-3839-4626-91fd-086879011a05"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIAdapter1 : IDXGIAdapter + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Enumerate adapter (video card) outputs. + /// + /// Type: UINT + /// The index of the output. + /// + /// + /// Type: IDXGIOutput** + /// The address of a pointer to an IDXGIOutput interface at the position specified by the Output parameter. + /// + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// When the EnumOutputs method succeeds and fills the ppOutput parameter with the address of the pointer to the output + /// interface, EnumOutputs increments the output interface's reference count. To avoid a memory leak, when you finish + /// using the output interface, call the Release method to decrement the reference count. + /// + /// + /// EnumOutputs first returns the output on which the desktop primary is displayed. This output corresponds with an index + /// of zero. EnumOutputs then returns other outputs. + /// + /// Examples + /// Enumerating Outputs + /// Here is an example of how to use EnumOutputs to enumerate all the outputs on an adapter: + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-enumoutputs HRESULT EnumOutputs( UINT Output, + // IDXGIOutput **ppOutput ); + new IDXGIOutput EnumOutputs(uint Output); + + /// Gets a DXGI 1.0 description of an adapter (or video card). + /// + /// Type: DXGI_ADAPTER_DESC* + /// + /// A pointer to a DXGI_ADAPTER_DESC structure that describes the adapter. This parameter must not be NULL. On feature + /// level 9 graphics hardware, GetDesc returns zeros for the PCI ID in the VendorId, DeviceId, + /// SubSysId, and Revision members of DXGI_ADAPTER_DESC and “Software Adapter” for the description string + /// in the Description member. + /// + /// + /// + /// + /// Graphics apps can use the DXGI API to retrieve an accurate set of graphics memory values on systems that have Windows + /// Display Driver Model (WDDM) drivers. The following are the critical steps involved. + /// + /// + /// + /// + /// Graphics driver model determination —Because DXGI is only available on systems with WDDM drivers, the app must first confirm + /// the driver model by using the following API. + /// + /// + /// + /// + /// Retrieval of graphics memory values.—After the app determines the driver model to be WDDM, the app can use the Direct3D 10 + /// or later API and DXGI to get the amount of graphics memory. After you create a Direct3D device, use this code to obtain a + /// DXGI_ADAPTER_DESC structure that contains the amount of available graphics memory. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-getdesc HRESULT GetDesc( DXGI_ADAPTER_DESC + // *pDesc ); + new DXGI_ADAPTER_DESC GetDesc(); + + /// Checks whether the system supports a device interface for a graphics component. + /// + /// Type: REFGUID + /// The GUID of the interface of the device version for which support is being checked. For example, __uuidof(ID3D10Device). + /// + /// + /// Type: LARGE_INTEGER* + /// + /// The user mode driver version of InterfaceName. This is returned only if the interface is supported, otherwise this parameter + /// will be NULL. + /// + /// + /// + /// Type: HRESULT + /// + /// S_OK indicates that the interface is supported, otherwise DXGI_ERROR_UNSUPPORTED is returned (For more information, see DXGI_ERROR). + /// + /// + /// + /// Note You can use CheckInterfaceSupport only to check whether a Direct3D 10.x interface is supported, and only + /// on Windows Vista SP1 and later versions of the operating system. If you try to use CheckInterfaceSupport to check + /// whether a Direct3D 11.x and later version interface is supported, CheckInterfaceSupport returns + /// DXGI_ERROR_UNSUPPORTED. Therefore, do not use CheckInterfaceSupport. Instead, to verify whether the operating system + /// supports a particular interface, try to create the interface. For example, if you call the ID3D11Device::CreateBlendState + /// method and it fails, the operating system does not support the ID3D11BlendState interface. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-checkinterfacesupport HRESULT + // CheckInterfaceSupport( REFGUID InterfaceName, LARGE_INTEGER *pUMDVersion ); + [PreserveSig] + new HRESULT CheckInterfaceSupport(in Guid InterfaceName, out long pUMDVersion); + + /// Gets a DXGI 1.1 description of an adapter (or video card). + /// + /// Type: DXGI_ADAPTER_DESC1* + /// + /// A pointer to a DXGI_ADAPTER_DESC1 structure that describes the adapter. This parameter must not be NULL. On feature + /// level 9 graphics hardware, GetDesc1 returns zeros for the PCI ID in the VendorId, DeviceId, + /// SubSysId, and Revision members of DXGI_ADAPTER_DESC1 and “Software Adapter” for the description string + /// in the Description member. + /// + /// + /// + /// + /// This method is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is + /// required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 + /// (SP2) (KB 971644) and Windows Server 2008 (KB 971512). + /// + /// + /// Use the GetDesc1 method to get a DXGI 1.1 description of an adapter. To get a DXGI 1.0 description, use the + /// IDXGIAdapter method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter1-getdesc1 HRESULT GetDesc1( DXGI_ADAPTER_DESC1 + // *pDesc ); + DXGI_ADAPTER_DESC1 GetDesc1(); + } + + /// An IDXGIDevice interface implements a derived class for DXGI objects that produce image data. + /// + /// + /// The IDXGIDevice interface is designed for use by DXGI objects that need access to other DXGI objects. This interface is + /// useful to applications that do not use Direct3D to communicate with DXGI. + /// + /// + /// The Direct3D create device functions return a Direct3D device object. This Direct3D device object implements the IUnknown + /// interface. You can query this Direct3D device object for the device's corresponding IDXGIDevice interface. To retrieve + /// the IDXGIDevice interface of a Direct3D device, use the following code: + /// + /// Windows Phone 8: This API is supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgidevice + [PInvokeData("dxgi.h")] + [ComImport, Guid("54ec77fa-1377-44e6-8c32-88fd5f44c84c"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIDevice : IDXGIObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Returns the adapter for the specified device. + /// + /// Type: IDXGIAdapter** + /// The address of an IDXGIAdapter interface pointer to the adapter. This parameter must not be NULL. + /// + /// + /// If the GetAdapter method succeeds, the reference count on the adapter interface will be incremented. To avoid a + /// memory leak, be sure to release the interface when you are finished using it. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevice-getadapter HRESULT GetAdapter( IDXGIAdapter + // **pAdapter ); + IDXGIAdapter GetAdapter(); + + /// Returns a surface. This method is used internally and you should not call it directly in your application. + /// + /// Type: const DXGI_SURFACE_DESC* + /// A pointer to a DXGI_SURFACE_DESC structure that describes the surface. + /// + /// + /// Type: UINT + /// The number of surfaces to create. + /// + /// + /// Type: DXGI_USAGE + /// A DXGI_USAGE flag that specifies how the surface is expected to be used. + /// + /// + /// Type: const * + /// + /// An optional pointer to a DXGI_SHARED_RESOURCE structure that contains shared resource information for opening views of such resources. + /// + /// + /// + /// Type: IDXGISurface** + /// The address of an IDXGISurface interface pointer to the first created surface. + /// + /// + /// + /// The CreateSurface method creates a buffer to exchange data between one or more devices. It is used internally, and + /// you should not directly call it. + /// + /// + /// The runtime automatically creates an IDXGISurface interface when it creates a Direct3D resource object that represents a + /// surface. For example, the runtime creates an IDXGISurface interface when it calls ID3D11Device::CreateTexture2D or + /// ID3D10Device::CreateTexture2D to create a 2D texture. To retrieve the IDXGISurface interface that represents the 2D + /// texture surface, call ID3D11Texture2D::QueryInterface or ID3D10Texture2D::QueryInterface. In this call, you must pass + /// the identifier of IDXGISurface. If the 2D texture has only a single MIP-map level and does not consist of an array of + /// textures, QueryInterface succeeds and returns a pointer to the IDXGISurface interface pointer. Otherwise, + /// QueryInterface fails and does not return the pointer to IDXGISurface. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevice-createsurface HRESULT CreateSurface( const + // DXGI_SURFACE_DESC *pDesc, UINT NumSurfaces, DXGI_USAGE Usage, const DXGI_SHARED_RESOURCE *pSharedResource, IDXGISurface + // **ppSurface ); + IDXGISurface CreateSurface(in DXGI_SURFACE_DESC pDesc, uint NumSurfaces, DXGI_USAGE Usage, [In, Optional] IntPtr pSharedResource); + + /// Gets the residency status of an array of resources. + /// + /// Type: IUnknown* + /// An array of IDXGIResource interfaces. + /// + /// + /// Type: DXGI_RESIDENCY* + /// + /// An array of DXGI_RESIDENCY flags. Each element describes the residency status for corresponding element in the ppResources + /// argument array. + /// + /// + /// + /// Type: UINT + /// The number of resources in the ppResources argument array and pResidencyStatus argument array. + /// + /// + /// Type: HRESULT + /// + /// Returns S_OK if successful; otherwise, returns DXGI_ERROR_DEVICE_REMOVED, E_INVALIDARG, or E_POINTER (see Common HRESULT + /// Values and WinError.h for more information). + /// + /// + /// + /// + /// The information returned by the pResidencyStatus argument array describes the residency status at the time that the + /// QueryResourceResidency method was called. + /// + /// Note The residency status will constantly change. + /// + /// If you call the QueryResourceResidency method during a device removed state, the pResidencyStatus argument will + /// return the DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY flag. + /// + /// Note This method should not be called every frame as it incurs a non-trivial amount of overhead. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevice-queryresourceresidency HRESULT + // QueryResourceResidency( IUnknown * const *ppResources, DXGI_RESIDENCY *pResidencyStatus, UINT NumResources ); + void QueryResourceResidency([In] IntPtr[] ppResources, [Out] DXGI_RESIDENCY[] pResidencyStatus, uint NumResources); + + /// Sets the GPU thread priority. + /// + /// Type: INT + /// + /// A value that specifies the required GPU thread priority. This value must be between -7 and 7, inclusive, where 0 represents + /// normal priority. + /// + /// + /// + /// The values for the Priority parameter function as follows: + /// + /// + /// + /// Positive values increase the likelihood that the GPU scheduler will grant GPU execution cycles to the device when rendering. + /// + /// + /// + /// Negative values lessen the likelihood that the device will receive GPU execution cycles when devices compete for them. + /// + /// + /// The device is guaranteed to receive some GPU execution cycles at all settings. + /// + /// + /// + /// To use the SetGPUThreadPriority method, you should have a comprehensive understanding of GPU scheduling. You should + /// profile your application to ensure that it behaves as intended. If used inappropriately, the SetGPUThreadPriority + /// method can impede rendering speed and result in a poor user experience. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevice-setgputhreadpriority HRESULT + // SetGPUThreadPriority( INT Priority ); + void SetGPUThreadPriority(int Priority); + + /// Gets the GPU thread priority. + /// + /// Type: INT* + /// + /// A pointer to a variable that receives a value that indicates the current GPU thread priority. The value will be between -7 + /// and 7, inclusive, where 0 represents normal priority. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevice-getgputhreadpriority HRESULT + // GetGPUThreadPriority( INT *pPriority ); + int GetGPUThreadPriority(); + } + + /// Inherited from objects that are tied to the device so that they can retrieve a pointer to it. + /// Windows Phone 8: This API is supported. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgidevicesubobject + [ComImport, Guid("3d3e0379-f9de-4d58-bb6c-18d62992f1a6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIDeviceSubObject : IDXGIObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Retrieves the device. + /// + /// Type: REFIID + /// The reference id for the device. + /// + /// + /// Type: void** + /// The address of a pointer to the device. + /// + /// + /// Type: HRESULT + /// A code that indicates success or failure (see DXGI_ERROR). + /// + /// + /// The type of interface that is returned can be any interface published by the device. For example, it could be an IDXGIDevice + /// * called pDevice, and therefore the REFIID would be obtained by calling __uuidof(pDevice). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevicesubobject-getdevice HRESULT GetDevice( REFIID + // riid, void **ppDevice ); + void GetDevice(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppDevice); + } + + /// An IDXGIFactory interface implements methods for generating DXGI objects (which handle full screen transitions). + /// + /// Create a factory by calling CreateDXGIFactory. + /// + /// Because you can create a Direct3D device without creating a swap chain, you might need to retrieve the factory that is used to + /// create the device in order to create a swap chain. You can request the IDXGIDevice interface from the Direct3D device and then + /// use the IDXGIObject::GetParent method to locate the factory. The following code shows how. + /// + /// Windows Phone 8: This API is supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgifactory + [PInvokeData("dxgi.h")] + [ComImport, Guid("7b7166ec-21c7-44ae-b21a-c9ae321ae369"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIFactory : IDXGIObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Enumerates the adapters (video cards). + /// + /// Type: UINT + /// The index of the adapter to enumerate. + /// + /// + /// Type: IDXGIAdapter** + /// + /// The address of a pointer to an IDXGIAdapter interface at the position specified by the Adapter parameter. This parameter + /// must not be NULL. + /// + /// + /// + /// + /// When you create a factory, the factory enumerates the set of adapters that are available in the system. Therefore, if you + /// change the adapters in a system, you must destroy and recreate the IDXGIFactory object. The number of adapters in a system + /// changes when you add or remove a display card, or dock or undock a laptop. + /// + /// + /// When the EnumAdapters method succeeds and fills the ppAdapter parameter with the address of the pointer to the + /// adapter interface, EnumAdapters increments the adapter interface's reference count. When you finish using the adapter + /// interface, call the Release method to decrement the reference count before you destroy the pointer. + /// + /// + /// EnumAdapters first returns the adapter with the output on which the desktop primary is displayed. This adapter + /// corresponds with an index of zero. EnumAdapters next returns other adapters with outputs. EnumAdapters finally + /// returns adapters without outputs. + /// + /// Examples + /// Enumerating Adapters + /// The following code example demonstrates how to enumerate adapters using the EnumAdapters method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-enumadapters HRESULT EnumAdapters( UINT Adapter, + // IDXGIAdapter **ppAdapter ); + IDXGIAdapter EnumAdapters(uint Adapter); + + /// + /// Allows DXGI to monitor an application's message queue for the alt-enter key sequence (which causes the application to switch + /// from windowed to full screen or vice versa). + /// + /// + /// Type: HWND + /// + /// The handle of the window that is to be monitored. This parameter can be NULL; but only if the flags are also 0. + /// + /// + /// + /// Type: UINT + /// One or more of the following values: + /// + /// + /// + /// DXGI_MWA_NO_WINDOW_CHANGES - Prevent DXGI from monitoring an applications message queue; this makes DXGI unable to respond + /// to mode changes. + /// + /// + /// + /// DXGI_MWA_NO_ALT_ENTER - Prevent DXGI from responding to an alt-enter sequence. + /// + /// + /// DXGI_MWA_NO_PRINT_SCREEN - Prevent DXGI from responding to a print-screen key. + /// + /// + /// + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// The combination of WindowHandle and Flags informs DXGI to stop monitoring window messages for the previously-associated window. + /// + /// + /// If the application switches to full-screen mode, DXGI will choose a full-screen resolution to be the smallest supported + /// resolution that is larger or the same size as the current back buffer size. + /// + /// + /// Applications can make some changes to make the transition from windowed to full screen more efficient. For example, on a + /// WM_SIZE message, the application should release any outstanding swap-chain back buffers, call IDXGISwapChain::ResizeBuffers, + /// then re-acquire the back buffers from the swap chain(s). This gives the swap chain(s) an opportunity to resize the back + /// buffers, and/or recreate them to enable full-screen flipping operation. If the application does not perform this sequence, + /// DXGI will still make the full-screen/windowed transition, but may be forced to use a stretch operation (since the back + /// buffers may not be the correct size), which may be less efficient. Even if a stretch is not required, presentation may not + /// be optimal because the back buffers might not be directly interchangeable with the front buffer. Thus, a call to + /// ResizeBuffers on WM_SIZE is always recommended, since WM_SIZE is always sent during a fullscreen transition. + /// + /// + /// While windowed, the application can, if it chooses, restrict the size of its window's client area to sizes to which it is + /// comfortable rendering. A fully flexible application would make no such restriction, but UI elements or other design + /// considerations can, of course, make this flexibility untenable. If the application further chooses to restrict its window's + /// client area to just those that match supported full-screen resolutions, the application can field WM_SIZING, then check + /// against IDXGIOutput::FindClosestMatchingMode. If a matching mode is found, allow the resize. (The IDXGIOutput can be + /// retrieved from IDXGISwapChain::GetContainingOutput. Absent subsequent changes to desktop topology, this will be the same + /// output that will be chosen when alt-enter is fielded and fullscreen mode is begun for that swap chain.) + /// + /// + /// Applications that want to handle mode changes or Alt+Enter themselves should call MakeWindowAssociation with the + /// DXGI_MWA_NO_WINDOW_CHANGES flag after swap chain creation. The WindowHandle argument, if non- NULL, specifies that + /// the application message queues will not be handled by the DXGI runtime for all swap chains of a particular target HWND. + /// Calling MakeWindowAssociation with the DXGI_MWA_NO_WINDOW_CHANGES flag after swapchain creation ensures that DXGI + /// will not interfere with application's handling of window mode changes or Alt+Enter. + /// + /// Notes for Windows Store apps + /// If a Windows Store app calls MakeWindowAssociation, it fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// A Microsoft Win32 application can use MakeWindowAssociation to control full-screen transitions through the Alt+Enter + /// key combination and print screen behavior for full screen. For Windows Store apps, because DXGI can't perform full-screen + /// transitions, a Windows Store app has no way to control full-screen transitions. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-makewindowassociation HRESULT + // MakeWindowAssociation( HWND WindowHandle, UINT Flags ); + void MakeWindowAssociation(HWND WindowHandle, DXGI_MWA Flags); + + /// Get the window through which the user controls the transition to and from full screen. + /// + /// Type: HWND* + /// A pointer to a window handle. + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-getwindowassociation HRESULT + // GetWindowAssociation( HWND *pWindowHandle ); + HWND GetWindowAssociation(); + + /// + /// + /// [Starting with Direct3D 11.1, we recommend not to use CreateSwapChain anymore to create a swap chain. Instead, use + /// CreateSwapChainForHwnd, CreateSwapChainForCoreWindow, or CreateSwapChainForComposition depending on how you want to create + /// the swap chain.] + /// + /// Creates a swap chain. + /// + /// + /// Type: IUnknown* + /// + /// For Direct3D 11, and earlier versions of Direct3D, this is a pointer to the Direct3D device for the swap chain. For Direct3D + /// 12 this is a pointer to a direct command queue (refer to ID3D12CommandQueue) . This parameter cannot be NULL. + /// + /// + /// + /// Type: DXGI_SWAP_CHAIN_DESC* + /// A pointer to a DXGI_SWAP_CHAIN_DESC structure for the swap-chain description. This parameter cannot be NULL. + /// + /// + /// Type: IDXGISwapChain** + /// + /// A pointer to a variable that receives a pointer to the IDXGISwapChain interface for the swap chain that + /// CreateSwapChain creates. + /// + /// + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// If you attempt to create a swap chain in full-screen mode, and full-screen mode is unavailable, the swap chain will be + /// created in windowed mode and DXGI_STATUS_OCCLUDED will be returned. + /// + /// + /// If the buffer width or the buffer height is zero, the sizes will be inferred from the output window size in the swap-chain description. + /// + /// + /// Because the target output can't be chosen explicitly when the swap chain is created, we recommend not to create a + /// full-screen swap chain. This can reduce presentation performance if the swap chain size and the output window size do not + /// match. Here are two ways to ensure that the sizes match: + /// + /// + /// + /// Create a windowed swap chain and then set it full-screen using IDXGISwapChain::SetFullscreenState. + /// + /// + /// + /// Save a pointer to the swap chain immediately after creation, and use it to get the output window size during a WM_SIZE + /// event. Then resize the swap chain buffers (with IDXGISwapChain::ResizeBuffers) during the transition from windowed to full-screen. + /// + /// + /// + /// + /// If the swap chain is in full-screen mode, before you release it you must use SetFullscreenState to switch it to windowed + /// mode. For more information about releasing a swap chain, see the "Destroying a Swap Chain" section of DXGI Overview. + /// + /// + /// After the runtime renders the initial frame in full screen, the runtime might unexpectedly exit full screen during a call to + /// IDXGISwapChain::Present. To work around this issue, we recommend that you execute the following code right after you call + /// CreateSwapChain to create a full-screen swap chain ( Windowed member of DXGI_SWAP_CHAIN_DESC set to FALSE). + /// + /// + /// You can specify DXGI_SWAP_EFFECT and DXGI_SWAP_CHAIN_FLAG values in the swap-chain description that pDesc points to. These + /// values allow you to use features like flip-model presentation and content protection by using pre-Windows 8 APIs. + /// + /// + /// However, to use stereo presentation and to change resize behavior for the flip model, applications must use the + /// IDXGIFactory2::CreateSwapChainForHwnd method. Otherwise, the back-buffer contents implicitly scale to fit the presentation + /// target size; that is, you can't turn off scaling. + /// + /// Notes for Windows Store apps + /// If a Windows Store app calls CreateSwapChain with full screen specified, CreateSwapChain fails. + /// Windows Store apps call the IDXGIFactory2::CreateSwapChainForCoreWindow method to create a swap chain. + /// For info about how to choose a format for the swap chain's back buffer, see Converting data for the color space. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-createswapchain HRESULT CreateSwapChain( + // IUnknown *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc, IDXGISwapChain **ppSwapChain ); + IDXGISwapChain CreateSwapChain([In, MarshalAs(UnmanagedType.IUnknown)] object pDevice, in DXGI_SWAP_CHAIN_DESC pDesc); + + /// Create an adapter interface that represents a software adapter. + /// + /// Type: HMODULE + /// Handle to the software adapter's dll. HMODULE can be obtained with GetModuleHandle or LoadLibrary. + /// + /// + /// Type: IDXGIAdapter** + /// Address of a pointer to an adapter (see IDXGIAdapter). + /// + /// + /// + /// A software adapter is a DLL that implements the entirety of a device driver interface, plus emulation, if necessary, of + /// kernel-mode graphics components for Windows. Details on implementing a software adapter can be found in the Windows Vista + /// Driver Development Kit. This is a very complex development task, and is not recommended for general readers. + /// + /// + /// Calling this method will increment the module's reference count by one. The reference count can be decremented by calling FreeLibrary. + /// + /// + /// The typical calling scenario is to call LoadLibrary, pass the handle to CreateSoftwareAdapter, then immediately call + /// FreeLibrary on the DLL and forget the DLL's HMODULE. Since the software adapter calls FreeLibrary when it is + /// destroyed, the lifetime of the DLL will now be owned by the adapter, and the application is free of any further + /// consideration of its lifetime. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-createsoftwareadapter HRESULT + // CreateSoftwareAdapter( HMODULE Module, IDXGIAdapter **ppAdapter ); + IDXGIAdapter CreateSoftwareAdapter(HINSTANCE Module); + } + + /// The IDXGIFactory1 interface implements methods for generating DXGI objects. + /// + /// + /// This interface is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is + /// required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 (SP2) + /// (KB 971644) and Windows Server 2008 (KB 971512). + /// + /// To create a factory, call the CreateDXGIFactory1 function. + /// + /// Because you can create a Direct3D device without creating a swap chain, you might need to retrieve the factory that is used to + /// create the device in order to create a swap chain. You can request the IDXGIDevice or IDXGIDevice1 interface from the Direct3D + /// device and then use the IDXGIObject::GetParent method to locate the factory. The following code shows how. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgifactory1 + [ComImport, Guid("770aae78-f26f-4dba-a829-253c83d1b387"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIFactory1 : IDXGIFactory + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Enumerates the adapters (video cards). + /// + /// Type: UINT + /// The index of the adapter to enumerate. + /// + /// + /// Type: IDXGIAdapter** + /// + /// The address of a pointer to an IDXGIAdapter interface at the position specified by the Adapter parameter. This parameter + /// must not be NULL. + /// + /// + /// + /// + /// When you create a factory, the factory enumerates the set of adapters that are available in the system. Therefore, if you + /// change the adapters in a system, you must destroy and recreate the IDXGIFactory object. The number of adapters in a system + /// changes when you add or remove a display card, or dock or undock a laptop. + /// + /// + /// When the EnumAdapters method succeeds and fills the ppAdapter parameter with the address of the pointer to the + /// adapter interface, EnumAdapters increments the adapter interface's reference count. When you finish using the adapter + /// interface, call the Release method to decrement the reference count before you destroy the pointer. + /// + /// + /// EnumAdapters first returns the adapter with the output on which the desktop primary is displayed. This adapter + /// corresponds with an index of zero. EnumAdapters next returns other adapters with outputs. EnumAdapters finally + /// returns adapters without outputs. + /// + /// Examples + /// Enumerating Adapters + /// The following code example demonstrates how to enumerate adapters using the EnumAdapters method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-enumadapters HRESULT EnumAdapters( UINT Adapter, + // IDXGIAdapter **ppAdapter ); + new IDXGIAdapter EnumAdapters(uint Adapter); + + /// + /// Allows DXGI to monitor an application's message queue for the alt-enter key sequence (which causes the application to switch + /// from windowed to full screen or vice versa). + /// + /// + /// Type: HWND + /// + /// The handle of the window that is to be monitored. This parameter can be NULL; but only if the flags are also 0. + /// + /// + /// + /// Type: UINT + /// One or more of the following values: + /// + /// + /// + /// DXGI_MWA_NO_WINDOW_CHANGES - Prevent DXGI from monitoring an applications message queue; this makes DXGI unable to respond + /// to mode changes. + /// + /// + /// + /// DXGI_MWA_NO_ALT_ENTER - Prevent DXGI from responding to an alt-enter sequence. + /// + /// + /// DXGI_MWA_NO_PRINT_SCREEN - Prevent DXGI from responding to a print-screen key. + /// + /// + /// + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// The combination of WindowHandle and Flags informs DXGI to stop monitoring window messages for the previously-associated window. + /// + /// + /// If the application switches to full-screen mode, DXGI will choose a full-screen resolution to be the smallest supported + /// resolution that is larger or the same size as the current back buffer size. + /// + /// + /// Applications can make some changes to make the transition from windowed to full screen more efficient. For example, on a + /// WM_SIZE message, the application should release any outstanding swap-chain back buffers, call IDXGISwapChain::ResizeBuffers, + /// then re-acquire the back buffers from the swap chain(s). This gives the swap chain(s) an opportunity to resize the back + /// buffers, and/or recreate them to enable full-screen flipping operation. If the application does not perform this sequence, + /// DXGI will still make the full-screen/windowed transition, but may be forced to use a stretch operation (since the back + /// buffers may not be the correct size), which may be less efficient. Even if a stretch is not required, presentation may not + /// be optimal because the back buffers might not be directly interchangeable with the front buffer. Thus, a call to + /// ResizeBuffers on WM_SIZE is always recommended, since WM_SIZE is always sent during a fullscreen transition. + /// + /// + /// While windowed, the application can, if it chooses, restrict the size of its window's client area to sizes to which it is + /// comfortable rendering. A fully flexible application would make no such restriction, but UI elements or other design + /// considerations can, of course, make this flexibility untenable. If the application further chooses to restrict its window's + /// client area to just those that match supported full-screen resolutions, the application can field WM_SIZING, then check + /// against IDXGIOutput::FindClosestMatchingMode. If a matching mode is found, allow the resize. (The IDXGIOutput can be + /// retrieved from IDXGISwapChain::GetContainingOutput. Absent subsequent changes to desktop topology, this will be the same + /// output that will be chosen when alt-enter is fielded and fullscreen mode is begun for that swap chain.) + /// + /// + /// Applications that want to handle mode changes or Alt+Enter themselves should call MakeWindowAssociation with the + /// DXGI_MWA_NO_WINDOW_CHANGES flag after swap chain creation. The WindowHandle argument, if non- NULL, specifies that + /// the application message queues will not be handled by the DXGI runtime for all swap chains of a particular target HWND. + /// Calling MakeWindowAssociation with the DXGI_MWA_NO_WINDOW_CHANGES flag after swapchain creation ensures that DXGI + /// will not interfere with application's handling of window mode changes or Alt+Enter. + /// + /// Notes for Windows Store apps + /// If a Windows Store app calls MakeWindowAssociation, it fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// A Microsoft Win32 application can use MakeWindowAssociation to control full-screen transitions through the Alt+Enter + /// key combination and print screen behavior for full screen. For Windows Store apps, because DXGI can't perform full-screen + /// transitions, a Windows Store app has no way to control full-screen transitions. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-makewindowassociation HRESULT + // MakeWindowAssociation( HWND WindowHandle, UINT Flags ); + new void MakeWindowAssociation(HWND WindowHandle, DXGI_MWA Flags); + + /// Get the window through which the user controls the transition to and from full screen. + /// + /// Type: HWND* + /// A pointer to a window handle. + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-getwindowassociation HRESULT + // GetWindowAssociation( HWND *pWindowHandle ); + new HWND GetWindowAssociation(); + + /// + /// + /// [Starting with Direct3D 11.1, we recommend not to use CreateSwapChain anymore to create a swap chain. Instead, use + /// CreateSwapChainForHwnd, CreateSwapChainForCoreWindow, or CreateSwapChainForComposition depending on how you want to create + /// the swap chain.] + /// + /// Creates a swap chain. + /// + /// + /// Type: IUnknown* + /// + /// For Direct3D 11, and earlier versions of Direct3D, this is a pointer to the Direct3D device for the swap chain. For Direct3D + /// 12 this is a pointer to a direct command queue (refer to ID3D12CommandQueue) . This parameter cannot be NULL. + /// + /// + /// + /// Type: DXGI_SWAP_CHAIN_DESC* + /// A pointer to a DXGI_SWAP_CHAIN_DESC structure for the swap-chain description. This parameter cannot be NULL. + /// + /// + /// Type: IDXGISwapChain** + /// + /// A pointer to a variable that receives a pointer to the IDXGISwapChain interface for the swap chain that + /// CreateSwapChain creates. + /// + /// + /// + /// Note If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// If you attempt to create a swap chain in full-screen mode, and full-screen mode is unavailable, the swap chain will be + /// created in windowed mode and DXGI_STATUS_OCCLUDED will be returned. + /// + /// + /// If the buffer width or the buffer height is zero, the sizes will be inferred from the output window size in the swap-chain description. + /// + /// + /// Because the target output can't be chosen explicitly when the swap chain is created, we recommend not to create a + /// full-screen swap chain. This can reduce presentation performance if the swap chain size and the output window size do not + /// match. Here are two ways to ensure that the sizes match: + /// + /// + /// + /// Create a windowed swap chain and then set it full-screen using IDXGISwapChain::SetFullscreenState. + /// + /// + /// + /// Save a pointer to the swap chain immediately after creation, and use it to get the output window size during a WM_SIZE + /// event. Then resize the swap chain buffers (with IDXGISwapChain::ResizeBuffers) during the transition from windowed to full-screen. + /// + /// + /// + /// + /// If the swap chain is in full-screen mode, before you release it you must use SetFullscreenState to switch it to windowed + /// mode. For more information about releasing a swap chain, see the "Destroying a Swap Chain" section of DXGI Overview. + /// + /// + /// After the runtime renders the initial frame in full screen, the runtime might unexpectedly exit full screen during a call to + /// IDXGISwapChain::Present. To work around this issue, we recommend that you execute the following code right after you call + /// CreateSwapChain to create a full-screen swap chain ( Windowed member of DXGI_SWAP_CHAIN_DESC set to FALSE). + /// + /// + /// You can specify DXGI_SWAP_EFFECT and DXGI_SWAP_CHAIN_FLAG values in the swap-chain description that pDesc points to. These + /// values allow you to use features like flip-model presentation and content protection by using pre-Windows 8 APIs. + /// + /// + /// However, to use stereo presentation and to change resize behavior for the flip model, applications must use the + /// IDXGIFactory2::CreateSwapChainForHwnd method. Otherwise, the back-buffer contents implicitly scale to fit the presentation + /// target size; that is, you can't turn off scaling. + /// + /// Notes for Windows Store apps + /// If a Windows Store app calls CreateSwapChain with full screen specified, CreateSwapChain fails. + /// Windows Store apps call the IDXGIFactory2::CreateSwapChainForCoreWindow method to create a swap chain. + /// For info about how to choose a format for the swap chain's back buffer, see Converting data for the color space. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-createswapchain HRESULT CreateSwapChain( + // IUnknown *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc, IDXGISwapChain **ppSwapChain ); + new IDXGISwapChain CreateSwapChain([In, MarshalAs(UnmanagedType.IUnknown)] object pDevice, in DXGI_SWAP_CHAIN_DESC pDesc); + + /// Create an adapter interface that represents a software adapter. + /// + /// Type: HMODULE + /// Handle to the software adapter's dll. HMODULE can be obtained with GetModuleHandle or LoadLibrary. + /// + /// + /// Type: IDXGIAdapter** + /// Address of a pointer to an adapter (see IDXGIAdapter). + /// + /// + /// + /// A software adapter is a DLL that implements the entirety of a device driver interface, plus emulation, if necessary, of + /// kernel-mode graphics components for Windows. Details on implementing a software adapter can be found in the Windows Vista + /// Driver Development Kit. This is a very complex development task, and is not recommended for general readers. + /// + /// + /// Calling this method will increment the module's reference count by one. The reference count can be decremented by calling FreeLibrary. + /// + /// + /// The typical calling scenario is to call LoadLibrary, pass the handle to CreateSoftwareAdapter, then immediately call + /// FreeLibrary on the DLL and forget the DLL's HMODULE. Since the software adapter calls FreeLibrary when it is + /// destroyed, the lifetime of the DLL will now be owned by the adapter, and the application is free of any further + /// consideration of its lifetime. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-createsoftwareadapter HRESULT + // CreateSoftwareAdapter( HMODULE Module, IDXGIAdapter **ppAdapter ); + new IDXGIAdapter CreateSoftwareAdapter(HINSTANCE Module); + + /// Enumerates both adapters (video cards) with or without outputs. + /// + /// Type: UINT + /// The index of the adapter to enumerate. + /// + /// + /// Type: IDXGIAdapter1** + /// + /// The address of a pointer to an IDXGIAdapter1 interface at the position specified by the Adapter parameter. This parameter + /// must not be NULL. + /// + /// + /// + /// + /// This method is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is + /// required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 + /// (SP2) (KB 971644) and Windows Server 2008 (KB 971512). + /// + /// + /// When you create a factory, the factory enumerates the set of adapters that are available in the system. Therefore, if you + /// change the adapters in a system, you must destroy and recreate the IDXGIFactory1 object. The number of adapters in a system + /// changes when you add or remove a display card, or dock or undock a laptop. + /// + /// + /// When the EnumAdapters1 method succeeds and fills the ppAdapter parameter with the address of the pointer to the + /// adapter interface, EnumAdapters1 increments the adapter interface's reference count. When you finish using the + /// adapter interface, call the Release method to decrement the reference count before you destroy the pointer. + /// + /// + /// EnumAdapters1 first returns the adapter with the output on which the desktop primary is displayed. This adapter + /// corresponds with an index of zero. EnumAdapters1 next returns other adapters with outputs. EnumAdapters1 + /// finally returns adapters without outputs. + /// + /// Examples + /// Enumerating Adapters + /// The following code example demonstrates how to enumerate adapters using the EnumAdapters1 method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory1-enumadapters1 HRESULT EnumAdapters1( UINT + // Adapter, IDXGIAdapter1 **ppAdapter ); + IDXGIAdapter1 EnumAdapters1(uint Adapter); + + /// Informs an application of the possible need to re-enumerate adapters. + /// + /// Type: BOOL + /// + /// FALSE, if a new adapter is becoming available or the current adapter is going away. TRUE, no adapter changes. + /// + /// IsCurrent returns FALSE to inform the calling application to re-enumerate adapters. + /// + /// + /// This method is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is + /// required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 + /// (SP2) (KB 971644) and Windows Server 2008 (KB 971512). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory1-iscurrent BOOL IsCurrent(); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + bool IsCurrent(); + } + + /// + /// An IDXGIObject interface is a base interface for all DXGI objects; IDXGIObject supports associating caller-defined + /// (private data) with an object and retrieval of an interface to the parent object. + /// + /// + /// IDXGIObject implements base-class functionality for the following interfaces: + /// + /// + /// IDXGIAdapter + /// + /// + /// IDXGIDevice + /// + /// + /// IDXGIFactory + /// + /// + /// IDXGIOutput + /// + /// + /// Windows Phone 8: This API is supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiobject + [ComImport, Guid("aec22fb8-76f3-4639-9be0-28eb43a67a2e"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + } + + /// An IDXGIOutput interface represents an adapter output (such as a monitor). + /// + /// To see the outputs available, use IDXGIAdapter::EnumOutputs. To see the specific output that the swap chain will update, use IDXGISwapChain::GetContainingOutput. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgioutput + [PInvokeData("dxgi.h")] + [ComImport, Guid("ae02eedb-c735-4690-8d52-5a8dc20213aa"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGIOutput : IDXGIObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Get a description of the output. + /// + /// Type: DXGI_OUTPUT_DESC* + /// A pointer to the output description (see DXGI_OUTPUT_DESC). + /// + /// + /// On a high DPI desktop, GetDesc returns the visualized screen size unless the app is marked high DPI aware. For info + /// about writing DPI-aware Win32 apps, see High DPI. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getdesc HRESULT GetDesc( DXGI_OUTPUT_DESC *pDesc ); + DXGI_OUTPUT_DESC GetDesc(); + + /// + /// + /// [Starting with Direct3D 11.1, we recommend not to use GetDisplayModeList anymore to retrieve the matching display + /// mode. Instead, use IDXGIOutput1::GetDisplayModeList1, which supports stereo display mode.] + /// + /// Gets the display modes that match the requested format and other input options. + /// + /// + /// Type: DXGI_FORMAT + /// The color format (see DXGI_FORMAT). + /// + /// + /// Type: UINT + /// + /// Options for modes to include (see DXGI_ENUM_MODES). DXGI_ENUM_MODES_SCALING needs to be specified to expose the display + /// modes that require scaling. Centered modes, requiring no scaling and corresponding directly to the display output, are + /// enumerated by default. + /// + /// + /// + /// Type: UINT* + /// + /// Set pDesc to NULL so that pNumModes returns the number of display modes that match the format and the options. + /// Otherwise, pNumModes returns the number of display modes returned in pDesc. + /// + /// + /// + /// Type: DXGI_MODE_DESC* + /// A pointer to a list of display modes (see DXGI_MODE_DESC); set to NULL to get the number of display modes. + /// + /// + /// + /// In general, when switching from windowed to full-screen mode, a swap chain automatically chooses a display mode that meets + /// (or exceeds) the resolution, color depth and refresh rate of the swap chain. To exercise more control over the display mode, + /// use this API to poll the set of display modes that are validated against monitor capabilities, or all modes that match the + /// desktop (if the desktop settings are not validated against the monitor). + /// + /// + /// As shown, this API is designed to be called twice. First to get the number of modes available, and second to return a + /// description of the modes. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getdisplaymodelist HRESULT GetDisplayModeList( + // DXGI_FORMAT EnumFormat, UINT Flags, UINT *pNumModes, DXGI_MODE_DESC *pDesc ); + void GetDisplayModeList(DXGI_FORMAT EnumFormat, DXGI_ENUM_MODES Flags, ref uint pNumModes, [Out, Optional] DXGI_MODE_DESC[] pDesc); + + /// + /// + /// [Starting with Direct3D 11.1, we recommend not to use FindClosestMatchingMode anymore to find the display mode that + /// most closely matches the requested display mode. Instead, use IDXGIOutput1::FindClosestMatchingMode1, which supports stereo + /// display mode.] + /// + /// Finds the display mode that most closely matches the requested display mode. + /// + /// + /// Type: const DXGI_MODE_DESC* + /// + /// The desired display mode (see DXGI_MODE_DESC). Members of DXGI_MODE_DESC can be unspecified indicating no preference + /// for that member. A value of 0 for Width or Height indicates the value is unspecified. If either Width + /// or Height are 0, both must be 0. A numerator and denominator of 0 in RefreshRate indicate it is unspecified. + /// Other members of DXGI_MODE_DESC have enumeration values indicating the member is unspecified. If pConcernedDevice is + /// NULL, Format cannot be DXGI_FORMAT_UNKNOWN. + /// + /// + /// + /// Type: DXGI_MODE_DESC* + /// The mode that most closely matches pModeToMatch. + /// + /// + /// Type: IUnknown* + /// + /// A pointer to the Direct3D device interface. If this parameter is NULL, only modes whose format matches that of + /// pModeToMatch will be returned; otherwise, only those formats that are supported for scan-out by the device are returned. For + /// info about the formats that are supported for scan-out by the device at each feature level: + /// + /// + /// + /// DXGI Format Support for Direct3D Feature Level 12.1 Hardware + /// + /// + /// DXGI Format Support for Direct3D Feature Level 12.0 Hardware + /// + /// + /// DXGI Format Support for Direct3D Feature Level 11.1 Hardware + /// + /// + /// DXGI Format Support for Direct3D Feature Level 11.0 Hardware + /// + /// + /// Hardware Support for Direct3D 10Level9 Formats + /// + /// + /// Hardware Support for Direct3D 10.1 Formats + /// + /// + /// Hardware Support for Direct3D 10 Formats + /// + /// + /// + /// + /// + /// FindClosestMatchingMode behaves similarly to the IDXGIOutput1::FindClosestMatchingMode1 except + /// FindClosestMatchingMode considers only the mono display modes. IDXGIOutput1::FindClosestMatchingMode1 + /// considers only stereo modes if you set the Stereo member in the DXGI_MODE_DESC1 structure that pModeToMatch points + /// to, and considers only mono modes if Stereo is not set. + /// + /// + /// IDXGIOutput1::FindClosestMatchingMode1 returns a matched display-mode set with only stereo modes or only mono modes. + /// FindClosestMatchingMode behaves as though you specified the input mode as mono. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-findclosestmatchingmode HRESULT + // FindClosestMatchingMode( const DXGI_MODE_DESC *pModeToMatch, DXGI_MODE_DESC *pClosestMatch, IUnknown *pConcernedDevice ); + void FindClosestMatchingMode(in DXGI_MODE_DESC pModeToMatch, out DXGI_MODE_DESC pClosestMatch, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pConcernedDevice); + + /// Halt a thread until the next vertical blank occurs. + /// + /// A vertical blank occurs when the raster moves from the lower right corner to the upper left corner to begin drawing the next frame. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-waitforvblank HRESULT WaitForVBlank(); + void WaitForVBlank(); + + /// Takes ownership of an output. + /// + /// Type: IUnknown* + /// A pointer to the IUnknown interface of a device (such as an ID3D10Device). + /// + /// + /// Type: BOOL + /// Set to TRUE to enable other threads or applications to take ownership of the device; otherwise, set to FALSE. + /// + /// + /// When you are finished with the output, call IDXGIOutput::ReleaseOwnership. + /// + /// TakeOwnership should not be called directly by applications, since results will be unpredictable. It is called + /// implicitly by the DXGI swap chain object during full-screen transitions, and should not be used as a substitute for + /// swap-chain methods. + /// + /// Notes for Windows Store apps + /// If a Windows Store app uses TakeOwnership, it fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-takeownership HRESULT TakeOwnership( IUnknown + // *pDevice, BOOL Exclusive ); + void TakeOwnership([In, MarshalAs(UnmanagedType.IUnknown)] object pDevice, [MarshalAs(UnmanagedType.Bool)] bool Exclusive); + + /// Releases ownership of the output. + /// None + /// + /// If you are not using a swap chain, get access to an output by calling IDXGIOutput::TakeOwnership and release it when you are + /// finished by calling IDXGIOutput::ReleaseOwnership. An application that uses a swap chain will typically not call + /// either of these methods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-releaseownership void ReleaseOwnership(); + [PreserveSig] + void ReleaseOwnership(); + + /// Gets a description of the gamma-control capabilities. + /// + /// Type: DXGI_GAMMA_CONTROL_CAPABILITIES* + /// A pointer to a description of the gamma-control capabilities (see DXGI_GAMMA_CONTROL_CAPABILITIES). + /// + /// + /// Note Calling this method is only supported while in full-screen mode. + /// For info about using gamma correction, see Using gamma correction. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getgammacontrolcapabilities HRESULT + // GetGammaControlCapabilities( DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps ); + DXGI_GAMMA_CONTROL_CAPABILITIES GetGammaControlCapabilities(); + + /// Sets the gamma controls. + /// + /// Type: const DXGI_GAMMA_CONTROL* + /// A pointer to a DXGI_GAMMA_CONTROL structure that describes the gamma curve to set. + /// + /// + /// Note Calling this method is only supported while in full-screen mode. + /// For info about using gamma correction, see Using gamma correction. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-setgammacontrol HRESULT SetGammaControl( const + // DXGI_GAMMA_CONTROL *pArray ); + void SetGammaControl(in DXGI_GAMMA_CONTROL pArray); + + /// Gets the gamma control settings. + /// + /// Type: DXGI_GAMMA_CONTROL* + /// An array of gamma control settings (see DXGI_GAMMA_CONTROL). + /// + /// + /// Note Calling this method is only supported while in full-screen mode. + /// For info about using gamma correction, see Using gamma correction. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getgammacontrol HRESULT GetGammaControl( + // DXGI_GAMMA_CONTROL *pArray ); + DXGI_GAMMA_CONTROL GetGammaControl(); + + /// Changes the display mode. + /// + /// Type: IDXGISurface* + /// + /// A pointer to a surface (see IDXGISurface) used for rendering an image to the screen. The surface must have been created as a + /// back buffer (DXGI_USAGE_BACKBUFFER). + /// + /// + /// + /// + /// IDXGIOutput::SetDisplaySurface should not be called directly by applications, since results will be unpredictable. It + /// is called implicitly by the DXGI swap chain object during full-screen transitions, and should not be used as a substitute + /// for swap-chain methods. + /// + /// This method should only be called between IDXGIOutput::TakeOwnership and IDXGIOutput::ReleaseOwnership calls. + /// Notes for Windows Store apps + /// If a Windows Store app uses SetDisplaySurface, it fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-setdisplaysurface HRESULT SetDisplaySurface( + // IDXGISurface *pScanoutSurface ); + void SetDisplaySurface([In] IDXGISurface pScanoutSurface); + + /// + /// + /// [Starting with Direct3D 11.1, we recommend not to use GetDisplaySurfaceData anymore to retrieve the current display + /// surface. Instead, use IDXGIOutput1::GetDisplaySurfaceData1, which supports stereo display mode.] + /// + /// Gets a copy of the current display surface. + /// + /// + /// Type: IDXGISurface* + /// A pointer to a destination surface (see IDXGISurface). + /// + /// + /// + /// IDXGIOutput::GetDisplaySurfaceData can only be called when an output is in full-screen mode. If the method succeeds, + /// DXGI fills the destination surface. + /// + /// + /// Use IDXGIOutput::GetDesc to determine the size (width and height) of the output when you want to allocate space for the + /// destination surface. This is true regardless of target monitor rotation. A destination surface created by a graphics + /// component (such as Direct3D 10) must be created with CPU-write permission (see D3D10_CPU_ACCESS_WRITE). Other surfaces + /// should be created with CPU read-write permission (see D3D10_CPU_ACCESS_READ_WRITE). This method will modify the surface data + /// to fit the destination surface (stretch, shrink, convert format, rotate). The stretch and shrink is performed with point-sampling. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getdisplaysurfacedata HRESULT + // GetDisplaySurfaceData( IDXGISurface *pDestination ); + void GetDisplaySurfaceData([In] IDXGISurface pDestination); + + /// Gets statistics about recently rendered frames. + /// + /// Type: DXGI_FRAME_STATISTICS* + /// A pointer to frame statistics (see DXGI_FRAME_STATISTICS). + /// + /// + /// This API is similar to IDXGISwapChain::GetFrameStatistics. + /// Note Calling this method is only supported while in full-screen mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getframestatistics HRESULT GetFrameStatistics( + // DXGI_FRAME_STATISTICS *pStats ); + DXGI_FRAME_STATISTICS GetFrameStatistics(); + } + + /// The IDXGISurface interface implements methods for image-data objects. + /// + /// An image-data object is a 2D section of memory, commonly called a surface. To get the surface from an output, call IDXGIOutput::GetDisplaySurfaceData. + /// + /// The runtime automatically creates an IDXGISurface interface when it creates a Direct3D resource object that represents a + /// surface. For example, the runtime creates an IDXGISurface interface when you call ID3D11Device::CreateTexture2D or + /// ID3D10Device::CreateTexture2D to create a 2D texture. To retrieve the IDXGISurface interface that represents the 2D + /// texture surface, call ID3D11Texture2D::QueryInterface or ID3D10Texture2D::QueryInterface. In this call, you must pass the + /// identifier of IDXGISurface. If the 2D texture has only a single MIP-map level and does not consist of an array of + /// textures, QueryInterface succeeds and returns a pointer to the IDXGISurface interface pointer. Otherwise, + /// QueryInterface fails and does not return the pointer to IDXGISurface. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgisurface + [PInvokeData("dxgi.h")] + [ComImport, Guid("cafcb56c-6ac3-4889-bf47-9e23bbd260ec"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGISurface : IDXGIDeviceSubObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Retrieves the device. + /// + /// Type: REFIID + /// The reference id for the device. + /// + /// + /// Type: void** + /// The address of a pointer to the device. + /// + /// + /// Type: HRESULT + /// A code that indicates success or failure (see DXGI_ERROR). + /// + /// + /// The type of interface that is returned can be any interface published by the device. For example, it could be an IDXGIDevice + /// * called pDevice, and therefore the REFIID would be obtained by calling __uuidof(pDevice). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevicesubobject-getdevice HRESULT GetDevice( REFIID + // riid, void **ppDevice ); + new void GetDevice(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppDevice); + + /// Get a description of the surface. + /// + /// Type: DXGI_SURFACE_DESC* + /// A pointer to the surface description (see DXGI_SURFACE_DESC). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgisurface-getdesc HRESULT GetDesc( DXGI_SURFACE_DESC + // *pDesc ); + DXGI_SURFACE_DESC GetDesc(); + + /// Get a pointer to the data contained in the surface, and deny GPU access to the surface. + /// + /// Type: DXGI_MAPPED_RECT* + /// A pointer to the surface data (see DXGI_MAPPED_RECT). + /// + /// + /// Type: UINT + /// CPU read-write flags. These flags can be combined with a logical OR. + /// + /// + /// DXGI_MAP_READ - Allow CPU read access. + /// + /// + /// DXGI_MAP_WRITE - Allow CPU write access. + /// + /// + /// DXGI_MAP_DISCARD - Discard the previous contents of a resource when it is mapped. + /// + /// + /// + /// + /// Use IDXGISurface::Map to access a surface from the CPU. To release a mapped surface (and allow GPU access) call IDXGISurface::Unmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgisurface-map HRESULT Map( DXGI_MAPPED_RECT *pLockedRect, + // UINT MapFlags ); + void Map(out DXGI_MAPPED_RECT pLockedRect, DXGI_MAP MapFlags); + + /// Invalidate the pointer to the surface retrieved by IDXGISurface::Map and re-enable GPU access to the resource. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgisurface-unmap HRESULT Unmap(); + void Unmap(); + } + + /// + /// An IDXGISwapChain interface implements one or more surfaces for storing rendered data before presenting it to an output. + /// + /// + /// You can create a swap chain by calling IDXGIFactory2::CreateSwapChainForHwnd, IDXGIFactory2::CreateSwapChainForCoreWindow, or + /// IDXGIFactory2::CreateSwapChainForComposition. You can also create a swap chain when you call D3D11CreateDeviceAndSwapChain; + /// however, you can then only access the sub-set of swap-chain functionality that the IDXGISwapChain interface provides. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiswapchain + [PInvokeData("dxgi.h")] + [ComImport, Guid("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDXGISwapChain : IDXGIDeviceSubObject + { + /// Sets application-defined data to the object and associates that data with a GUID. + /// + /// Type: REFGUID + /// A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data. + /// + /// + /// Type: UINT + /// The size of the object's data. + /// + /// + /// Type: const void* + /// A pointer to the object's data. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + /// + /// SetPrivateData makes a copy of the specified data and stores it with the object. + /// + /// Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored + /// by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a + /// Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData). + /// + /// + /// The debug layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The + /// default friendly name is "<unnamed>". You can set the friendly name so that you can determine if the corresponding + /// object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the well-known + /// private data GUID ( WKPDID_D3DDebugObjectName) that is in D3Dcommon.h. For example, to give pContext a friendly name + /// of My name, use the following code: + /// + /// + /// You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your + /// applications. This information is reflected in the output of the debug layer that is related to memory leaks + /// (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedata HRESULT SetPrivateData( REFGUID + // Name, UINT DataSize, const void *pData ); + new void SetPrivateData(in Guid Name, uint DataSize, IntPtr pData); + + /// Set an interface in the object's private data. + /// + /// Type: REFGUID + /// A GUID identifying the interface. + /// + /// + /// Type: const IUnknown* + /// The interface to set. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// This API associates an interface pointer with the object. + /// + /// When the interface is set its reference count is incremented. When the data are overwritten (by calling SPD or SPDI with the + /// same GUID) or the object is destroyed, ::Release() is called and the interface's reference count is decremented. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-setprivatedatainterface HRESULT + // SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown ); + new void SetPrivateDataInterface(in Guid Name, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnknown); + + /// Get a pointer to the object's data. + /// + /// Type: REFGUID + /// A GUID identifying the data. + /// + /// + /// Type: UINT* + /// The size of the data. + /// + /// + /// Type: void* + /// Pointer to the data. + /// + /// + /// Type: HRESULT + /// Returns one of the following DXGI_ERROR. + /// + /// + /// + /// If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by + /// IDXGIObject::SetPrivateDataInterface, you must call ::Release() on the pointer before the pointer is freed to decrement the + /// reference count. + /// + /// + /// You can pass GUID_DeviceType in the Name parameter of GetPrivateData to retrieve the device type from the + /// display adapter object (IDXGIAdapter, IDXGIAdapter1, IDXGIAdapter2). + /// + /// To get the type of device on which the display adapter was created + /// + /// + /// Call IUnknown::QueryInterface on the ID3D11Device or ID3D10Device object to retrieve the IDXGIDevice object. + /// + /// + /// Call GetParent on the IDXGIDevice object to retrieve the IDXGIAdapter object. + /// + /// + /// + /// Call GetPrivateData on the IDXGIAdapter object with GUID_DeviceType to retrieve the type of device on which + /// the display adapter was created. pData will point to a value from the driver-type enumeration (for example, a value from D3D_DRIVER_TYPE). + /// + /// + /// + /// + /// On Windows 7 or earlier, this type is either a value from D3D10_DRIVER_TYPE or D3D_DRIVER_TYPE depending on which kind of + /// device was created. On Windows 8, this type is always a value from D3D_DRIVER_TYPE. Don't use + /// IDXGIObject::SetPrivateData with GUID_DeviceType because the behavior when doing so is undefined. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getprivatedata HRESULT GetPrivateData( REFGUID + // Name, UINT *pDataSize, void *pData ); + [PreserveSig] + new HRESULT GetPrivateData(in Guid Name, ref uint pDataSize, [Out] IntPtr pData); + + /// Gets the parent of the object. + /// + /// Type: REFIID + /// The ID of the requested interface. + /// + /// + /// Type: void** + /// The address of a pointer to the parent object. + /// + /// + /// Type: HRESULT + /// Returns one of the DXGI_ERROR values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiobject-getparent HRESULT GetParent( REFIID riid, void + // **ppParent ); + new void GetParent(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppParent); + + /// Retrieves the device. + /// + /// Type: REFIID + /// The reference id for the device. + /// + /// + /// Type: void** + /// The address of a pointer to the device. + /// + /// + /// Type: HRESULT + /// A code that indicates success or failure (see DXGI_ERROR). + /// + /// + /// The type of interface that is returned can be any interface published by the device. For example, it could be an IDXGIDevice + /// * called pDevice, and therefore the REFIID would be obtained by calling __uuidof(pDevice). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgidevicesubobject-getdevice HRESULT GetDevice( REFIID + // riid, void **ppDevice ); + new void GetDevice(in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppDevice); + + /// Presents a rendered image to the user. + /// + /// Type: UINT + /// An integer that specifies how to synchronize presentation of a frame with the vertical blank. + /// For the bit-block transfer (bitblt) model (DXGI_SWAP_EFFECT_DISCARDor DXGI_SWAP_EFFECT_SEQUENTIAL), values are: + /// + /// + /// 0 - The presentation occurs immediately, there is no synchronization. + /// + /// + /// 1 through 4 - Synchronize presentation after the nth vertical blank. + /// + /// + /// For the flip model ( + /// DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL + /// ), values are: + /// + /// + /// 0 - Cancel the remaining time on the previously presented frame and discard this frame if a newer frame is queued. + /// + /// + /// 1 through 4 - Synchronize presentation for at least n vertical blanks. + /// + /// + /// For an example that shows how sync-interval values affect a flip presentation queue, see Remarks. + /// + /// If the update region straddles more than one output (each represented by IDXGIOutput), Present performs the + /// synchronization to the output that contains the largest sub-rectangle of the target window's client area. + /// + /// + /// + /// Type: UINT + /// An integer value that contains swap-chain presentation options. These options are defined by the DXGI_PRESENT constants. + /// + /// + /// Type: HRESULT + /// + /// Possible return values include: S_OK, DXGI_ERROR_DEVICE_RESET or DXGI_ERROR_DEVICE_REMOVED (see DXGI_ERROR), + /// DXGI_STATUS_OCCLUDED (see DXGI_STATUS), or D3DDDIERR_DEVICEREMOVED. + /// + /// + /// Note The Present method can return either DXGI_ERROR_DEVICE_REMOVED or D3DDDIERR_DEVICEREMOVED if a video card + /// has been physically removed from the computer, or a driver upgrade for the video card has occurred. + /// + /// + /// + /// + /// Starting with Direct3D 11.1, consider using IDXGISwapChain1::Present1 because you can then use dirty rectangles and the + /// scroll rectangle in the swap chain presentation and as such use less memory bandwidth and as a result less system power. For + /// more info about using dirty rectangles and the scroll rectangle in swap chain presentation, see Using dirty rectangles and + /// the scroll rectangle in swap chain presentation. + /// + /// + /// For the best performance when flipping swap-chain buffers in a full-screen application, see Full-Screen Application + /// Performance Hints. + /// + /// + /// Because calling Present might cause the render thread to wait on the message-pump thread, be careful when calling + /// this method in an application that uses multiple threads. For more details, see Multithreading Considerations. + /// + /// + /// + /// + /// Differences between Direct3D 9 and Direct3D 10: Specifying DXGI_PRESENT_TEST in the Flags parameter is analogous to + /// IDirect3DDevice9::TestCooperativeLevel in Direct3D 9. + /// + /// + /// + /// + /// For flip presentation model swap chains that you create with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value set, a successful + /// presentation unbinds back buffer 0 from the graphics pipeline, except for when you pass the DXGI_PRESENT_DO_NOT_SEQUENCE + /// flag in the Flags parameter. + /// + /// For info about how data values change when you present content to the screen, see Converting data for the color space. + /// Flip presentation model queue + /// Suppose the following frames with sync-interval values are queued from oldest (A) to newest (E) before you call Present. + /// A: 3, B: 0, C: 0, D: 1, E: 0 + /// + /// When you call Present, the runtime shows frame A for only 1 vertical blank interval. The runtime terminates frame A + /// early because of the sync interval 0 in frame B. Then the runtime shows frame D for 1 vertical blank interval, and then + /// frame E until you submit a new presentation. The runtime discards frames B and C. + /// + /// Variable refresh rate displays + /// + /// It is a requirement of variable refresh rate displays that tearing is enabled. The CheckFeatureSupport method can be used to + /// determine if this feature is available, and to set the required flags refer to the descriptions of + /// DXGI_PRESENT_ALLOW_TEARING and DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING, and the Variable refresh rate displays/Vsync off + /// section of DXGI 1.5 Improvements. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-present HRESULT Present( UINT SyncInterval, + // UINT Flags ); + void Present(uint SyncInterval, DXGI_PRESENT Flags); + + /// Accesses one of the swap-chain's back buffers. + /// + /// Type: UINT + /// A zero-based buffer index. + /// + /// If the swap chain's swap effect is DXGI_SWAP_EFFECT_DISCARD, this method can only access the first buffer; for this + /// situation, set the index to zero. + /// + /// + /// If the swap chain's swap effect is either DXGI_SWAP_EFFECT_SEQUENTIAL or DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, only the swap + /// chain's zero-index buffer can be read from and written to. The swap chain's buffers with indexes greater than zero can only + /// be read from; so if you call the IDXGIResource::GetUsage method for such buffers, they have the DXGI_USAGE_READ_ONLY flag set. + /// + /// + /// + /// Type: REFIID + /// The type of interface used to manipulate the buffer. + /// + /// + /// Type: void** + /// A pointer to a back-buffer interface. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getbuffer HRESULT GetBuffer( UINT Buffer, + // REFIID riid, void **ppSurface ); + [return: MarshalAs(UnmanagedType.IUnknown)] object GetBuffer(uint Buffer, in Guid riid); + + /// Sets the display state to windowed or full screen. + /// + /// Type: BOOL + /// + /// A Boolean value that specifies whether to set the display state to windowed or full screen. TRUE for full screen, and + /// FALSE for windowed. + /// + /// + /// + /// Type: IDXGIOutput* + /// + /// If you pass TRUE to the Fullscreen parameter to set the display state to full screen, you can optionally set this + /// parameter to a pointer to an IDXGIOutput interface for the output target that contains the swap chain. If you set this + /// parameter to NULL, DXGI will choose the output based on the swap-chain's device and the output window's placement. If + /// you pass FALSE to Fullscreen, you must set this parameter to NULL. + /// + /// + /// + /// DXGI may change the display state of a swap chain in response to end user or system requests. + /// + /// We recommend that you create a windowed swap chain and allow the end user to change the swap chain to full screen through + /// SetFullscreenState; that is, do not set the Windowed member of DXGI_SWAP_CHAIN_DESC to FALSE to force the swap + /// chain to be full screen. However, if you create the swap chain as full screen, also provide the end user with a list of + /// supported display modes because a swap chain that is created with an unsupported display mode might cause the display to go + /// black and prevent the end user from seeing anything. Also, we recommend that you have a time-out confirmation screen or + /// other fallback mechanism when you allow the end user to change display modes. + /// + /// Notes for Windows Store apps + /// + /// If a Windows Store app calls SetFullscreenState to set the display state to full screen, SetFullscreenState + /// fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// + /// You cannot call SetFullscreenState on a swap chain that you created with IDXGIFactory2::CreateSwapChainForComposition. + /// + /// For the flip presentation model, after you transition the display state to full screen, you must call ResizeBuffers to + /// ensure that your call to IDXGISwapChain1::Present1 succeeds. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-setfullscreenstate HRESULT SetFullscreenState( + // BOOL Fullscreen, IDXGIOutput *pTarget ); + void SetFullscreenState([MarshalAs(UnmanagedType.Bool)] bool Fullscreen, [In, Optional] IDXGIOutput pTarget); + + /// Get the state associated with full-screen mode. + /// + /// Type: BOOL* + /// A pointer to a boolean whose value is either: + /// + /// + /// TRUE if the swap chain is in full-screen mode + /// + /// + /// FALSE if the swap chain is in windowed mode + /// + /// + /// + /// + /// Type: IDXGIOutput** + /// A pointer to the output target (see IDXGIOutput) when the mode is full screen; otherwise NULL. + /// + /// + /// When the swap chain is in full-screen mode, a pointer to the target output will be returned and its reference count will be incremented. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getfullscreenstate HRESULT GetFullscreenState( + // BOOL *pFullscreen, IDXGIOutput **ppTarget ); + IDXGIOutput GetFullscreenState([MarshalAs(UnmanagedType.Bool)] out bool pFullscreen); + + /// + /// + /// [Starting with Direct3D 11.1, we recommend not to use GetDesc anymore to get a description of the swap chain. + /// Instead, use IDXGISwapChain1::GetDesc1.] + /// + /// Get a description of the swap chain. + /// + /// + /// Type: DXGI_SWAP_CHAIN_DESC* + /// A pointer to the swap-chain description (see DXGI_SWAP_CHAIN_DESC). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getdesc HRESULT GetDesc( DXGI_SWAP_CHAIN_DESC + // *pDesc ); + DXGI_SWAP_CHAIN_DESC GetDesc(); + + /// + /// Changes the swap chain's back buffer size, format, and number of buffers. This should be called when the application window + /// is resized. + /// + /// + /// Type: UINT + /// + /// The number of buffers in the swap chain (including all back and front buffers). This number can be different from the number + /// of buffers with which you created the swap chain. This number can't be greater than DXGI_MAX_SWAP_CHAIN_BUFFERS. Set + /// this number to zero to preserve the existing number of buffers in the swap chain. You can't specify less than two buffers + /// for the flip presentation model. + /// + /// + /// + /// Type: UINT + /// + /// The new width of the back buffer. If you specify zero, DXGI will use the width of the client area of the target window. You + /// can't specify the width as zero if you called the IDXGIFactory2::CreateSwapChainForComposition method to create the swap + /// chain for a composition surface. + /// + /// + /// + /// Type: UINT + /// + /// The new height of the back buffer. If you specify zero, DXGI will use the height of the client area of the target window. + /// You can't specify the height as zero if you called the IDXGIFactory2::CreateSwapChainForComposition method to create the + /// swap chain for a composition surface. + /// + /// + /// + /// Type: DXGI_FORMAT + /// + /// A DXGI_FORMAT-typed value for the new format of the back buffer. Set this value to DXGI_FORMAT_UNKNOWN to preserve the + /// existing format of the back buffer. The flip presentation model supports a more restricted set of formats than the bit-block + /// transfer (bitblt) model. + /// + /// + /// + /// Type: UINT + /// + /// A combination of DXGI_SWAP_CHAIN_FLAG-typed values that are combined by using a bitwise OR operation. The resulting value + /// specifies options for swap-chain behavior. + /// + /// + /// + /// + /// You can't resize a swap chain unless you release all outstanding references to its back buffers. You must release all of its + /// direct and indirect references on the back buffers in order for ResizeBuffers to succeed. + /// + /// Direct references are held by the application after it calls AddRef on a resource. + /// + /// Indirect references are held by views to a resource, binding a view of the resource to a device context, a command list that + /// used the resource, a command list that used a view to that resource, a command list that executed another command list that + /// used the resource, and so on. + /// + /// + /// Before you call ResizeBuffers, ensure that the application releases all references (by calling the appropriate number + /// of Release invocations) on the resources, any views to the resource, and any command lists that use either the resources or + /// views, and ensure that neither the resource nor a view is still bound to a device context. You can use + /// ID3D11DeviceContext::ClearState to ensure that all references are released. If a view is bound to a deferred context, you + /// must discard the partially built command list as well (by calling ID3D11DeviceContext::ClearState, then + /// ID3D11DeviceContext::FinishCommandList, then Release on the command list). After you call ResizeBuffers, you + /// can re-query interfaces via IDXGISwapChain::GetBuffer. + /// + /// + /// For swap chains that you created with DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE, before you call ResizeBuffers, also call + /// IDXGISurface1::ReleaseDC on the swap chain's back-buffer surface to ensure that you have no outstanding GDI device contexts + /// (DCs) open. + /// + /// + /// We recommend that you call ResizeBuffers when a client window is resized (that is, when an application receives a + /// WM_SIZE message). + /// + /// + /// The only difference between IDXGISwapChain::ResizeBuffers in Windows 8 versus Windows 7 is with flip presentation + /// model swap chains that you create with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL or DXGI_SWAP_EFFECT_FLIP_DISCARD value set. In + /// Windows 8, you must call ResizeBuffers to realize a transition between full-screen mode and windowed mode; otherwise, + /// your next call to the IDXGISwapChain::Present method fails. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-resizebuffers HRESULT ResizeBuffers( UINT + // BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags ); + void ResizeBuffers(uint BufferCount, uint Width, uint Height, DXGI_FORMAT NewFormat, uint SwapChainFlags); + + /// Resizes the output target. + /// + /// Type: const DXGI_MODE_DESC* + /// + /// A pointer to a DXGI_MODE_DESC structure that describes the mode, which specifies the new width, height, format, and refresh + /// rate of the target. If the format is DXGI_FORMAT_UNKNOWN, ResizeTarget uses the existing format. We only recommend + /// that you use DXGI_FORMAT_UNKNOWN when the swap chain is in full-screen mode as this method is not thread safe. + /// + /// + /// + /// + /// ResizeTarget resizes the target window when the swap chain is in windowed mode, and changes the display mode on the + /// target output when the swap chain is in full-screen mode. Therefore, apps can call ResizeTarget to resize the target + /// window (rather than a Microsoft Win32API such as SetWindowPos) without knowledge of the swap chain display mode. + /// + /// If a Windows Store app calls ResizeTarget, it fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE. + /// You cannot call ResizeTarget on a swap chain that you created with IDXGIFactory2::CreateSwapChainForComposition. + /// + /// Apps must still call IDXGISwapChain::ResizeBuffers after they call ResizeTarget because only ResizeBuffers can + /// change the back buffers. But, if those apps have implemented window resize processing to call ResizeBuffers, they + /// don't need to explicitly call ResizeBuffers after they call ResizeTarget because the window resize processing + /// will achieve what the app requires. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-resizetarget HRESULT ResizeTarget( const + // DXGI_MODE_DESC *pNewTargetParameters ); + void ResizeTarget(in DXGI_MODE_DESC pNewTargetParameters); + + /// Get the output (the display monitor) that contains the majority of the client area of the target window. + /// + /// Type: IDXGIOutput** + /// A pointer to the output interface (see IDXGIOutput). + /// + /// + /// + /// If the method succeeds, the output interface will be filled and its reference count incremented. When you are finished with + /// it, be sure to release the interface to avoid a memory leak. + /// + /// The output is also owned by the adapter on which the swap chain's device was created. + /// You cannot call GetContainingOutput on a swap chain that you created with IDXGIFactory2::CreateSwapChainForComposition. + /// + /// To determine the output corresponding to such a swap chain, you should call IDXGIFactory::EnumAdapters and then + /// IDXGIAdapter::EnumOutputs to enumerate over all of the available outputs. You should then intersect the bounds of your + /// CoreWindow::Bounds with the desktop coordinates of each output, as reported by DXGI_OUTPUT_DESC1::DesktopCoordinates or DXGI_OUTPUT_DESC::DesktopCoordinates. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getcontainingoutput HRESULT + // GetContainingOutput( IDXGIOutput **ppOutput ); + IDXGIOutput GetContainingOutput(); + + /// Gets performance statistics about the last render frame. + /// + /// Type: DXGI_FRAME_STATISTICS* + /// A pointer to a DXGI_FRAME_STATISTICS structure for the frame statistics. + /// + /// + /// + /// You cannot use GetFrameStatistics for swap chains that both use the bit-block transfer (bitblt) presentation model + /// and draw in windowed mode. + /// + /// + /// You can only use GetFrameStatistics for swap chains that either use the flip presentation model or draw in + /// full-screen mode. You set the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value in the SwapEffect member of the + /// DXGI_SWAP_CHAIN_DESC1 structure to specify that the swap chain uses the flip presentation model. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getframestatistics HRESULT GetFrameStatistics( + // DXGI_FRAME_STATISTICS *pStats ); + DXGI_FRAME_STATISTICS GetFrameStatistics(); + + /// Gets the number of times that IDXGISwapChain::Present or IDXGISwapChain1::Present1 has been called. + /// + /// Type: UINT* + /// A pointer to a variable that receives the number of calls. + /// + /// For info about presentation statistics for a frame, see DXGI_FRAME_STATISTICS. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getlastpresentcount HRESULT + // GetLastPresentCount( UINT *pLastPresentCount ); + uint GetLastPresentCount(); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Direct3D/DXGI/DXGI.cs b/PInvoke/Graphics/Direct3D/DXGI/DXGI.cs new file mode 100644 index 00000000..b28d453a --- /dev/null +++ b/PInvoke/Graphics/Direct3D/DXGI/DXGI.cs @@ -0,0 +1,2447 @@ +using System; +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + // TODO: Move once DXGI lib is done + /// Items from the DXGI.dll + public static partial class DXGI + { + /// Identifies the type of DXGI adapter. + /// + /// The DXGI_ADAPTER_FLAG enumerated type is used by the Flags member of the DXGI_ADAPTER_DESC1 or DXGI_ADAPTER_DESC2 + /// structure to identify the type of DXGI adapter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_adapter_flag typedef enum DXGI_ADAPTER_FLAG { + // DXGI_ADAPTER_FLAG_NONE, DXGI_ADAPTER_FLAG_REMOTE, DXGI_ADAPTER_FLAG_SOFTWARE, DXGI_ADAPTER_FLAG_FORCE_DWORD } ; + [PInvokeData("dxgi.h", MSDNShortId = "9c3c78cd-4f4e-4753-969a-54ea63583be1")] + public enum DXGI_ADAPTER_FLAG : uint + { + /// Specifies no flags. + DXGI_ADAPTER_FLAG_NONE = 0, + + /// Value always set to 0. This flag is reserved. + DXGI_ADAPTER_FLAG_REMOTE = 1, + + /// + /// Specifies a software adapter. For more info about this flag, see new info in Windows 8 about enumerating adapters.Direct3D + /// 11: This enumeration value is supported starting with Windows 8. + /// + DXGI_ADAPTER_FLAG_SOFTWARE = 2, + + /// + /// Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to + /// compile to a size other than 32 bits. This value is not used. + /// + DXGI_ADAPTER_FLAG_FORCE_DWORD = 0xffffffff, + } + + /// Flags for + [PInvokeData("dxgi1_3.h", MSDNShortId = "D3CF43B0-8F17-486E-8750-CF0B9052BE74")] + [Flags] + public enum DXGI_CREATE_FACTORY + { + /// The system creates an implicit factory during device creation. + DXGI_CREATE_FACTORY_DEBUG = 1, + } + + /// + /// Options for enumerating display modes. + /// + /// + /// Constant/value + /// Description + /// + /// + /// DXGI_ENUM_MODES_INTERLACED 1UL + /// Include interlaced modes. + /// + /// + /// DXGI_ENUM_MODES_SCALING 2UL + /// Include stretched-scaling modes. + /// + /// + /// DXGI_ENUM_MODES_STEREO 4UL + /// Include stereo modes. Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + /// + /// DXGI_ENUM_MODES_DISABLED_STEREO 8UL + /// + /// Include stereo modes that are hidden because the user has disabled stereo. Control panel applications can use this option to + /// show stereo capabilities that have been disabled as part of a user interface that enables and disables stereo. Direct3D 11: This + /// enumeration value is supported starting with Windows 8. + /// + /// + /// + /// + /// + /// These flag options are used in IDXGIOutput::GetDisplayModeList to enumerate display modes. + /// These flag options are also used in IDXGIOutput1::GetDisplayModeList1 to enumerate display modes. + /// + // https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-enum-modes + [PInvokeData("dxgi.h", MSDNShortId = "7e0f5629-f8e2-478b-b8eb-00780a3dcf1f")] + [Flags] + public enum DXGI_ENUM_MODES : uint + { + /// Include interlaced modes. + DXGI_ENUM_MODES_INTERLACED = 1, + + /// Include stretched-scaling modes. + DXGI_ENUM_MODES_SCALING = 2, + + /// + /// Include stereo modes. + /// Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + DXGI_ENUM_MODES_STEREO = 4, + + /// + /// Include stereo modes that are hidden because the user has disabled stereo. Control panel applications can use this option to + /// show stereo capabilities that have been disabled as part of a user interface that enables and disables stereo. + /// Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + DXGI_ENUM_MODES_DISABLED_STEREO = 8, + } + + /// + /// Resource data formats, including fully-typed and typeless formats. A list of modifiers at the bottom of the page more fully + /// describes each format type. + /// + /// + /// Byte Order (LSB/MSB) + /// + /// Most formats have byte-aligned components, and the components are in C-array order (the least address comes first). For those + /// formats that don't have power-of-2-aligned components, the first named component is in the least-significant bits. + /// + /// Portable Coding for Endian-Independence + /// + /// Rather than adjusting for whether a system uses big-endian or little-endian byte ordering, you should write portable code, as follows. + /// + /// Restrictions and notes on formats + /// A few formats have additional restrictions and implied behavior: + /// + /// + /// + /// A resource declared with the DXGI_FORMAT_R32G32B32 family of formats cannot be used simultaneously for vertex and texture data. + /// That is, you may not create a buffer resource with the DXGI_FORMAT_R32G32B32 family of formats that uses any of the following + /// bind flags: D3D10_BIND_VERTEX_BUFFER, D3D10_BIND_INDEX_BUFFER, D3D10_BIND_CONSTANT_BUFFER, or D3D10_BIND_STREAM_OUTPUT (see D3D10_BIND_FLAG). + /// + /// + /// + /// + /// DXGI_FORMAT_R1_UNORM is designed specifically for text filtering, and must be used with a format-specific, configurable 8x8 + /// filter mode. When calling an HLSL sampling function using this format, the address offset parameter must be set to (0,0). + /// + /// + /// + /// + /// A resource using a sub-sampled format (such as DXGI_FORMAT_R8G8_B8G8) must have a size that is a multiple of 2 in the x dimension. + /// + /// + /// + /// Format is not available in Direct3D 10 and Direct3D 10.1 + /// + /// + /// + /// These float formats have an implied 1 added to their mantissa. If the exponent is not 0, 1.0 is added to the mantissa before + /// applying the exponent. + /// + /// + /// + /// These float formats do not have an implied 1 added to their mantissa. + /// + /// + /// Denorm support: the 9, 10, 11 and 16 bit float formats support denorms. + /// + /// + /// No denorm support: the 32 and 64 bit float formats flush denorms to zero. + /// + /// + /// The following topics provide lists of the formats that particular hardware feature levels support: + /// + /// + /// DXGI Format Support for Direct3D Feature Level 12.1 Hardware + /// + /// + /// DXGI Format Support for Direct3D Feature Level 12.0 Hardware + /// + /// + /// DXGI Format Support for Direct3D Feature Level 11.1 Hardware + /// + /// + /// DXGI Format Support for Direct3D Feature Level 11.0 Hardware + /// + /// + /// Hardware Support for Direct3D 10Level9 Formats + /// + /// + /// Hardware Support for Direct3D 10.1 Formats + /// + /// + /// Hardware Support for Direct3D 10 Formats + /// + /// + /// For a list of the DirectXMath types that map to DXGI_FORMAT values, see DirectXMath Library Internals. + /// Format Modifiers + /// Each enumeration value contains a format modifier which describes the data type. + /// + /// + /// Format Modifiers + /// Description + /// + /// + /// _FLOAT + /// + /// A floating-point value; 32-bit floating-point formats use IEEE 754 single-precision (s23e8 format): sign bit, 8-bit biased (127) + /// exponent, and 23-bit mantissa. 16-bit floating-point formats use half-precision (s10e5 format): sign bit, 5-bit biased (15) + /// exponent, and 10-bit mantissa. + /// + /// + /// + /// _SINT + /// Two's complement signed integer. For example, a 3-bit SINT represents the values -4, -3, -2, -1, 0, 1, 2, 3. + /// + /// + /// _SNORM + /// + /// Signed normalized integer; which is interpreted in a resource as a signed integer, and is interpreted in a shader as a signed + /// normalized floating-point value in the range [-1, 1]. For an 2's complement number, the maximum value is 1.0f (a 5-bit value + /// 01111 maps to 1.0f), and the minimum value is -1.0f (a 5-bit value 10000 maps to -1.0f). In addition, the second-minimum number + /// maps to -1.0f (a 5-bit value 10001 maps to -1.0f). The resulting integer representations are evenly spaced floating-point values + /// in the range (-1.0f...0.0f), and also a complementary set of representations for numbers in the range (0.0f...1.0f). + /// + /// + /// + /// _SRGB + /// + /// Standard RGB data, which roughly displays colors in a linear ramp of luminosity levels such that an average observer, under + /// average viewing conditions, can view them on an average display. All 0's maps to 0.0f, and all 1's maps to 1.0f. The sequence of + /// unsigned integer encodings between all 0's and all 1's represent a nonlinear progression in the floating-point interpretation of + /// the numbers between 0.0f to 1.0f. For more detail, see the SRGB color standard, IEC 61996-2-1, at IEC (International + /// Electrotechnical Commission).Conversion to or from sRGB space is automatically done by D3DX10 or D3DX9 texture-load functions. + /// If a format with _SRGB has an A channel, the A channel is stored in Gamma 1.0f data; the R, G, and B channels in the format are + /// stored in Gamma 2.2f data. + /// + /// + /// + /// + /// _TYPELESS + /// + /// Typeless data, with a defined number of bits. Typeless formats are designed for creating typeless resources; that is, a resource + /// whose size is known, but whose data type is not yet fully defined. When a typeless resource is bound to a shader, the + /// application or shader must resolve the format type (which must match the number of bits per component in the typeless format). A + /// typeless format contains one or more subformats; each subformat resolves the data type. For example, in the R32G32B32 group, + /// which defines types for three-component 96-bit data, there is one typeless format and three fully typed subformats. + /// + /// + /// + /// _UINT + /// Unsigned integer. For instance, a 3-bit UINT represents the values 0, 1, 2, 3, 4, 5, 6, 7. + /// + /// + /// _UNORM + /// + /// Unsigned normalized integer; which is interpreted in a resource as an unsigned integer, and is interpreted in a shader as an + /// unsigned normalized floating-point value in the range [0, 1]. All 0's maps to 0.0f, and all 1's maps to 1.0f. A sequence of + /// evenly spaced floating-point values from 0.0f to 1.0f are represented. For instance, a 2-bit UNORM represents 0.0f, 1/3, 2/3, + /// and 1.0f. + /// + /// + /// + /// _SHAREDEXP + /// A shared exponent. All the floating point representations in the format share the one exponent. + /// + /// + /// New Resource Formats + /// + /// Direct3D 10 offers new data compression formats for compressing high-dynamic range (HDR) lighting data, normal maps and + /// heightfields to a fraction of their original size. These compression types include: + /// + /// + /// + /// Shared-Exponent high-dynamic range (HDR) format (RGBE) + /// + /// + /// New Block-Compressed 1-2 channel UNORM/SNORM formats + /// + /// + /// + /// The block compression formats can be used for any of the 2D or 3D texture types ( Texture2D, Texture2DArray, Texture3D, or + /// TextureCube) including mipmap surfaces. The block compression techniques require texture dimensions to be a multiple of 4 (since + /// the implementation compresses on blocks of 4x4 texels). In the texture sampler, compressed formats are always decompressed + /// before texture filtering. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format typedef enum DXGI_FORMAT { + // DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R32G32B32A32_TYPELESS, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_UINT, + // DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32_TYPELESS, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_UINT, + // DXGI_FORMAT_R32G32B32_SINT, DXGI_FORMAT_R16G16B16A16_TYPELESS, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_UNORM, + // DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R32G32_TYPELESS, + // DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G8X24_TYPELESS, + // DXGI_FORMAT_D32_FLOAT_S8X24_UINT, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, + // DXGI_FORMAT_R10G10B10A2_TYPELESS, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_R11G11B10_FLOAT, + // DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UINT, + // DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R16G16_TYPELESS, DXGI_FORMAT_R16G16_FLOAT, + // DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R32_TYPELESS, + // DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R24G8_TYPELESS, + // DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_X24_TYPELESS_G8_UINT, DXGI_FORMAT_R8G8_TYPELESS, + // DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R16_TYPELESS, + // DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_SNORM, + // DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R8_TYPELESS, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_SNORM, + // DXGI_FORMAT_R8_SINT, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R8G8_B8G8_UNORM, + // DXGI_FORMAT_G8R8_G8B8_UNORM, DXGI_FORMAT_BC1_TYPELESS, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB, + // DXGI_FORMAT_BC2_TYPELESS, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB, DXGI_FORMAT_BC3_TYPELESS, DXGI_FORMAT_BC3_UNORM, + // DXGI_FORMAT_BC3_UNORM_SRGB, DXGI_FORMAT_BC4_TYPELESS, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_SNORM, DXGI_FORMAT_BC5_TYPELESS, + // DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_SNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, + // DXGI_FORMAT_B8G8R8X8_UNORM, DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, DXGI_FORMAT_B8G8R8A8_TYPELESS, + // DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8X8_TYPELESS, DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, DXGI_FORMAT_BC6H_TYPELESS, + // DXGI_FORMAT_BC6H_UF16, DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_BC7_TYPELESS, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM_SRGB, + // DXGI_FORMAT_AYUV, DXGI_FORMAT_Y410, DXGI_FORMAT_Y416, DXGI_FORMAT_NV12, DXGI_FORMAT_P010, DXGI_FORMAT_P016, + // DXGI_FORMAT_420_OPAQUE, DXGI_FORMAT_YUY2, DXGI_FORMAT_Y210, DXGI_FORMAT_Y216, DXGI_FORMAT_NV11, DXGI_FORMAT_AI44, + // DXGI_FORMAT_IA44, DXGI_FORMAT_P8, DXGI_FORMAT_A8P8, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_P208, DXGI_FORMAT_V208, + // DXGI_FORMAT_V408, DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE, DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE, + // DXGI_FORMAT_FORCE_UINT } ; + [PInvokeData("dxgiformat.h")] + public enum DXGI_FORMAT : uint + { + /// The format is not known. + DXGI_FORMAT_UNKNOWN, + + /// A four-component, 128-bit typeless format that supports 32 bits per channel including alpha. ¹ + DXGI_FORMAT_R32G32B32A32_TYPELESS, + + /// A four-component, 128-bit floating-point format that supports 32 bits per channel including alpha. + DXGI_FORMAT_R32G32B32A32_FLOAT, + + /// A four-component, 128-bit unsigned-integer format that supports 32 bits per channel including alpha. ¹ + DXGI_FORMAT_R32G32B32A32_UINT, + + /// A four-component, 128-bit signed-integer format that supports 32 bits per channel including alpha. ¹ + DXGI_FORMAT_R32G32B32A32_SINT, + + /// A three-component, 96-bit typeless format that supports 32 bits per color channel. + DXGI_FORMAT_R32G32B32_TYPELESS, + + /// A three-component, 96-bit floating-point format that supports 32 bits per color channel. + DXGI_FORMAT_R32G32B32_FLOAT, + + /// A three-component, 96-bit unsigned-integer format that supports 32 bits per color channel. + DXGI_FORMAT_R32G32B32_UINT, + + /// A three-component, 96-bit signed-integer format that supports 32 bits per color channel. + DXGI_FORMAT_R32G32B32_SINT, + + /// A four-component, 64-bit typeless format that supports 16 bits per channel including alpha. + DXGI_FORMAT_R16G16B16A16_TYPELESS, + + /// A four-component, 64-bit floating-point format that supports 16 bits per channel including alpha. + DXGI_FORMAT_R16G16B16A16_FLOAT, + + /// A four-component, 64-bit unsigned-normalized-integer format that supports 16 bits per channel including alpha. + DXGI_FORMAT_R16G16B16A16_UNORM, + + /// A four-component, 64-bit unsigned-integer format that supports 16 bits per channel including alpha. + DXGI_FORMAT_R16G16B16A16_UINT, + + /// A four-component, 64-bit signed-normalized-integer format that supports 16 bits per channel including alpha. + DXGI_FORMAT_R16G16B16A16_SNORM, + + /// A four-component, 64-bit signed-integer format that supports 16 bits per channel including alpha. + DXGI_FORMAT_R16G16B16A16_SINT, + + /// + /// A two-component, 64-bit typeless format that supports 32 bits for the red channel and 32 bits for the green channel. + /// + DXGI_FORMAT_R32G32_TYPELESS, + + /// + /// A two-component, 64-bit floating-point format that supports 32 bits for the red channel and 32 bits for the green channel. + /// + DXGI_FORMAT_R32G32_FLOAT, + + /// + /// A two-component, 64-bit unsigned-integer format that supports 32 bits for the red channel and 32 bits for the green channel. + /// + DXGI_FORMAT_R32G32_UINT, + + /// + /// A two-component, 64-bit signed-integer format that supports 32 bits for the red channel and 32 bits for the green channel. + /// + DXGI_FORMAT_R32G32_SINT, + + /// + /// A two-component, 64-bit typeless format that supports 32 bits for the red channel, 8 bits for the green channel, and 24 bits + /// are unused. + /// + DXGI_FORMAT_R32G8X24_TYPELESS, + + /// + /// A 32-bit floating-point component, and two unsigned-integer components (with an additional 32 bits). This format supports + /// 32-bit depth, 8-bit stencil, and 24 bits are unused.⁵ + /// + DXGI_FORMAT_D32_FLOAT_S8X24_UINT, + + /// + /// A 32-bit floating-point component, and two typeless components (with an additional 32 bits). This format supports 32-bit red + /// channel, 8 bits are unused, and 24 bits are unused.⁵ + /// + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, + + /// + /// A 32-bit typeless component, and two unsigned-integer components (with an additional 32 bits). This format has 32 bits + /// unused, 8 bits for green channel, and 24 bits are unused. + /// + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, + + /// A four-component, 32-bit typeless format that supports 10 bits for each color and 2 bits for alpha. + DXGI_FORMAT_R10G10B10A2_TYPELESS, + + /// + /// A four-component, 32-bit unsigned-normalized-integer format that supports 10 bits for each color and 2 bits for alpha. + /// + DXGI_FORMAT_R10G10B10A2_UNORM, + + /// A four-component, 32-bit unsigned-integer format that supports 10 bits for each color and 2 bits for alpha. + DXGI_FORMAT_R10G10B10A2_UINT, + + /// + /// Three partial-precision floating-point numbers encoded into a single 32-bit value (a variant of s10e5, which is sign bit, + /// 10-bit mantissa, and 5-bit biased (15) exponent). There are no sign bits, and there is a 5-bit biased (15) exponent for each + /// channel, 6-bit mantissa for R and G, and a 5-bit mantissa for B, as shown in the following illustration. + /// + DXGI_FORMAT_R11G11B10_FLOAT, + + /// A four-component, 32-bit typeless format that supports 8 bits per channel including alpha. + DXGI_FORMAT_R8G8B8A8_TYPELESS, + + /// A four-component, 32-bit unsigned-normalized-integer format that supports 8 bits per channel including alpha. + DXGI_FORMAT_R8G8B8A8_UNORM, + + /// + /// A four-component, 32-bit unsigned-normalized integer sRGB format that supports 8 bits per channel including alpha. + /// + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + + /// A four-component, 32-bit unsigned-integer format that supports 8 bits per channel including alpha. + DXGI_FORMAT_R8G8B8A8_UINT, + + /// A four-component, 32-bit signed-normalized-integer format that supports 8 bits per channel including alpha. + DXGI_FORMAT_R8G8B8A8_SNORM, + + /// A four-component, 32-bit signed-integer format that supports 8 bits per channel including alpha. + DXGI_FORMAT_R8G8B8A8_SINT, + + /// + /// A two-component, 32-bit typeless format that supports 16 bits for the red channel and 16 bits for the green channel. + /// + DXGI_FORMAT_R16G16_TYPELESS, + + /// + /// A two-component, 32-bit floating-point format that supports 16 bits for the red channel and 16 bits for the green channel. + /// + DXGI_FORMAT_R16G16_FLOAT, + + /// + /// A two-component, 32-bit unsigned-normalized-integer format that supports 16 bits each for the green and red channels. + /// + DXGI_FORMAT_R16G16_UNORM, + + /// + /// A two-component, 32-bit unsigned-integer format that supports 16 bits for the red channel and 16 bits for the green channel. + /// + DXGI_FORMAT_R16G16_UINT, + + /// + /// A two-component, 32-bit signed-normalized-integer format that supports 16 bits for the red channel and 16 bits for the green channel. + /// + DXGI_FORMAT_R16G16_SNORM, + + /// + /// A two-component, 32-bit signed-integer format that supports 16 bits for the red channel and 16 bits for the green channel. + /// + DXGI_FORMAT_R16G16_SINT, + + /// A single-component, 32-bit typeless format that supports 32 bits for the red channel. + DXGI_FORMAT_R32_TYPELESS, + + /// A single-component, 32-bit floating-point format that supports 32 bits for depth. + DXGI_FORMAT_D32_FLOAT, + + /// A single-component, 32-bit floating-point format that supports 32 bits for the red channel. + DXGI_FORMAT_R32_FLOAT, + + /// A single-component, 32-bit unsigned-integer format that supports 32 bits for the red channel. + DXGI_FORMAT_R32_UINT, + + /// A single-component, 32-bit signed-integer format that supports 32 bits for the red channel. + DXGI_FORMAT_R32_SINT, + + /// A two-component, 32-bit typeless format that supports 24 bits for the red channel and 8 bits for the green channel. + DXGI_FORMAT_R24G8_TYPELESS, + + /// A 32-bit z-buffer format that supports 24 bits for depth and 8 bits for stencil. + DXGI_FORMAT_D24_UNORM_S8_UINT, + + /// + /// A 32-bit format, that contains a 24 bit, single-component, unsigned-normalized integer, with an additional typeless 8 bits. + /// This format has 24 bits red channel and 8 bits unused. + /// + DXGI_FORMAT_R24_UNORM_X8_TYPELESS, + + /// + /// A 32-bit format, that contains a 24 bit, single-component, typeless format, with an additional 8 bit unsigned integer + /// component. This format has 24 bits unused and 8 bits green channel. + /// + DXGI_FORMAT_X24_TYPELESS_G8_UINT, + + /// A two-component, 16-bit typeless format that supports 8 bits for the red channel and 8 bits for the green channel. + DXGI_FORMAT_R8G8_TYPELESS, + + /// + /// A two-component, 16-bit unsigned-normalized-integer format that supports 8 bits for the red channel and 8 bits for the green channel. + /// + DXGI_FORMAT_R8G8_UNORM, + + /// + /// A two-component, 16-bit unsigned-integer format that supports 8 bits for the red channel and 8 bits for the green channel. + /// + DXGI_FORMAT_R8G8_UINT, + + /// + /// A two-component, 16-bit signed-normalized-integer format that supports 8 bits for the red channel and 8 bits for the green channel. + /// + DXGI_FORMAT_R8G8_SNORM, + + /// + /// A two-component, 16-bit signed-integer format that supports 8 bits for the red channel and 8 bits for the green channel. + /// + DXGI_FORMAT_R8G8_SINT, + + /// A single-component, 16-bit typeless format that supports 16 bits for the red channel. + DXGI_FORMAT_R16_TYPELESS, + + /// A single-component, 16-bit floating-point format that supports 16 bits for the red channel. + DXGI_FORMAT_R16_FLOAT, + + /// A single-component, 16-bit unsigned-normalized-integer format that supports 16 bits for depth. + DXGI_FORMAT_D16_UNORM, + + /// A single-component, 16-bit unsigned-normalized-integer format that supports 16 bits for the red channel. + DXGI_FORMAT_R16_UNORM, + + /// A single-component, 16-bit unsigned-integer format that supports 16 bits for the red channel. + DXGI_FORMAT_R16_UINT, + + /// A single-component, 16-bit signed-normalized-integer format that supports 16 bits for the red channel. + DXGI_FORMAT_R16_SNORM, + + /// A single-component, 16-bit signed-integer format that supports 16 bits for the red channel. + DXGI_FORMAT_R16_SINT, + + /// A single-component, 8-bit typeless format that supports 8 bits for the red channel. + DXGI_FORMAT_R8_TYPELESS, + + /// A single-component, 8-bit unsigned-normalized-integer format that supports 8 bits for the red channel. + DXGI_FORMAT_R8_UNORM, + + /// A single-component, 8-bit unsigned-integer format that supports 8 bits for the red channel. + DXGI_FORMAT_R8_UINT, + + /// A single-component, 8-bit signed-normalized-integer format that supports 8 bits for the red channel. + DXGI_FORMAT_R8_SNORM, + + /// A single-component, 8-bit signed-integer format that supports 8 bits for the red channel. + DXGI_FORMAT_R8_SINT, + + /// A single-component, 8-bit unsigned-normalized-integer format for alpha only. + DXGI_FORMAT_A8_UNORM, + + /// A single-component, 1-bit unsigned-normalized integer format that supports 1 bit for the red channel. ². + DXGI_FORMAT_R1_UNORM, + + /// + /// Three partial-precision floating-point numbers encoded into a single 32-bit value all sharing the same 5-bit exponent + /// (variant of s10e5, which is sign bit, 10-bit mantissa, and 5-bit biased (15) exponent). There is no sign bit, and there is a + /// shared 5-bit biased (15) exponent and a 9-bit mantissa for each channel, as shown in the following illustration. . + /// + DXGI_FORMAT_R9G9B9E5_SHAREDEXP, + + /// + /// A four-component, 32-bit unsigned-normalized-integer format. This packed RGB format is analogous to the UYVY format. Each + /// 32-bit block describes a pair of pixels: (R8, G8, B8) and (R8, G8, B8) where the R8/B8 values are repeated, and the G8 + /// values are unique to each pixel. ³Width must be even. + /// + DXGI_FORMAT_R8G8_B8G8_UNORM, + + /// + /// A four-component, 32-bit unsigned-normalized-integer format. This packed RGB format is analogous to the YUY2 format. Each + /// 32-bit block describes a pair of pixels: (R8, G8, B8) and (R8, G8, B8) where the R8/B8 values are repeated, and the G8 + /// values are unique to each pixel. ³Width must be even. + /// + DXGI_FORMAT_G8R8_G8B8_UNORM, + + /// + /// Four-component typeless block-compression format. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC1_TYPELESS, + + /// + /// Four-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC1_UNORM, + + /// + /// Four-component block-compression format for sRGB data. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC1_UNORM_SRGB, + + /// + /// Four-component typeless block-compression format. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC2_TYPELESS, + + /// + /// Four-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC2_UNORM, + + /// + /// Four-component block-compression format for sRGB data. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC2_UNORM_SRGB, + + /// + /// Four-component typeless block-compression format. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC3_TYPELESS, + + /// + /// Four-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC3_UNORM, + + /// + /// Four-component block-compression format for sRGB data. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC3_UNORM_SRGB, + + /// + /// One-component typeless block-compression format. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC4_TYPELESS, + + /// + /// One-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC4_UNORM, + + /// + /// One-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC4_SNORM, + + /// + /// Two-component typeless block-compression format. For information about block-compression formats, see Texture Block + /// Compression in Direct3D 11. + /// + DXGI_FORMAT_BC5_TYPELESS, + + /// + /// Two-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC5_UNORM, + + /// + /// Two-component block-compression format. For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC5_SNORM, + + /// + /// A three-component, 16-bit unsigned-normalized-integer format that supports 5 bits for blue, 6 bits for green, and 5 bits for + /// red.Direct3D 10 through Direct3D 11: This value is defined for DXGI. However, Direct3D 10, 10.1, or 11 devices do not + /// support this format.Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_B5G6R5_UNORM, + + /// + /// A four-component, 16-bit unsigned-normalized-integer format that supports 5 bits for each color channel and 1-bit + /// alpha.Direct3D 10 through Direct3D 11: This value is defined for DXGI. However, Direct3D 10, 10.1, or 11 devices do not + /// support this format.Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_B5G5R5A1_UNORM, + + /// + /// A four-component, 32-bit unsigned-normalized-integer format that supports 8 bits for each color channel and 8-bit alpha. + /// + DXGI_FORMAT_B8G8R8A8_UNORM, + + /// + /// A four-component, 32-bit unsigned-normalized-integer format that supports 8 bits for each color channel and 8 bits unused. + /// + DXGI_FORMAT_B8G8R8X8_UNORM, + + /// + /// A four-component, 32-bit 2.8-biased fixed-point format that supports 10 bits for each color channel and 2-bit alpha. + /// + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, + + /// A four-component, 32-bit typeless format that supports 8 bits for each channel including alpha. ⁴ + DXGI_FORMAT_B8G8R8A8_TYPELESS, + + /// + /// A four-component, 32-bit unsigned-normalized standard RGB format that supports 8 bits for each channel including alpha. ⁴ + /// + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, + + /// + /// A four-component, 32-bit typeless format that supports 8 bits for each color channel, and 8 bits are unused. ⁴ + /// + DXGI_FORMAT_B8G8R8X8_TYPELESS, + + /// + /// A four-component, 32-bit unsigned-normalized standard RGB format that supports 8 bits for each color channel, and 8 bits are + /// unused. ⁴ + /// + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, + + /// + /// A typeless block-compression format. ⁴ For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC6H_TYPELESS, + + /// + /// A block-compression format. ⁴ For information about block-compression formats, see Texture Block Compression in Direct3D 11.⁵ + /// + DXGI_FORMAT_BC6H_UF16, + + /// + /// A block-compression format. ⁴ For information about block-compression formats, see Texture Block Compression in Direct3D 11.⁵ + /// + DXGI_FORMAT_BC6H_SF16, + + /// + /// A typeless block-compression format. ⁴ For information about block-compression formats, see Texture Block Compression in + /// Direct3D 11. + /// + DXGI_FORMAT_BC7_TYPELESS, + + /// + /// A block-compression format. ⁴ For information about block-compression formats, see Texture Block Compression in Direct3D 11. + /// + DXGI_FORMAT_BC7_UNORM, + + /// + /// A block-compression format. ⁴ For information about block-compression formats, see Texture Block Compression in Direct3D 11. + /// + DXGI_FORMAT_BC7_UNORM_SRGB, + + /// + /// Most common YUV 4:4:4 video resource format. Valid view formats for this video resource format are + /// DXGI_FORMAT_R8G8B8A8_UNORM and DXGI_FORMAT_R8G8B8A8_UINT. For UAVs, an additional valid view format is DXGI_FORMAT_R32_UINT. + /// By using DXGI_FORMAT_R32_UINT for UAVs, you can both read and write as opposed to just write for DXGI_FORMAT_R8G8B8A8_UNORM + /// and DXGI_FORMAT_R8G8B8A8_UINT. Supported view types are SRV, RTV, and UAV. One view provides a straightforward mapping of + /// the entire surface. The mapping to the view channel is V->R8, U->G8, Y->B8, and A->A8.For more info about YUV + /// formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. Direct3D 11.1: This value is not + /// supported until Windows 8. + /// + DXGI_FORMAT_AYUV, + + /// + /// 10-bit per channel packed YUV 4:4:4 video resource format. Valid view formats for this video resource format are + /// DXGI_FORMAT_R10G10B10A2_UNORM and DXGI_FORMAT_R10G10B10A2_UINT. For UAVs, an additional valid view format is + /// DXGI_FORMAT_R32_UINT. By using DXGI_FORMAT_R32_UINT for UAVs, you can both read and write as opposed to just write for + /// DXGI_FORMAT_R10G10B10A2_UNORM and DXGI_FORMAT_R10G10B10A2_UINT. Supported view types are SRV and UAV. One view provides a + /// straightforward mapping of the entire surface. The mapping to the view channel is U->R10,Y->G10,V->B10,and + /// A->A2.For more info about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. + /// Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_Y410, + + /// + /// 16-bit per channel packed YUV 4:4:4 video resource format. Valid view formats for this video resource format are + /// DXGI_FORMAT_R16G16B16A16_UNORM and DXGI_FORMAT_R16G16B16A16_UINT. Supported view types are SRV and UAV. One view provides a + /// straightforward mapping of the entire surface. The mapping to the view channel is U->R16,Y->G16,V->B16,and + /// A->A16.For more info about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. + /// Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_Y416, + + /// + /// Most common YUV 4:2:0 video resource format. Valid luminance data view formats for this video resource format are + /// DXGI_FORMAT_R8_UNORM and DXGI_FORMAT_R8_UINT. Valid chrominance data view formats (width and height are each 1/2 of + /// luminance view) for this video resource format are DXGI_FORMAT_R8G8_UNORM and DXGI_FORMAT_R8G8_UINT. Supported view types + /// are SRV, RTV, and UAV. For luminance data view, the mapping to the view channel is Y->R8. For chrominance data view, the + /// mapping to the view channel is U->R8 andV->G8.For more info about YUV formats for video rendering, see Recommended + /// 8-Bit YUV Formats for Video Rendering. Width and height must be even. Direct3D 11 staging resources and initData parameters + /// for this format use (rowPitch * (height + (height / 2))) bytes. The first (SysMemPitch * height) bytes are the Y plane, the + /// remaining (SysMemPitch * (height / 2)) bytes are the UV plane.An app using the YUY 4:2:0 formats must map the luma (Y) plane + /// separately from the chroma (UV) planes. Developers do this by calling ID3D12Device::CreateShaderResourceView twice for the + /// same texture and passing in 1-channel and 2-channel formats. Passing in a 1-channel format compatible with the Y plane maps + /// only the Y plane. Passing in a 2-channel format compatible with the UV planes (together) maps only the U and V planes as a + /// single resource view.Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_NV12, + + /// + /// 10-bit per channel planar YUV 4:2:0 video resource format. Valid luminance data view formats for this video resource format + /// are DXGI_FORMAT_R16_UNORM and DXGI_FORMAT_R16_UINT. The runtime does not enforce whether the lowest 6 bits are 0 (given that + /// this video resource format is a 10-bit format that uses 16 bits). If required, application shader code would have to enforce + /// this manually. From the runtime's point of view, DXGI_FORMAT_P010 is no different than DXGI_FORMAT_P016. Valid chrominance + /// data view formats (width and height are each 1/2 of luminance view) for this video resource format are + /// DXGI_FORMAT_R16G16_UNORM and DXGI_FORMAT_R16G16_UINT. For UAVs, an additional valid chrominance data view format is + /// DXGI_FORMAT_R32_UINT. By using DXGI_FORMAT_R32_UINT for UAVs, you can both read and write as opposed to just write for + /// DXGI_FORMAT_R16G16_UNORM and DXGI_FORMAT_R16G16_UINT. Supported view types are SRV, RTV, and UAV. For luminance data view, + /// the mapping to the view channel is Y->R16. For chrominance data view, the mapping to the view channel is U->R16 + /// andV->G16.For more info about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. + /// Width and height must be even. Direct3D 11 staging resources and initData parameters for this format use (rowPitch * (height + /// + (height / 2))) bytes. The first (SysMemPitch * height) bytes are the Y plane, the remaining (SysMemPitch * (height / 2)) + /// bytes are the UV plane.An app using the YUY 4:2:0 formats must map the luma (Y) plane separately from the chroma (UV) + /// planes. Developers do this by calling ID3D12Device::CreateShaderResourceView twice for the same texture and passing in + /// 1-channel and 2-channel formats. Passing in a 1-channel format compatible with the Y plane maps only the Y plane. Passing in + /// a 2-channel format compatible with the UV planes (together) maps only the U and V planes as a single resource view.Direct3D + /// 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_P010, + + /// + /// 16-bit per channel planar YUV 4:2:0 video resource format. Valid luminance data view formats for this video resource format + /// are DXGI_FORMAT_R16_UNORM and DXGI_FORMAT_R16_UINT. Valid chrominance data view formats (width and height are each 1/2 of + /// luminance view) for this video resource format are DXGI_FORMAT_R16G16_UNORM and DXGI_FORMAT_R16G16_UINT. For UAVs, an + /// additional valid chrominance data view format is DXGI_FORMAT_R32_UINT. By using DXGI_FORMAT_R32_UINT for UAVs, you can both + /// read and write as opposed to just write for DXGI_FORMAT_R16G16_UNORM and DXGI_FORMAT_R16G16_UINT. Supported view types are + /// SRV, RTV, and UAV. For luminance data view, the mapping to the view channel is Y->R16. For chrominance data view, the + /// mapping to the view channel is U->R16 andV->G16.For more info about YUV formats for video rendering, see Recommended + /// 8-Bit YUV Formats for Video Rendering. Width and height must be even. Direct3D 11 staging resources and initData parameters + /// for this format use (rowPitch * (height + (height / 2))) bytes. The first (SysMemPitch * height) bytes are the Y plane, the + /// remaining (SysMemPitch * (height / 2)) bytes are the UV plane.An app using the YUY 4:2:0 formats must map the luma (Y) plane + /// separately from the chroma (UV) planes. Developers do this by calling ID3D12Device::CreateShaderResourceView twice for the + /// same texture and passing in 1-channel and 2-channel formats. Passing in a 1-channel format compatible with the Y plane maps + /// only the Y plane. Passing in a 2-channel format compatible with the UV planes (together) maps only the U and V planes as a + /// single resource view.Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_P016, + + /// + /// 8-bit per channel planar YUV 4:2:0 video resource format. This format is subsampled where each pixel has its own Y value, + /// but each 2x2 pixel block shares a single U and V value. The runtime requires that the width and height of all resources that + /// are created with this format are multiples of 2. The runtime also requires that the left, right, top, and bottom members of + /// any RECT that are used for this format are multiples of 2. This format differs from DXGI_FORMAT_NV12 in that the layout of + /// the data within the resource is completely opaque to applications. Applications cannot use the CPU to map the resource and + /// then access the data within the resource. You cannot use shaders with this format. Because of this behavior, legacy hardware + /// that supports a non-NV12 4:2:0 layout (for example, YV12, and so on) can be used. Also, new hardware that has a 4:2:0 + /// implementation better than NV12 can be used when the application does not need the data to be in a standard layout. For more + /// info about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. Width and height must be + /// even. Direct3D 11 staging resources and initData parameters for this format use (rowPitch * (height + (height / 2))) bytes. + /// An app using the YUY 4:2:0 formats must map the luma (Y) plane separately from the chroma (UV) planes. Developers do this by + /// calling ID3D12Device::CreateShaderResourceView twice for the same texture and passing in 1-channel and 2-channel formats. + /// Passing in a 1-channel format compatible with the Y plane maps only the Y plane. Passing in a 2-channel format compatible + /// with the UV planes (together) maps only the U and V planes as a single resource view.Direct3D 11.1: This value is not + /// supported until Windows 8. + /// + DXGI_FORMAT_420_OPAQUE, + + /// + /// Most common YUV 4:2:2 video resource format. Valid view formats for this video resource format are + /// DXGI_FORMAT_R8G8B8A8_UNORM and DXGI_FORMAT_R8G8B8A8_UINT. For UAVs, an additional valid view format is DXGI_FORMAT_R32_UINT. + /// By using DXGI_FORMAT_R32_UINT for UAVs, you can both read and write as opposed to just write for DXGI_FORMAT_R8G8B8A8_UNORM + /// and DXGI_FORMAT_R8G8B8A8_UINT. Supported view types are SRV and UAV. One view provides a straightforward mapping of the + /// entire surface. The mapping to the view channel is Y0->R8, U0->G8, Y1->B8, and V0->A8.A unique valid view format + /// for this video resource format is DXGI_FORMAT_R8G8_B8G8_UNORM. With this view format, the width of the view appears to be + /// twice what the DXGI_FORMAT_R8G8B8A8_UNORM or DXGI_FORMAT_R8G8B8A8_UINT view would be when hardware reconstructs RGBA + /// automatically on read and before filtering. This Direct3D hardware behavior is legacy and is likely not useful any more. + /// With this view format, the mapping to the view channel is Y0->R8, U0->G8[0], Y1->B8, and V0->G8[1].For more info + /// about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. Width must be even.Direct3D + /// 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_YUY2, + + /// + /// 10-bit per channel packed YUV 4:2:2 video resource format. Valid view formats for this video resource format are + /// DXGI_FORMAT_R16G16B16A16_UNORM and DXGI_FORMAT_R16G16B16A16_UINT. The runtime does not enforce whether the lowest 6 bits are + /// 0 (given that this video resource format is a 10-bit format that uses 16 bits). If required, application shader code would + /// have to enforce this manually. From the runtime's point of view, DXGI_FORMAT_Y210 is no different than DXGI_FORMAT_Y216. + /// Supported view types are SRV and UAV. One view provides a straightforward mapping of the entire surface. The mapping to the + /// view channel is Y0->R16,U->G16,Y1->B16,and V->A16.For more info about YUV formats for video rendering, see + /// Recommended 8-Bit YUV Formats for Video Rendering. Width must be even.Direct3D 11.1: This value is not supported until + /// Windows 8. + /// + DXGI_FORMAT_Y210, + + /// + /// 16-bit per channel packed YUV 4:2:2 video resource format. Valid view formats for this video resource format are + /// DXGI_FORMAT_R16G16B16A16_UNORM and DXGI_FORMAT_R16G16B16A16_UINT. Supported view types are SRV and UAV. One view provides a + /// straightforward mapping of the entire surface. The mapping to the view channel is Y0->R16,U->G16,Y1->B16,and + /// V->A16.For more info about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. Width + /// must be even.Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_Y216, + + /// + /// Most common planar YUV 4:1:1 video resource format. Valid luminance data view formats for this video resource format are + /// DXGI_FORMAT_R8_UNORM and DXGI_FORMAT_R8_UINT. Valid chrominance data view formats (width and height are each 1/4 of + /// luminance view) for this video resource format are DXGI_FORMAT_R8G8_UNORM and DXGI_FORMAT_R8G8_UINT. Supported view types + /// are SRV, RTV, and UAV. For luminance data view, the mapping to the view channel is Y->R8. For chrominance data view, the + /// mapping to the view channel is U->R8 andV->G8.For more info about YUV formats for video rendering, see Recommended + /// 8-Bit YUV Formats for Video Rendering. Width must be a multiple of 4. Direct3D11 staging resources and initData parameters + /// for this format use (rowPitch * height * 2) bytes. The first (SysMemPitch * height) bytes are the Y plane, the next + /// ((SysMemPitch / 2) * height) bytes are the UV plane, and the remainder is padding. Direct3D 11.1: This value is not + /// supported until Windows 8. + /// + DXGI_FORMAT_NV11, + + /// + /// 4-bit palletized YUV format that is commonly used for DVD subpicture.For more info about YUV formats for video rendering, + /// see Recommended 8-Bit YUV Formats for Video Rendering. Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_AI44, + + /// + /// 4-bit palletized YUV format that is commonly used for DVD subpicture.For more info about YUV formats for video rendering, + /// see Recommended 8-Bit YUV Formats for Video Rendering. Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_IA44, + + /// + /// 8-bit palletized format that is used for palletized RGB data when the processor processes ISDB-T data and for palletized YUV + /// data when the processor processes BluRay data.For more info about YUV formats for video rendering, see Recommended 8-Bit YUV + /// Formats for Video Rendering. Direct3D 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_P8, + + /// + /// 8-bit palletized format with 8 bits of alpha that is used for palletized YUV data when the processor processes BluRay + /// data.For more info about YUV formats for video rendering, see Recommended 8-Bit YUV Formats for Video Rendering. Direct3D + /// 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_A8P8, + + /// + /// A four-component, 16-bit unsigned-normalized integer format that supports 4 bits for each channel including alpha.Direct3D + /// 11.1: This value is not supported until Windows 8. + /// + DXGI_FORMAT_B4G4R4A4_UNORM, + + /// A video format; an 8-bit version of a hybrid planar 4:2:2 format. + DXGI_FORMAT_P208 = 130, + + /// An 8 bit YCbCrA 4:4 rendering format. + DXGI_FORMAT_V208, + + /// An 8 bit YCbCrA 4:4:4:4 rendering format. + DXGI_FORMAT_V408, + + /// + /// Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to + /// compile to a size other than 32 bits. This value is not used. + /// + DXGI_FORMAT_FORCE_UINT = 0xffffffff, + } + + /// CPU read-write flags. + [PInvokeData("dxgi.h")] + [Flags] + public enum DXGI_MAP : uint + { + /// Allow CPU read access. + DXGI_MAP_READ = 0x1, + + /// Allow CPU write access. + DXGI_MAP_WRITE = 0x2, + + /// Discard the previous contents of a resource when it is mapped. + DXGI_MAP_DISCARD = 0x4 + } + + /// Flags that indicate how the back buffers should be rotated to fit the physical rotation of a monitor. + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173065(v=vs.85) typedef enum DXGI_MODE_ROTATION { + // DXGI_MODE_ROTATION_UNSPECIFIED = 0, DXGI_MODE_ROTATION_IDENTITY = 1, DXGI_MODE_ROTATION_ROTATE90 = 2, + // DXGI_MODE_ROTATION_ROTATE180 = 3, DXGI_MODE_ROTATION_ROTATE270 = 4 } DXGI_MODE_ROTATION; + [PInvokeData("DXGI.h")] + public enum DXGI_MODE_ROTATION + { + /// Unspecified rotation. + DXGI_MODE_ROTATION_UNSPECIFIED = 0, + + /// Specifies no rotation. + DXGI_MODE_ROTATION_IDENTITY, + + /// Specifies 90 degrees of rotation. + DXGI_MODE_ROTATION_ROTATE90, + + /// Specifies 180 degrees of rotation. + DXGI_MODE_ROTATION_ROTATE180, + + /// Specifies 270 degrees of rotation. + DXGI_MODE_ROTATION_ROTATE270, + } + + /// Flags indicating how an image is stretched to fit a given monitor's resolution. + /// + /// + /// Selecting the CENTERED or STRETCHED modes can result in a mode change even if you specify the native resolution of the display + /// in the DXGI_MODE_DESC. If you know the native resolution of the display and want to make sure that you do not initiate a mode + /// change when transitioning a swap chain to full screen (either via ALT+ENTER or IDXGISwapChain::SetFullscreenState), you + /// should use UNSPECIFIED. + /// + /// This enum is used by the DXGI_MODE_DESC1 and DXGI_SWAP_CHAIN_FULLSCREEN_DESC structures. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173066(v=vs.85) typedef enum DXGI_MODE_SCALING { + // DXGI_MODE_SCALING_UNSPECIFIED = 0, DXGI_MODE_SCALING_CENTERED = 1, DXGI_MODE_SCALING_STRETCHED = 2 } DXGI_MODE_SCALING; + [PInvokeData("DXGI.h")] + public enum DXGI_MODE_SCALING + { + /// Unspecified scaling. + DXGI_MODE_SCALING_UNSPECIFIED = 0, + + /// + /// Specifies no scaling. The image is centered on the display. This flag is typically used for a fixed-dot-pitch display (such + /// as an LED display). + /// + DXGI_MODE_SCALING_CENTERED, + + /// Specifies stretched scaling. + DXGI_MODE_SCALING_STRETCHED, + } + + /// Flags indicating the method the raster uses to create an image on a surface. + /// This enum is used by the DXGI_MODE_DESC1 and DXGI_SWAP_CHAIN_FULLSCREEN_DESC structures. + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173067(v=vs.85) typedef enum DXGI_MODE_SCANLINE_ORDER + // { DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST + // = 2, DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3 } DXGI_MODE_SCANLINE_ORDER; + [PInvokeData("DXGI.h")] + public enum DXGI_MODE_SCANLINE_ORDER + { + /// Scanline order is unspecified. + DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, + + /// The image is created from the first scanline to the last without skipping any. + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE, + + /// The image is created beginning with the upper field. + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST, + + /// The image is created beginning with the lower field. + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST, + } + + /// Flags for + [PInvokeData("dxgi.h")] + [Flags] + public enum DXGI_MWA + { + /// Prevent DXGI from monitoring an applications message queue; this makes DXGI unable to respond to mode changes. + DXGI_MWA_NO_WINDOW_CHANGES = (1 << 0), + + /// Prevent DXGI from responding to an alt-enter sequence. + DXGI_MWA_NO_ALT_ENTER = (1 << 1), + + /// Prevent DXGI from responding to a print-screen key. + DXGI_MWA_NO_PRINT_SCREEN = (1 << 2), + } + + /// + /// The DXGI_PRESENT constants specify options for presenting frames to the output. + /// + /// + /// Constant/value + /// Description + /// + /// + /// 0 + /// Present a frame from each buffer (starting with the current buffer) to the output. + /// + /// + /// DXGI_PRESENT_DO_NOT_SEQUENCE 0x00000002UL + /// + /// Present a frame from the current buffer to the output. Use this flag so that the presentation can use vertical-blank + /// synchronization instead of sequencing buffers in the chain in the usual manner. + /// + /// + /// + /// DXGI_PRESENT_TEST 0x00000001UL + /// + /// Do not present the frame to the output. The status of the swap chain will be tested and appropriate errors returned. + /// DXGI_PRESENT_TEST is intended for use only when switching from the idle state; do not use it to determine when to switch to the + /// idle state because doing so can leave the swap chain unable to exit full-screen mode. + /// + /// + /// + /// DXGI_PRESENT_RESTART 0x00000004UL + /// Specifies that the runtime will discard outstanding queued presents. + /// + /// + /// DXGI_PRESENT_DO_NOT_WAIT 0x00000008UL + /// + /// Specifies that the runtime will fail the presentation (that is, fail a call to IDXGISwapChain1::Present1) with the + /// DXGI_ERROR_WAS_STILL_DRAWING error code if the calling thread is blocked; the runtime returns DXGI_ERROR_WAS_STILL_DRAWING + /// instead of sleeping until the dependency is resolved. Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + /// + /// + /// DXGI_PRESENT_RESTRICT_TO_OUTPUT 0x00000010UL + /// + /// Indicates that presentation content will be shown only on the particular output. The content will not be visible on other + /// outputs. For example, if the user tries to relocate video content on another output, the video content will not be visible. + /// Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + /// + /// + /// DXGI_PRESENT_STEREO_PREFER_RIGHT 0x00000020UL + /// + /// Indicates that if the stereo present must be reduced to mono, right-eye viewing is used rather than left-eye viewing. Direct3D + /// 11: This enumeration value is supported starting with Windows 8. + /// + /// + /// + /// DXGI_PRESENT_STEREO_TEMPORARY_MONO 0x00000040UL + /// + /// Indicates that the presentation should use the left buffer as a mono buffer. An application calls the + /// IDXGISwapChain1::IsTemporaryMonoSupported method to determine whether a swap chain supports "temporary mono". Direct3D 11: This + /// enumeration value is supported starting with Windows 8. + /// + /// + /// + /// DXGI_PRESENT_USE_DURATION 0x00000100UL + /// This flag must be set by media apps that are currently using a custom present duration (custom refresh rate). See IDXGISwapChainMedia. + /// + /// + /// DXGI_PRESENT_ALLOW_TEARING 0x00000200UL + /// + /// Allowing tearing is a requirement of variable refresh rate displays. The conditions for using DXGI_PRESENT_ALLOW_TEARING during + /// Present are as follows: Calling Present (or Present1) with this flag and not meeting the conditions above will result in a + /// DXGI_ERROR_INVALID_CALL error being returned to the calling application. + /// + /// + /// + /// + /// + /// + /// Presentation options are supplied during the IDXGISwapChain::Present or IDXGISwapChain1::Present1 call. The + /// buffers are specified in the swap chain description (see DXGI_SWAP_CHAIN_DESC or DXGI_SWAP_CHAIN_DESC1). + /// + /// + /// DXGI_PRESENT_RESTART is valid only for flip-model swap chains and full screen. Applications can use DXGI_PRESENT_RESTART to + /// recover from glitches in playback, as well as to discard previously queued presentations. Discarding previously queued + /// presentations is useful if those queued presentations are windowed scenarios. In particular, the previously queued presentation + /// might have assumed that the window is an old size (that is, a resize operation occurred after submission). + /// + /// + /// DXGI_PRESENT_RESTRICT_TO_OUTPUT is valid only for swap chains that specified a particular output to restrict content to when + /// those swap chains were created ( IDXGIFactory2::CreateSwapChainForHwnd). If there is no output to restrict to, the flag + /// is invalid. + /// + /// + /// DXGI_PRESENT_STEREO_PREFER_RIGHT indicates that if the stereo present must be reduced to mono the right eye should be used + /// rather than the left (default) eye. You can use this flag if one side is higher quality (for example, if the stereo pair is + /// synthesized from a standard image.) + /// + /// + /// DXGI_PRESENT_STEREO_TEMPORARY_MONO indicates that the present should use the left buffer as a mono buffer. You can use this flag + /// to avoid updating the right buffer when an application temporarily has no stereo content. You should use this flag whenever + /// possible because it enables significant optimization by the operating system and under some circumstances it can avoid visible + /// mode change artifacts. + /// + /// + /// You should use the DXGI_PRESENT_STEREO_TEMPORARY_MONO flag in preference to switching to a mono swap chain for most applications + /// that you anticipate will use stereo again. You need to balance the use of this flag in applications that are extremely long + /// running or that rarely display stereo against the disadvantage of unused memory. + /// + /// + /// The DXGI_PRESENT_STEREO_PREFER_RIGHT and DXGI_PRESENT_STEREO_TEMPORARY_MONO flags apply only to stereo swap chains. If you use + /// them when you present mono swap chains, an invalid operation occurs. + /// + /// + /// If you use the DXGI_PRESENT_STEREO_TEMPORARY_MONO flag when you present a stereo swap chain that does not support temporary + /// mono, an error occurs, the swap chain does not display, and the presentation returns DXGI_ERROR_INVALID_CALL. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-present + [PInvokeData("dxgi.h", MSDNShortId = "1ddf8643-ea3e-4c9f-8439-c245942f7333")] + [Flags] + public enum DXGI_PRESENT + { + /// + /// Do not present the frame to the output. The status of the swap chain will be tested and appropriate errors returned. + /// DXGI_PRESENT_TEST is intended for use only when switching from the idle state; do not use it to determine when to switch to + /// the idle state because doing so can leave the swap chain unable to exit full-screen mode. + /// + DXGI_PRESENT_TEST = 0x00000001, + + /// + /// Present a frame from the current buffer to the output. Use this flag so that the presentation can use vertical-blank + /// synchronization instead of sequencing buffers in the chain in the usual manner. + /// + DXGI_PRESENT_DO_NOT_SEQUENCE = 0x00000002, + + /// Specifies that the runtime will discard outstanding queued presents. + DXGI_PRESENT_RESTART = 0x00000004, + + /// + /// Specifies that the runtime will fail the presentation (that is, fail a call to IDXGISwapChain1::Present1) with the + /// DXGI_ERROR_WAS_STILL_DRAWING error code if the calling thread is blocked; the runtime returns DXGI_ERROR_WAS_STILL_DRAWING + /// instead of sleeping until the dependency is resolved. Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + DXGI_PRESENT_DO_NOT_WAIT = 0x00000008, + + /// + /// Indicates that if the stereo present must be reduced to mono, right-eye viewing is used rather than left-eye viewing. + /// Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + DXGI_PRESENT_STEREO_PREFER_RIGHT = 0x00000010, + + /// + /// Indicates that the presentation should use the left buffer as a mono buffer. An application calls the + /// IDXGISwapChain1::IsTemporaryMonoSupported method to determine whether a swap chain supports "temporary mono". Direct3D 11: + /// This enumeration value is supported starting with Windows 8. + /// + DXGI_PRESENT_STEREO_TEMPORARY_MONO = 0x00000020, + + /// + /// Indicates that presentation content will be shown only on the particular output. The content will not be visible on other + /// outputs. For example, if the user tries to relocate video content on another output, the video content will not be visible. + /// Direct3D 11: This enumeration value is supported starting with Windows 8. + /// + DXGI_PRESENT_RESTRICT_TO_OUTPUT = 0x00000040, + + /// + /// This flag must be set by media apps that are currently using a custom present duration (custom refresh rate). See IDXGISwapChainMedia. + /// + DXGI_PRESENT_USE_DURATION = 0x00000100, + + /// + /// Allowing tearing is a requirement of variable refresh rate displays. The conditions for using DXGI_PRESENT_ALLOW_TEARING + /// during Present are as follows: Calling Present (or Present1) with this flag and not meeting the conditions above will result + /// in a DXGI_ERROR_INVALID_CALL error being returned to the calling application. + /// + DXGI_PRESENT_ALLOW_TEARING = 0x00000200, + } + + /// Flags indicating the memory location of a resource. + /// This enum is used by QueryResourceResidency. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_residency typedef enum DXGI_RESIDENCY { + // DXGI_RESIDENCY_FULLY_RESIDENT, DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY, DXGI_RESIDENCY_EVICTED_TO_DISK } ; + [PInvokeData("dxgi.h")] + public enum DXGI_RESIDENCY + { + /// The resource is located in video memory. + DXGI_RESIDENCY_FULLY_RESIDENT = 1, + + /// At least some of the resource is located in CPU memory. + DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY, + + /// At least some of the resource has been paged out to the hard drive. + DXGI_RESIDENCY_EVICTED_TO_DISK, + } + + /// Options for swap-chain behavior. + /// + /// This enumeration is used by the DXGI_SWAP_CHAIN_DESC structure and the IDXGISwapChain::ResizeTarget method. + /// This enumeration is also used by the DXGI_SWAP_CHAIN_DESC1 structure. + /// + /// You don't need to set DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY for swap chains that you create in full-screen mode with the + /// IDXGIFactory::CreateSwapChain method because those swap chains already behave as if DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY is + /// set. That is, presented content is not accessible by remote access or through the desktop duplication APIs. + /// + /// + /// Swap chains that you create with the IDXGIFactory2::CreateSwapChainForHwnd, IDXGIFactory2::CreateSwapChainForCoreWindow, and + /// IDXGIFactory2::CreateSwapChainForComposition methods are not protected if DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY is not set + /// and are protected if DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY is set. When swap chains are protected, screen scraping is + /// prevented and, in full-screen mode, presented content is not accessible through the desktop duplication APIs. + /// + /// + /// When you call IDXGISwapChain::ResizeBuffers to change the swap chain's back buffer, you can reset or change all + /// DXGI_SWAP_CHAIN_FLAG flags. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_chain_flag typedef enum DXGI_SWAP_CHAIN_FLAG { + // DXGI_SWAP_CHAIN_FLAG_NONPREROTATED, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH, DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE, + // DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT, DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER, DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY, + // DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT, DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER, DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO, + // DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO, DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED, DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING, + // DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS } ; + [PInvokeData("dxgi.h")] + [Flags] + public enum DXGI_SWAP_CHAIN_FLAG + { + /// + /// Set this flag to turn off automatic image rotation; that is, do not perform a rotation when transferring the contents of the + /// front buffer to the monitor. Use this flag to avoid a bandwidth penalty when an application expects to handle rotation. This + /// option is valid only during full-screen mode. + /// + DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, + + /// + /// Set this flag to enable an application to switch modes by calling IDXGISwapChain::ResizeTarget. When switching from windowed + /// to full-screen mode, the display mode (or monitor resolution) will be changed to match the dimensions of the application window. + /// + DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, + + /// + /// Set this flag to enable an application to render using GDI on a swap chain or a surface. This will allow the application to + /// call IDXGISurface1::GetDC on the 0th back buffer or a surface.This flag is not applicable for Direct3D 12. + /// + DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, + + /// + /// Set this flag to indicate that the swap chain might contain protected content; therefore, the operating system supports the + /// creation of the swap chain only when driver and hardware protection is used. If the driver and hardware do not support + /// content protection, the call to create a resource for the swap chain fails.Direct3D 11: This enumeration value is supported + /// starting with Windows 8. + /// + DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, + + /// + /// Set this flag to indicate that shared resources that are created within the swap chain must be protected by using the + /// driver’s mechanism for restricting access to shared surfaces.Direct3D 11: This enumeration value is supported starting with + /// Windows 8. + /// + DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, + + /// + /// Set this flag to restrict presented content to the local displays. Therefore, the presented content is not accessible via + /// remote accessing or through the desktop duplication APIs. This flag supports the window content protection features of + /// Windows. Applications can use this flag to protect their own onscreen window content from being captured or copied through a + /// specific set of public operating system features and APIs.If you use this flag with windowed (HWND or IWindow) swap chains + /// where another process created the HWND, the owner of the HWND must use the SetWindowDisplayAffinity function appropriately + /// in order to allow calls to IDXGISwapChain::Present or IDXGISwapChain1::Present1 to succeed.Direct3D 11: This enumeration + /// value is supported starting with Windows 8. + /// + DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, + + /// + /// Set this flag to create a waitable object you can use to ensure rendering does not begin while a frame is still being + /// presented. When this flag is used, the swapchain's latency must be set with the IDXGISwapChain2::SetMaximumFrameLatency API + /// instead of IDXGIDevice1::SetMaximumFrameLatency.Note This enumeration value is supported starting with Windows 8.1. + /// + DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, + + /// + /// Set this flag to create a swap chain in the foreground layer for multi-plane rendering. This flag can only be used with + /// CoreWindow swap chains, which are created with CreateSwapChainForCoreWindow. Apps should not create foreground swap chains + /// if IDXGIOutput2::SupportsOverlays indicates that hardware support for overlays is not available.Note that + /// IDXGISwapChain::ResizeBuffers cannot be used to add or remove this flag.Note This enumeration value is supported starting + /// with Windows 8.1. + /// + DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, + + /// + /// Set this flag to create a swap chain for full-screen video. Note This enumeration value is supported starting with Windows 8.1. + /// + DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, + + /// + /// Set this flag to create a swap chain for YUV video.Note This enumeration value is supported starting with Windows 8.1. + /// + DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, + + /// + /// Indicates that the swap chain should be created such that all underlying resources can be protected by the hardware. + /// Resource creation will fail if hardware content protection is not supported.This flag has the following restrictions:Note + /// This enumeration value is supported starting with Windows 10. + /// + DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024, + + /// + /// Tearing support is a requirement to enable displays that support variable refresh rates to function properly when the + /// application presents a swap chain tied to a full screen borderless window. Win32 apps can already achieve tearing in + /// fullscreen exclusive mode by calling SetFullscreenState(TRUE), but the recommended approach for Win32 developers is to use + /// this tearing flag instead. This flag requires the use of a DXGI_SWAP_EFFECT_FLIP_* swap effect.To check for hardware support + /// of this feature, refer to IDXGIFactory5::CheckFeatureSupport. For usage information refer to IDXGISwapChain::Present and the + /// DXGI_PRESENT flags. + /// + DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 2048, + + /// + DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 4096, + } + + /// Options for handling pixels in a display surface after calling IDXGISwapChain1::Present1. + /// + /// This enumeration is used by the DXGI_SWAP_CHAIN_DESC and DXGI_SWAP_CHAIN_DESC1structures. + /// + /// To use multisampling with DXGI_SWAP_EFFECT_SEQUENTIAL or DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, you must perform the + /// multisampling in a separate render target. For example, create a multisampled texture by calling ID3D11Device::CreateTexture2D + /// with a filled D3D11_TEXTURE2D_DESC structure ( BindFlags member set to D3D11_BIND_RENDER_TARGET and SampleDesc + /// member with multisampling parameters). Next call ID3D11Device::CreateRenderTargetView to create a render-target view for the + /// texture, and render your scene into the texture. Finally call ID3D11DeviceContext::ResolveSubresource to resolve the + /// multisampled texture into your non-multisampled swap chain. + /// + /// + /// The primary difference between presentation models is how back-buffer contents get to the Desktop Window Manager (DWM) for + /// composition. In the bitblt model, which is used with the DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL + /// values, contents of the back buffer get copied into the redirection surface on each call to IDXGISwapChain1::Present1. In the + /// flip model, which is used with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value, all back buffers are shared with the DWM. + /// Therefore, the DWM can compose straight from those back buffers without any additional copy operations. In general, the flip + /// model is the more efficient model. The flip model also provides more features, such as enhanced present statistics. + /// + /// + /// When you call IDXGISwapChain1::Present1 on a flip model swap chain ( DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) with 0 specified + /// in the SyncInterval parameter, IDXGISwapChain1::Present1's behavior is the same as the behavior of Direct3D 9Ex's + /// IDirect3DDevice9Ex::PresentEx with D3DSWAPEFFECT_FLIPEX and D3DPRESENT_FORCEIMMEDIATE. That is, the runtime not only presents + /// the next frame instead of any previously queued frames, it also terminates any remaining time left on the previously queued frames. + /// + /// + /// Regardless of whether the flip model is more efficient, an application still might choose the bitblt model because the bitblt + /// model is the only way to mix GDI and DirectX presentation. In the flip model, the application must create the swap chain with + /// DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE, and then must use GetDC on the back buffer explicitly. After the first successful call to + /// IDXGISwapChain1::Present1 on a flip-model swap chain, GDI no longer works with the HWND that is associated with that swap chain, + /// even after the destruction of the swap chain. This restriction even extends to methods like ScrollWindowEx. + /// + /// + /// For more info about the flip-model swap chain and optimizing presentation, see Enhancing presentation with the flip model, dirty + /// rectangles, and scrolled areas. + /// + /// Examples + /// + /// To create a swap chain in UWP, you just need to create a new instance of the DX11 template and look at the implementation of in + /// the D3D12 samples. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_effect typedef enum DXGI_SWAP_EFFECT { + // DXGI_SWAP_EFFECT_DISCARD, DXGI_SWAP_EFFECT_SEQUENTIAL, DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, DXGI_SWAP_EFFECT_FLIP_DISCARD } ; + [PInvokeData("dxgi.h")] + public enum DXGI_SWAP_EFFECT + { + /// + /// Use this flag to specify the bit-block transfer (bitblt) model and to specify that DXGI discard the contents of the back + /// buffer after you call IDXGISwapChain1::Present1. This flag is valid for a swap chain with more than one back buffer, + /// although, applications only have read and write access to buffer 0. Use this flag to enable the display driver to select the + /// most efficient presentation technique for the swap chain. + /// + DXGI_SWAP_EFFECT_DISCARD = 0, + + /// + /// Use this flag to specify the bitblt model and to specify that DXGI persist the contents of the back buffer after you call + /// IDXGISwapChain1::Present1. Use this option to present the contents of the swap chain in order, from the first buffer (buffer + /// 0) to the last buffer. This flag cannot be used with multisampling. + /// + DXGI_SWAP_EFFECT_SEQUENTIAL = 1, + + /// + /// Use this flag to specify the flip presentation model and to specify that DXGI persist the contents of the back buffer after + /// you call IDXGISwapChain1::Present1. This flag cannot be used with multisampling. Direct3D 11: This enumeration value is + /// supported starting with Windows 8. + /// + DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, + + /// + /// Use this flag to specify the flip presentation model and to specify that DXGI discard the contents of the back buffer after + /// you call IDXGISwapChain1::Present1. This flag cannot be used with multisampling and partial presentation. See DXGI 1.4 + /// Improvements. Direct3D 11: This enumeration value is supported starting with Windows 10. + /// + DXGI_SWAP_EFFECT_FLIP_DISCARD = 4, + } + + /// + /// Flags for surface and resource creation options. + /// + /// + /// Constant/value + /// Description + /// + /// + /// DXGI_USAGE_BACK_BUFFER 1L << (2 + 4) + /// + /// The surface or resource is used as a back buffer. You don’t need to pass DXGI_USAGE_BACK_BUFFER when you create a swap chain. + /// But you can determine whether a resource belongs to a swap chain when you call IDXGIResource::GetUsage and get DXGI_USAGE_BACK_BUFFER. + /// + /// + /// + /// DXGI_USAGE_DISCARD_ON_PRESENT 1L << (5 + 4) + /// This flag is for internal use only. + /// + /// + /// DXGI_USAGE_READ_ONLY 1L << (4 + 4) + /// Use the surface or resource for reading only. + /// + /// + /// DXGI_USAGE_RENDER_TARGET_OUTPUT 1L << (1 + 4) + /// Use the surface or resource as an output render target. + /// + /// + /// DXGI_USAGE_SHADER_INPUT 1L << (0 + 4) + /// Use the surface or resource as an input to a shader. + /// + /// + /// DXGI_USAGE_SHARED 1L << (3 + 4) + /// Share the surface or resource. + /// + /// + /// DXGI_USAGE_UNORDERED_ACCESS 1L << (6 + 4) + /// Use the surface or resource for unordered access. + /// + /// + /// + /// + /// Each flag is defined as an unsigned integer. + /// + /// These flag options are used in a call to the IDXGIFactory::CreateSwapChain, IDXGIFactory2::CreateSwapChainForHwnd, + /// IDXGIFactory2::CreateSwapChainForCoreWindow, or IDXGIFactory2::CreateSwapChainForComposition method to describe + /// the surface usage and CPU access options for the back buffer of a swap chain. You can't use the DXGI_USAGE_SHARED, + /// DXGI_USAGE_DISCARD_ON_PRESENT, and DXGI_USAGE_READ_ONLY values as input to create a swap chain. However, DXGI can + /// set DXGI_USAGE_DISCARD_ON_PRESENT and DXGI_USAGE_READ_ONLY for some of the swap chain's back buffers on the + /// application's behalf. You can call the IDXGIResource::GetUsage method to retrieve the usage of these back buffers. Swap + /// chain's only support the DXGI_CPU_ACCESS_NONE value in the DXGI_CPU_ACCESS_FIELD part of DXGI_USAGE. + /// + /// These flag options are also used by the IDXGIDevice::CreateSurface method. + /// + // https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-usage + [PInvokeData("", MSDNShortId = "b5026566-89b5-458e-b36d-a55e5f8c10c1")] + [Flags] + public enum DXGI_USAGE : uint + { + /// + DXGI_CPU_ACCESS_NONE = 0, + + /// + DXGI_CPU_ACCESS_DYNAMIC = 1, + + /// + DXGI_CPU_ACCESS_READ_WRITE = 2, + + /// + DXGI_CPU_ACCESS_SCRATCH = 3, + + /// + DXGI_CPU_ACCESS_FIELD = 15, + + /// Use the surface or resource as an input to a shader. + DXGI_USAGE_SHADER_INPUT = 0x00000010, + + /// Use the surface or resource as an output render target. + DXGI_USAGE_RENDER_TARGET_OUTPUT = 0x00000020, + + /// + /// The surface or resource is used as a back buffer. You don’t need to pass DXGI_USAGE_BACK_BUFFER when you create a swap + /// chain. But you can determine whether a resource belongs to a swap chain when you call IDXGIResource::GetUsage and get DXGI_USAGE_BACK_BUFFER. + /// + DXGI_USAGE_BACK_BUFFER = 0x00000040, + + /// Share the surface or resource. + DXGI_USAGE_SHARED = 0x00000080, + + /// + DXGI_USAGE_READ_ONLY = 0x00000100, + + /// This flag is for internal use only. + DXGI_USAGE_DISCARD_ON_PRESENT = 0x00000200, + + /// Use the surface or resource for unordered access. + DXGI_USAGE_UNORDERED_ACCESS = 0x00000400, + } + + /// Creates a DXGI 1.0 factory that you can use to generate other DXGI objects. + /// + /// Type: REFIID + /// The globally unique identifier (GUID) of the IDXGIFactory object referenced by the ppFactory parameter. + /// + /// + /// Type: void** + /// Address of a pointer to an IDXGIFactory object. + /// + /// + /// Type: HRESULT + /// Returns S_OK if successful; otherwise, returns one of the following DXGI_ERROR. + /// + /// + /// + /// Use a DXGI factory to generate objects that enumerate adapters, create swap chains, and associate a window with the alt+enter + /// key sequence for toggling to and from the fullscreen display mode. + /// + /// + /// If the CreateDXGIFactory function succeeds, the reference count on the IDXGIFactory interface is incremented. To avoid a + /// memory leak, when you finish using the interface, call the IDXGIFactory::Release method to release the interface. + /// + /// + /// Note Do not mix the use of DXGI 1.0 (IDXGIFactory) and DXGI 1.1 (IDXGIFactory1) in an application. Use + /// IDXGIFactory or IDXGIFactory1, but not both in an application. + /// + /// + /// NoteCreateDXGIFactory fails if your app's DllMain function calls it. For more info about how DXGI responds from + /// DllMain, see DXGI Responses from DLLMain. + /// + /// + /// Note Starting with Windows 8, all DXGI factories (regardless if they were created with CreateDXGIFactory or + /// CreateDXGIFactory1) enumerate adapters identically. The enumeration order of adapters, which you retrieve with + /// IDXGIFactory::EnumAdapters or IDXGIFactory1::EnumAdapters1, is as follows: + /// + /// + /// The CreateDXGIFactory function does not exist for Windows Store apps. Instead, Windows Store apps use the + /// CreateDXGIFactory1 function. + /// + /// Examples + /// Creating a DXGI 1.0 Factory + /// + /// The following code example demonstrates how to create a DXGI 1.0 factory. This example uses the __uuidof() intrinsic to obtain + /// the REFIID, or GUID, of the IDXGIFactory interface. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-createdxgifactory HRESULT CreateDXGIFactory( REFIID riid, void + // **ppFactory ); + [DllImport(Lib.DXGI, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dxgi.h")] + public static extern HRESULT CreateDXGIFactory(in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppFactory); + + /// Creates a DXGI 1.0 factory that you can use to generate other DXGI objects. + /// An IDXGIFactory object. + /// + /// + /// Use a DXGI factory to generate objects that enumerate adapters, create swap chains, and associate a window with the alt+enter + /// key sequence for toggling to and from the fullscreen display mode. + /// + /// + /// If the CreateDXGIFactory function succeeds, the reference count on the IDXGIFactory interface is incremented. To avoid a + /// memory leak, when you finish using the interface, call the IDXGIFactory::Release method to release the interface. + /// + /// + /// Note Do not mix the use of DXGI 1.0 (IDXGIFactory) and DXGI 1.1 (IDXGIFactory1) in an application. Use + /// IDXGIFactory or IDXGIFactory1, but not both in an application. + /// + /// + /// NoteCreateDXGIFactory fails if your app's DllMain function calls it. For more info about how DXGI responds from + /// DllMain, see DXGI Responses from DLLMain. + /// + /// + /// Note Starting with Windows 8, all DXGI factories (regardless if they were created with CreateDXGIFactory or + /// CreateDXGIFactory1) enumerate adapters identically. The enumeration order of adapters, which you retrieve with + /// IDXGIFactory::EnumAdapters or IDXGIFactory1::EnumAdapters1, is as follows: + /// + /// + /// The CreateDXGIFactory function does not exist for Windows Store apps. Instead, Windows Store apps use the + /// CreateDXGIFactory1 function. + /// + /// + public static IDXGIFactory CreateDXGIFactory() + { + CreateDXGIFactory(typeof(IDXGIFactory).GUID, out var f).ThrowIfFailed(); + return (IDXGIFactory)f; + } + + /// Creates a DXGI 1.1 factory that you can use to generate other DXGI objects. + /// + /// Type: REFIID + /// The globally unique identifier (GUID) of the IDXGIFactory1 object referenced by the ppFactory parameter. + /// + /// + /// Type: void** + /// Address of a pointer to an IDXGIFactory1 object. + /// + /// + /// Type: HRESULT + /// Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR. + /// + /// + /// + /// Use a DXGI 1.1 factory to generate objects that enumerate adapters, create swap chains, and associate a window with the + /// alt+enter key sequence for toggling to and from the full-screen display mode. + /// + /// + /// If the CreateDXGIFactory1 function succeeds, the reference count on the IDXGIFactory1 interface is incremented. To avoid + /// a memory leak, when you finish using the interface, call the IDXGIFactory1::Release method to release the interface. + /// + /// + /// This entry point is not supported by DXGI 1.0, which shipped in Windows Vista and Windows Server 2008. DXGI 1.1 support is + /// required, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista with Service Pack 2 (SP2) + /// (KB 971644) and Windows Server 2008 (KB 971512). + /// + /// + /// Note Do not mix the use of DXGI 1.0 (IDXGIFactory) and DXGI 1.1 (IDXGIFactory1) in an application. Use + /// IDXGIFactory or IDXGIFactory1, but not both in an application. + /// + /// + /// NoteCreateDXGIFactory1 fails if your app's DllMain function calls it. For more info about how DXGI responds from + /// DllMain, see DXGI Responses from DLLMain. + /// + /// + /// Note Starting with Windows 8, all DXGI factories (regardless if they were created with CreateDXGIFactory or + /// CreateDXGIFactory1) enumerate adapters identically. The enumeration order of adapters, which you retrieve with + /// IDXGIFactory::EnumAdapters or IDXGIFactory1::EnumAdapters1, is as follows: + /// + /// Examples + /// Creating a DXGI 1.1 Factory + /// + /// The following code example demonstrates how to create a DXGI 1.1 factory. This example uses the __uuidof() intrinsic to obtain + /// the REFIID, or GUID, of the IDXGIFactory1 interface. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-createdxgifactory1 HRESULT CreateDXGIFactory1( REFIID riid, void + // **ppFactory ); + [DllImport(Lib.DXGI, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dxgi.h", MSDNShortId = "6fb9d7a3-0b59-4b7a-8871-b99d59811d46")] + public static extern HRESULT CreateDXGIFactory1(in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppFactory); + + /// + /// Creates a DXGI 1.3 factory that you can use to generate other DXGI objects. + /// + /// In Windows 8, any DXGI factory created while DXGIDebug.dll was present on the system would load and use it. Starting in Windows + /// 8.1, apps explicitly request that DXGIDebug.dll be loaded instead. Use CreateDXGIFactory2 and specify the + /// DXGI_CREATE_FACTORY_DEBUG flag to request DXGIDebug.dll; the DLL will be loaded if it is present on the system. + /// + /// + /// + /// Type: UINT + /// Valid values include the DXGI_CREATE_FACTORY_DEBUG (0x01) flag, and zero. + /// Note This flag will be set by the D3D runtime if: + /// + /// + /// Type: REFIID + /// The globally unique identifier (GUID) of the IDXGIFactory2 object referenced by the ppFactory parameter. + /// + /// + /// Type: void** + /// Address of a pointer to an IDXGIFactory2 object. + /// + /// + /// Type: HRESULT + /// Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR. + /// + /// + /// This function accepts a flag indicating whether DXGIDebug.dll is loaded. The function otherwise behaves identically to CreateDXGIFactory1. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-createdxgifactory2 HRESULT CreateDXGIFactory2( UINT Flags, + // REFIID riid, void **ppFactory ); + [DllImport(Lib.DXGI, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dxgi1_3.h", MSDNShortId = "D3CF43B0-8F17-486E-8750-CF0B9052BE74")] + public static extern HRESULT CreateDXGIFactory2(DXGI_CREATE_FACTORY Flags, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppFactory); + + /// Allows a process to indicate that it's resilient to any of its graphics devices being removed. + /// + /// Type: HRESULT + /// + /// Returns S_OK if successful; an error code otherwise. If this function is called after device creation, it returns + /// DXGI_ERROR_INVALID_CALL. If this is not the first time that this function is called, it returns + /// DXGI_ERROR_ALREADY_EXISTS. For a full list of error codes, see DXGI_ERROR. + /// + /// + /// + /// + /// This function is graphics API-agonistic, meaning that apps running on other APIs, such as OpenGL and Vulkan, would also apply. + /// + /// This function should be called once per process and before any device creation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_6/nf-dxgi1_6-dxgideclareadapterremovalsupport HRESULT DXGIDeclareAdapterRemovalSupport(); + [DllImport(Lib.DXGI, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dxgi1_6.h", MSDNShortId = "602EA66C-6D3D-4604-822C-DBD66EB70C3C")] + public static extern HRESULT DXGIDeclareAdapterRemovalSupport(); + + /// Retrieves an interface that Windows Store apps use for debugging the Microsoft DirectX Graphics Infrastructure (DXGI). + /// Not used. + /// + /// The globally unique identifier (GUID) of the requested interface type, which can be the identifier for the IDXGIDebug, + /// IDXGIDebug1, or IDXGIInfoQueue interfaces. + /// + /// A pointer to a buffer that receives a pointer to the debugging interface. + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The DXGIGetDebugInterface1 function returns E_NOINTERFACE on systems without the Windows Software Development Kit + /// (SDK) installed, because it's a development-time aid. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-dxgigetdebuginterface1 HRESULT DXGIGetDebugInterface1( UINT + // Flags, REFIID riid, void **pDebug ); + [DllImport(Lib.DXGI, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dxgi1_3.h", MSDNShortId = "0FE0EAF5-3ADC-426F-9DA9-FEDEC519EEF0")] + public static extern HRESULT DXGIGetDebugInterface1(uint Flags, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object pDebug); + + /// Describes an adapter (or video card) by using DXGI 1.0. + /// + /// The DXGI_ADAPTER_DESC structure provides a description of an adapter. This structure is initialized by using the + /// IDXGIAdapter::GetDesc method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_adapter_desc typedef struct DXGI_ADAPTER_DESC { WCHAR + // Description[128]; UINT VendorId; UINT DeviceId; UINT SubSysId; UINT Revision; SIZE_T DedicatedVideoMemory; SIZE_T + // DedicatedSystemMemory; SIZE_T SharedSystemMemory; LUID AdapterLuid; } DXGI_ADAPTER_DESC; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct DXGI_ADAPTER_DESC + { + /// + /// Type: WCHAR[128] + /// + /// A string that contains the adapter description. On feature level 9 graphics hardware, GetDesc returns “Software Adapter” for + /// the description string. + /// + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + public string Description; + + /// + /// Type: UINT + /// + /// The PCI ID of the hardware vendor. On feature level 9 graphics hardware, GetDesc returns zeros for the PCI ID of the + /// hardware vendor. + /// + /// + public uint VendorId; + + /// + /// Type: UINT + /// + /// The PCI ID of the hardware device. On feature level 9 graphics hardware, GetDesc returns zeros for the PCI ID of the + /// hardware device. + /// + /// + public uint DeviceId; + + /// + /// Type: UINT + /// + /// The PCI ID of the sub system. On feature level 9 graphics hardware, GetDesc returns zeros for the PCI ID of the sub system. + /// + /// + public uint SubSysId; + + /// + /// Type: UINT + /// + /// The PCI ID of the revision number of the adapter. On feature level 9 graphics hardware, GetDesc returns zeros for the PCI ID + /// of the revision number of the adapter. + /// + /// + public uint Revision; + + /// + /// Type: SIZE_T + /// The number of bytes of dedicated video memory that are not shared with the CPU. + /// + public SizeT DedicatedVideoMemory; + + /// + /// Type: SIZE_T + /// + /// The number of bytes of dedicated system memory that are not shared with the CPU. This memory is allocated from available + /// system memory at boot time. + /// + /// + public SizeT DedicatedSystemMemory; + + /// + /// Type: SIZE_T + /// + /// The number of bytes of shared system memory. This is the maximum value of system memory that may be consumed by the adapter + /// during operation. Any incidental memory consumed by the driver as it manages and uses video memory is additional. + /// + /// + public SizeT SharedSystemMemory; + + /// + /// Type: LUID + /// + /// A unique value that identifies the adapter. See LUID for a definition of the structure. LUID is defined in dxgi.h. + /// + /// + public AdvApi32.LUID AdapterLuid; + } + + /// Describes an adapter (or video card) using DXGI 1.1. + /// + /// The DXGI_ADAPTER_DESC1 structure provides a DXGI 1.1 description of an adapter. This structure is initialized by using + /// the IDXGIAdapter1::GetDesc1 method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_adapter_desc1 typedef struct DXGI_ADAPTER_DESC1 { WCHAR + // Description[128]; UINT VendorId; UINT DeviceId; UINT SubSysId; UINT Revision; SIZE_T DedicatedVideoMemory; SIZE_T + // DedicatedSystemMemory; SIZE_T SharedSystemMemory; LUID AdapterLuid; UINT Flags; } DXGI_ADAPTER_DESC1; + [PInvokeData("dxgi.h", MSDNShortId = "0ae3bdb1-b122-439a-8f62-c831a9dd87e2")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct DXGI_ADAPTER_DESC1 + { + /// + /// Type: WCHAR[128] + /// + /// A string that contains the adapter description. On feature level 9 graphics hardware, GetDesc1 returns “Software Adapter” + /// for the description string. + /// + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + public string Description; + + /// + /// Type: UINT + /// + /// The PCI ID of the hardware vendor. On feature level 9 graphics hardware, GetDesc1 returns zeros for the PCI ID of the + /// hardware vendor. + /// + /// + public uint VendorId; + + /// + /// Type: UINT + /// + /// The PCI ID of the hardware device. On feature level 9 graphics hardware, GetDesc1 returns zeros for the PCI ID of the + /// hardware device. + /// + /// + public uint DeviceId; + + /// + /// Type: UINT + /// + /// The PCI ID of the sub system. On feature level 9 graphics hardware, GetDesc1 returns zeros for the PCI ID of the sub system. + /// + /// + public uint SubSysId; + + /// + /// Type: UINT + /// + /// The PCI ID of the revision number of the adapter. On feature level 9 graphics hardware, GetDesc1 returns zeros for the PCI + /// ID of the revision number of the adapter. + /// + /// + public uint Revision; + + /// + /// Type: SIZE_T + /// The number of bytes of dedicated video memory that are not shared with the CPU. + /// + public SizeT DedicatedVideoMemory; + + /// + /// Type: SIZE_T + /// + /// The number of bytes of dedicated system memory that are not shared with the CPU. This memory is allocated from available + /// system memory at boot time. + /// + /// + public SizeT DedicatedSystemMemory; + + /// + /// Type: SIZE_T + /// + /// The number of bytes of shared system memory. This is the maximum value of system memory that may be consumed by the adapter + /// during operation. Any incidental memory consumed by the driver as it manages and uses video memory is additional. + /// + /// + public SizeT SharedSystemMemory; + + /// + /// Type: LUID + /// + /// A unique value that identifies the adapter. See LUID for a definition of the structure. LUID is defined in dxgi.h. + /// + /// + public AdvApi32.LUID AdapterLuid; + + /// + /// Type: UINT + /// + /// A value of the DXGI_ADAPTER_FLAG enumerated type that describes the adapter type. The DXGI_ADAPTER_FLAG_REMOTE flag + /// is reserved. + /// + /// + public DXGI_ADAPTER_FLAG Flags; + } + + /// Describes timing and presentation statistics for a frame. + /// + /// + /// You initialize the DXGI_FRAME_STATISTICS structure with the IDXGIOutput::GetFrameStatistics or + /// IDXGISwapChain::GetFrameStatistics method. + /// + /// + /// You can only use IDXGISwapChain::GetFrameStatistics for swap chains that either use the flip presentation model or draw in + /// full-screen mode. You set the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value in the SwapEffect member of the + /// DXGI_SWAP_CHAIN_DESC1 structure to specify that the swap chain uses the flip presentation model. + /// + /// + /// The values in the PresentCount and PresentRefreshCount members indicate information about when a frame was + /// presented on the display screen. You can use these values to determine whether a glitch occurred. The values in the + /// SyncRefreshCount and SyncQPCTime members indicate timing information that you can use for audio and video + /// synchronization or very precise animation. If the swap chain draws in full-screen mode, these values are based on when the + /// computer booted. If the swap chain draws in windowed mode, these values are based on when the swap chain is created. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_frame_statistics typedef struct DXGI_FRAME_STATISTICS { UINT + // PresentCount; UINT PresentRefreshCount; UINT SyncRefreshCount; LARGE_INTEGER SyncQPCTime; LARGE_INTEGER SyncGPUTime; } DXGI_FRAME_STATISTICS; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_FRAME_STATISTICS + { + /// + /// Type: UINT + /// + /// A value that represents the running total count of times that an image was presented to the monitor since the computer booted. + /// + /// + /// Note The number of times that an image was presented to the monitor is not necessarily the same as the number of + /// times that you called IDXGISwapChain::Present or IDXGISwapChain1::Present1. + /// + /// + public uint PresentCount; + + /// + /// Type: UINT + /// + /// A value that represents the running total count of v-blanks at which the last image was presented to the monitor and that + /// have happened since the computer booted (for windowed mode, since the swap chain was created). + /// + /// + public uint PresentRefreshCount; + + /// + /// Type: UINT + /// + /// A value that represents the running total count of v-blanks when the scheduler last sampled the machine time by calling + /// QueryPerformanceCounter and that have happened since the computer booted (for windowed mode, since the swap chain was created). + /// + /// + public uint SyncRefreshCount; + + /// + /// Type: LARGE_INTEGER + /// + /// A value that represents the high-resolution performance counter timer. This value is the same as the value returned by the + /// QueryPerformanceCounter function. + /// + /// + public int SyncQPCTime; + + /// + /// Type: LARGE_INTEGER + /// Reserved. Always returns 0. + /// + public int SyncGPUTime; + } + + /// Controls the settings of a gamma curve. + /// + /// The DXGI_GAMMA_CONTROL structure is used by the IDXGIOutput::SetGammaControl method. + /// For info about using gamma correction, see Using gamma correction. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173061(v=vs.85) typedef struct DXGI_GAMMA_CONTROL { + // DXGI_RGB Scale; DXGI_RGB Offset; DXGI_RGB GammaCurve[1025]; } DXGI_GAMMA_CONTROL; + [PInvokeData("DXGI.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_GAMMA_CONTROL + { + /// + /// A DXGI_RGB structure with scalar values that are applied to rgb values before being sent to the gamma look up table. + /// + public DXGI_RGB Scale; + + /// + /// A DXGI_RGB structure with offset values that are applied to the rgb values before being sent to the gamma look up table. + /// + public DXGI_RGB Offset; + + /// An array of DXGI_RGB structures that control the points of a gamma curve. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1025)] + public DXGI_RGB[] GammaCurve; + } + + /// The DXGI_GAMMA_CONTROL_CAPABILIITES structure describes gamma capabilities. + // https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dxgitype/ns-dxgitype-dxgi_gamma_control_capabilities typedef struct + // DXGI_GAMMA_CONTROL_CAPABILITIES { BOOL ScaleAndOffsetSupported; float MaxConvertedValue; float MinConvertedValue; UINT + // NumGammaControlPoints; float ControlPointPositions[1025]; } DXGI_GAMMA_CONTROL_CAPABILITIES; + [PInvokeData("dxgitype.h", MSDNShortId = "7a91311e-c8b9-4f28-b72e-9f93d459aac2")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_GAMMA_CONTROL_CAPABILITIES + { + /// + /// [out] A BOOL value that indicates whether the device supports scale and offset. TRUE indicates that the device + /// supports scale and offset; FALSE indicates that the device does not support scale and offset. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool ScaleAndOffsetSupported; + + /// [out] A single-precision float vector for the maximum converted value for the gamma control. + public float MaxConvertedValue; + + /// [out] A single-precision float vector for the minimum converted value for the gamma control. + public float MinConvertedValue; + + /// [out] The number of elements in the array that the ControlPointPositions member specifies. + public uint NumGammaControlPoints; + + /// [out] An array of single-precision float vectors that describe the gamma control point positions. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1025)] + public float[] ControlPointPositions; + } + + /// Describes a mapped rectangle that is used to access a surface. + /// The DXGI_MAPPED_RECT structure is initialized by the IDXGISurface::Map method. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_mapped_rect typedef struct DXGI_MAPPED_RECT { INT Pitch; + // BYTE *pBits; } DXGI_MAPPED_RECT; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_MAPPED_RECT + { + /// + /// Type: INT + /// A value that describes the width, in bytes, of the surface. + /// + public int Pitch; + + /// + /// Type: BYTE* + /// A pointer to the image buffer of the surface. + /// + public IntPtr pBits; + } + + /// Describes a display mode. + /// + /// This structure is used by the GetDisplayModeList and FindClosestMatchingMode methods. + /// + /// The following format values are valid for display modes and when you create a bit-block transfer (bitblt) model swap chain. The + /// valid values depend on the feature level that you are working with. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// You can pass one of these format values to ID3D11Device::CheckFormatSupport to determine if it is a valid format for + /// displaying on screen. If ID3D11Device::CheckFormatSupport returns D3D11_FORMAT_SUPPORT_DISPLAY in the bit field to + /// which the pFormatSupport parameter points, the format is valid for displaying on screen. + /// + /// + /// Starting with Windows 8 for a flip model swap chain (that is, a swap chain that has the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL + /// value set in the SwapEffect member of DXGI_SWAP_CHAIN_DESC), you must set the Format member of + /// DXGI_MODE_DESC to DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_B8G8R8A8_UNORM, or DXGI_FORMAT_R8G8B8A8_UNORM. + /// + /// + /// Because of the relaxed render target creation rules that Direct3D 11 has for back buffers, applications can create a + /// DXGI_FORMAT_B8G8R8A8_UNORM_SRGB render target view from a DXGI_FORMAT_B8G8R8A8_UNORM swap chain so they can use + /// automatic color space conversion when they render the swap chain. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173064(v=vs.85) typedef struct DXGI_MODE_DESC { UINT + // Width; UINT Height; DXGI_RATIONAL RefreshRate; DXGI_FORMAT Format; DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; DXGI_MODE_SCALING + // Scaling; } DXGI_MODE_DESC; + [PInvokeData("DXGI.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_MODE_DESC + { + /// + /// A value that describes the resolution width. If you specify the width as zero when you call the + /// IDXGIFactory::CreateSwapChain method to create a swap chain, the runtime obtains the width from the output window and + /// assigns this width value to the swap-chain description. You can subsequently call the IDXGISwapChain::GetDesc method to + /// retrieve the assigned width value. + /// + public uint Width; + + /// + /// A value describing the resolution height. If you specify the height as zero when you call the IDXGIFactory::CreateSwapChain + /// method to create a swap chain, the runtime obtains the height from the output window and assigns this height value to the + /// swap-chain description. You can subsequently call the IDXGISwapChain::GetDesc method to retrieve the assigned height value. + /// + public uint Height; + + /// A DXGI_RATIONAL structure describing the refresh rate in hertz + public DXGI_RATIONAL RefreshRate; + + /// A DXGI_FORMAT structure describing the display format. + public DXGI_FORMAT Format; + + /// A member of the DXGI_MODE_SCANLINE_ORDER enumerated type describing the scanline drawing mode. + public DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; + + /// A member of the DXGI_MODE_SCALING enumerated type describing the scaling mode. + public DXGI_MODE_SCALING Scaling; + } + + /// Describes an output or physical connection between the adapter (video card) and a device. + /// The DXGI_OUTPUT_DESC structure is initialized by the IDXGIOutput::GetDesc method. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_output_desc typedef struct DXGI_OUTPUT_DESC { WCHAR + // DeviceName[32]; RECT DesktopCoordinates; BOOL AttachedToDesktop; DXGI_MODE_ROTATION Rotation; HMONITOR Monitor; } DXGI_OUTPUT_DESC; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct DXGI_OUTPUT_DESC + { + /// + /// Type: WCHAR[32] + /// A string that contains the name of the output device. + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string DeviceName; + + /// + /// Type: RECT + /// + /// A RECT structure containing the bounds of the output in desktop coordinates. Desktop coordinates depend on the dots per inch + /// (DPI) of the desktop. For info about writing DPI-aware Win32 apps, see High DPI. + /// + /// + public RECT DesktopCoordinates; + + /// + /// Type: BOOL + /// True if the output is attached to the desktop; otherwise, false. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool AttachedToDesktop; + + /// + /// Type: DXGI_MODE_ROTATION + /// A member of the DXGI_MODE_ROTATION enumerated type describing on how an image is rotated by the output. + /// + public DXGI_MODE_ROTATION Rotation; + + /// + /// Type: HMONITOR + /// An HMONITOR handle that represents the display monitor. For more information, see HMONITOR and the Device Context. + /// + public HMONITOR Monitor; + } + + /// Represents a rational number. + /// + /// This structure is a member of the DXGI_MODE_DESC structure. + /// The DXGI_RATIONAL structure operates under the following rules: + /// + /// + /// 0/0 is legal and will be interpreted as 0/1. + /// + /// + /// 0/anything is interpreted as zero. + /// + /// + /// If you are representing a whole number, the denominator should be 1. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgicommon/ns-dxgicommon-dxgi_rational typedef struct DXGI_RATIONAL { UINT + // Numerator; UINT Denominator; } DXGI_RATIONAL; + [PInvokeData("dxgicommon.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_RATIONAL + { + /// + /// Type: UINT + /// An unsigned integer value representing the top of the rational number. + /// + public uint Numerator; + + /// + /// Type: UINT + /// An unsigned integer value representing the bottom of the rational number. + /// + public uint Denominator; + } + + /// Represents an RGB color. + /// This structure is a member of the DXGI_GAMMA_CONTROL structure. + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173071(v=vs.85) typedef struct DXGI_RGB { float Red; + // float Green; float Blue; } DXGI_RGB; + [PInvokeData("DXGI.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_RGB + { + /// A value representing the color of the red component. The range of this value is between 0 and 1. + public float Red; + + /// A value representing the color of the green component. The range of this value is between 0 and 1. + public float Green; + + /// A value representing the color of the blue component. The range of this value is between 0 and 1. + public float Blue; + } + + /// Describes multi-sampling parameters for a resource. + /// + /// This structure is a member of the DXGI_SWAP_CHAIN_DESC1 structure. + /// The default sampler mode, with no anti-aliasing, has a count of 1 and a quality level of 0. + /// + /// If multi-sample antialiasing is being used, all bound render targets and depth buffers must have the same sample counts and + /// quality levels. + /// + /// + /// + /// + /// Differences between Direct3D 10.0 and Direct3D 10.1 and between Direct3D 10.0 and Direct3D 11: Direct3D 10.1 has defined two + /// standard quality levels: D3D10_STANDARD_MULTISAMPLE_PATTERN and D3D10_CENTER_MULTISAMPLE_PATTERN in the + /// D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS enumeration in D3D10_1.h. Direct3D 11 has defined two standard quality levels: + /// D3D11_STANDARD_MULTISAMPLE_PATTERN and D3D11_CENTER_MULTISAMPLE_PATTERN in the D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS + /// enumeration in D3D11.h. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgicommon/ns-dxgicommon-dxgi_sample_desc typedef struct DXGI_SAMPLE_DESC { + // UINT Count; UINT Quality; } DXGI_SAMPLE_DESC; + [PInvokeData("dxgicommon.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_SAMPLE_DESC + { + /// + /// Type: UINT + /// The number of multisamples per pixel. + /// + public uint Count; + + /// + /// Type: UINT + /// + /// The image quality level. The higher the quality, the lower the performance. The valid range is between zero and one less + /// than the level returned by ID3D10Device::CheckMultisampleQualityLevels for Direct3D 10 or + /// ID3D11Device::CheckMultisampleQualityLevels for Direct3D 11. + /// + /// + /// For Direct3D 10.1 and Direct3D 11, you can use two special quality level values. For more information about these quality + /// level values, see Remarks. + /// + /// + public uint Quality; + } + + /// Represents a handle to a shared resource. + /// To create a shared surface, pass a shared-resource handle into the IDXGIDevice::CreateSurface method. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_shared_resource typedef struct DXGI_SHARED_RESOURCE { HANDLE + // Handle; } DXGI_SHARED_RESOURCE; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_SHARED_RESOURCE + { + /// + /// Type: HANDLE + /// A handle to a shared resource. + /// + public HANDLE Handle; + } + + /// Describes a surface. + /// This structure is used by the GetDesc and CreateSurface methods. + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_surface_desc typedef struct DXGI_SURFACE_DESC { UINT Width; + // UINT Height; DXGI_FORMAT Format; DXGI_SAMPLE_DESC SampleDesc; } DXGI_SURFACE_DESC; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_SURFACE_DESC + { + /// + /// Type: UINT + /// A value describing the surface width. + /// + public uint Width; + + /// + /// Type: UINT + /// A value describing the surface height. + /// + public uint Height; + + /// + /// Type: DXGI_FORMAT + /// A member of the DXGI_FORMAT enumerated type that describes the surface format. + /// + public DXGI_FORMAT Format; + + /// + /// Type: DXGI_SAMPLE_DESC + /// A member of the DXGI_SAMPLE_DESC structure that describes multi-sampling parameters for the surface. + /// + public DXGI_SAMPLE_DESC SampleDesc; + } + + /// Describes a swap chain. + /// + /// This structure is used by the GetDesc and CreateSwapChain methods. + /// In full-screen mode, there is a dedicated front buffer; in windowed mode, the desktop is the front buffer. + /// + /// If you create a swap chain with one buffer, specifying DXGI_SWAP_EFFECT_SEQUENTIAL does not cause the contents of the + /// single buffer to be swapped with the front buffer. + /// + /// + /// For performance information about flipping swap-chain buffers in full-screen application, see Full-Screen Application + /// Performance Hints. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_swap_chain_desc typedef struct DXGI_SWAP_CHAIN_DESC { + // DXGI_MODE_DESC BufferDesc; DXGI_SAMPLE_DESC SampleDesc; DXGI_USAGE BufferUsage; UINT BufferCount; HWND OutputWindow; BOOL + // Windowed; DXGI_SWAP_EFFECT SwapEffect; UINT Flags; } DXGI_SWAP_CHAIN_DESC; + [PInvokeData("dxgi.h")] + [StructLayout(LayoutKind.Sequential)] + public struct DXGI_SWAP_CHAIN_DESC + { + /// + /// Type: DXGI_MODE_DESC + /// A DXGI_MODE_DESC structure that describes the backbuffer display mode. + /// + public DXGI_MODE_DESC BufferDesc; + + /// + /// Type: DXGI_SAMPLE_DESC + /// A DXGI_SAMPLE_DESC structure that describes multi-sampling parameters. + /// + public DXGI_SAMPLE_DESC SampleDesc; + + /// + /// Type: DXGI_USAGE + /// + /// A member of the DXGI_USAGE enumerated type that describes the surface usage and CPU access options for the back buffer. The + /// back buffer can be used for shader input or render-target output. + /// + /// + public DXGI_USAGE BufferUsage; + + /// + /// Type: UINT + /// + /// A value that describes the number of buffers in the swap chain. When you call IDXGIFactory::CreateSwapChain to create a + /// full-screen swap chain, you typically include the front buffer in this value. For more information about swap-chain buffers, + /// see Remarks. + /// + /// + public uint BufferCount; + + /// + /// Type: HWND + /// An HWND handle to the output window. This member must not be NULL. + /// + public HWND OutputWindow; + + /// + /// Type: BOOL + /// + /// A Boolean value that specifies whether the output is in windowed mode. TRUE if the output is in windowed mode; + /// otherwise, FALSE. + /// + /// + /// We recommend that you create a windowed swap chain and allow the end user to change the swap chain to full screen through + /// IDXGISwapChain::SetFullscreenState; that is, do not set this member to FALSE to force the swap chain to be full screen. + /// However, if you create the swap chain as full screen, also provide the end user with a list of supported display modes + /// through the BufferDesc member because a swap chain that is created with an unsupported display mode might cause the + /// display to go black and prevent the end user from seeing anything. + /// + /// For more information about choosing windowed verses full screen, see IDXGIFactory::CreateSwapChain. + /// + [MarshalAs(UnmanagedType.Bool)] public bool Windowed; + + /// + /// Type: DXGI_SWAP_EFFECT + /// + /// A member of the DXGI_SWAP_EFFECT enumerated type that describes options for handling the contents of the presentation buffer + /// after presenting a surface. + /// + /// + public DXGI_SWAP_EFFECT SwapEffect; + + /// + /// Type: UINT + /// A member of the DXGI_SWAP_CHAIN_FLAG enumerated type that describes options for swap-chain behavior. + /// + public DXGI_SWAP_CHAIN_FLAG Flags; + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/DirectWrite/Dwrite.Interfaces.cs b/PInvoke/Graphics/DirectWrite/Dwrite.Interfaces.cs new file mode 100644 index 00000000..c2a2fa21 --- /dev/null +++ b/PInvoke/Graphics/DirectWrite/Dwrite.Interfaces.cs @@ -0,0 +1,4998 @@ +using System; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Text; +using Vanara.InteropServices; +using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; + +namespace Vanara.PInvoke +{ + /// Items from the Dwrite.dll + public static partial class Dwrite + { + /// Encapsulates a 32-bit device independent bitmap and device context, which can be used for rendering glyphs. + /// + /// + /// You create an IDWriteBitmapRenderTarget by using the IDWriteGdiInterop::CreateBitmapRenderTarget method, as shown in the + /// following code. + /// + /// + /// IDWriteGdiInterop::CreateBitmapRenderTarget takes a handle to a DC and the desired width and height. In the above example, the + /// width and height given are the size of the window rect. + /// + /// Rendering + /// + /// One way to use a IDWriteBitmapRenderTarget, for rendering to a bitmap, is to implement a custom renderer interface + /// derived from the IDWriteTextRenderer interface. In your implementation of the DrawGlyphRun method of your custom renderer, call + /// the IDWriteBitmapRenderTarget::DrawGlyphRun method to draw the glyphs as shown in the following code. + /// + /// + /// The IDWriteBitmapRenderTarget encapsulates and renders to a bitmap in memory. The GetMemoryDC function returns a handle + /// to the device context of this bitmap. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritebitmaprendertarget + [PInvokeData("dwrite.h", MSDNShortId = "9953a9e9-7772-41a3-9cd9-2340a9dd4b6f")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5e5a32a3-8dff-4773-9ff6-0696eab77267")] + public interface IDWriteBitmapRenderTarget + { + /// Draws a run of glyphs to a bitmap target at the specified position. + /// + /// Type: FLOAT + /// The horizontal position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. + /// + /// + /// Type: FLOAT + /// The vertical position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// The measuring method for glyphs in the run, used with the other properties to determine the rendering mode. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// The structure containing the properties of the glyph run. + /// + /// + /// Type: IDWriteRenderingParams* + /// The object that controls rendering behavior. + /// + /// + /// Type: COLORREF + /// The foreground color of the text. + /// + /// + /// Type: RECT* + /// + /// The optional rectangle that receives the bounding box (in pixels not DIPs) of all the pixels affected by drawing the glyph + /// run. The black box rectangle may extend beyond the dimensions of the bitmap. + /// + /// + /// + /// + /// You can use the IDWriteBitmapRenderTarget::DrawGlyphRun to render to a bitmap from a custom text renderer that you + /// implement. The custom text renderer should call this method from within the IDWriteTextRenderer::DrawGlyphRun callback + /// method as shown in the following code. + /// + /// + /// The baselineOriginX, baslineOriginY, measuringMethod, and glyphRun parameters are provided (as arguments) when the callback + /// method is invoked. The renderingParams, textColor and blackBoxRect are not. + /// + /// Default rendering params can be retrieved by using the IDWriteFactory::CreateMonitorRenderingParams method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-drawglyphrun HRESULT + // DrawGlyphRun( FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE measuringMode, DWRITE_GLYPH_RUN const + // *glyphRun, IDWriteRenderingParams *renderingParams, COLORREF textColor, RECT *blackBoxRect ); + void DrawGlyphRun(float baselineOriginX, float baselineOriginY, DWRITE_MEASURING_MODE measuringMode, in DWRITE_GLYPH_RUN glyphRun, [In] IDWriteRenderingParams renderingParams, COLORREF textColor, out RECT blackBoxRect); + + /// Gets a handle to the memory device context. + /// + /// Type: HDC + /// Returns a device context handle to the memory device context. + /// + /// + /// + /// An application can use the device context to draw using GDI functions. An application can obtain the bitmap handle (HBITMAP) + /// by calling GetCurrentObject. An application that wants information about the underlying bitmap, including a pointer to the + /// pixel data, can call GetObject to fill in a DIBSECTION structure. The bitmap is always a 32-bit top-down DIB. + /// + /// Note that this method takes no parameters and returns an HDC variable, not an HRESULT. + /// + /// The HDC returned here is still owned by the bitmap render targer object and should not be released or deleted by the client. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-getmemorydc HDC GetMemoryDC(); + [PreserveSig] + HDC GetMemoryDC(); + + /// Gets the number of bitmap pixels per DIP. + /// + /// Type: FLOAT + /// The number of bitmap pixels per DIP. + /// + /// + /// A DIP (device-independent pixel) is 1/96 inch. Therefore, this value is the number if pixels per inch divided by 96. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-getpixelsperdip FLOAT GetPixelsPerDip(); + [PreserveSig] + float GetPixelsPerDip(); + + /// + /// Sets the number of bitmap pixels per DIP (device-independent pixel). A DIP is 1/96 inch, so this value is the number if + /// pixels per inch divided by 96. + /// + /// + /// Type: FLOAT + /// A value that specifies the number of pixels per DIP. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-setpixelsperdip HRESULT + // SetPixelsPerDip( FLOAT pixelsPerDip ); + void SetPixelsPerDip(float pixelsPerDip); + + /// + /// Gets the transform that maps abstract coordinates to DIPs. By default this is the identity transform. Note that this is + /// unrelated to the world transform of the underlying device context. + /// + /// + /// Type: DWRITE_MATRIX* + /// When this method returns, contains a transform matrix. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-getcurrenttransform HRESULT + // GetCurrentTransform( DWRITE_MATRIX *transform ); + DWRITE_MATRIX GetCurrentTransform(); + + /// + /// Sets the transform that maps abstract coordinate to DIPs (device-independent pixel). This does not affect the world + /// transform of the underlying device context. + /// + /// + /// Type: const DWRITE_MATRIX* + /// Specifies the new transform. This parameter can be NULL, in which case the identity transform is implied. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-setcurrenttransform HRESULT + // SetCurrentTransform( DWRITE_MATRIX const *transform ); + void SetCurrentTransform([In, Optional] IntPtr transform); + + /// Gets the dimensions of the target bitmap. + /// + /// Type: SIZE* + /// Returns the width and height of the bitmap in pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-getsize HRESULT GetSize( SIZE + // *size ); + SIZE GetSize(); + + /// Resizes the bitmap. + /// + /// Type: UINT32 + /// The new bitmap width, in pixels. + /// + /// + /// Type: UINT32 + /// The new bitmap height, in pixels. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritebitmaprendertarget-resize HRESULT Resize( UINT32 + // width, UINT32 height ); + void Resize(uint width, uint height); + } + + /// + /// Used to create all subsequent DirectWrite objects. This interface is the root factory interface for all DirectWrite objects. + /// + /// + /// Create an IDWriteFactory object by using the DWriteCreateFactory function. + /// + /// An IDWriteFactory object holds state information, such as font loader registration and cached font data. This state can + /// be shared or isolated. Shared is recommended for most applications because it saves memory. However, isolated can be useful in + /// situations where you want to have a separate state for some objects. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefactory + [PInvokeData("dwrite.h", MSDNShortId = "73a85977-5c24-4abc-ad8c-1d0d6474bd7e")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b859ee5a-d838-4b5b-a2e8-1adc7d93db48")] + public interface IDWriteFactory + { + /// Gets an object which represents the set of installed fonts. + /// + /// Type: IDWriteFontCollection** + /// + /// When this method returns, contains the address of a pointer to the system font collection object, or NULL in case of failure. + /// + /// + /// + /// Type: BOOL + /// + /// If this parameter is nonzero, the function performs an immediate check for changes to the set of installed fonts. If this + /// parameter is FALSE, the function will still detect changes if the font cache service is running, but there may be + /// some latency. For example, an application might specify TRUE if it has itself just installed a font and wants to be + /// sure the font collection contains that font. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-getsystemfontcollection HRESULT + // GetSystemFontCollection( IDWriteFontCollection **fontCollection, BOOL checkForUpdates ); + void GetSystemFontCollection(out IDWriteFontCollection fontCollection, [MarshalAs(UnmanagedType.Bool)] bool checkForUpdates = false); + + /// Creates a font collection using a custom font collection loader. + /// + /// Type: IDWriteFontCollectionLoader* + /// An application-defined font collection loader, which must have been previously registered using RegisterFontCollectionLoader. + /// + /// + /// Type: const void* + /// + /// The key used by the loader to identify a collection of font files. The buffer allocated for this key should at least be the + /// size of collectionKeySize. + /// + /// + /// + /// Type: UINT32 + /// The size, in bytes, of the collection key. + /// + /// + /// Type: IDWriteFontCollection** + /// + /// Contains an address of a pointer to the system font collection object if the method succeeds, or NULL in case of failure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createcustomfontcollection HRESULT + // CreateCustomFontCollection( IDWriteFontCollectionLoader *collectionLoader, void const *collectionKey, UINT32 + // collectionKeySize, IDWriteFontCollection **fontCollection ); + IDWriteFontCollection CreateCustomFontCollection([In] IDWriteFontCollectionLoader collectionLoader, [In] IntPtr collectionKey, uint collectionKeySize); + + /// Registers a custom font collection loader with the factory object. + /// + /// Type: IDWriteFontCollectionLoader* + /// Pointer to a IDWriteFontCollectionLoader object to be registered. + /// + /// + /// This function registers a font collection loader with DirectWrite. The font collection loader interface, which should be + /// implemented by a singleton object, handles enumerating font files in a font collection given a particular type of key. A + /// given instance can only be registered once. Succeeding attempts will return an error, indicating that it has already been + /// registered. Note that font file loader implementations must not register themselves with DirectWrite inside their + /// constructors, and must not unregister themselves inside their destructors, because registration and unregistraton operations + /// increment and decrement the object reference count respectively. Instead, registration and unregistration with DirectWrite + /// of font file loaders should be performed outside of the font file loader implementation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-registerfontcollectionloader HRESULT + // RegisterFontCollectionLoader( IDWriteFontCollectionLoader *fontCollectionLoader ); + void RegisterFontCollectionLoader([In] IDWriteFontCollectionLoader fontCollectionLoader); + + /// Unregisters a custom font collection loader that was previously registered using RegisterFontCollectionLoader. + /// + /// Type: IDWriteFontCollectionLoader* + /// Pointer to a IDWriteFontCollectionLoader object to be unregistered. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-unregisterfontcollectionloader HRESULT + // UnregisterFontCollectionLoader( IDWriteFontCollectionLoader *fontCollectionLoader ); + void UnregisterFontCollectionLoader([In] IDWriteFontCollectionLoader fontCollectionLoader); + + /// Creates a font file reference object from a local font file. + /// + /// Type: const WCHAR* + /// + /// An array of characters that contains the absolute file path for the font file. Subsequent operations on the constructed + /// object may fail if the user provided filePath doesn't correspond to a valid file on the disk. + /// + /// + /// + /// Type: const FILETIME* + /// + /// The last modified time of the input file path. If the parameter is omitted, the function will access the font file to obtain + /// its last write time. You should specify this value to avoid extra disk access. Subsequent operations on the constructed + /// object may fail if the user provided lastWriteTime doesn't match the file on the disk. + /// + /// + /// + /// Type: IDWriteFontFile** + /// + /// When this method returns, contains an address of a pointer to the newly created font file reference object, or NULL + /// in case of failure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createfontfilereference HRESULT + // CreateFontFileReference( WCHAR const *filePath, FILETIME const *lastWriteTime, IDWriteFontFile **fontFile ); + IDWriteFontFile CreateFontFileReference([MarshalAs(UnmanagedType.LPWStr)] string filePath, [In, Optional] IntPtr lastWriteTime); + + /// Creates a reference to an application-specific font file resource. + /// + /// Type: const void* + /// A font file reference key that uniquely identifies the font file resource during the lifetime of fontFileLoader. + /// + /// + /// Type: UINT32 + /// The size of the font file reference key in bytes. + /// + /// + /// Type: IDWriteFontFileLoader* + /// The font file loader that will be used by the font system to load data from the file identified by fontFileReferenceKey. + /// + /// + /// Type: IDWriteFontFile** + /// + /// Contains an address of a pointer to the newly created font file object when this method succeeds, or NULL in case of failure. + /// + /// + /// + /// This function is provided for cases when an application or a document needs to use a private font without having to install + /// it on the system. fontFileReferenceKey has to be unique only in the scope of the fontFileLoader used in this call. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createcustomfontfilereference HRESULT + // CreateCustomFontFileReference( void const *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileLoader + // *fontFileLoader, IDWriteFontFile **fontFile ); + IDWriteFontFile CreateCustomFontFileReference([In] IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, [In] IDWriteFontFileLoader fontFileLoader); + + /// Creates an object that represents a font face. + /// + /// Type: DWRITE_FONT_FACE_TYPE + /// A value that indicates the type of file format of the font face. + /// + /// + /// Type: UINT32 + /// The number of font files, in element count, required to represent the font face. + /// + /// + /// Type: const IDWriteFontFile* + /// + /// A font file object representing the font face. Because IDWriteFontFacemaintains its own references to the input font file + /// objects, you may release them after this call. + /// + /// + /// + /// Type: UINT32 + /// + /// The zero-based index of a font face, in cases when the font files contain a collection of font faces. If the font files + /// contain a single face, this value should be zero. + /// + /// + /// + /// Type: DWRITE_FONT_SIMULATIONS + /// + /// A value that indicates which, if any, font face simulation flags for algorithmic means of making text bold or italic are + /// applied to the current font face. + /// + /// + /// + /// Type: IDWriteFontFace** + /// + /// When this method returns, contains an address of a pointer to the newly created font face object, or NULL in case of failure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createfontface HRESULT CreateFontFace( + // DWRITE_FONT_FACE_TYPE fontFaceType, UINT32 numberOfFiles, IDWriteFontFile * const *fontFiles, UINT32 faceIndex, + // DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags, IDWriteFontFace **fontFace ); + IDWriteFontFace CreateFontFace(DWRITE_FONT_FACE_TYPE fontFaceType, uint numberOfFiles, + [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface)] IDWriteFontFile[] fontFiles, + uint faceIndex, DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags); + + /// + /// Creates a rendering parameters object with default settings for the primary monitor. Different monitors may have different + /// rendering parameters, for more information see the How to Add Support for Multiple Monitors topic. + /// + /// + /// Type: IDWriteRenderingParams** + /// When this method returns, contains an address of a pointer to the newly created rendering parameters object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createrenderingparams HRESULT + // CreateRenderingParams( IDWriteRenderingParams **renderingParams ); + IDWriteRenderingParams CreateRenderingParams(); + + /// + /// Creates a rendering parameters object with default settings for the specified monitor. In most cases, this is the preferred + /// way to create a rendering parameters object. + /// + /// + /// Type: HMONITOR + /// A handle for the specified monitor. + /// + /// + /// Type: IDWriteRenderingParams** + /// When this method returns, contains an address of a pointer to the rendering parameters object created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createmonitorrenderingparams HRESULT + // CreateMonitorRenderingParams( HMONITOR monitor, IDWriteRenderingParams **renderingParams ); + IDWriteRenderingParams CreateMonitorRenderingParams(HMONITOR monitor); + + /// Creates a rendering parameters object with the specified properties. + /// + /// Type: FLOAT + /// The gamma level to be set for the new rendering parameters object. + /// + /// + /// Type: FLOAT + /// The enhanced contrast level to be set for the new rendering parameters object. + /// + /// + /// Type: FLOAT + /// The ClearType level to be set for the new rendering parameters object. + /// + /// + /// Type: DWRITE_PIXEL_GEOMETRY + /// + /// Represents the internal structure of a device pixel (that is, the physical arrangement of red, green, and blue color + /// components) that is assumed for purposes of rendering text. + /// + /// + /// + /// Type: DWRITE_RENDERING_MODE + /// A value that represents the method (for example, ClearType natural quality) for rendering glyphs. + /// + /// + /// Type: IDWriteRenderingParams** + /// When this method returns, contains an address of a pointer to the newly created rendering parameters object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createcustomrenderingparams HRESULT + // CreateCustomRenderingParams( FLOAT gamma, FLOAT enhancedContrast, FLOAT clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry, + // DWRITE_RENDERING_MODE renderingMode, IDWriteRenderingParams **renderingParams ); + IDWriteRenderingParams CreateCustomRenderingParams(float gamma, float enhancedContrast, float clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry, DWRITE_RENDERING_MODE renderingMode); + + /// Registers a font file loader with DirectWrite. + /// + /// Type: IDWriteFontFileLoader* + /// Pointer to a IDWriteFontFileLoader object for a particular file resource type. + /// + /// + /// This function registers a font file loader with DirectWrite. The font file loader interface, which should be implemented by + /// a singleton object, handles loading font file resources of a particular type from a key. A given instance can only be + /// registered once. Succeeding attempts will return an error, indicating that it has already been registered. Note that font + /// file loader implementations must not register themselves with DirectWrite inside their constructors, and must not unregister + /// themselves inside their destructors, because registration and unregistraton operations increment and decrement the object + /// reference count respectively. Instead, registration and unregistration with DirectWrite of font file loaders should be + /// performed outside of the font file loader implementation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-registerfontfileloader HRESULT + // RegisterFontFileLoader( IDWriteFontFileLoader *fontFileLoader ); + void RegisterFontFileLoader([In] IDWriteFontFileLoader fontFileLoader); + + /// Unregisters a font file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. + /// + /// Type: IDWriteFontFileLoader* + /// Pointer to the file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. + /// + /// + /// This function unregisters font file loader callbacks with the DirectWrite font system. You should implement the font file + /// loader interface by a singleton object. Note that font file loader implementations must not register themselves with + /// DirectWrite inside their constructors and must not unregister themselves in their destructors, because registration and + /// unregistraton operations increment and decrement the object reference count respectively. Instead, registration and + /// unregistration of font file loaders with DirectWrite should be performed outside of the font file loader implementation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-unregisterfontfileloader HRESULT + // UnregisterFontFileLoader( IDWriteFontFileLoader *fontFileLoader ); + void UnregisterFontFileLoader([In] IDWriteFontFileLoader fontFileLoader); + + /// Creates a text format object used for text layout. + /// + /// Type: const WCHAR* + /// An array of characters that contains the name of the font family + /// + /// + /// Type: IDWriteFontCollection* + /// A pointer to a font collection object. When this is NULL, indicates the system font collection. + /// + /// + /// Type: DWRITE_FONT_WEIGHT + /// A value that indicates the font weight for the text object created by this method. + /// + /// + /// Type: DWRITE_FONT_STYLE + /// A value that indicates the font style for the text object created by this method. + /// + /// + /// Type: DWRITE_FONT_STRETCH + /// A value that indicates the font stretch for the text object created by this method. + /// + /// + /// Type: FLOAT + /// The logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch. + /// + /// + /// Type: const WCHAR* + /// An array of characters that contains the locale name. + /// + /// + /// Type: IDWriteTextFormat** + /// + /// When this method returns, contains an address of a pointer to a newly created text format object, or NULL in case of failure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createtextformat HRESULT CreateTextFormat( + // WCHAR const *fontFamilyName, IDWriteFontCollection *fontCollection, DWRITE_FONT_WEIGHT fontWeight, DWRITE_FONT_STYLE + // fontStyle, DWRITE_FONT_STRETCH fontStretch, FLOAT fontSize, WCHAR const *localeName, IDWriteTextFormat **textFormat ); + IDWriteTextFormat CreateTextFormat([MarshalAs(UnmanagedType.LPWStr)] string fontFamilyName, [In, Optional] IDWriteFontCollection fontCollection, DWRITE_FONT_WEIGHT fontWeight, + DWRITE_FONT_STYLE fontStyle, DWRITE_FONT_STRETCH fontStretch, float fontSize, [MarshalAs(UnmanagedType.LPWStr)] string localeName); + + /// Creates a typography object for use in a text layout. + /// + /// Type: IDWriteTypography** + /// + /// When this method returns, contains the address of a pointer to a newly created typography object, or NULL in case of failure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createtypography HRESULT CreateTypography( + // IDWriteTypography **typography ); + IDWriteTypography CreateTypography(); + + /// Creates an object that is used for interoperability with GDI. + /// + /// Type: IDWriteGdiInterop** + /// + /// When this method returns, contains an address of a pointer to a GDI interop object if successful, or NULL in case of failure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-getgdiinterop HRESULT GetGdiInterop( + // IDWriteGdiInterop **gdiInterop ); + IDWriteGdiInterop GetGdiInterop(); + + /// + /// Takes a string, text format, and associated constraints, and produces an object that represents the fully analyzed and + /// formatted result. + /// + /// + /// Type: const WCHAR* + /// + /// An array of characters that contains the string to create a new IDWriteTextLayout object from. This array must be of length + /// stringLength and can contain embedded NULL characters. + /// + /// + /// + /// Type: UINT32 + /// The number of characters in the string. + /// + /// + /// Type: IDWriteTextFormat* + /// A pointer to an object that indicates the format to apply to the string. + /// + /// + /// Type: FLOAT + /// The width of the layout box. + /// + /// + /// Type: FLOAT + /// The height of the layout box. + /// + /// + /// Type: IDWriteTextLayout** + /// When this method returns, contains an address of a pointer to the resultant text layout object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createtextlayout HRESULT CreateTextLayout( + // WCHAR const *string, UINT32 stringLength, IDWriteTextFormat *textFormat, FLOAT maxWidth, FLOAT maxHeight, IDWriteTextLayout + // **textLayout ); + IDWriteTextLayout CreateTextLayout([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, float maxWidth, float maxHeight); + + /// + /// Takes a string, format, and associated constraints, and produces an object representing the result, formatted for a + /// particular display resolution and measuring mode. + /// + /// + /// Type: const WCHAR* + /// + /// An array of characters that contains the string to create a new IDWriteTextLayout object from. This array must be of length + /// stringLength and can contain embedded NULL characters. + /// + /// + /// + /// Type: UINT32 + /// The length of the string, in character count. + /// + /// + /// Type: IDWriteTextFormat* + /// The text formatting object to apply to the string. + /// + /// + /// Type: FLOAT + /// The width of the layout box. + /// + /// + /// Type: FLOAT + /// The height of the layout box. + /// + /// + /// Type: FLOAT + /// + /// The number of physical pixels per DIP (device independent pixel). For example, if rendering onto a 96 DPI device + /// pixelsPerDipis 1. If rendering onto a 120 DPI device pixelsPerDip is 1.25 (120/96). + /// + /// + /// + /// Type: const DWRITE_MATRIX* + /// + /// An optional transform applied to the glyphs and their positions. This transform is applied after the scaling specifies the + /// font size and pixels per DIP. + /// + /// + /// + /// Type: BOOL + /// + /// Instructs the text layout to use the same metrics as GDI bi-level text when set to FALSE. When set to TRUE, + /// instructs the text layout to use the same metrics as text measured by GDI using a font created with CLEARTYPE_NATURAL_QUALITY. + /// + /// + /// + /// Type: IDWriteTextLayout** + /// When this method returns, contains an address to the pointer of the resultant text layout object. + /// + /// + /// The resulting text layout should only be used for the intended resolution, and for cases where text scalability is desired + /// CreateTextLayout should be used instead. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-creategdicompatibletextlayout HRESULT + // CreateGdiCompatibleTextLayout( WCHAR const *string, UINT32 stringLength, IDWriteTextFormat *textFormat, FLOAT layoutWidth, + // FLOAT layoutHeight, FLOAT pixelsPerDip, DWRITE_MATRIX const *transform, BOOL useGdiNatural, IDWriteTextLayout **textLayout ); + IDWriteTextLayout CreateGdiCompatibleTextLayout([MarshalAs(UnmanagedType.LPWStr)] string @string, uint stringLength, [In] IDWriteTextFormat textFormat, + float layoutWidth, float layoutHeight, float pixelsPerDip, [In, Optional] IntPtr transform, [MarshalAs(UnmanagedType.Bool)] bool useGdiNatural); + + /// Creates an inline object for trimming, using an ellipsis as the omission sign. + /// + /// Type: IDWriteTextFormat* + /// A text format object, created with CreateTextFormat, used for text layout. + /// + /// + /// Type: IDWriteInlineObject** + /// + /// When this method returns, contains an address of a pointer to the omission (that is, ellipsis trimming) sign created by this method. + /// + /// + /// + /// The ellipsis will be created using the current settings of the format, including base font, style, and any effects. + /// Alternate omission signs can be created by the application by implementing IDWriteInlineObject. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createellipsistrimmingsign HRESULT + // CreateEllipsisTrimmingSign( IDWriteTextFormat *textFormat, IDWriteInlineObject **trimmingSign ); + IDWriteInlineObject CreateEllipsisTrimmingSign([In] IDWriteTextFormat textFormat); + + /// Returns an interface for performing text analysis. + /// + /// Type: IDWriteTextAnalyzer** + /// When this method returns, contains an address of a pointer to the newly created text analyzer object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createtextanalyzer HRESULT + // CreateTextAnalyzer( IDWriteTextAnalyzer **textAnalyzer ); + IDWriteTextAnalyzer CreateTextAnalyzer(); + + /// + /// Creates a number substitution object using a locale name, substitution method, and an indicator whether to ignore user + /// overrides (use NLS defaults for the given culture instead). + /// + /// + /// Type: DWRITE_NUMBER_SUBSTITUTION_METHOD + /// A value that specifies how to apply number substitution on digits and related punctuation. + /// + /// + /// Type: const WCHAR* + /// The name of the locale to be used in the numberSubstitution object. + /// + /// + /// Type: BOOL + /// A Boolean flag that indicates whether to ignore user overrides. + /// + /// + /// Type: IDWriteNumberSubstitution** + /// When this method returns, contains an address to a pointer to the number substitution object created by this method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createnumbersubstitution HRESULT + // CreateNumberSubstitution( DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, WCHAR const *localeName, BOOL + // ignoreUserOverride, IDWriteNumberSubstitution **numberSubstitution ); + IDWriteNumberSubstitution CreateNumberSubstitution([In] DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, [MarshalAs(UnmanagedType.LPWStr)] string localeName, [In] [MarshalAs(UnmanagedType.Bool)] bool ignoreUserOverride); + + /// Creates a glyph run analysis object, which encapsulates information used to render a glyph run. + /// + /// Type: const DWRITE_GLYPH_RUN* + /// A structure that contains the properties of the glyph run (font face, advances, and so on). + /// + /// + /// Type: FLOAT + /// + /// Number of physical pixels per DIP (device independent pixel). For example, if rendering onto a 96 DPI bitmap then + /// pixelsPerDipis 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 1.25. + /// + /// + /// + /// Type: const DWRITE_MATRIX* + /// + /// Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified the + /// emSize and pixelsPerDip. + /// + /// + /// + /// Type: DWRITE_RENDERING_MODE + /// + /// A value that specifies the rendering mode, which must be one of the raster rendering modes (that is, not default and not outline). + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// Specifies the measuring mode to use with glyphs. + /// + /// + /// Type: FLOAT + /// The horizontal position (X-coordinate) of the baseline origin, in DIPs. + /// + /// + /// Type: FLOAT + /// Vertical position (Y-coordinate) of the baseline origin, in DIPs. + /// + /// + /// Type: IDWriteGlyphRunAnalysis** + /// When this method returns, contains an address of a pointer to the newly created glyph run analysis object. + /// + /// + /// + /// The glyph run analysis object contains the results of analyzing the glyph run, including the positions of all the glyphs and + /// references to all of the rasterized glyphs in the font cache. + /// + /// Examples + /// + /// The following code example shows how to create a glyph run analysis object. In this example, an empty glyph run is being used. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createglyphrunanalysis HRESULT + // CreateGlyphRunAnalysis( DWRITE_GLYPH_RUN const *glyphRun, FLOAT pixelsPerDip, DWRITE_MATRIX const *transform, + // DWRITE_RENDERING_MODE renderingMode, DWRITE_MEASURING_MODE measuringMode, FLOAT baselineOriginX, FLOAT baselineOriginY, + // IDWriteGlyphRunAnalysis **glyphRunAnalysis ); + IDWriteGlyphRunAnalysis CreateGlyphRunAnalysis(in DWRITE_GLYPH_RUN glyphRun, float pixelsPerDip, [In, Optional] IntPtr transform, + DWRITE_RENDERING_MODE renderingMode, DWRITE_MEASURING_MODE measuringMode, float baselineOriginX, float baselineOriginY); + } + + /// + /// Represents a physical font in a font collection. This interface is used to create font faces from physical fonts, or to retrieve + /// information such as font face metrics or face names from existing font faces. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefont + [PInvokeData("dwrite.h", MSDNShortId = "e29e626f-3e63-4c27-934b-64be51dcf3db")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("acd16696-8c14-4f5d-877e-fe3fc1d32737")] + public interface IDWriteFont + { + /// Gets the font family to which the specified font belongs. + /// + /// Type: IDWriteFontFamily** + /// When this method returns, contains an address of a pointer to the font family object to which the specified font belongs. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getfontfamily HRESULT GetFontFamily( + // IDWriteFontFamily **fontFamily ); + IDWriteFontFamily GetFontFamily(); + + /// Gets the weight, or stroke thickness, of the specified font. + /// + /// Type: DWRITE_FONT_WEIGHT + /// A value that indicates the weight for the specified font. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getweight DWRITE_FONT_WEIGHT GetWeight(); + [PreserveSig] + DWRITE_FONT_WEIGHT GetWeight(); + + /// Gets the stretch, or width, of the specified font. + /// + /// Type: DWRITE_FONT_STRETCH + /// A value that indicates the type of stretch, or width, applied to the specified font. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getstretch DWRITE_FONT_STRETCH GetStretch(); + [PreserveSig] + DWRITE_FONT_STRETCH GetStretch(); + + /// Gets the style, or slope, of the specified font. + /// + /// Type: DWRITE_FONT_STYLE + /// A value that indicates the type of style, or slope, of the specified font. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getstyle DWRITE_FONT_STYLE GetStyle(); + [PreserveSig] + DWRITE_FONT_STYLE GetStyle(); + + /// Determines whether the font is a symbol font. + /// + /// Type: BOOL + /// TRUE if the font is a symbol font; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-issymbolfont BOOL IsSymbolFont(); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + bool IsSymbolFont(); + + /// + /// Gets a localized strings collection containing the face names for the font (such as Regular or Bold), indexed by locale name. + /// + /// + /// Type: IDWriteLocalizedStrings** + /// When this method returns, contains an address to a pointer to the newly created localized strings object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getfacenames HRESULT GetFaceNames( + // IDWriteLocalizedStrings **names ); + IDWriteLocalizedStrings GetFaceNames(); + + /// Gets a localized strings collection containing the specified informational strings, indexed by locale name. + /// + /// Type: DWRITE_INFORMATIONAL_STRING_ID + /// + /// A value that identifies the informational string to get. For example, DWRITE_INFORMATIONAL_STRING_DESCRIPTION specifies a + /// string that contains a description of the font. + /// + /// + /// + /// Type: IDWriteLocalizedStrings** + /// When this method returns, contains an address of a pointer to the newly created localized strings object. + /// + /// + /// Type: BOOL* + /// When this method returns, TRUE if the font contains the specified string ID; otherwise, FALSE. + /// + /// + /// If the font does not contain the string specified by informationalStringID, the return value is S_OK but + /// informationalStrings receives a NULL pointer and exists receives the value FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getinformationalstrings HRESULT + // GetInformationalStrings( DWRITE_INFORMATIONAL_STRING_ID informationalStringID, IDWriteLocalizedStrings + // **informationalStrings, BOOL *exists ); + void GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_ID informationalStringID, out IDWriteLocalizedStrings informationalStrings, [MarshalAs(UnmanagedType.Bool)] out bool exists); + + /// Gets a value that indicates what simulations are applied to the specified font. + /// + /// Type: DWRITE_FONT_SIMULATIONS + /// A value that indicates one or more of the types of simulations (none, bold, or oblique) applied to the specified font. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getsimulations DWRITE_FONT_SIMULATIONS GetSimulations(); + [PreserveSig] + DWRITE_FONT_SIMULATIONS GetSimulations(); + + /// + /// Obtains design units and common metrics for the font face. These metrics are applicable to all the glyphs within a font face + /// and are used by applications for layout calculations. + /// + /// + /// Type: DWRITE_FONT_METRICS* + /// + /// When this method returns, contains a structure that has font metrics for the current font face. The metrics returned by this + /// function are in font design units. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-getmetrics void GetMetrics( + // DWRITE_FONT_METRICS *fontMetrics ); + [PreserveSig] + void GetMetrics(out DWRITE_FONT_METRICS fontMetrics); + + /// Determines whether the font supports a specified character. + /// + /// Type: UINT32 + /// A Unicode (UCS-4) character value for the method to inspect. + /// + /// + /// Type: BOOL* + /// When this method returns, TRUE if the font supports the specified character; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-hascharacter HRESULT HasCharacter( UINT32 + // unicodeValue, BOOL *exists ); + [return: MarshalAs(UnmanagedType.Bool)] + bool HasCharacter(uint unicodeValue); + + /// Creates a font face object for the font. + /// + /// Type: IDWriteFontFace** + /// When this method returns, contains an address of a pointer to the newly created font face object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefont-createfontface HRESULT CreateFontFace( + // IDWriteFontFace **fontFace ); + IDWriteFontFace CreateFontFace(); + } + + /// + /// An object that encapsulates a set of fonts, such as the set of fonts installed on the system, or the set of fonts in a + /// particular directory. The font collection API can be used to discover what font families and fonts are available, and to obtain + /// some metadata about the fonts. + /// + /// + /// + /// The IDWriteFactory::GetSystemFontCollection method will give you an IDWriteFontCollection object, which encapsulates the + /// set of fonts installed on the system, as shown in the following code example. + /// + /// + /// IDWriteTextFormat and IDWriteTextLayout both have a GetFontCollection method that returns the font collection being used by the + /// object. These interfaces use the system font collection by default, but can use a custom font collection instead. + /// + /// + /// To determine what fonts are available on the system, get a reference to the system font collection. You can then use the + /// IDWriteFontCollection::GetFontFamilyCount method to determine the number of fonts and loop through the list. The following + /// example enumerates the fonts in the system font collection, and prints the font family names to the console. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontcollection + [PInvokeData("dwrite.h", MSDNShortId = "2ca7e2d3-d66a-4c57-8fbe-15a5232c3506")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("a84cee02-3eea-4eee-a827-87c1a02a0fcc")] + public interface IDWriteFontCollection + { + /// Gets the number of font families in the collection. + /// + /// Type: UINT32 + /// The number of font families in the collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontcollection-getfontfamilycount UINT32 GetFontFamilyCount(); + [PreserveSig] + uint GetFontFamilyCount(); + + /// Creates a font family object given a zero-based font family index. + /// + /// Type: UINT32 + /// Zero-based index of the font family. + /// + /// + /// Type: IDWriteFontFamily** + /// When this method returns, contains the address of a pointer to the newly created font family object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontcollection-getfontfamily HRESULT + // GetFontFamily( UINT32 index, IDWriteFontFamily **fontFamily ); + IDWriteFontFamily GetFontFamily(uint index); + + /// Finds the font family with the specified family name. + /// + /// Type: const WCHAR* + /// + /// An array of characters, which is null-terminated, containing the name of the font family. The name is not case-sensitive but + /// must otherwise exactly match a family name in the collection. + /// + /// + /// + /// Type: UINT32* + /// + /// When this method returns, contains the zero-based index of the matching font family if the family name was found; otherwise, UINT_MAX. + /// + /// + /// + /// Type: BOOL* + /// When this method returns, TRUE if the family name exists; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontcollection-findfamilyname HRESULT + // FindFamilyName( WCHAR const *familyName, UINT32 *index, BOOL *exists ); + void FindFamilyName([MarshalAs(UnmanagedType.LPWStr)] string familyName, out uint index, [MarshalAs(UnmanagedType.Bool)] out bool exists); + + /// + /// Gets the font object that corresponds to the same physical font as the specified font face object. The specified physical + /// font must belong to the font collection. + /// + /// + /// Type: IDWriteFontFace* + /// A font face object that specifies the physical font. + /// + /// + /// Type: IDWriteFont** + /// + /// When this method returns, contains the address of a pointer to the newly created font object if successful; otherwise, NULL. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontcollection-getfontfromfontface HRESULT + // GetFontFromFontFace( IDWriteFontFace *fontFace, IDWriteFont **font ); + IDWriteFont GetFontFromFontFace([In] IDWriteFontFace fontFace); + } + + /// Used to construct a collection of fonts given a particular type of key. + /// + /// The font collection loader interface is recommended to be implemented by a singleton object. Note that font collection loader + /// implementations must not register themselves with DirectWrite factory inside their constructors and must not unregister + /// themselves in their destructors, because registration and unregistraton operations increment and decrement the object reference + /// count respectively. Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed + /// outside of the font file loader implementation as a separate step. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontcollectionloader + [PInvokeData("dwrite.h", MSDNShortId = "898645ce-4bd5-4491-a31c-f60a17578872")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("cca920e4-52f0-492b-bfa8-29c72ee0a468")] + public interface IDWriteFontCollectionLoader + { + /// + /// Creates a font file enumerator object that encapsulates a collection of font files. The font system calls back to this + /// interface to create a font collection. + /// + /// + /// Type: IDWriteFactory* + /// Pointer to the IDWriteFactory object that was used to create the current font collection. + /// + /// + /// Type: const void* + /// + /// A font collection key that uniquely identifies the collection of font files within the scope of the font collection loader + /// being used. The buffer allocated for this key must be at least the size, in bytes, specified by collectionKeySize. + /// + /// + /// + /// Type: UINT32 + /// The size of the font collection key, in bytes. + /// + /// + /// Type: IDWriteFontFileEnumerator** + /// When this method returns, contains the address of a pointer to the newly created font file enumerator. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontcollectionloader-createenumeratorfromkey + // HRESULT CreateEnumeratorFromKey( IDWriteFactory *factory, void const *collectionKey, UINT32 collectionKeySize, + // IDWriteFontFileEnumerator **fontFileEnumerator ); + [PreserveSig] + HRESULT CreateEnumeratorFromKey([In] IDWriteFactory factory, IntPtr collectionKey, uint collectionKeySize, out IDWriteFontFileEnumerator fontFileEnumerator); + } + + /// + /// + /// This interface exposes various font data such as metrics, names, and glyph outlines. It contains font face type, appropriate + /// file references, and face identification data. + /// + /// This interface extends IUnknown. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontface + [PInvokeData("dwrite.h", MSDNShortId = "1b6bb9e2-cf01-413c-9ee8-42bb0f703ce8")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5f49804d-7024-4d43-bfa9-d25984f53849")] + public interface IDWriteFontFace + { + /// Obtains the file format type of a font face. + /// + /// Type: DWRITE_FONT_FACE_TYPE + /// A value that indicates the type of format for the font face (such as Type 1, TrueType, vector, or bitmap). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-gettype DWRITE_FONT_FACE_TYPE GetType(); + [PreserveSig] + DWRITE_FONT_FACE_TYPE GetType(); + + /// Obtains the font files representing a font face. + /// + /// Type: UINT32* + /// + /// If fontFiles is NULL, receives the number of files representing the font face. Otherwise, the number of font files + /// being requested should be passed. See the Remarks section below for more information. + /// + /// + /// + /// Type: IDWriteFontFile** + /// + /// When this method returns, contains a pointer to a user-provided array that stores pointers to font files representing the + /// font face. This parameter can be NULL if the user wants only the number of files representing the font face. This API + /// increments reference count of the font file pointers returned according to COM conventions, and the client should release + /// them when finished. + /// + /// + /// + /// + /// The IDWriteFontFace::GetFiles method should be called twice. The first time you call GetFiles fontFiles should + /// be NULL. When the method returns, numberOfFiles receives the number of font files that represent the font face. + /// + /// + /// Then, call the method a second time, passing the numberOfFiles value that was output the first call, and a non-null buffer + /// of the correct size to store the IDWriteFontFile pointers. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getfiles HRESULT GetFiles( UINT32 + // *numberOfFiles, IDWriteFontFile **fontFiles ); + void GetFiles(ref uint numberOfFiles, [Out, Optional, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface)] IDWriteFontFile[] fontFiles); + + /// Obtains the index of a font face in the context of its font files. + /// + /// Type: UINT32 + /// + /// The zero-based index of a font face in cases when the font files contain a collection of font faces. If the font files + /// contain a single face, this value is zero. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getindex UINT32 GetIndex(); + [PreserveSig] + uint GetIndex(); + + /// Obtains the algorithmic style simulation flags of a font face. + /// + /// Type: DWRITE_FONT_SIMULATIONS + /// Font face simulation flags for algorithmic means of making text bold or italic. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getsimulations DWRITE_FONT_SIMULATIONS GetSimulations(); + [PreserveSig] + DWRITE_FONT_SIMULATIONS GetSimulations(); + + /// Determines whether the font is a symbol font. + /// + /// Type: BOOL + /// Returns TRUE if the font is a symbol font, otherwise FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-issymbolfont BOOL IsSymbolFont(); + [PreserveSig] + [return: MarshalAs(UnmanagedType.Bool)] + bool IsSymbolFont(); + + /// + /// Obtains design units and common metrics for the font face. These metrics are applicable to all the glyphs within a font face + /// and are used by applications for layout calculations. + /// + /// + /// Type: DWRITE_FONT_METRICS* + /// + /// When this method returns, a DWRITE_FONT_METRICS structure that holds metrics (such as ascent, descent, or cap height) for + /// the current font face element. The metrics returned by this function are in font design units. + /// + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getmetrics void GetMetrics( + // DWRITE_FONT_METRICS *fontFaceMetrics ); + [PreserveSig] + void GetMetrics(out DWRITE_FONT_METRICS fontFaceMetrics); + + /// Obtains the number of glyphs in the font face. + /// + /// Type: UINT16 + /// The number of glyphs in the font face. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getglyphcount UINT16 GetGlyphCount(); + [PreserveSig] + ushort GetGlyphCount(); + + /// Obtains ideal (resolution-independent) glyph metrics in font design units. + /// + /// Type: const UINT16* + /// + /// An array of glyph indices for which to compute metrics. The array must contain at least as many elements as specified by glyphCount. + /// + /// + /// + /// Type: UINT32 + /// The number of elements in the glyphIndices array. + /// + /// + /// Type: DWRITE_GLYPH_METRICS* + /// + /// When this method returns, contains an array of DWRITE_GLYPH_METRICS structures. glyphMetrics must be initialized with an + /// empty buffer that contains at least as many elements as glyphCount. The metrics returned by this function are in font design units. + /// + /// + /// + /// Type: BOOL + /// + /// Indicates whether the font is being used in a sideways run. This can affect the glyph metrics if the font has oblique + /// simulation because sideways oblique simulation differs from non-sideways oblique simulation + /// + /// + /// Design glyph metrics are used for glyph positioning. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getdesignglyphmetrics HRESULT + // GetDesignGlyphMetrics( UINT16 const *glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS *glyphMetrics, BOOL isSideways ); + void GetDesignGlyphMetrics([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ushort[] glyphIndices, uint glyphCount, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] DWRITE_GLYPH_METRICS[] glyphMetrics, [MarshalAs(UnmanagedType.Bool)] bool isSideways = false); + + /// Returns the nominal mapping of UCS4 Unicode code points to glyph indices as defined by the font 'CMAP' table. + /// + /// Type: const UINT32* + /// + /// An array of USC4 code points from which to obtain nominal glyph indices. The array must be allocated and be able to contain + /// the number of elements specified by codePointCount. + /// + /// + /// + /// Type: UINT32 + /// The number of elements in the codePoints array. + /// + /// + /// Type: UINT16* + /// When this method returns, contains a pointer to an array of nominal glyph indices filled by this function. + /// + /// + /// + /// Note that this mapping is primarily provided for line layout engines built on top of the physical font API. Because of + /// OpenType glyph substitution and line layout character substitution, the nominal conversion does not always correspond to how + /// a Unicode string will map to glyph indices when rendering using a particular font face. Also, note that Unicode variant + /// selectors provide for alternate mappings for character to glyph. This call will always return the default variant. + /// + /// + /// When characters are not present in the font this method returns the index 0, which is the undefined glyph or ".notdef" + /// glyph. If a character isn't in a font, IDWriteFont::HasCharacter returns false and GetUnicodeRanges doesn't return it in the range. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getglyphindices HRESULT GetGlyphIndices( + // UINT32 const *codePoints, UINT32 codePointCount, UINT16 *glyphIndices ); + void GetGlyphIndices([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] codePoints, uint codePointCount, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ushort[] glyphIndices); + + /// + /// Finds the specified OpenType font table if it exists and returns a pointer to it. The function accesses the underlying font + /// data through the IDWriteFontFileStream interface implemented by the font file loader. + /// + /// + /// Type: UINT32 + /// + /// The four-character tag of a OpenType font table to find. Use the DWRITE_MAKE_OPENTYPE_TAG macro to create it as an + /// UINT32. Unlike GDI, it does not support the special TTCF and null tags to access the whole font. + /// + /// + /// + /// Type: const void** + /// + /// When this method returns, contains the address of a pointer to the base of the table in memory. The pointer is valid only as + /// long as the font face used to get the font table still exists; (not any other font face, even if it actually refers to the + /// same physical font). This parameter is passed uninitialized. + /// + /// + /// + /// Type: UINT32* + /// When this method returns, contains a pointer to the size, in bytes, of the font table. + /// + /// + /// Type: void** + /// + /// When this method returns, the address of a pointer to the opaque context, which must be freed by calling ReleaseFontTable. + /// The context actually comes from the lower-level IDWriteFontFileStream, which may be implemented by the application or DWrite + /// itself. It is possible for a NULL tableContext to be returned, especially if the implementation performs direct + /// memory mapping on the whole file. Nevertheless, always release it later, and do not use it as a test for function success. + /// The same table can be queried multiple times, but because each returned context can be different, you must release each + /// context separately. + /// + /// + /// + /// Type: BOOL* + /// When this method returns, TRUE if the font table exists; otherwise, FALSE. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The context for the same tag may be different for each call, so each one must be held and released separately. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-trygetfonttable HRESULT TryGetFontTable( + // UINT32 openTypeTableTag, const void **tableData, UINT32 *tableSize, void **tableContext, BOOL *exists ); + HRESULT TryGetFontTable([In] uint openTypeTableTag, out IntPtr tableData, out uint tableSize, out IntPtr tableContext, [MarshalAs(UnmanagedType.Bool)] out bool exists); + + /// Releases the table obtained earlier from TryGetFontTable. + /// + /// Type: void* + /// A pointer to the opaque context from TryGetFontTable. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-releasefonttable void ReleaseFontTable( + // void *tableContext ); + [PreserveSig] + void ReleaseFontTable([In] IntPtr tableContext); + + /// Computes the outline of a run of glyphs by calling back to the outline sink interface. + /// + /// Type: FLOAT + /// The logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// + /// + /// Type: const UINT16* + /// + /// An array of glyph indices. The glyphs are in logical order and the advance direction depends on the isRightToLeft parameter. + /// The array must be allocated and be able to contain the number of elements specified by glyphCount. + /// + /// + /// + /// Type: const FLOAT* + /// + /// An optional array of glyph advances in DIPs. The advance of a glyph is the amount to advance the position (in the direction + /// of the baseline) after drawing the glyph. glyphAdvances contains the number of elements specified by glyphCount. + /// + /// + /// + /// Type: const DWRITE_GLYPH_OFFSET* + /// + /// An optional array of glyph offsets, each of which specifies the offset along the baseline and offset perpendicular to the + /// baseline of a glyph relative to the current pen position. glyphOffsets contains the number of elements specified by glyphCount. + /// + /// + /// + /// Type: UINT32 + /// The number of glyphs in the run. + /// + /// + /// Type: BOOL + /// + /// If TRUE, the ascender of the glyph runs alongside the baseline. If FALSE, the glyph ascender runs + /// perpendicular to the baseline. For example, an English alphabet on a vertical baseline would have isSideways set to FALSE. + /// + /// + /// A client can render a vertical run by setting isSideways to TRUE and rotating the resulting geometry 90 degrees to + /// the right using a transform. The isSideways and isRightToLeft parameters cannot both be true. + /// + /// + /// + /// Type: BOOL + /// + /// The visual order of the glyphs. If this parameter is FALSE, then glyph advances are from left to right. If + /// TRUE, the advance direction is right to left. By default, the advance direction is left to right. + /// + /// + /// + /// Type: IDWriteGeometrySink* + /// A pointer to the interface that is called back to perform outline drawing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getglyphrunoutline HRESULT + // GetGlyphRunOutline( FLOAT emSize, UINT16 const *glyphIndices, FLOAT const *glyphAdvances, DWRITE_GLYPH_OFFSET const + // *glyphOffsets, UINT32 glyphCount, BOOL isSideways, BOOL isRightToLeft, IDWriteGeometrySink *geometrySink ); + void GetGlyphRunOutline(float emSize, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] ushort[] glyphIndices, + [In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] float[] glyphAdvances, + [In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] DWRITE_GLYPH_OFFSET[] glyphOffsets, + uint glyphCount, [MarshalAs(UnmanagedType.Bool)] bool isSideways, [MarshalAs(UnmanagedType.Bool)] bool isRightToLeft, + [In] D2d1.ID2D1SimplifiedGeometrySink geometrySink); + + /// Determines the recommended rendering mode for the font, using the specified size and rendering parameters. + /// + /// Type: FLOAT + /// The logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// + /// + /// Type: FLOAT + /// + /// The number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96, this value is 1.0f. If the + /// DPI is 120, this value is 120.0f/96. + /// + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// + /// The measuring method that will be used for glyphs in the font. Renderer implementations may choose different rendering modes + /// for different measuring methods, for example: + /// + /// + /// + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL + /// + /// + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC + /// + /// + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL + /// + /// + /// + /// + /// Type: IDWriteRenderingParams* + /// + /// A pointer to an object that contains rendering settings such as gamma level, enhanced contrast, and ClearType level. This + /// parameter is necessary in case the rendering parameters object overrides the rendering mode. + /// + /// + /// + /// Type: DWRITE_RENDERING_MODE* + /// When this method returns, contains a value that indicates the recommended rendering mode to use. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getrecommendedrenderingmode HRESULT + // GetRecommendedRenderingMode( FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MEASURING_MODE measuringMode, IDWriteRenderingParams + // *renderingParams, DWRITE_RENDERING_MODE *renderingMode ); + DWRITE_RENDERING_MODE GetRecommendedRenderingMode(float emSize, float pixelsPerDip, DWRITE_MEASURING_MODE measuringMode, IDWriteRenderingParams renderingParams); + + /// + /// Obtains design units and common metrics for the font face. These metrics are applicable to all the glyphs within a fontface + /// and are used by applications for layout calculations. + /// + /// + /// Type: FLOAT + /// The logical size of the font in DIP units. + /// + /// + /// Type: FLOAT + /// The number of physical pixels per DIP. + /// + /// + /// Type: const DWRITE_MATRIX* + /// + /// An optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by + /// the font size and pixelsPerDip. + /// + /// + /// + /// Type: DWRITE_FONT_METRICS* + /// + /// A pointer to a DWRITE_FONT_METRICS structure to fill in. The metrics returned by this function are in font design units. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getgdicompatiblemetrics HRESULT + // GetGdiCompatibleMetrics( FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MATRIX const *transform, DWRITE_FONT_METRICS + // *fontFaceMetrics ); + DWRITE_FONT_METRICS GetGdiCompatibleMetrics(float emSize, float pixelsPerDip, [In, Optional] IntPtr transform); + + /// Obtains glyph metrics in font design units with the return values compatible with what GDI would produce. + /// + /// Type: FLOAT + /// The ogical size of the font in DIP units. + /// + /// + /// Type: FLOAT + /// The number of physical pixels per DIP. + /// + /// + /// Type: const DWRITE_MATRIX* + /// + /// An optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by + /// the font size and pixelsPerDip. + /// + /// + /// + /// Type: BOOL + /// + /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. When set to TRUE, the metrics + /// are the same as the metrics of text measured by GDI using a font created with CLEARTYPE_NATURAL_QUALITY. + /// + /// + /// + /// Type: const UINT16* + /// An array of glyph indices for which to compute the metrics. + /// + /// + /// Type: UINT32 + /// The number of elements in the glyphIndices array. + /// + /// + /// Type: DWRITE_GLYPH_METRICS* + /// An array of DWRITE_GLYPH_METRICS structures filled by this function. The metrics are in font design units. + /// + /// + /// Type: BOOL + /// + /// A BOOL value that indicates whether the font is being used in a sideways run. This can affect the glyph metrics if the font + /// has oblique simulation because sideways oblique simulation differs from non-sideways oblique simulation. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getgdicompatibleglyphmetrics HRESULT + // GetGdiCompatibleGlyphMetrics( FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MATRIX const *transform, BOOL useGdiNatural, UINT16 + // const *glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS *glyphMetrics, BOOL isSideways ); + void GetGdiCompatibleGlyphMetrics(float emSize, float pixelsPerDip, [In, Optional] IntPtr transform, [MarshalAs(UnmanagedType.Bool)] bool useGdiNatural, + [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] ushort[] glyphIndices, uint glyphCount, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] DWRITE_GLYPH_METRICS[] glyphMetrics, [MarshalAs(UnmanagedType.Bool)] bool isSideways = false); + } + + /// Represents a family of related fonts. + /// + /// + /// A font family is a set of fonts that share the same family name, such as "Times New Roman", but that differ in features. These + /// feature differences include style, such as italic, and weight, such as bold. + /// + /// The following illustration shows examples of fonts that are members of the "Times New Roman" font family. + /// + /// An IDWriteFontFamily object can be retrieved from a font collection using the IDWriteFontCollection::GetFontFamily method + /// shown in the following example. GetFontFamily takes a UINT32 index and returns the font family for the font at that index. + /// + /// + /// The font family name is used to specify the font family for text layout and text format objects. You can get a list of localized + /// font family names from an IDWriteFontFamily object in the form of an IDWriteLocalizedStrings object by using the + /// IDWriteFontFamily::GetFamilyNames method, as shown in the following code. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontfamily + [PInvokeData("dwrite.h", MSDNShortId = "1fce3d62-af4e-4d2b-a3fd-e534b5fcdb13")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("da20d8ef-812a-4c43-9802-62ec4abd7add")] + public interface IDWriteFontFamily : IDWriteFontList + { + /// Gets the font collection that contains the fonts in the font list. + /// + /// Type: IDWriteFontCollection** + /// When this method returns, contains the address of a pointer to the current IDWriteFontCollection object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontlist-getfontcollection HRESULT + // GetFontCollection( IDWriteFontCollection **fontCollection ); + new IDWriteFontCollection GetFontCollection(); + + /// Gets the number of fonts in the font list. + /// + /// Type: UINT32 + /// The number of fonts in the font list. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontlist-getfontcount UINT32 GetFontCount(); + [PreserveSig] + new uint GetFontCount(); + + /// Gets a font given its zero-based index. + /// + /// Type: UINT32 + /// Zero-based index of the font in the font list. + /// + /// + /// Type: IDWriteFont** + /// When this method returns, contains the address of a pointer to the newly created IDWriteFont object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontlist-getfont HRESULT GetFont( UINT32 index, + // IDWriteFont **font ); + new IDWriteFont GetFont(uint index); + + /// Creates a localized strings object that contains the family names for the font family, indexed by locale name. + /// + /// Type: IDWriteLocalizedStrings** + /// The address of a pointer to the newly created IDWriteLocalizedStrings object. + /// + /// The following code example shows how to get the font family name from a IDWriteFontFamily object. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfamily-getfamilynames HRESULT GetFamilyNames( + // IDWriteLocalizedStrings **names ); + IDWriteLocalizedStrings GetFamilyNames(); + + /// Gets the font that best matches the specified properties. + /// + /// Type: DWRITE_FONT_WEIGHT + /// A value that is used to match a requested font weight. + /// + /// + /// Type: DWRITE_FONT_STRETCH + /// A value that is used to match a requested font stretch. + /// + /// + /// Type: DWRITE_FONT_STYLE + /// A value that is used to match a requested font style. + /// + /// + /// Type: IDWriteFont** + /// When this method returns, contains the address of a pointer to the newly created IDWriteFont object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfamily-getfirstmatchingfont HRESULT + // GetFirstMatchingFont( DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFont + // **matchingFont ); + IDWriteFont GetFirstMatchingFont(DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style); + + /// Gets a list of fonts in the font family ranked in order of how well they match the specified properties. + /// + /// Type: DWRITE_FONT_WEIGHT + /// A value that is used to match a requested font weight. + /// + /// + /// Type: DWRITE_FONT_STRETCH + /// A value that is used to match a requested font stretch. + /// + /// + /// Type: DWRITE_FONT_STYLE + /// A value that is used to match a requested font style. + /// + /// + /// Type: IDWriteFontList** + /// An address of a pointer to the newly created IDWriteFontList object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfamily-getmatchingfonts HRESULT + // GetMatchingFonts( DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFontList + // **matchingFonts ); + IDWriteFontList GetMatchingFonts(DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style); + } + + /// + /// Represents a font file. Applications such as font managers or font viewers can call IDWriteFontFile::Analyze to find out if a + /// particular file is a font file, and whether it is a font type that is supported by the font system. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontfile + [PInvokeData("dwrite.h", MSDNShortId = "d4be5466-0b6c-4cc5-9f16-aa00c6037eb9")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("739d886a-cef5-47dc-8769-1a8b41bebbb0")] + public interface IDWriteFontFile + { + /// + /// Obtains the pointer to the reference key of a font file. The returned pointer is valid until the font file object is released. + /// + /// + /// Type: const void** + /// + /// When this method returns, contains an address of a pointer to the font file reference key. Note that the pointer value is + /// only valid until the font file object it is obtained from is released. This parameter is passed uninitialized. + /// + /// + /// + /// Type: UINT32* + /// When this method returns, contains the size of the font file reference key in bytes. This parameter is passed uninitialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfile-getreferencekey HRESULT GetReferenceKey( + // void const **fontFileReferenceKey, UINT32 *fontFileReferenceKeySize ); + void GetReferenceKey(out IntPtr fontFileReferenceKey, out uint fontFileReferenceKeySize); + + /// Obtains the file loader associated with a font file object. + /// + /// Type: IDWriteFontFileLoader** + /// + /// When this method returns, contains the address of a pointer to the font file loader associated with the font file object. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfile-getloader HRESULT GetLoader( + // IDWriteFontFileLoader **fontFileLoader ); + IDWriteFontFileLoader GetLoader(); + + /// + /// Analyzes a file and returns whether it represents a font, and whether the font type is supported by the font system. + /// + /// + /// Type: BOOL* + /// TRUE if the font type is supported by the font system; otherwise, FALSE. + /// + /// + /// Type: DWRITE_FONT_FILE_TYPE* + /// + /// When this method returns, contains a value that indicates the type of the font file. Note that even if isSupportedFontType + /// is FALSE, the fontFileType value may be different from DWRITE_FONT_FILE_TYPE_UNKNOWN. + /// + /// + /// + /// Type: DWRITE_FONT_FACE_TYPE* + /// + /// When this method returns, contains a value that indicates the type of the font face. If fontFileType is not equal to + /// DWRITE_FONT_FILE_TYPE_UNKNOWN, then that can be constructed from the font file. + /// + /// + /// + /// Type: UINT32* + /// When this method returns, contains the number of font faces contained in the font file. + /// + /// + /// Important Certain font file types are recognized, but not supported by the font system. For example, the font system + /// will recognize a file as a Type 1 font file but will not be able to construct a font face object from it. In such + /// situations, Analyze will set isSupportedFontType output parameter to FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfile-analyze HRESULT Analyze( BOOL + // *isSupportedFontType, DWRITE_FONT_FILE_TYPE *fontFileType, DWRITE_FONT_FACE_TYPE *fontFaceType, UINT32 *numberOfFaces ); + void Analyze([MarshalAs(UnmanagedType.Bool)] out bool isSupportedFontType, out DWRITE_FONT_FILE_TYPE fontFileType, out DWRITE_FONT_FACE_TYPE fontFaceType, out uint numberOfFaces); + } + + /// + /// Encapsulates a collection of font files. The font system uses this interface to enumerate font files when building a font collection. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontfileenumerator + [PInvokeData("dwrite.h", MSDNShortId = "d89efffd-ccda-4d55-8419-de142b0f9652")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("72755049-5ff7-435d-8348-4be97cfa6c7c")] + public interface IDWriteFontFileEnumerator + { + /// + /// Advances to the next font file in the collection. When it is first created, the enumerator is positioned before the first + /// element of the collection and the first call to MoveNext advances to the first file. + /// + /// + /// Type: BOOL* + /// + /// When the method returns, contains the value TRUE if the enumerator advances to a file; otherwise, FALSE if the + /// enumerator advances past the last file in the collection. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfileenumerator-movenext HRESULT MoveNext( BOOL + // *hasCurrentFile ); + [PreserveSig] + HRESULT MoveNext([MarshalAs(UnmanagedType.Bool)] out bool hasCurrentFile); + + /// Gets a reference to the current font file. + /// + /// Type: IDWriteFontFile** + /// When this method returns, the address of a pointer to the newly created IDWriteFontFile object. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfileenumerator-getcurrentfontfile HRESULT + // GetCurrentFontFile( IDWriteFontFile **fontFile ); + [PreserveSig] + HRESULT GetCurrentFontFile(out IDWriteFontFile fontFile); + } + + /// + /// Handles loading font file resources of a particular type from a font file reference key into a font file stream object. + /// + /// + /// The font file loader interface is recommended to be implemented by a singleton object. Note that font file loader + /// implementations must not register themselves with DirectWrite factory inside their constructors and must not unregister + /// themselves in their destructors, because registration and unregistraton operations increment and decrement the object reference + /// count respectively. Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed + /// outside of the font file loader implementation as a separate step. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontfileloader + [PInvokeData("dwrite.h", MSDNShortId = "855e281e-3855-4c11-af87-68f8e0dadbf8")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("727cad4e-d6af-4c9e-8a08-d695b11caa49")] + public interface IDWriteFontFileLoader + { + /// Creates a font file stream object that encapsulates an open file resource. + /// + /// Type: const void* + /// A pointer to a font file reference key that uniquely identifies the font file resource within the scope of the font loader being used. The buffer allocated for this key must at least be the size, in bytes, specified by fontFileReferenceKeySize. + /// + /// + /// Type: UINT32 + /// The size of font file reference key, in bytes. + /// + /// + /// Type: IDWriteFontFileStream** + /// When this method returns, contains the address of a pointer to the newly created IDWriteFontFileStream object. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The resource is closed when the last reference to fontFileStream is released. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfileloader-createstreamfromkey + // HRESULT CreateStreamFromKey( void const *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileStream **fontFileStream ); + [PreserveSig] + HRESULT CreateStreamFromKey([In] IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, out IDWriteFontFileStream fontFileStream); + } + + /// Loads font file data from a custom font file loader. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontfilestream + [PInvokeData("dwrite.h", MSDNShortId = "792ab9be-853f-427d-a762-2da8e81423f8")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0")] + public interface IDWriteFontFileStream + { + /// Reads a fragment from a font file. + /// + /// Type: const void** + /// When this method returns, contains an address of a pointer to the start of the font file fragment. This parameter is passed uninitialized. + /// + /// + /// Type: UINT64 + /// The offset of the fragment, in bytes, from the beginning of the font file. + /// + /// + /// Type: UINT64 + /// The size of the file fragment, in bytes. + /// + /// + /// Type: void** + /// When this method returns, contains the address of a pointer to a pointer to the client-defined context to be passed to ReleaseFileFragment. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// Note that ReadFileFragment implementations must check whether the requested font file fragment is within the file bounds. Otherwise, an error should be returned from ReadFileFragment. + /// DirectWrite may invoke IDWriteFontFileStream methods on the same object from multiple threads simultaneously. Therefore, ReadFileFragment implementations that rely on internal mutable state must serialize access to such state across multiple threads. For example, an implementation that uses separate Seek and Read operations to read a file fragment must place the code block containing Seek and Read calls under a lock or a critical section. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfilestream-readfilefragment + // HRESULT ReadFileFragment( void const **fragmentStart, UINT64 fileOffset, UINT64 fragmentSize, void **fragmentContext ); + [PreserveSig] + HRESULT ReadFileFragment(out IntPtr fragmentStart, ulong fileOffset, ulong fragmentSize, [Out] out IntPtr fragmentContext); + + /// Releases a fragment from a file. + /// + /// Type: void* + /// A pointer to the client-defined context of a font fragment returned from ReadFileFragment. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfilestream-releasefilefragment void + // ReleaseFileFragment( void *fragmentContext ); + [PreserveSig] + void ReleaseFileFragment([In] IntPtr fragmentContext); + + /// Obtains the total size of a file. + /// + /// Type: UINT64* + /// When this method returns, contains the total size of the file. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// Implementing GetFileSize() for asynchronously loaded font files may require downloading the complete file contents. Therefore, this method should be used only for operations that either require a complete font file to be loaded (for example, copying a font file) or that need to make decisions based on the value of the file size (for example, validation against a persisted file size). + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfilestream-getfilesize + // HRESULT GetFileSize( UINT64 *fileSize ); + [PreserveSig] + HRESULT GetFileSize(out ulong fileSize); + + /// Obtains the last modified time of the file. + /// + /// Type: UINT64* + /// When this method returns, contains the last modified time of the file in the format that represents the number of 100-nanosecond intervals since January 1, 1601 (UTC). + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The "last modified time" is used by DirectWrite font selection algorithms to determine whether one font resource is more up to date than another one. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfilestream-getlastwritetime + // HRESULT GetLastWriteTime( UINT64 *lastWriteTime ); + [PreserveSig] + HRESULT GetLastWriteTime(out FILETIME lastWriteTime); + } + + /// Represents a list of fonts. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritefontlist + [PInvokeData("dwrite.h", MSDNShortId = "00c41c5f-4405-45ff-98e5-03858dc3056f")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb")] + public interface IDWriteFontList + { + /// Gets the font collection that contains the fonts in the font list. + /// + /// Type: IDWriteFontCollection** + /// When this method returns, contains the address of a pointer to the current IDWriteFontCollection object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontlist-getfontcollection HRESULT + // GetFontCollection( IDWriteFontCollection **fontCollection ); + IDWriteFontCollection GetFontCollection(); + + /// Gets the number of fonts in the font list. + /// + /// Type: UINT32 + /// The number of fonts in the font list. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontlist-getfontcount UINT32 GetFontCount(); + [PreserveSig] + uint GetFontCount(); + + /// Gets a font given its zero-based index. + /// + /// Type: UINT32 + /// Zero-based index of the font in the font list. + /// + /// + /// Type: IDWriteFont** + /// When this method returns, contains the address of a pointer to the newly created IDWriteFont object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontlist-getfont HRESULT GetFont( UINT32 index, + // IDWriteFont **font ); + IDWriteFont GetFont(uint index); + } + + /// + /// Provides interoperability with GDI, such as methods to convert a font face to a LOGFONT structure, or to convert a GDI font + /// description into a font face. It is also used to create bitmap render target objects. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritegdiinterop + [PInvokeData("dwrite.h", MSDNShortId = "79472021-ee12-45dd-a943-3908c9e06cde")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1edd9491-9853-4299-898f-6432983b6f3a")] + public interface IDWriteGdiInterop + { + /// Creates a font object that matches the properties specified by the LOGFONT structure. + /// + /// Type: const LOGFONTW* + /// A structure containing a GDI-compatible font description. + /// + /// + /// Type: IDWriteFont** + /// + /// When this method returns, contains an address of a pointer to a newly created IDWriteFont object if successful; otherwise, NULL. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritegdiinterop-createfontfromlogfont HRESULT + // CreateFontFromLOGFONT( LOGFONTW const *logFont, IDWriteFont **font ); + IDWriteFont CreateFontFromLOGFONT(in LOGFONT logFont); + + /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. + /// + /// Type: IDWriteFont* + /// An IDWriteFont object to be converted into a GDI-compatible LOGFONT structure. + /// + /// + /// Type: LOGFONTW* + /// When this method returns, contains a structure that receives a GDI-compatible font description. + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains TRUE if the specified font object is part of the system font collection; + /// otherwise, FALSE. + /// + /// + /// + /// The conversion to a LOGFONT by using ConvertFontToLOGFONT operates at the logical font level and does not + /// guarantee that it will map to a specific physical font. It is not guaranteed that GDI will select the same physical font for + /// displaying text formatted by a LOGFONT as the IDWriteFont object that was converted. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritegdiinterop-convertfonttologfont HRESULT + // ConvertFontToLOGFONT( IDWriteFont *font, LOGFONTW *logFont, BOOL *isSystemFont ); + void ConvertFontToLOGFONT([In] IDWriteFont font, out LOGFONT logFont, [MarshalAs(UnmanagedType.Bool)] out bool isSystemFont); + + /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. + /// + /// Type: IDWriteFontFace* + /// An IDWriteFontFace object to be converted into a GDI-compatible LOGFONT structure. + /// + /// + /// Type: LOGFONTW* + /// When this method returns, contains a pointer to a structure that receives a GDI-compatible font description. + /// + /// + /// The conversion to a LOGFONT by using ConvertFontFaceToLOGFONT operates at the logical font level and does not + /// guarantee that it will map to a specific physical font. It is not guaranteed that GDI will select the same physical font for + /// displaying text formatted by a LOGFONT as the IDWriteFont object that was converted. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritegdiinterop-convertfontfacetologfont HRESULT + // ConvertFontFaceToLOGFONT( IDWriteFontFace *font, LOGFONTW *logFont ); + LOGFONT ConvertFontFaceToLOGFONT([In] IDWriteFontFace font); + + /// + /// Creates an IDWriteFontFace object that corresponds to the currently selected HFONT of the specified HDC. + /// + /// + /// Type: HDC + /// + /// A handle to a device context into which a font has been selected. It is assumed that the client has already performed font + /// mapping and that the font selected into the device context is the actual font to be used for rendering glyphs. + /// + /// + /// + /// Type: IDWriteFontFace** + /// + /// Contains an address of a pointer to the newly created font face object, or NULL in case of failure. The font face + /// returned is guaranteed to reference the same physical typeface that would be used for drawing glyphs (but not necessarily + /// characters) using ExtTextOut. + /// + /// + /// + /// This function is intended for scenarios in which an application wants to use GDI and Uniscribe 1.x for text layout and + /// shaping, but DirectWrite for final rendering. This function assumes the client is performing text output using glyph indexes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritegdiinterop-createfontfacefromhdc HRESULT + // CreateFontFaceFromHdc( HDC hdc, IDWriteFontFace **fontFace ); + IDWriteFontFace CreateFontFaceFromHdc(HDC hdc); + + /// + /// Creates an object that encapsulates a bitmap and memory DC (device context) which can be used for rendering glyphs. + /// + /// + /// Type: HDC + /// A handle to the optional device context used to create a compatible memory DC (device context). + /// + /// + /// Type: UINT32 + /// The width of the bitmap render target. + /// + /// + /// Type: UINT32 + /// The height of the bitmap render target. + /// + /// + /// Type: IDWriteBitmapRenderTarget** + /// When this method returns, contains an address of a pointer to the newly created IDWriteBitmapRenderTarget object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritegdiinterop-createbitmaprendertarget HRESULT + // CreateBitmapRenderTarget( HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **renderTarget ); + IDWriteBitmapRenderTarget CreateBitmapRenderTarget([In, Optional] HDC hdc, uint width, uint height); + } + + /// Contains low-level information used to render a glyph run. + /// + /// The alpha texture can be a bi-level alpha texture or a ClearType alpha texture. + /// + /// A bi-level alpha texture contains one byte per pixel, therefore the size of the buffer for a bi-level texture will be the area + /// of the texture bounds, in bytes. Each byte in a bi-level alpha texture created by CreateAlphaTexture is either set to + /// DWRITE_ALPHA_MAX (that is, 255) or zero. + /// + /// + /// A ClearType alpha texture contains three bytes per pixel, therefore the size of the buffer for a ClearType alpha texture is + /// three times the area of the texture bounds, in bytes. + /// + /// Examples + /// + /// The following code example shows how to create a glyph run analysis object. In this example, an empty glyph run is being used. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwriteglyphrunanalysis + [PInvokeData("dwrite.h", MSDNShortId = "d4739b55-1a9b-4346-9b47-d8adb98df163")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("7d97dbf7-e085-42d4-81e3-6a883bded118")] + public interface IDWriteGlyphRunAnalysis + { + /// Gets the bounding rectangle of the physical pixels affected by the glyph run. + /// + /// Type: DWRITE_TEXTURE_TYPE + /// + /// Specifies the type of texture requested. If a bi-level texture is requested, the bounding rectangle includes only bi-level + /// glyphs. Otherwise, the bounding rectangle includes only antialiased glyphs. + /// + /// + /// + /// Type: RECT* + /// + /// When this method returns, contains the bounding rectangle of the physical pixels affected by the glyph run, or an empty + /// rectangle if there are no glyphs of the specified texture type. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteglyphrunanalysis-getalphatexturebounds HRESULT + // GetAlphaTextureBounds( DWRITE_TEXTURE_TYPE textureType, RECT *textureBounds ); + RECT GetAlphaTextureBounds(DWRITE_TEXTURE_TYPE textureType); + + /// Creates an alpha texture of the specified type for glyphs within a specified bounding rectangle. + /// + /// Type: DWRITE_TEXTURE_TYPE + /// + /// A value that specifies the type of texture requested. This can be DWRITE_TEXTURE_BILEVEL_1x1 or + /// DWRITE_TEXTURE_CLEARTYPE_3x1. If a bi-level texture is requested, the texture contains only bi-level glyphs. + /// Otherwise, the texture contains only antialiased glyphs. + /// + /// + /// + /// Type: const RECT* + /// The bounding rectangle of the texture, which can be different than the bounding rectangle returned by GetAlphaTextureBounds. + /// + /// + /// Type: BYTE* + /// + /// When this method returns, contains the array of alpha values from the texture. The buffer allocated for this array must be + /// at least the size of bufferSize. + /// + /// + /// + /// Type: UINT32 + /// + /// The size of the alphaValues array, in bytes. The minimum size depends on the dimensions of the rectangle and the type of + /// texture requested. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteglyphrunanalysis-createalphatexture HRESULT + // CreateAlphaTexture( DWRITE_TEXTURE_TYPE textureType, RECT const *textureBounds, BYTE *alphaValues, UINT32 bufferSize ); + void CreateAlphaTexture(DWRITE_TEXTURE_TYPE textureType, in RECT textureBounds, [Out] IntPtr alphaValues, uint bufferSize); + + /// Gets alpha blending properties required for ClearType blending. + /// + /// Type: IDWriteRenderingParams* + /// + /// An object that specifies the ClearType level and enhanced contrast, gamma, pixel geometry, and rendering mode. In most + /// cases, the values returned by the output parameters of this method are based on the properties of this object, unless a + /// GDI-compatible rendering mode was specified. + /// + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the gamma value to use for gamma correction. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the enhanced contrast value to be used for blending. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the ClearType level used in the alpha blending. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteglyphrunanalysis-getalphablendparams HRESULT + // GetAlphaBlendParams( IDWriteRenderingParams *renderingParams, FLOAT *blendGamma, FLOAT *blendEnhancedContrast, FLOAT + // *blendClearTypeLevel ); + void GetAlphaBlendParams([In] IDWriteRenderingParams renderingParams, out float blendGamma, out float blendEnhancedContrast, out float blendClearTypeLevel); + } + + /// + /// Wraps an application-defined inline graphic, allowing DWrite to query metrics as if the graphic were a glyph inline with the text. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwriteinlineobject + [PInvokeData("dwrite.h", MSDNShortId = "cf915458-acbc-4a37-be5c-b1337153f386")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("8339FDE3-106F-47ab-8373-1C6295EB10B3")] + public interface IDWriteInlineObject + { + /// + /// The application implemented rendering callback (IDWriteTextRenderer::DrawInlineObject) can use this to draw the inline + /// object without needing to cast or query the object type. The text layout does not call this method directly. + /// + /// + /// Type: void* + /// The drawing context passed to IDWriteTextLayout::Draw. This parameter may be NULL. + /// + /// + /// Type: IDWriteTextRenderer* + /// + /// The same renderer passed to IDWriteTextLayout::Draw as the object's containing parent. This is useful if the inline object + /// is recursive such as a nested layout. + /// + /// + /// + /// Type: FLOAT + /// The x-coordinate at the upper-left corner of the inline object. + /// + /// + /// Type: FLOAT + /// The y-coordinate at the upper-left corner of the inline object. + /// + /// + /// Type: BOOL + /// A Boolean flag that indicates whether the object's baseline runs alongside the baseline axis of the line. + /// + /// + /// Type: BOOL + /// A Boolean flag that indicates whether the object is in a right-to-left context and should be drawn flipped. + /// + /// + /// Type: IUnknown* + /// + /// The drawing effect set in IDWriteTextLayout::SetDrawingEffect. Usually this effect is a foreground brush that is used in + /// glyph drawing. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteinlineobject-draw HRESULT Draw( void + // *clientDrawingContext, IDWriteTextRenderer *renderer, FLOAT originX, FLOAT originY, BOOL isSideways, BOOL isRightToLeft, + // IUnknown *clientDrawingEffect ); + void Draw([In, Optional] IntPtr clientDrawingContext, [In] IDWriteTextRenderer renderer, float originX, float originY, + [MarshalAs(UnmanagedType.Bool)] bool isSideways, [MarshalAs(UnmanagedType.Bool)] bool isRightToLeft, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object clientDrawingEffect); + + /// IDWriteTextLayout calls this callback function to get the measurement of the inline object. + /// + /// Type: DWRITE_INLINE_OBJECT_METRICS* + /// + /// When this method returns, contains a structure describing the geometric measurement of an application-defined inline object. + /// These metrics are in relation to the baseline of the adjacent text. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteinlineobject-getmetrics HRESULT GetMetrics( + // DWRITE_INLINE_OBJECT_METRICS *metrics ); + DWRITE_INLINE_OBJECT_METRICS GetMetrics(); + + /// + /// + /// IDWriteTextLayout calls this callback function to get the visible extents (in DIPs) of the inline object. In the case of a + /// simple bitmap, with no padding and no overhang, all the overhangs will simply be zeroes. + /// + /// + /// The overhangs should be returned relative to the reported size of the object (see DWRITE_INLINE_OBJECT_METRICS), and should + /// not be baseline adjusted. + /// + /// + /// + /// Type: DWRITE_OVERHANG_METRICS* + /// Overshoot of visible extents (in DIPs) outside the object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteinlineobject-getoverhangmetrics HRESULT + // GetOverhangMetrics( DWRITE_OVERHANG_METRICS *overhangs ); + DWRITE_OVERHANG_METRICS GetOverhangMetrics(); + + /// Layout uses this to determine the line-breaking behavior of the inline object among the text. + /// + /// Type: DWRITE_BREAK_CONDITION* + /// + /// When this method returns, contains a value which indicates the line-breaking condition between the object and the content + /// immediately preceding it. + /// + /// + /// + /// Type: DWRITE_BREAK_CONDITION* + /// + /// When this method returns, contains a value which indicates the line-breaking condition between the object and the content + /// immediately following it. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriteinlineobject-getbreakconditions HRESULT + // GetBreakConditions( DWRITE_BREAK_CONDITION *breakConditionBefore, DWRITE_BREAK_CONDITION *breakConditionAfter ); + void GetBreakConditions(out DWRITE_BREAK_CONDITION breakConditionBefore, out DWRITE_BREAK_CONDITION breakConditionAfter); + } + + /// + /// A built-in implementation of the IDWriteFontFileLoader interface, that operates on local font files and exposes local + /// font file information from the font file reference key. Font file references created using CreateFontFileReference use + /// this font file loader. + /// + // https://docs.microsoft.com/en-us/windows/win32/directwrite/idwritelocalfontfileloader + [PInvokeData("dwrite.h", MSDNShortId = "acb777c8-24c6-452e-8f58-8fb2ad8c0b6c")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2")] + public interface IDWriteLocalFontFileLoader : IDWriteFontFileLoader + { + /// Creates a font file stream object that encapsulates an open file resource. + /// + /// Type: const void* + /// A pointer to a font file reference key that uniquely identifies the font file resource within the scope of the font loader being used. The buffer allocated for this key must at least be the size, in bytes, specified by fontFileReferenceKeySize. + /// + /// + /// Type: UINT32 + /// The size of font file reference key, in bytes. + /// + /// + /// Type: IDWriteFontFileStream** + /// When this method returns, contains the address of a pointer to the newly created IDWriteFontFileStream object. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The resource is closed when the last reference to fontFileStream is released. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfileloader-createstreamfromkey + // HRESULT CreateStreamFromKey( void const *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileStream **fontFileStream ); + [PreserveSig] + new HRESULT CreateStreamFromKey([In] IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, out IDWriteFontFileStream fontFileStream); + + /// Obtains the length of the absolute file path from the font file reference key. + /// + /// Type: const void* + /// Font file reference key that uniquely identifies the local font file within the scope of the font loader being used. + /// + /// + /// Type: UINT32 + /// Size of font file reference key in bytes. + /// + /// + /// Type: UINT32* + /// Length of the file path string, not including the terminated NULL character. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalfontfileloader-getfilepathlengthfromkey + // HRESULT GetFilePathLengthFromKey( void const *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, UINT32 *filePathLength ); + [PreserveSig] + HRESULT GetFilePathLengthFromKey(IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, out uint filePathLength); + + /// Obtains the absolute font file path from the font file reference key. + /// + /// Type: const void* + /// The font file reference key that uniquely identifies the local font file within the scope of the font loader being used. + /// + /// + /// Type: UINT32 + /// The size of font file reference key in bytes. + /// + /// + /// Type: WCHAR* + /// The character array that receives the local file path. + /// + /// + /// Type: UINT32 + /// The length of the file path character array. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalfontfileloader-getfilepathfromkey + // HRESULT GetFilePathFromKey( void const *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, WCHAR *filePath, UINT32 filePathSize ); + [PreserveSig] + HRESULT GetFilePathFromKey(IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder filePath, uint filePathSize); + + /// Obtains the last write time of the file from the font file reference key. + /// + /// Type: const void* + /// The font file reference key that uniquely identifies the local font file within the scope of the font loader being used. + /// + /// + /// Type: UINT32 + /// The size of font file reference key in bytes. + /// + /// + /// Type: FILETIME* + /// The time of the last font file modification. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalfontfileloader-getlastwritetimefromkey + // HRESULT GetLastWriteTimeFromKey( void const *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, FILETIME *lastWriteTime ); + [PreserveSig] + HRESULT GetLastWriteTimeFromKey(IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, out FILETIME lastWriteTime); + } + + /// Represents a collection of strings indexed by locale name. + /// + /// + /// The set of strings represented by an IDWriteLocalizedStrings are indexed by a zero based UINT32 number that maps to a + /// locale. The numeric index for a specific locale is retreived by using the FindLocaleName method. + /// + /// + /// A common use for the IDWriteLocalizedStrings interface is to hold a list of localized font family names created by using + /// the IDWriteFontFamily::GetFamilyNames method. The following example shows how to get the family name for the "en-us" locale. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritelocalizedstrings + [PInvokeData("dwrite.h", MSDNShortId = "37bfc613-4128-45aa-b6b2-6163d44378e4")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("08256209-099a-4b34-b86d-c22b110e7771")] + public interface IDWriteLocalizedStrings + { + /// Gets the number of language/string pairs. + /// + /// Type: UINT32 + /// The number of language/string pairs. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalizedstrings-getcount UINT32 GetCount(); + [PreserveSig] + uint GetCount(); + + /// Gets the zero-based index of the locale name/string pair with the specified locale name. + /// + /// Type: const WCHAR* + /// A null-terminated array of characters containing the locale name to look for. + /// + /// + /// Type: UINT32* + /// The zero-based index of the locale name/string pair. This method initializes index to UINT_MAX. + /// + /// + /// Type: BOOL* + /// + /// When this method returns, contains TRUE if the locale name exists; otherwise, FALSE. This method initializes + /// exists to FALSE. + /// + /// + /// + /// Note that if the locale name does not exist, the return value is a success and the exists parameter is FALSE. If you + /// are getting the font family name for a font and the specified locale name does not exist, one option is to set the index to + /// 0 as shown below. There is always at least one locale for a font family. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalizedstrings-findlocalename HRESULT + // FindLocaleName( WCHAR const *localeName, UINT32 *index, BOOL *exists ); + void FindLocaleName([MarshalAs(UnmanagedType.LPWStr)] string localeName, out uint index, [MarshalAs(UnmanagedType.Bool)] out bool exists); + + /// Gets the length in characters (not including the null terminator) of the locale name with the specified index. + /// + /// Type: UINT32 + /// Zero-based index of the locale name to be retrieved. + /// + /// + /// Type: UINT32* + /// When this method returns, contains the length in characters of the locale name, not including the null terminator. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalizedstrings-getlocalenamelength HRESULT + // GetLocaleNameLength( UINT32 index, UINT32 *length ); + uint GetLocaleNameLength(uint index); + + /// Copies the locale name with the specified index to the specified array. + /// + /// Type: UINT32 + /// Zero-based index of the locale name to be retrieved. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contains a character array, which is null-terminated, that receives the locale name from the + /// language/string pair. The buffer allocated for this array must be at least the size of size, in element count. + /// + /// + /// + /// Type: UINT32 + /// The size of the array in characters. The size must include space for the terminating null character. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalizedstrings-getlocalename HRESULT + // GetLocaleName( UINT32 index, WCHAR *localeName, UINT32 size ); + void GetLocaleName(uint index, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder localeName, uint size); + + /// Gets the length in characters (not including the null terminator) of the string with the specified index. + /// + /// Type: UINT32 + /// A zero-based index of the language/string pair. + /// + /// + /// Type: UINT32* + /// The length in characters of the string, not including the null terminator, from the language/string pair. + /// + /// + /// Use GetStringLength to get the string length before calling the IDWriteLocalizedStrings::GetString method, as shown + /// in the following code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalizedstrings-getstringlength HRESULT + // GetStringLength( UINT32 index, UINT32 *length ); + uint GetStringLength(uint index); + + /// Copies the string with the specified index to the specified array. + /// + /// Type: UINT32 + /// The zero-based index of the language/string pair to be examined. + /// + /// + /// Type: WCHAR* + /// + /// The null terminated array of characters that receives the string from the language/string pair. The buffer allocated for + /// this array should be at least the size of size. GetStringLength can be used to get the size of the array before using this method. + /// + /// + /// + /// Type: UINT32 + /// + /// The size of the array in characters. The size must include space for the terminating null character. GetStringLength can be + /// used to get the size of the array before using this method. + /// + /// + /// + /// The string returned must be allocated by the caller. You can get the size of the string by using the GetStringLength method + /// prior to calling GetString, as shown in the following example. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritelocalizedstrings-getstring HRESULT GetString( + // UINT32 index, WCHAR *stringBuffer, UINT32 size ); + void GetString(uint index, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder stringBuffer, uint size); + } + + /// Holds the appropriate digits and numeric punctuation for a specified locale. + // https://docs.microsoft.com/en-us/windows/win32/directwrite/idwritenumbersubstitution + [PInvokeData("", MSDNShortId = "bf8caeea-6ede-4cd3-84f7-2e8314af50db")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("14885CC9-BAB0-4f90-B6ED-5C366A2CD03D")] + public interface IDWriteNumberSubstitution + { + } + + /// + /// Defines the pixel snapping properties such as pixels per DIP(device-independent pixel) and the current transform matrix of a + /// text renderer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritepixelsnapping + [PInvokeData("dwrite.h", MSDNShortId = "b1b1eeb7-934f-42f4-ac01-50973a94996e")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("eaf3a2da-ecf4-4d24-b644-b34f6842024b")] + public interface IDWritePixelSnapping + { + /// + /// Determines whether pixel snapping is disabled. The recommended default is FALSE, unless doing animation that requires + /// subpixel vertical placement. + /// + /// + /// Type: void* + /// The context passed to IDWriteTextLayout::Draw. + /// + /// + /// [out] Type: BOOL* + /// Receives TRUE if pixel snapping is disabled; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/dd371281(v%3Dvs.85) virtual HRESULT + // IsPixelSnappingEnabled( void * clientDrawingContext, [out] BOOL * isDisabled ) = 0; + [return: MarshalAs(UnmanagedType.Bool)] + bool IsPixelSnappingDisabled([In, Optional] IntPtr clientDrawingContext); + + /// Gets a transform that maps abstract coordinates to DIPs. + /// + /// Type: void* + /// The drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: DWRITE_MATRIX* + /// When this method returns, contains a structure which has transform information for pixel snapping. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritepixelsnapping-getcurrenttransform HRESULT + // GetCurrentTransform( void *clientDrawingContext, DWRITE_MATRIX *transform ); + DWRITE_MATRIX GetCurrentTransform([In, Optional] IntPtr clientDrawingContext); + + /// Gets the number of physical pixels per DIP. + /// + /// Type: void* + /// The drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the number of physical pixels per DIP. + /// + /// + /// Because a DIP (device-independent pixel) is 1/96 inch, the pixelsPerDip value is the number of logical pixels per inch + /// divided by 96. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritepixelsnapping-getpixelsperdip HRESULT + // GetPixelsPerDip( void *clientDrawingContext, FLOAT *pixelsPerDip ); + float GetPixelsPerDip([In, Optional] IntPtr clientDrawingContext); + } + + /// + /// + /// Represents text rendering settings such as ClearType level, enhanced contrast, and gamma correction for glyph rasterization and filtering. + /// + /// + /// An application typically obtains a rendering parameters object by calling the IDWriteFactory::CreateMonitorRenderingParams method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwriterenderingparams + [PInvokeData("dwrite.h", MSDNShortId = "28b118e4-9a63-46cf-8ab7-e1039126405b")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2f0da53a-2add-47cd-82ee-d9ec34688e75")] + public interface IDWriteRenderingParams + { + /// Gets the gamma value used for gamma correction. Valid values must be greater than zero and cannot exceed 256. + /// + /// Type: FLOAT + /// Returns the gamma value used for gamma correction. Valid values must be greater than zero and cannot exceed 256. + /// + /// + /// The gamma value is used for gamma correction, which compensates for the non-linear luminosity response of most monitors. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getgamma FLOAT GetGamma(); + [PreserveSig] + float GetGamma(); + + /// + /// Gets the enhanced contrast property of the rendering parameters object. Valid values are greater than or equal to zero. + /// + /// + /// Type: FLOAT + /// Returns the amount of contrast enhancement. Valid values are greater than or equal to zero. + /// + /// + /// Enhanced contrast is the amount to increase the darkness of text, and typically ranges from 0 to 1. Zero means no contrast enhancement. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getenhancedcontrast FLOAT GetEnhancedContrast(); + [PreserveSig] + float GetEnhancedContrast(); + + /// Gets the ClearType level of the rendering parameters object. + /// + /// Type: FLOAT + /// The ClearType level of the rendering parameters object. + /// + /// + /// The ClearType level represents the amount of ClearType that is, the degree to which the red, green, and blue subpixels of + /// each pixel are treated differently. Valid values range from zero (meaning no ClearType, which is equivalent to grayscale + /// anti-aliasing) to one (meaning full ClearType) + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getcleartypelevel FLOAT GetClearTypeLevel(); + [PreserveSig] + float GetClearTypeLevel(); + + /// Gets the pixel geometry of the rendering parameters object. + /// + /// Type: DWRITE_PIXEL_GEOMETRY + /// A value that indicates the type of pixel geometry used in the rendering parameters object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getpixelgeometry + // DWRITE_PIXEL_GEOMETRY GetPixelGeometry(); + [PreserveSig] + DWRITE_PIXEL_GEOMETRY GetPixelGeometry(); + + /// Gets the rendering mode of the rendering parameters object. + /// + /// Type: DWRITE_RENDERING_MODE + /// A value that indicates the rendering mode of the rendering parameters object. + /// + /// + /// By default, the rendering mode is initialized to DWRITE_RENDERING_MODE_DEFAULT, which means the rendering mode is determined + /// automatically based on the font and size. To determine the recommended rendering mode to use for a given font and size and + /// rendering parameters object, use the IDWriteFontFace::GetRecommendedRenderingMode method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getrenderingmode + // DWRITE_RENDERING_MODE GetRenderingMode(); + [PreserveSig] + DWRITE_RENDERING_MODE GetRenderingMode(); + } + + /// This interface is implemented by the text analyzer's client to receive the output of a given text analysis. + /// + /// The text analyzer disregards any current state of the analysis sink, therefore, a Set method call on a range overwrites the + /// previously set analysis result of the same range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextanalysissink + [PInvokeData("dwrite.h", MSDNShortId = "1fd2ca46-006c-4b01-8258-6c24f4be1641")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5810cd44-0ca0-4701-b3fa-bec5182ae4f6")] + public interface IDWriteTextAnalysisSink + { + /// Reports script analysis for the specified text range. + /// + /// Type: UINT32 + /// The starting position from which to report. + /// + /// + /// Type: UINT32 + /// The number of UTF16 units of the reported range. + /// + /// + /// Type: const DWRITE_SCRIPT_ANALYSIS* + /// + /// A pointer to a structure that contains a zero-based index representation of a writing system script and a value indicating + /// whether additional shaping of text is required. + /// + /// + /// + /// Type: HRESULT + /// A successful code or error code to stop analysis. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissink-setscriptanalysis HRESULT + // SetScriptAnalysis( UINT32 textPosition, UINT32 textLength, DWRITE_SCRIPT_ANALYSIS const *scriptAnalysis ); + [PreserveSig] + HRESULT SetScriptAnalysis(uint textPosition, uint textLength, in DWRITE_SCRIPT_ANALYSIS scriptAnalysis); + + /// Sets line-break opportunities for each character, starting from the specified position. + /// + /// Type: UINT32 + /// The starting text position from which to report. + /// + /// + /// Type: UINT32 + /// The number of UTF16 units of the reported range. + /// + /// + /// Type: DWRITE_LINE_BREAKPOINT* + /// + /// A pointer to a structure that contains breaking conditions set for each character from the starting position to the end of + /// the specified range. + /// + /// + /// + /// Type: HRESULT + /// A successful code or error code to stop analysis. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissink-setlinebreakpoints HRESULT + // SetLineBreakpoints( UINT32 textPosition, UINT32 textLength, DWRITE_LINE_BREAKPOINT const *lineBreakpoints ); + [PreserveSig] + HRESULT SetLineBreakpoints(uint textPosition, uint textLength, [In] DWRITE_LINE_BREAKPOINT[] lineBreakpoints); + + /// Sets a bidirectional level on the range, which is called once per run change (either explicit or resolved implicit). + /// + /// Type: UINT32 + /// The starting position from which to report. + /// + /// + /// Type: UINT32 + /// The number of UTF16 units of the reported range. + /// + /// + /// Type: UINT8 + /// + /// The explicit level from the paragraph reading direction and any embedded control codes RLE/RLO/LRE/LRO/PDF, which is + /// determined before any additional rules. + /// + /// + /// + /// Type: UINT8 + /// + /// The final implicit level considering the explicit level and characters' natural directionality, after all Bidi rules have + /// been applied. + /// + /// + /// + /// Type: HRESULT + /// A successful code or error code to stop analysis. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissink-setbidilevel HRESULT + // SetBidiLevel( UINT32 textPosition, UINT32 textLength, UINT8 explicitLevel, UINT8 resolvedLevel ); + [PreserveSig] + HRESULT SetBidiLevel(uint textPosition, uint textLength, byte explicitLevel, byte resolvedLevel); + + /// Sets the number substitution on the text range affected by the text analysis. + /// + /// Type: UINT32 + /// The starting position from which to report. + /// + /// + /// Type: UINT32 + /// The number of UTF16 units of the reported range. + /// + /// + /// Type: IDWriteNumberSubstitution* + /// + /// An object that holds the appropriate digits and numeric punctuation for a given locale. Use + /// IDWriteFactory::CreateNumberSubstitution to create this object. + /// + /// + /// + /// Type: HRESULT + /// A successful code or error code to stop analysis. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissink-setnumbersubstitution HRESULT + // SetNumberSubstitution( UINT32 textPosition, UINT32 textLength, IDWriteNumberSubstitution *numberSubstitution ); + [PreserveSig] + HRESULT SetNumberSubstitution(uint textPosition, uint textLength, [In] IDWriteNumberSubstitution numberSubstitution); + } + + /// + /// Implemented by the text analyzer's client to provide text to the analyzer. It allows the separation between the logical view of + /// text as a continuous stream of characters identifiable by unique text positions, and the actual memory layout of potentially + /// discrete blocks of text in the client's backing store. + /// + /// + /// If any of these callbacks returns an error, then the analysis functions will stop prematurely and return a callback error. Note + /// that rather than return E_NOTIMPL, an application should stub the method and return a constant/null and S_OK. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextanalysissource + [PInvokeData("dwrite.h", MSDNShortId = "7e2a523d-9191-4f99-9e73-a7955c432126")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("688e1a58-5094-47c8-adc8-fbcea60ae92b")] + public interface IDWriteTextAnalysisSource + { + /// Gets a block of text starting at the specified text position. + /// + /// Type: UINT32 + /// + /// The first position of the piece to obtain. All positions are in UTF16 code units, not whole characters, which matters + /// when supplementary characters are used. + /// + /// + /// + /// Type: const WCHAR** + /// + /// When this method returns, contains an address of the block of text as an array of characters to be retrieved from the text analysis. + /// + /// + /// + /// Type: UINT32* + /// + /// When this method returns, contains the number of UTF16 units of the retrieved chunk. The returned length is not the + /// length of the block, but the length remaining in the block, from the specified position until its end. For example, querying + /// for a position that is 75 positions into a 100-position block would return 25. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// Returning NULL indicates the end of text, which is the position after the last character. This function is called + /// iteratively for each consecutive block, tying together several fragmented blocks in the backing store into a virtual + /// contiguous string. + /// + /// + /// Although applications can implement sparse textual content that maps only part of the backing store, the application must + /// map any text that is in the range passed to any analysis functions. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissource-gettextatposition HRESULT + // GetTextAtPosition( UINT32 textPosition, WCHAR const **textString, UINT32 *textLength ); + [PreserveSig] + HRESULT GetTextAtPosition(uint textPosition, out StrPtrUni textString, out uint textLength); + + /// Gets a block of text immediately preceding the specified position. + /// + /// Type: UINT32 + /// The position immediately after the last position of the block of text to obtain. + /// + /// + /// Type: const WCHAR** + /// + /// When this method returns, contains an address of a pointer to the block of text, as an array of characters from the + /// specified range. The text range will be from textPosition to the front of the block. + /// + /// + /// + /// Type: UINT32* + /// + /// Number of UTF16 units of the retrieved block. The length returned is from the specified position to the front of the block. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// NULL indicates no chunk available at the specified position, either because textPosition equals 0, textPosition is greater + /// than the entire text content length, or the queried position is not mapped into the application's backing store. + /// + /// + /// Although applications can implement sparse textual content that maps only part of the backing store, the application must + /// map any text that is in the range passed to any analysis functions. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissource-gettextbeforeposition HRESULT + // GetTextBeforePosition( UINT32 textPosition, WCHAR const **textString, UINT32 *textLength ); + [PreserveSig] + HRESULT GetTextBeforePosition(uint textPosition, out StrPtrUni textString, out uint textLength); + + /// Gets the paragraph reading direction. + /// + /// Type: DWRITE_READING_DIRECTION + /// The reading direction of the current paragraph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissource-getparagraphreadingdirection + // DWRITE_READING_DIRECTION GetParagraphReadingDirection(); + [PreserveSig] + DWRITE_READING_DIRECTION GetParagraphReadingDirection(); + + /// Gets the locale name on the range affected by the text analysis. + /// + /// Type: UINT32 + /// The text position to examine. + /// + /// + /// Type: UINT32* + /// Contains the length of the text being affected by the text analysis up to the next differing locale. + /// + /// + /// Type: const WCHAR** + /// + /// Contains an address of a pointer to an array of characters which receives the locale name from the text affected by the text + /// analysis. The array of characters is null-terminated. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The localeName pointer must remain valid until the next call or until the analysis returns. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissource-getlocalename HRESULT + // GetLocaleName( UINT32 textPosition, UINT32 *textLength, WCHAR const **localeName ); + [PreserveSig] + HRESULT GetLocaleName(uint textPosition, out uint textLength, out StrPtrUni localeName); + + /// Gets the number substitution from the text range affected by the text analysis. + /// + /// Type: UINT32 + /// The starting position from which to report. + /// + /// + /// Type: UINT32* + /// Contains the length of the text, in characters, remaining in the text range up to the next differing number substitution. + /// + /// + /// Type: IDWriteNumberSubstitution** + /// + /// Contains an address of a pointer to an object, which was created with IDWriteFactory::CreateNumberSubstitution, that holds + /// the appropriate digits and numeric punctuation for a given locale. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// Any implementation should return the number substitution with an incremented reference count, and the analysis will release + /// when finished with it (either before the next call or before it returns). However, the sink callback may hold onto it after that. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalysissource-getnumbersubstitution HRESULT + // GetNumberSubstitution( UINT32 textPosition, UINT32 *textLength, IDWriteNumberSubstitution **numberSubstitution ); + [PreserveSig] + HRESULT GetNumberSubstitution(uint textPosition, out uint textLength, out IDWriteNumberSubstitution numberSubstitution); + } + + /// + /// Analyzes various text properties for complex script processing such as bidirectional (bidi) support for languages like Arabic, + /// determination of line break opportunities, glyph placement, and number substitution. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextanalyzer + [PInvokeData("dwrite.h", MSDNShortId = "e832ffc4-31db-41b1-a008-04696d9a975e")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b7e6163e-7f46-43b4-84b3-e4e6249c365d")] + public interface IDWriteTextAnalyzer + { + /// + /// Analyzes a text range for script boundaries, reading text attributes from the source and reporting the Unicode script ID to + /// the sink callback SetScript. + /// + /// + /// Type: IDWriteTextAnalysisSource* + /// A pointer to the source object to analyze. + /// + /// + /// Type: UINT32 + /// The starting text position within the source object. + /// + /// + /// Type: UINT32 + /// The text length to analyze. + /// + /// + /// Type: IDWriteTextAnalysisSink* + /// A pointer to the sink callback object that receives the text analysis. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-analyzescript HRESULT AnalyzeScript( + // IDWriteTextAnalysisSource *analysisSource, UINT32 textPosition, UINT32 textLength, IDWriteTextAnalysisSink *analysisSink ); + void AnalyzeScript([In] IDWriteTextAnalysisSource analysisSource, uint textPosition, uint textLength, [In] IDWriteTextAnalysisSink analysisSink); + + /// + /// Analyzes a text range for script directionality, reading attributes from the source and reporting levels to the sink + /// callback SetBidiLevel. + /// + /// + /// Type: IDWriteTextAnalysisSource* + /// A pointer to a source object to analyze. + /// + /// + /// Type: UINT32 + /// The starting text position within the source object. + /// + /// + /// Type: UINT32 + /// The text length to analyze. + /// + /// + /// Type: IDWriteTextAnalysisSink* + /// A pointer to the sink callback object that receives the text analysis. + /// + /// + /// While the function can handle multiple paragraphs, the text range should not arbitrarily split the middle of paragraphs. + /// Otherwise, the returned levels may be wrong, because the Bidi algorithm is meant to apply to the paragraph as a whole. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-analyzebidi HRESULT AnalyzeBidi( + // IDWriteTextAnalysisSource *analysisSource, UINT32 textPosition, UINT32 textLength, IDWriteTextAnalysisSink *analysisSink ); + void AnalyzeBidi([In] IDWriteTextAnalysisSource analysisSource, uint textPosition, uint textLength, [In] IDWriteTextAnalysisSink analysisSink); + + /// + /// Analyzes a text range for spans where number substitution is applicable, reading attributes from the source and reporting + /// substitutable ranges to the sink callback SetNumberSubstitution. + /// + /// + /// Type: IDWriteTextAnalysisSource* + /// The source object to analyze. + /// + /// + /// Type: UINT32 + /// The starting position within the source object. + /// + /// + /// Type: UINT32 + /// The length to analyze. + /// + /// + /// Type: IDWriteTextAnalysisSink* + /// A pointer to the sink callback object that receives the text analysis. + /// + /// + /// Although the function can handle multiple ranges of differing number substitutions, the text ranges should not arbitrarily + /// split the middle of numbers. Otherwise, it will treat the numbers separately and will not translate any intervening punctuation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-analyzenumbersubstitution HRESULT + // AnalyzeNumberSubstitution( IDWriteTextAnalysisSource *analysisSource, UINT32 textPosition, UINT32 textLength, + // IDWriteTextAnalysisSink *analysisSink ); + void AnalyzeNumberSubstitution([In] IDWriteTextAnalysisSource analysisSource, uint textPosition, uint textLength, [In] IDWriteTextAnalysisSink analysisSink); + + /// + /// Analyzes a text range for potential breakpoint opportunities, reading attributes from the source and reporting breakpoint + /// opportunities to the sink callback SetLineBreakpoints. + /// + /// + /// Type: IDWriteTextAnalysisSource* + /// A pointer to the source object to analyze. + /// + /// + /// Type: UINT32 + /// The starting text position within the source object. + /// + /// + /// Type: UINT32 + /// The text length to analyze. + /// + /// + /// Type: IDWriteTextAnalysisSink* + /// A pointer to the sink callback object that receives the text analysis. + /// + /// + /// Although the function can handle multiple paragraphs, the text range should not arbitrarily split the middle of paragraphs, + /// unless the specified text span is considered a whole unit. Otherwise, the returned properties for the first and last + /// characters will inappropriately allow breaks. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-analyzelinebreakpoints HRESULT + // AnalyzeLineBreakpoints( IDWriteTextAnalysisSource *analysisSource, UINT32 textPosition, UINT32 textLength, + // IDWriteTextAnalysisSink *analysisSink ); + void AnalyzeLineBreakpoints([In] IDWriteTextAnalysisSource analysisSource, uint textPosition, uint textLength, [In] IDWriteTextAnalysisSink analysisSink); + + /// + /// Parses the input text string and maps it to the set of glyphs and associated glyph data according to the font and the + /// writing system's rendering rules. + /// + /// + /// Type: const WCHAR* + /// An array of characters to convert to glyphs. + /// + /// + /// Type: UINT32 + /// The length of textString. + /// + /// + /// Type: IDWriteFontFace* + /// The font face that is the source of the output glyphs. + /// + /// + /// Type: BOOL + /// A Boolean flag set to TRUE if the text is intended to be drawn vertically. + /// + /// + /// Type: BOOL + /// A Boolean flag set to TRUE for right-to-left text. + /// + /// + /// Type: const DWRITE_SCRIPT_ANALYSIS* + /// A pointer to a Script analysis result from an AnalyzeScript call. + /// + /// + /// Type: const WCHAR* + /// + /// The locale to use when selecting glyphs. For example the same character may map to different glyphs for ja-jp versus zh-chs. + /// If this is NULL, then the default mapping based on the script is used. + /// + /// + /// + /// Type: IDWriteNumberSubstitution* + /// + /// A pointer to an optional number substitution which selects the appropriate glyphs for digits and related numeric characters, + /// depending on the results obtained from AnalyzeNumberSubstitution. Passing NULL indicates that no substitution is + /// needed and that the digits should receive nominal glyphs. + /// + /// + /// + /// Type: const DWRITE_TYPOGRAPHIC_FEATURES** + /// An array of pointers to the sets of typographic features to use in each feature range. + /// + /// + /// Type: const UINT32* + /// The length of each feature range, in characters. The sum of all lengths should be equal to textLength. + /// + /// + /// Type: UINT32 + /// The number of feature ranges. + /// + /// + /// Type: UINT32 + /// The maximum number of glyphs that can be returned. + /// + /// + /// Type: UINT16* + /// When this method returns, contains the mapping from character ranges to glyph ranges. + /// + /// + /// Type: DWRITE_SHAPING_TEXT_PROPERTIES* + /// When this method returns, contains a pointer to an array of structures that contains shaping properties for each character. + /// + /// + /// Type: UINT16* + /// The output glyph indices. + /// + /// + /// Type: DWRITE_SHAPING_GLYPH_PROPERTIES* + /// + /// When this method returns, contains a pointer to an array of structures that contain shaping properties for each output glyph. + /// + /// + /// + /// Type: UINT32* + /// When this method returns, contains the actual number of glyphs returned if the call succeeds. + /// + /// + /// Note that the mapping from characters to glyphs is, in general, many-to-many. The recommended estimate for the per-glyph + /// output buffers is (3 * textLength / 2 + 16). This is not guaranteed to be sufficient. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-getglyphs HRESULT GetGlyphs( WCHAR + // const *textString, UINT32 textLength, IDWriteFontFace *fontFace, BOOL isSideways, BOOL isRightToLeft, DWRITE_SCRIPT_ANALYSIS + // const *scriptAnalysis, WCHAR const *localeName, IDWriteNumberSubstitution *numberSubstitution, DWRITE_TYPOGRAPHIC_FEATURES + // const **features, UINT32 const *featureRangeLengths, UINT32 featureRanges, UINT32 maxGlyphCount, UINT16 *clusterMap, + // DWRITE_SHAPING_TEXT_PROPERTIES *textProps, UINT16 *glyphIndices, DWRITE_SHAPING_GLYPH_PROPERTIES *glyphProps, UINT32 + // *actualGlyphCount ); + void GetGlyphs([MarshalAs(UnmanagedType.LPWStr)] string textString, uint textLength, [In] IDWriteFontFace fontFace, + [MarshalAs(UnmanagedType.Bool)] bool isSideways, [MarshalAs(UnmanagedType.Bool)] bool isRightToLeft, + in DWRITE_SCRIPT_ANALYSIS scriptAnalysis, [MarshalAs(UnmanagedType.LPWStr)] string localeName, + [In, Optional] IDWriteNumberSubstitution numberSubstitution, [In, Optional, MarshalAs(UnmanagedType.LPArray)] DWRITE_TYPOGRAPHIC_FEATURES[] features, + [In, Optional] uint[] featureRangeLengths, uint featureRanges, uint maxGlyphCount, [Out, MarshalAs(UnmanagedType.LPArray)] ushort[] clusterMap, + [Out, MarshalAs(UnmanagedType.LPArray)] DWRITE_SHAPING_TEXT_PROPERTIES[] textProps, [Out, MarshalAs(UnmanagedType.LPArray)] ushort[] glyphIndices, + [Out, MarshalAs(UnmanagedType.LPArray)] DWRITE_SHAPING_GLYPH_PROPERTIES[] glyphProps, out uint actualGlyphCount); + + /// Places glyphs output from the GetGlyphs method according to the font and the writing system's rendering rules. + /// + /// Type: const WCHAR* + /// An array of characters containing the original string from which the glyphs came. + /// + /// + /// Type: const UINT16* + /// A pointer to the mapping from character ranges to glyph ranges. This is returned by GetGlyphs. + /// + /// + /// Type: DWRITE_SHAPING_TEXT_PROPERTIES* + /// + /// A pointer to an array of structures that contains shaping properties for each character. This structure is returned by GetGlyphs. + /// + /// + /// + /// Type: UINT32 + /// The text length of textString. + /// + /// + /// Type: const UINT16* + /// An array of glyph indices returned by GetGlyphs. + /// + /// + /// Type: const DWRITE_SHAPING_GLYPH_PROPERTIES* + /// A pointer to an array of structures that contain shaping properties for each glyph returned by GetGlyphs. + /// + /// + /// Type: UINT32 + /// The number of glyphs returned from GetGlyphs. + /// + /// + /// Type: IDWriteFontFace* + /// A pointer to the font face that is the source for the output glyphs. + /// + /// + /// Type: FLOAT + /// The logical font size in DIPs. + /// + /// + /// Type: BOOL + /// A Boolean flag set to TRUE if the text is intended to be drawn vertically. + /// + /// + /// Type: BOOL + /// A Boolean flag set to TRUE for right-to-left text. + /// + /// + /// Type: const DWRITE_SCRIPT_ANALYSIS* + /// A pointer to a Script analysis result from an AnalyzeScript call. + /// + /// + /// Type: const WCHAR* + /// + /// An array of characters containing the locale to use when selecting glyphs. For example, the same character may map to + /// different glyphs for ja-jp versus zh-chs. If this is NULL, the default mapping based on the script is used. + /// + /// + /// + /// Type: const DWRITE_TYPOGRAPHIC_FEATURES** + /// An array of pointers to the sets of typographic features to use in each feature range. + /// + /// + /// Type: const UINT32* + /// The length of each feature range, in characters. The sum of all lengths should be equal to textLength. + /// + /// + /// Type: UINT32 + /// The number of feature ranges. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the advance width of each glyph. + /// + /// + /// Type: DWRITE_GLYPH_OFFSET* + /// When this method returns, contains the offset of the origin of each glyph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-getglyphplacements HRESULT + // GetGlyphPlacements( WCHAR const *textString, UINT16 const *clusterMap, DWRITE_SHAPING_TEXT_PROPERTIES *textProps, UINT32 + // textLength, UINT16 const *glyphIndices, DWRITE_SHAPING_GLYPH_PROPERTIES const *glyphProps, UINT32 glyphCount, IDWriteFontFace + // *fontFace, FLOAT fontEmSize, BOOL isSideways, BOOL isRightToLeft, DWRITE_SCRIPT_ANALYSIS const *scriptAnalysis, WCHAR const + // *localeName, DWRITE_TYPOGRAPHIC_FEATURES const **features, UINT32 const *featureRangeLengths, UINT32 featureRanges, FLOAT + // *glyphAdvances, DWRITE_GLYPH_OFFSET *glyphOffsets ); + void GetGlyphPlacements([MarshalAs(UnmanagedType.LPWStr)] string textString, [In, MarshalAs(UnmanagedType.LPArray)] ushort[] clusterMap, + [In, MarshalAs(UnmanagedType.LPArray)] DWRITE_SHAPING_TEXT_PROPERTIES[] textProps, uint textLength, [In, MarshalAs(UnmanagedType.LPArray)] ushort[] glyphIndices, + [In, MarshalAs(UnmanagedType.LPArray)] DWRITE_SHAPING_GLYPH_PROPERTIES[] glyphProps, uint glyphCount, [In] IDWriteFontFace fontFace, float fontEmSize, + [MarshalAs(UnmanagedType.Bool)] bool isSideways, [MarshalAs(UnmanagedType.Bool)] bool isRightToLeft, + in DWRITE_SCRIPT_ANALYSIS scriptAnalysis, [MarshalAs(UnmanagedType.LPWStr)] string localeName, + [In, Optional, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStruct)] DWRITE_TYPOGRAPHIC_FEATURES[] features, + [In, Optional, MarshalAs(UnmanagedType.LPArray)] uint[] featureRangeLengths, uint featureRanges, [Out, MarshalAs(UnmanagedType.LPArray)] float[] glyphAdvances, + [Out, MarshalAs(UnmanagedType.LPArray)] DWRITE_GLYPH_OFFSET[] glyphOffsets); + + /// Place glyphs output from the GetGlyphs method according to the font and the writing system's rendering rules. + /// + /// Type: const WCHAR* + /// An array of characters containing the original string from which the glyphs came. + /// + /// + /// Type: const UINT16* + /// A pointer to the mapping from character ranges to glyph ranges. This is returned by GetGlyphs. + /// + /// + /// Type: DWRITE_SHAPING_TEXT_PROPERTIES* + /// + /// A pointer to an array of structures that contains shaping properties for each character. This structure is returned by GetGlyphs. + /// + /// + /// + /// Type: UINT32 + /// The text length of textString. + /// + /// + /// Type: const UINT16* + /// An array of glyph indices returned by GetGlyphs. + /// + /// + /// Type: const DWRITE_SHAPING_GLYPH_PROPERTIES* + /// A pointer to an array of structures that contain shaping properties for each glyph returned by GetGlyphs. + /// + /// + /// Type: UINT32 + /// The number of glyphs returned from GetGlyphs. + /// + /// + /// Type: IDWriteFontFace* + /// A pointer to the font face that is the source for the output glyphs. + /// + /// + /// Type: FLOAT + /// The logical font size in DIPs. + /// + /// + /// Type: FLOAT + /// The number of physical pixels per DIP. + /// + /// + /// Type: const DWRITE_MATRIX* + /// + /// An optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by + /// the font size and pixelsPerDip. + /// + /// + /// + /// Type: BOOL + /// + /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. When set to TRUE, the metrics + /// are the same as the metrics of text measured by GDI using a font created with CLEARTYPE_NATURAL_QUALITY. + /// + /// + /// + /// Type: BOOL + /// A Boolean flag set to TRUE if the text is intended to be drawn vertically. + /// + /// + /// Type: BOOL + /// A Boolean flag set to TRUE for right-to-left text. + /// + /// + /// Type: const DWRITE_SCRIPT_ANALYSIS* + /// A pointer to a Script analysis result from anAnalyzeScript call. + /// + /// + /// Type: const WCHAR* + /// + /// An array of characters containing the locale to use when selecting glyphs. For example, the same character may map to + /// different glyphs for ja-jp versus zh-chs. If this is NULL, then the default mapping based on the script is used. + /// + /// + /// + /// Type: const DWRITE_TYPOGRAPHIC_FEATURES** + /// An array of pointers to the sets of typographic features to use in each feature range. + /// + /// + /// Type: const UINT32* + /// The length of each feature range, in characters. The sum of all lengths should be equal to textLength. + /// + /// + /// Type: UINT32 + /// The number of feature ranges. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the advance width of each glyph. + /// + /// + /// Type: DWRITE_GLYPH_OFFSET* + /// When this method returns, contains the offset of the origin of each glyph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextanalyzer-getgdicompatibleglyphplacements + // HRESULT GetGdiCompatibleGlyphPlacements( WCHAR const *textString, UINT16 const *clusterMap, DWRITE_SHAPING_TEXT_PROPERTIES + // *textProps, UINT32 textLength, UINT16 const *glyphIndices, DWRITE_SHAPING_GLYPH_PROPERTIES const *glyphProps, UINT32 + // glyphCount, IDWriteFontFace *fontFace, FLOAT fontEmSize, FLOAT pixelsPerDip, DWRITE_MATRIX const *transform, BOOL + // useGdiNatural, BOOL isSideways, BOOL isRightToLeft, DWRITE_SCRIPT_ANALYSIS const *scriptAnalysis, WCHAR const *localeName, + // DWRITE_TYPOGRAPHIC_FEATURES const **features, UINT32 const *featureRangeLengths, UINT32 featureRanges, FLOAT *glyphAdvances, + // DWRITE_GLYPH_OFFSET *glyphOffsets ); + void GetGdiCompatibleGlyphPlacements([MarshalAs(UnmanagedType.LPWStr)] string textString, [In, MarshalAs(UnmanagedType.LPArray)] ushort[] clusterMap, + [In, MarshalAs(UnmanagedType.LPArray)] DWRITE_SHAPING_TEXT_PROPERTIES[] textProps, uint textLength, [In, MarshalAs(UnmanagedType.LPArray)] ushort[] glyphIndices, + [In, MarshalAs(UnmanagedType.LPArray)] DWRITE_SHAPING_GLYPH_PROPERTIES[] glyphProps, uint glyphCount, [In] IDWriteFontFace fontFace, float fontEmSize, + float pixelsPerDip, [In, Optional] IntPtr transform, [MarshalAs(UnmanagedType.Bool)] bool useGdiNatural, + [MarshalAs(UnmanagedType.Bool)] bool isSideways, [MarshalAs(UnmanagedType.Bool)] bool isRightToLeft, + in DWRITE_SCRIPT_ANALYSIS scriptAnalysis, [MarshalAs(UnmanagedType.LPWStr)] string localeName, + [In, Optional, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStruct)] DWRITE_TYPOGRAPHIC_FEATURES[] features, + [In, Optional, MarshalAs(UnmanagedType.LPArray)] uint[] featureRangeLengths, uint featureRanges, [Out, MarshalAs(UnmanagedType.LPArray)] float[] glyphAdvances, + [Out, MarshalAs(UnmanagedType.LPArray)] DWRITE_GLYPH_OFFSET[] glyphOffsets); + } + + /// + /// The IDWriteTextFormat interface describes the font and paragraph properties used to format text, and it describes locale information. + /// + /// + /// + /// To get a reference to the IDWriteTextFormat interface, the application must call the IDWriteFactory::CreateTextFormat + /// method as shown in the following code. + /// + /// + /// When creating an IDWriteTextFormat object using the CreateTextFormat function, the application specifies the font family, + /// font collection, font weight, font size, and locale name for the text format. + /// + /// + /// These properties cannot be changed after the IDWriteTextFormat object is created. To change these properties, a new + /// IDWriteTextFormat object must be created with the desired properties. + /// + /// The IDWriteTextFormat interface is used to draw text with a single format + /// + /// To draw text with multiple formats, or to use a custom text renderer, use the IDWriteTextLayout interface. + /// IDWriteTextLayout enables the application to change the format for ranges of text within the string. The + /// IDWriteFactory::CreateTextLayout takes an IDWriteTextFormat object as a parameter and initially applies the format + /// information to the entire string. + /// + /// This object may not be thread-safe, and it may carry the state of text format change. + /// DirectWrite and Direct2D + /// + /// To draw simple text with a single format, Direct2D provides the ID2D1RenderTarget::DrawText method, which draws a string using + /// the format information provided by an IDWriteTextFormat object. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextformat + [PInvokeData("dwrite.h", MSDNShortId = "64b2cac3-c4cb-4213-b808-7b279d296939")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9c906818-31d7-4fd3-a151-7c5e225db55a")] + public interface IDWriteTextFormat + { + /// + /// Sets the alignment of text in a paragraph, relative to the leading and trailing edge of a layout box for a IDWriteTextFormat interface. + /// + /// + /// Type: DWRITE_TEXT_ALIGNMENT + /// The text alignment option being set for the paragraph of type DWRITE_TEXT_ALIGNMENT. For more information, see Remarks. + /// + /// + /// + /// The text can be aligned to the leading or trailing edge of the layout box, or it can be centered. The following illustration + /// shows text with the alignment set to DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_CENTER, and + /// DWRITE_TEXT_ALIGNMENT_TRAILING, respectively. + /// + /// + /// Note The alignment is dependent on reading direction, the above is for left-to-right reading direction. For + /// right-to-left reading direction it would be the opposite. + /// + /// See DWRITE_TEXT_ALIGNMENT for more information. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-settextalignment HRESULT + // SetTextAlignment( DWRITE_TEXT_ALIGNMENT textAlignment ); + void SetTextAlignment(DWRITE_TEXT_ALIGNMENT textAlignment); + + /// Sets the alignment option of a paragraph relative to the layout box's top and bottom edge. + /// + /// Type: DWRITE_PARAGRAPH_ALIGNMENT + /// The paragraph alignment option being set for a paragraph; see DWRITE_PARAGRAPH_ALIGNMENT for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setparagraphalignment HRESULT + // SetParagraphAlignment( DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment ); + void SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment); + + /// Sets the word wrapping option. + /// + /// Type: DWRITE_WORD_WRAPPING + /// The word wrapping option being set for a paragraph; see DWRITE_WORD_WRAPPING for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setwordwrapping HRESULT + // SetWordWrapping( DWRITE_WORD_WRAPPING wordWrapping ); + void SetWordWrapping(DWRITE_WORD_WRAPPING wordWrapping); + + /// Sets the paragraph reading direction. + /// + /// Type: DWRITE_READING_DIRECTION + /// + /// The text reading direction (for example, DWRITE_READING_DIRECTION_RIGHT_TO_LEFT for languages, such as Arabic, that read + /// from right to left) for a paragraph. + /// + /// + /// + /// The reading direction and flow direction must always be set 90 degrees orthogonal to each other, or else you will get the + /// error DWRITE_E_FLOWDIRECTIONCONFLICTS when you use layout functions like Draw or GetMetrics. So if you set a vertical + /// reading direction (for example, to DWRITE_READING_DIRECTION_TOP_TO_BOTTOM), then you must also use SetFlowDirection to set + /// the flow direction appropriately (for example, to DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setreadingdirection HRESULT + // SetReadingDirection( DWRITE_READING_DIRECTION readingDirection ); + void SetReadingDirection(DWRITE_READING_DIRECTION readingDirection); + + /// Sets the paragraph flow direction. + /// + /// Type: DWRITE_FLOW_DIRECTION + /// The paragraph flow direction; see DWRITE_FLOW_DIRECTION for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setflowdirection HRESULT + // SetFlowDirection( DWRITE_FLOW_DIRECTION flowDirection ); + void SetFlowDirection(DWRITE_FLOW_DIRECTION flowDirection); + + /// Sets a fixed distance between two adjacent tab stops. + /// + /// Type: FLOAT + /// The fixed distance between two adjacent tab stops. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setincrementaltabstop HRESULT + // SetIncrementalTabStop( FLOAT incrementalTabStop ); + void SetIncrementalTabStop(float incrementalTabStop); + + /// Sets trimming options for text overflowing the layout width. + /// + /// Type: const DWRITE_TRIMMING* + /// Text trimming options. + /// + /// + /// Type: IDWriteInlineObject* + /// Application-defined omission sign. This parameter may be NULL. See IDWriteInlineObject for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-settrimming HRESULT SetTrimming( + // DWRITE_TRIMMING const *trimmingOptions, IDWriteInlineObject *trimmingSign ); + void SetTrimming(in DWRITE_TRIMMING trimmingOptions, [In, Optional] IDWriteInlineObject trimmingSign); + + /// Sets the line spacing. + /// + /// Type: DWRITE_LINE_SPACING_METHOD + /// Specifies how line height is being determined; see DWRITE_LINE_SPACING_METHOD for more information. + /// + /// + /// Type: FLOAT + /// The line height, or distance between one baseline to another. + /// + /// + /// Type: FLOAT + /// The distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent. + /// + /// + /// For the default method, spacing depends solely on the content. For uniform spacing, the specified line height overrides the content. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setlinespacing HRESULT SetLineSpacing( + // DWRITE_LINE_SPACING_METHOD lineSpacingMethod, FLOAT lineSpacing, FLOAT baseline ); + void SetLineSpacing(DWRITE_LINE_SPACING_METHOD lineSpacingMethod, float lineSpacing, float baseline); + + /// Gets the alignment option of text relative to the layout box's leading and trailing edge. + /// + /// Type: DWRITE_TEXT_ALIGNMENT + /// Returns the text alignment option of the current paragraph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-gettextalignment DWRITE_TEXT_ALIGNMENT GetTextAlignment(); + [PreserveSig] + DWRITE_TEXT_ALIGNMENT GetTextAlignment(); + + /// Gets the alignment option of a paragraph which is relative to the top and bottom edges of a layout box. + /// + /// Type: DWRITE_PARAGRAPH_ALIGNMENT + /// A value that indicates the current paragraph alignment option. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getparagraphalignment + // DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment(); + [PreserveSig] + DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment(); + + /// Gets the word wrapping option. + /// + /// Type: DWRITE_WORD_WRAPPING + /// Returns the word wrapping option; see DWRITE_WORD_WRAPPING for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getwordwrapping DWRITE_WORD_WRAPPING GetWordWrapping(); + [PreserveSig] + DWRITE_WORD_WRAPPING GetWordWrapping(); + + /// Gets the current reading direction for text in a paragraph. + /// + /// Type: DWRITE_READING_DIRECTION + /// A value that indicates the current reading direction for text in a paragraph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getreadingdirection + // DWRITE_READING_DIRECTION GetReadingDirection(); + [PreserveSig] + DWRITE_READING_DIRECTION GetReadingDirection(); + + /// Gets the direction that text lines flow. + /// + /// Type: DWRITE_FLOW_DIRECTION + /// + /// The direction that text lines flow within their parent container. For example, DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM indicates + /// that text lines are placed from top to bottom. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getflowdirection DWRITE_FLOW_DIRECTION GetFlowDirection(); + [PreserveSig] + DWRITE_FLOW_DIRECTION GetFlowDirection(); + + /// Gets the incremental tab stop position. + /// + /// Type: FLOAT + /// The incremental tab stop value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getincrementaltabstop FLOAT GetIncrementalTabStop(); + [PreserveSig] + float GetIncrementalTabStop(); + + /// Gets the trimming options for text that overflows the layout box. + /// + /// Type: DWRITE_TRIMMING* + /// + /// When this method returns, it contains a pointer to a DWRITE_TRIMMING structure that holds the text trimming options for the + /// overflowing text. + /// + /// + /// + /// Type: IDWriteInlineObject** + /// When this method returns, contains an address of a pointer to a trimming omission sign. This parameter may be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-gettrimming HRESULT GetTrimming( + // DWRITE_TRIMMING *trimmingOptions, IDWriteInlineObject **trimmingSign ); + void GetTrimming(out DWRITE_TRIMMING trimmingOptions, out IDWriteInlineObject trimmingSign); + + /// Gets the line spacing adjustment set for a multiline text paragraph. + /// + /// Type: DWRITE_LINE_SPACING_METHOD* + /// A value that indicates how line height is determined. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the line height, or distance between one baseline to another. + /// + /// + /// Type: FLOAT* + /// + /// When this method returns, contains the distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlinespacing HRESULT GetLineSpacing( + // DWRITE_LINE_SPACING_METHOD *lineSpacingMethod, FLOAT *lineSpacing, FLOAT *baseline ); + void GetLineSpacing(out DWRITE_LINE_SPACING_METHOD lineSpacingMethod, out float lineSpacing, out float baseline); + + /// Gets the current font collection. + /// + /// Type: IDWriteFontCollection** + /// When this method returns, contains an address of a pointer to the font collection being used for the current text. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontcollection HRESULT + // GetFontCollection( IDWriteFontCollection **fontCollection ); + IDWriteFontCollection GetFontCollection(); + + /// Gets the length of the font family name. + /// + /// Type: UINT32 + /// The size of the character array, in character count, not including the terminated NULL character. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontfamilynamelength UINT32 GetFontFamilyNameLength(); + [PreserveSig] + uint GetFontFamilyNameLength(); + + /// Gets a copy of the font family name. + /// + /// Type: WCHAR* + /// + /// When this method returns, contains a pointer to a character array, which is null-terminated, that receives the current font + /// family name. The buffer allocated for this array should be at least the size, in elements, of nameSize. + /// + /// + /// + /// Type: UINT32 + /// + /// The size of the fontFamilyName character array, in character count, including the terminated NULL character. To find + /// the size of fontFamilyName, use GetFontFamilyNameLength. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontfamilyname HRESULT + // GetFontFamilyName( WCHAR *fontFamilyName, UINT32 nameSize ); + void GetFontFamilyName([MarshalAs(UnmanagedType.LPWStr)] StringBuilder fontFamilyName, uint nameSize); + + /// Gets the font weight of the text. + /// + /// Type: DWRITE_FONT_WEIGHT + /// A value that indicates the type of weight (such as normal, bold, or black). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontweight DWRITE_FONT_WEIGHT GetFontWeight(); + [PreserveSig] + DWRITE_FONT_WEIGHT GetFontWeight(); + + /// Gets the font style of the text. + /// + /// Type: DWRITE_FONT_STYLE + /// A value which indicates the type of font style (such as slope or incline). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontstyle DWRITE_FONT_STYLE GetFontStyle(); + [PreserveSig] + DWRITE_FONT_STYLE GetFontStyle(); + + /// Gets the font stretch of the text. + /// + /// Type: DWRITE_FONT_STRETCH + /// A value which indicates the type of font stretch (such as normal or condensed). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontstretch DWRITE_FONT_STRETCH GetFontStretch(); + [PreserveSig] + DWRITE_FONT_STRETCH GetFontStretch(); + + /// Gets the font size in DIP unites. + /// + /// Type: FLOAT + /// The current font size in DIP units. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontsize FLOAT GetFontSize(); + [PreserveSig] + float GetFontSize(); + + /// Gets the length of the locale name. + /// + /// Type: UINT32 + /// The size of the character array in character count, not including the terminated NULL character. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlocalenamelength UINT32 GetLocaleNameLength(); + [PreserveSig] + uint GetLocaleNameLength(); + + /// Gets a copy of the locale name. + /// + /// Type: WCHAR* + /// Contains a character array that receives the current locale name. + /// + /// + /// Type: UINT32 + /// + /// The size of the character array, in character count, including the terminated NULL character. Use GetLocaleNameLength + /// to get the size of the locale name character array. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlocalename HRESULT GetLocaleName( + // WCHAR *localeName, UINT32 nameSize ); + void GetLocaleName([MarshalAs(UnmanagedType.LPWStr)] StringBuilder localeName, uint nameSize); + } + + /// The IDWriteTextLayout interface represents a block of text after it has been fully analyzed and formatted. + /// + /// + /// To get a reference to the IDWriteTextLayout interface, the application must call the IDWriteFactory::CreateTextLayout + /// method, as shown in the following code. + /// + /// + /// The IDWriteTextLayout interface allows the application to change the format for ranges of the text it represents, + /// specified by a DWRITE_TEXT_RANGE structure. The following example shows how to set the font weight for a text range. + /// + /// IDWriteTextLayout also provides methods for adding strikethrough, underline, and inline objects to the text. + /// + /// To draw the block of text represented by an IDWriteTextLayout object, Direct2D provides the + /// ID2D1RenderTarget::DrawTextLayout method. To draw using a custom renderer implement an IDWriteTextRenderer interface and call + /// the IDWriteTextLayout::Draw method + /// + /// DirectWrite and Direct2D + /// + /// To draw a formatted string represented by an IDWriteTextLayout object, Direct2D provides the + /// ID2D1RenderTarget::DrawTextLayout method. + /// + /// Other Rendering Options + /// + /// To render using a custom renderer, use the IDWriteTextLayout::Draw method, which takes a callback interface derived from + /// IDWriteTextRenderer as an argument, as shown in the following code. + /// + /// + /// IDWriteTextRenderer declares methods for drawing a glyph run, underline, strikethrough and inline objects. It is up to the + /// application to implement these methods. Creating a custom text renderer allows the application to apply additional effects when + /// rendering text, such as a custom fill or outline. + /// + /// Using a custom text renderer also enables you to render using another technology, such as GDI. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextlayout + [PInvokeData("dwrite.h", MSDNShortId = "0d687337-8623-4014-967c-f533072e31cc")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("53737037-6d14-410b-9bfe-0b182bb70961")] + public interface IDWriteTextLayout : IDWriteTextFormat + { + /// + /// Sets the alignment of text in a paragraph, relative to the leading and trailing edge of a layout box for a IDWriteTextFormat interface. + /// + /// + /// Type: DWRITE_TEXT_ALIGNMENT + /// The text alignment option being set for the paragraph of type DWRITE_TEXT_ALIGNMENT. For more information, see Remarks. + /// + /// + /// + /// The text can be aligned to the leading or trailing edge of the layout box, or it can be centered. The following illustration + /// shows text with the alignment set to DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_CENTER, and + /// DWRITE_TEXT_ALIGNMENT_TRAILING, respectively. + /// + /// + /// Note The alignment is dependent on reading direction, the above is for left-to-right reading direction. For + /// right-to-left reading direction it would be the opposite. + /// + /// See DWRITE_TEXT_ALIGNMENT for more information. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-settextalignment HRESULT + // SetTextAlignment( DWRITE_TEXT_ALIGNMENT textAlignment ); + new void SetTextAlignment(DWRITE_TEXT_ALIGNMENT textAlignment); + + /// Sets the alignment option of a paragraph relative to the layout box's top and bottom edge. + /// + /// Type: DWRITE_PARAGRAPH_ALIGNMENT + /// The paragraph alignment option being set for a paragraph; see DWRITE_PARAGRAPH_ALIGNMENT for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setparagraphalignment HRESULT + // SetParagraphAlignment( DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment ); + new void SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment); + + /// Sets the word wrapping option. + /// + /// Type: DWRITE_WORD_WRAPPING + /// The word wrapping option being set for a paragraph; see DWRITE_WORD_WRAPPING for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setwordwrapping HRESULT + // SetWordWrapping( DWRITE_WORD_WRAPPING wordWrapping ); + new void SetWordWrapping(DWRITE_WORD_WRAPPING wordWrapping); + + /// Sets the paragraph reading direction. + /// + /// Type: DWRITE_READING_DIRECTION + /// + /// The text reading direction (for example, DWRITE_READING_DIRECTION_RIGHT_TO_LEFT for languages, such as Arabic, that read + /// from right to left) for a paragraph. + /// + /// + /// + /// The reading direction and flow direction must always be set 90 degrees orthogonal to each other, or else you will get the + /// error DWRITE_E_FLOWDIRECTIONCONFLICTS when you use layout functions like Draw or GetMetrics. So if you set a vertical + /// reading direction (for example, to DWRITE_READING_DIRECTION_TOP_TO_BOTTOM), then you must also use SetFlowDirection to set + /// the flow direction appropriately (for example, to DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setreadingdirection HRESULT + // SetReadingDirection( DWRITE_READING_DIRECTION readingDirection ); + new void SetReadingDirection(DWRITE_READING_DIRECTION readingDirection); + + /// Sets the paragraph flow direction. + /// + /// Type: DWRITE_FLOW_DIRECTION + /// The paragraph flow direction; see DWRITE_FLOW_DIRECTION for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setflowdirection HRESULT + // SetFlowDirection( DWRITE_FLOW_DIRECTION flowDirection ); + new void SetFlowDirection(DWRITE_FLOW_DIRECTION flowDirection); + + /// Sets a fixed distance between two adjacent tab stops. + /// + /// Type: FLOAT + /// The fixed distance between two adjacent tab stops. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setincrementaltabstop HRESULT + // SetIncrementalTabStop( FLOAT incrementalTabStop ); + new void SetIncrementalTabStop(float incrementalTabStop); + + /// Sets trimming options for text overflowing the layout width. + /// + /// Type: const DWRITE_TRIMMING* + /// Text trimming options. + /// + /// + /// Type: IDWriteInlineObject* + /// Application-defined omission sign. This parameter may be NULL. See IDWriteInlineObject for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-settrimming HRESULT SetTrimming( + // DWRITE_TRIMMING const *trimmingOptions, IDWriteInlineObject *trimmingSign ); + new void SetTrimming(in DWRITE_TRIMMING trimmingOptions, [In, Optional] IDWriteInlineObject trimmingSign); + + /// Sets the line spacing. + /// + /// Type: DWRITE_LINE_SPACING_METHOD + /// Specifies how line height is being determined; see DWRITE_LINE_SPACING_METHOD for more information. + /// + /// + /// Type: FLOAT + /// The line height, or distance between one baseline to another. + /// + /// + /// Type: FLOAT + /// The distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent. + /// + /// + /// For the default method, spacing depends solely on the content. For uniform spacing, the specified line height overrides the content. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-setlinespacing HRESULT SetLineSpacing( + // DWRITE_LINE_SPACING_METHOD lineSpacingMethod, FLOAT lineSpacing, FLOAT baseline ); + new void SetLineSpacing(DWRITE_LINE_SPACING_METHOD lineSpacingMethod, float lineSpacing, float baseline); + + /// Gets the alignment option of text relative to the layout box's leading and trailing edge. + /// + /// Type: DWRITE_TEXT_ALIGNMENT + /// Returns the text alignment option of the current paragraph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-gettextalignment DWRITE_TEXT_ALIGNMENT GetTextAlignment(); + [PreserveSig] + new DWRITE_TEXT_ALIGNMENT GetTextAlignment(); + + /// Gets the alignment option of a paragraph which is relative to the top and bottom edges of a layout box. + /// + /// Type: DWRITE_PARAGRAPH_ALIGNMENT + /// A value that indicates the current paragraph alignment option. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getparagraphalignment + // DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment(); + [PreserveSig] + new DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment(); + + /// Gets the word wrapping option. + /// + /// Type: DWRITE_WORD_WRAPPING + /// Returns the word wrapping option; see DWRITE_WORD_WRAPPING for more information. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getwordwrapping DWRITE_WORD_WRAPPING GetWordWrapping(); + [PreserveSig] + new DWRITE_WORD_WRAPPING GetWordWrapping(); + + /// Gets the current reading direction for text in a paragraph. + /// + /// Type: DWRITE_READING_DIRECTION + /// A value that indicates the current reading direction for text in a paragraph. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getreadingdirection + // DWRITE_READING_DIRECTION GetReadingDirection(); + [PreserveSig] + new DWRITE_READING_DIRECTION GetReadingDirection(); + + /// Gets the direction that text lines flow. + /// + /// Type: DWRITE_FLOW_DIRECTION + /// + /// The direction that text lines flow within their parent container. For example, DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM indicates + /// that text lines are placed from top to bottom. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getflowdirection DWRITE_FLOW_DIRECTION GetFlowDirection(); + [PreserveSig] + new DWRITE_FLOW_DIRECTION GetFlowDirection(); + + /// Gets the incremental tab stop position. + /// + /// Type: FLOAT + /// The incremental tab stop value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getincrementaltabstop FLOAT GetIncrementalTabStop(); + [PreserveSig] + new float GetIncrementalTabStop(); + + /// Gets the trimming options for text that overflows the layout box. + /// + /// Type: DWRITE_TRIMMING* + /// + /// When this method returns, it contains a pointer to a DWRITE_TRIMMING structure that holds the text trimming options for the + /// overflowing text. + /// + /// + /// + /// Type: IDWriteInlineObject** + /// When this method returns, contains an address of a pointer to a trimming omission sign. This parameter may be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-gettrimming HRESULT GetTrimming( + // DWRITE_TRIMMING *trimmingOptions, IDWriteInlineObject **trimmingSign ); + new void GetTrimming(out DWRITE_TRIMMING trimmingOptions, out IDWriteInlineObject trimmingSign); + + /// Gets the line spacing adjustment set for a multiline text paragraph. + /// + /// Type: DWRITE_LINE_SPACING_METHOD* + /// A value that indicates how line height is determined. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the line height, or distance between one baseline to another. + /// + /// + /// Type: FLOAT* + /// + /// When this method returns, contains the distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlinespacing HRESULT GetLineSpacing( + // DWRITE_LINE_SPACING_METHOD *lineSpacingMethod, FLOAT *lineSpacing, FLOAT *baseline ); + new void GetLineSpacing(out DWRITE_LINE_SPACING_METHOD lineSpacingMethod, out float lineSpacing, out float baseline); + + /// Gets the current font collection. + /// + /// Type: IDWriteFontCollection** + /// When this method returns, contains an address of a pointer to the font collection being used for the current text. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontcollection HRESULT + // GetFontCollection( IDWriteFontCollection **fontCollection ); + new IDWriteFontCollection GetFontCollection(); + + /// Gets the length of the font family name. + /// + /// Type: UINT32 + /// The size of the character array, in character count, not including the terminated NULL character. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontfamilynamelength UINT32 GetFontFamilyNameLength(); + [PreserveSig] + new uint GetFontFamilyNameLength(); + + /// Gets a copy of the font family name. + /// + /// Type: WCHAR* + /// + /// When this method returns, contains a pointer to a character array, which is null-terminated, that receives the current font + /// family name. The buffer allocated for this array should be at least the size, in elements, of nameSize. + /// + /// + /// + /// Type: UINT32 + /// + /// The size of the fontFamilyName character array, in character count, including the terminated NULL character. To find + /// the size of fontFamilyName, use GetFontFamilyNameLength. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontfamilyname HRESULT + // GetFontFamilyName( WCHAR *fontFamilyName, UINT32 nameSize ); + new void GetFontFamilyName([MarshalAs(UnmanagedType.LPWStr)] StringBuilder fontFamilyName, uint nameSize); + + /// Gets the font weight of the text. + /// + /// Type: DWRITE_FONT_WEIGHT + /// A value that indicates the type of weight (such as normal, bold, or black). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontweight DWRITE_FONT_WEIGHT GetFontWeight(); + [PreserveSig] + new DWRITE_FONT_WEIGHT GetFontWeight(); + + /// Gets the font style of the text. + /// + /// Type: DWRITE_FONT_STYLE + /// A value which indicates the type of font style (such as slope or incline). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontstyle DWRITE_FONT_STYLE GetFontStyle(); + [PreserveSig] + new DWRITE_FONT_STYLE GetFontStyle(); + + /// Gets the font stretch of the text. + /// + /// Type: DWRITE_FONT_STRETCH + /// A value which indicates the type of font stretch (such as normal or condensed). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontstretch DWRITE_FONT_STRETCH GetFontStretch(); + [PreserveSig] + new DWRITE_FONT_STRETCH GetFontStretch(); + + /// Gets the font size in DIP unites. + /// + /// Type: FLOAT + /// The current font size in DIP units. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getfontsize FLOAT GetFontSize(); + [PreserveSig] + new float GetFontSize(); + + /// Gets the length of the locale name. + /// + /// Type: UINT32 + /// The size of the character array in character count, not including the terminated NULL character. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlocalenamelength UINT32 GetLocaleNameLength(); + [PreserveSig] + new uint GetLocaleNameLength(); + + /// Gets a copy of the locale name. + /// + /// Type: WCHAR* + /// Contains a character array that receives the current locale name. + /// + /// + /// Type: UINT32 + /// + /// The size of the character array, in character count, including the terminated NULL character. Use GetLocaleNameLength + /// to get the size of the locale name character array. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlocalename HRESULT GetLocaleName( + // WCHAR *localeName, UINT32 nameSize ); + new void GetLocaleName([MarshalAs(UnmanagedType.LPWStr)] StringBuilder localeName, uint nameSize); + + /// Sets the layout maximum width. + /// + /// Type: FLOAT + /// A value that indicates the maximum width of the layout box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setmaxwidth HRESULT SetMaxWidth( FLOAT + // maxWidth ); + void SetMaxWidth(float maxWidth); + + /// Sets the layout maximum height. + /// + /// Type: FLOAT + /// A value that indicates the maximum height of the layout box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setmaxheight HRESULT SetMaxHeight( + // FLOAT maxHeight ); + void SetMaxHeight(float maxHeight); + + /// Sets the font collection. + /// + /// Type: IDWriteFontCollection* + /// The font collection to set. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setfontcollection HRESULT + // SetFontCollection( IDWriteFontCollection *fontCollection, DWRITE_TEXT_RANGE textRange ); + void SetFontCollection([In] IDWriteFontCollection fontCollection, DWRITE_TEXT_RANGE textRange); + + /// Sets null-terminated font family name for text within a specified text range. + /// + /// Type: const WCHAR* + /// The font family name that applies to the entire text string within the range specified by textRange. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setfontfamilyname HRESULT + // SetFontFamilyName( WCHAR const *fontFamilyName, DWRITE_TEXT_RANGE textRange ); + void SetFontFamilyName([MarshalAs(UnmanagedType.LPWStr)] string fontFamilyName, DWRITE_TEXT_RANGE textRange); + + /// Sets the font weight for text within a text range specified by a DWRITE_TEXT_RANGE structure. + /// + /// Type: DWRITE_FONT_WEIGHT + /// The font weight to be set for text within the range specified by textRange. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + /// + /// + /// The font weight can be set to one of the predefined font weight values provided in the DWRITE_FONT_WEIGHT enumeration or an + /// integer from 1 to 999. Values outside this range will cause the method to fail with an E_INVALIDARG return value. + /// + /// The following illustration shows an example of Normal and UltraBold weights for the Palatino Linotype typeface. + /// Examples + /// The following code illustrates how to set the font weight to bold. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setfontweight HRESULT SetFontWeight( + // DWRITE_FONT_WEIGHT fontWeight, DWRITE_TEXT_RANGE textRange ); + void SetFontWeight(DWRITE_FONT_WEIGHT fontWeight, DWRITE_TEXT_RANGE textRange); + + /// Sets the font style for text within a text range specified by a DWRITE_TEXT_RANGE structure. + /// + /// Type: DWRITE_FONT_STYLE + /// The font style to be set for text within a range specified by textRange. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// The text range to which this change applies. + /// + /// + /// + /// The font style can be set to Normal, Italic or Oblique. The following illustration shows three styles for the Palatino font. + /// For more information, see DWRITE_FONT_STYLE. + /// + /// Examples + /// The following code illustrates how to set the font style to italic. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setfontstyle HRESULT SetFontStyle( + // DWRITE_FONT_STYLE fontStyle, DWRITE_TEXT_RANGE textRange ); + void SetFontStyle(DWRITE_FONT_STYLE fontStyle, DWRITE_TEXT_RANGE textRange); + + /// Sets the font stretch for text within a specified text range. + /// + /// Type: DWRITE_FONT_STRETCH + /// A value which indicates the type of font stretch for text within the range specified by textRange. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setfontstretch HRESULT SetFontStretch( + // DWRITE_FONT_STRETCH fontStretch, DWRITE_TEXT_RANGE textRange ); + void SetFontStretch(DWRITE_FONT_STRETCH fontStretch, DWRITE_TEXT_RANGE textRange); + + /// Sets the font size in DIP units for text within a specified text range. + /// + /// Type: FLOAT + /// The font size in DIP units to be set for text in the range specified by textRange. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setfontsize HRESULT SetFontSize( FLOAT + // fontSize, DWRITE_TEXT_RANGE textRange ); + void SetFontSize(float fontSize, DWRITE_TEXT_RANGE textRange); + + /// Sets underlining for text within a specified text range. + /// + /// Type: BOOL + /// A Boolean flag that indicates whether underline takes place within a specified text range. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setunderline HRESULT SetUnderline( BOOL + // hasUnderline, DWRITE_TEXT_RANGE textRange ); + void SetUnderline([MarshalAs(UnmanagedType.Bool)] bool hasUnderline, DWRITE_TEXT_RANGE textRange); + + /// Sets strikethrough for text within a specified text range. + /// + /// Type: BOOL + /// A Boolean flag that indicates whether strikethrough takes place in the range specified by textRange. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setstrikethrough HRESULT + // SetStrikethrough( BOOL hasStrikethrough, DWRITE_TEXT_RANGE textRange ); + void SetStrikethrough([MarshalAs(UnmanagedType.Bool)] bool hasStrikethrough, DWRITE_TEXT_RANGE textRange); + + /// Sets the application-defined drawing effect. + /// + /// Type: IUnknown* + /// + /// Application-defined drawing effects that apply to the range. This data object will be passed back to the application's + /// drawing callbacks for final rendering. + /// + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// The text range to which this change applies. + /// + /// + /// + /// An ID2D1Brush, such as a color or gradient brush, can be set as a drawing effect if you are using the + /// ID2D1RenderTarget::DrawTextLayout to draw text and that brush will be used to draw the specified range of text. + /// + /// + /// This drawing effect is associated with the specified range and will be passed back to the application by way of the callback + /// when the range is drawn at drawing time. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setdrawingeffect HRESULT + // SetDrawingEffect( IUnknown *drawingEffect, DWRITE_TEXT_RANGE textRange ); + void SetDrawingEffect([MarshalAs(UnmanagedType.IUnknown)] object drawingEffect, DWRITE_TEXT_RANGE textRange); + + /// Sets the inline object. + /// + /// Type: IDWriteInlineObject* + /// An application-defined inline object. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + /// + /// + /// The application may call this function to specify the set of properties describing an application-defined inline object for + /// specific range. + /// + /// + /// This inline object applies to the specified range and will be passed back to the application by way of the DrawInlineObject + /// callback when the range is drawn. Any text in that range will be suppressed. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setinlineobject HRESULT + // SetInlineObject( IDWriteInlineObject *inlineObject, DWRITE_TEXT_RANGE textRange ); + void SetInlineObject([In] IDWriteInlineObject inlineObject, DWRITE_TEXT_RANGE textRange); + + /// Sets font typography features for text within a specified text range. + /// + /// Type: IDWriteTypography* + /// Pointer to font typography settings. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-settypography HRESULT SetTypography( + // IDWriteTypography *typography, DWRITE_TEXT_RANGE textRange ); + void SetTypography([In] IDWriteTypography typography, DWRITE_TEXT_RANGE textRange); + + /// Sets the locale name for text within a specified text range. + /// + /// Type: const WCHAR* + /// A null-terminated locale name string. + /// + /// + /// Type: DWRITE_TEXT_RANGE + /// Text range to which this change applies. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-setlocalename HRESULT SetLocaleName( + // WCHAR const *localeName, DWRITE_TEXT_RANGE textRange ); + void SetLocaleName([MarshalAs(UnmanagedType.LPWStr)] string localeName, DWRITE_TEXT_RANGE textRange); + + /// Gets the layout maximum width. + /// + /// Type: FLOAT + /// Returns the layout maximum width. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getmaxwidth FLOAT GetMaxWidth(); + [PreserveSig] + float GetMaxWidth(); + + /// Gets the layout maximum height. + /// + /// Type: FLOAT + /// The layout maximum height. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getmaxheight FLOAT GetMaxHeight(); + [PreserveSig] + float GetMaxHeight(); + + /// Gets the font collection associated with the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: IDWriteFontCollection** + /// Contains an address of a pointer to the current font collection. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the underline. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontcollection HRESULT + // GetFontCollection( UINT32 currentPosition, IDWriteFontCollection **fontCollection, DWRITE_TEXT_RANGE *textRange ); + void GetFontCollection(uint currentPosition, out IDWriteFontCollection fontCollection, out DWRITE_TEXT_RANGE textRange); + + /// Get the length of the font family name at the current position. + /// + /// Type: UINT32 + /// The current text position. + /// + /// + /// Type: UINT32* + /// + /// When this method returns, contains the size of the character array containing the font family name, in character count, not + /// including the terminated NULL character. + /// + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the font family. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontfamilynamelength HRESULT + // GetFontFamilyNameLength( UINT32 currentPosition, UINT32 *nameLength, DWRITE_TEXT_RANGE *textRange ); + void GetFontFamilyNameLength(uint currentPosition, out uint nameLength, out DWRITE_TEXT_RANGE textRange); + + /// Copies the font family name of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to examine. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contains an array of characters that receives the current font family name. You must allocate + /// storage for this parameter. + /// + /// + /// + /// Type: UINT32 + /// The size of the character array in character count including the terminated NULL character. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the font family name. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontfamilyname HRESULT + // GetFontFamilyName( UINT32 currentPosition, WCHAR *fontFamilyName, UINT32 nameSize, DWRITE_TEXT_RANGE *textRange ); + void GetFontFamilyName(uint currentPosition, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder fontFamilyName, uint nameSize, out DWRITE_TEXT_RANGE textRange); + + /// Gets the font weight of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: DWRITE_FONT_WEIGHT* + /// + /// When this method returns, contains a value which indicates the type of font weight being applied at the specified position. + /// + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the font weight. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontweight HRESULT GetFontWeight( + // UINT32 currentPosition, DWRITE_FONT_WEIGHT *fontWeight, DWRITE_TEXT_RANGE *textRange ); + void GetFontWeight(uint currentPosition, out DWRITE_FONT_WEIGHT fontWeight, out DWRITE_TEXT_RANGE textRange); + + /// Gets the font style (also known as slope) of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: DWRITE_FONT_STYLE* + /// + /// When this method returns, contains a value which indicates the type of font style (also known as slope or incline) being + /// applied at the specified position. + /// + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the font style. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontstyle HRESULT GetFontStyle( + // UINT32 currentPosition, DWRITE_FONT_STYLE *fontStyle, DWRITE_TEXT_RANGE *textRange ); + void GetFontStyle(uint currentPosition, out DWRITE_FONT_STYLE fontStyle, out DWRITE_TEXT_RANGE textRange); + + /// Gets the font stretch of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: DWRITE_FONT_STRETCH* + /// + /// When this method returns, contains a value which indicates the type of font stretch (also known as width) being applied at + /// the specified position. + /// + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the font stretch. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontstretch HRESULT GetFontStretch( + // UINT32 currentPosition, DWRITE_FONT_STRETCH *fontStretch, DWRITE_TEXT_RANGE *textRange ); + void GetFontStretch(uint currentPosition, out DWRITE_FONT_STRETCH fontStretch, out DWRITE_TEXT_RANGE textRange); + + /// Gets the font em height of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the size of the font in ems of the text at the specified position. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the font size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getfontsize HRESULT GetFontSize( UINT32 + // currentPosition, FLOAT *fontSize, DWRITE_TEXT_RANGE *textRange ); + void GetFontSize(uint currentPosition, out float fontSize, out DWRITE_TEXT_RANGE textRange); + + /// Gets the underline presence of the text at the specified position. + /// + /// Type: UINT32 + /// The current text position. + /// + /// + /// Type: BOOL* + /// A Boolean flag that indicates whether underline is present at the position indicated by currentPosition. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the underline. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getunderline HRESULT GetUnderline( + // UINT32 currentPosition, BOOL *hasUnderline, DWRITE_TEXT_RANGE *textRange ); + void GetUnderline(uint currentPosition, [MarshalAs(UnmanagedType.Bool)] out bool hasUnderline, out DWRITE_TEXT_RANGE textRange); + + /// Get the strikethrough presence of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: BOOL* + /// A Boolean flag that indicates whether strikethrough is present at the position indicated by currentPosition. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// Contains the range of text that has the same formatting as the text at the position specified by currentPosition. This means + /// the run has the exact formatting as the position specified, including but not limited to strikethrough. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getstrikethrough HRESULT + // GetStrikethrough( UINT32 currentPosition, BOOL *hasStrikethrough, DWRITE_TEXT_RANGE *textRange ); + void GetStrikethrough(uint currentPosition, [MarshalAs(UnmanagedType.Bool)] out bool hasStrikethrough, out DWRITE_TEXT_RANGE textRange); + + /// Gets the application-defined drawing effect at the specified text position. + /// + /// Type: UINT32 + /// The position of the text whose drawing effect is to be retrieved. + /// + /// + /// Type: IUnknown** + /// + /// When this method returns, contains an address of a pointer to the current application-defined drawing effect. Usually this + /// effect is a foreground brush that is used in glyph drawing. + /// + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// Contains the range of text that has the same formatting as the text at the position specified by currentPosition. This means + /// the run has the exact formatting as the position specified, including but not limited to the drawing effect. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getdrawingeffect HRESULT + // GetDrawingEffect( UINT32 currentPosition, IUnknown **drawingEffect, DWRITE_TEXT_RANGE *textRange ); + void GetDrawingEffect(uint currentPosition, [MarshalAs(UnmanagedType.IUnknown)] out object drawingEffect, out DWRITE_TEXT_RANGE textRange); + + /// Gets the inline object at the specified position. + /// + /// Type: UINT32 + /// The specified text position. + /// + /// + /// Type: IDWriteInlineObject** + /// Contains the application-defined inline object. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the inline object. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getinlineobject HRESULT + // GetInlineObject( UINT32 currentPosition, IDWriteInlineObject **inlineObject, DWRITE_TEXT_RANGE *textRange ); + void GetInlineObject(uint currentPosition, out IDWriteInlineObject inlineObject, out DWRITE_TEXT_RANGE textRange); + + /// Gets the typography setting of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: IDWriteTypography** + /// When this method returns, contains an address of a pointer to the current typography setting. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the typography. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-gettypography HRESULT GetTypography( + // UINT32 currentPosition, IDWriteTypography **typography, DWRITE_TEXT_RANGE *textRange ); + void GetTypography(uint currentPosition, out IDWriteTypography typography, out DWRITE_TEXT_RANGE textRange); + + /// Gets the length of the locale name of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: UINT32* + /// Size of the character array, in character count, not including the terminated NULL character. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the locale name. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getlocalenamelength HRESULT + // GetLocaleNameLength( UINT32 currentPosition, UINT32 *nameLength, DWRITE_TEXT_RANGE *textRange ); + void GetLocaleNameLength(uint currentPosition, out uint nameLength, out DWRITE_TEXT_RANGE textRange); + + /// Gets the locale name of the text at the specified position. + /// + /// Type: UINT32 + /// The position of the text to inspect. + /// + /// + /// Type: WCHAR* + /// When this method returns, contains the character array receiving the current locale name. + /// + /// + /// Type: UINT32 + /// Size of the character array, in character count, including the terminated NULL character. + /// + /// + /// Type: DWRITE_TEXT_RANGE* + /// + /// The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run + /// has the exact formatting as the position specified, including but not limited to the locale name. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getlocalename HRESULT GetLocaleName( + // UINT32 currentPosition, WCHAR *localeName, UINT32 nameSize, DWRITE_TEXT_RANGE *textRange ); + void GetLocaleName(uint currentPosition, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder localeName, uint nameSize, out DWRITE_TEXT_RANGE textRange); + + /// Draws text using the specified client drawing context. + /// + /// Type: void* + /// An application-defined drawing context. + /// + /// + /// Type: IDWriteTextRenderer* + /// Pointer to the set of callback functions used to draw parts of a text string. + /// + /// + /// Type: FLOAT + /// The x-coordinate of the layout's left side. + /// + /// + /// Type: FLOAT + /// The y-coordinate of the layout's top side. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// To draw text with this method, a textLayout object needs to be created by the application using IDWriteFactory::CreateTextLayout. + /// + /// After the textLayout object is obtained, the application calls the IDWriteTextLayout::Draw method to draw the text, + /// decorations, and inline objects. The actual drawing is done through the callback interface passed in as the textRenderer + /// argument; there, the corresponding DrawGlyphRun API is called. + /// + /// + /// If you set a vertical text reading direction on IDWriteTextLayout via SetReadingDirection with + /// DWRITE_READING_DIRECTION_TOP_TO_BOTTOM (or bottom to top), then you must pass an interface that implements + /// IDWriteTextRenderer1. Otherwise you get the error DWRITE_E_TEXTRENDERERINCOMPATIBLE because the original IDWriteTextRenderer + /// interface only supported horizontal text. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-draw HRESULT Draw( void + // *clientDrawingContext, IDWriteTextRenderer *renderer, FLOAT originX, FLOAT originY ); + void Draw([In, Optional] IntPtr clientDrawingContext, [In] IDWriteTextRenderer renderer, float originX, float originY); + + /// Retrieves the information about each individual text line of the text string. + /// + /// Type: DWRITE_LINE_METRICS* + /// + /// When this method returns, contains a pointer to an array of structures containing various calculated length values of + /// individual text lines. + /// + /// + /// + /// Type: UINT32 + /// The maximum size of the lineMetrics array. + /// + /// + /// Type: UINT32* + /// When this method returns, contains the actual size of the lineMetricsarray that is needed. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// If maxLineCount is not large enough E_NOT_SUFFICIENT_BUFFER, which is equivalent to + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), is returned and *actualLineCount is set to the number of lines needed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getlinemetrics HRESULT GetLineMetrics( + // DWRITE_LINE_METRICS *lineMetrics, UINT32 maxLineCount, UINT32 *actualLineCount ); + void GetLineMetrics([Out, Optional, MarshalAs(UnmanagedType.LPArray)] DWRITE_LINE_METRICS[] lineMetrics, uint maxLineCount, out uint actualLineCount); + + /// Retrieves overall metrics for the formatted string. + /// + /// Type: DWRITE_TEXT_METRICS* + /// When this method returns, contains the measured distances of text and associated content after being formatted. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getmetrics HRESULT GetMetrics( + // DWRITE_TEXT_METRICS *textMetrics ); + DWRITE_TEXT_METRICS GetMetrics(); + + /// + /// Returns the overhangs (in DIPs) of the layout and all objects contained in it, including text glyphs and inline objects. + /// + /// + /// Type: DWRITE_OVERHANG_METRICS* + /// Overshoots of visible extents (in DIPs) outside the layout. + /// + /// + /// Underlines and strikethroughs do not contribute to the black box determination, since these are actually drawn by the + /// renderer, which is allowed to draw them in any variety of styles. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getoverhangmetrics HRESULT + // GetOverhangMetrics( DWRITE_OVERHANG_METRICS *overhangs ); + DWRITE_OVERHANG_METRICS GetOverhangMetrics(); + + /// Retrieves logical properties and measurements of each glyph cluster. + /// + /// Type: DWRITE_CLUSTER_METRICS* + /// When this method returns, contains metrics, such as line-break or total advance width, for a glyph cluster. + /// + /// + /// Type: UINT32 + /// The maximum size of the clusterMetrics array. + /// + /// + /// Type: UINT32* + /// When this method returns, contains the actual size of the clusterMetrics array that is needed. + /// + /// + /// If maxClusterCount is not large enough, then E_NOT_SUFFICIENT_BUFFER, which is equivalent to + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), is returned and actualClusterCount is set to the number of clusters needed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-getclustermetrics HRESULT + // GetClusterMetrics( DWRITE_CLUSTER_METRICS *clusterMetrics, UINT32 maxClusterCount, UINT32 *actualClusterCount ); + void GetClusterMetrics([Out, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] DWRITE_CLUSTER_METRICS[] clusterMetrics, uint maxClusterCount, out uint actualClusterCount); + + /// + /// Determines the minimum possible width the layout can be set to without emergency breaking between the characters of whole + /// words occurring. + /// + /// + /// Type: FLOAT* + /// Minimum width. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-determineminwidth HRESULT + // DetermineMinWidth( FLOAT *minWidth ); + float DetermineMinWidth(); + + /// + /// The application calls this function passing in a specific pixel location relative to the top-left location of the layout box + /// and obtains the information about the correspondent hit-test metrics of the text string where the hit-test has occurred. + /// When the specified pixel location is outside the text string, the function sets the output value *isInside to FALSE. + /// + /// + /// Type: FLOAT + /// The pixel location X to hit-test, relative to the top-left location of the layout box. + /// + /// + /// Type: FLOAT + /// The pixel location Y to hit-test, relative to the top-left location of the layout box. + /// + /// + /// Type: BOOL* + /// + /// An output flag that indicates whether the hit-test location is at the leading or the trailing side of the character. When + /// the output *isInside value is set to FALSE, this value is set according to the output hitTestMetrics->textPosition + /// value to represent the edge closest to the hit-test location. + /// + /// + /// + /// Type: BOOL* + /// + /// An output flag that indicates whether the hit-test location is inside the text string. When FALSE, the position + /// nearest the text's edge is returned. + /// + /// + /// + /// Type: DWRITE_HIT_TEST_METRICS* + /// + /// The output geometry fully enclosing the hit-test location. When the output *isInside value is set to FALSE, this + /// structure represents the geometry enclosing the edge closest to the hit-test location. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-hittestpoint HRESULT HitTestPoint( + // FLOAT pointX, FLOAT pointY, BOOL *isTrailingHit, BOOL *isInside, DWRITE_HIT_TEST_METRICS *hitTestMetrics ); + void HitTestPoint(float pointX, float pointY, [MarshalAs(UnmanagedType.Bool)] out bool isTrailingHit, + [MarshalAs(UnmanagedType.Bool)] out bool isInside, out DWRITE_HIT_TEST_METRICS hitTestMetrics); + + /// + /// The application calls this function to get the pixel location relative to the top-left of the layout box given the text + /// position and the logical side of the position. This function is normally used as part of caret positioning of text where the + /// caret is drawn at the location corresponding to the current text editing position. It may also be used as a way to + /// programmatically obtain the geometry of a particular text position in UI automation. + /// + /// + /// Type: UINT32 + /// The text position used to get the pixel location. + /// + /// + /// Type: BOOL + /// + /// A Boolean flag that indicates whether the pixel location is of the leading or the trailing side of the specified text position. + /// + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the output pixel location X, relative to the top-left location of the layout box. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the output pixel location Y, relative to the top-left location of the layout box. + /// + /// + /// Type: DWRITE_HIT_TEST_METRICS* + /// When this method returns, contains the output geometry fully enclosing the specified text position. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-hittesttextposition HRESULT + // HitTestTextPosition( UINT32 textPosition, BOOL isTrailingHit, FLOAT *pointX, FLOAT *pointY, DWRITE_HIT_TEST_METRICS + // *hitTestMetrics ); + void HitTestTextPosition(uint textPosition, [MarshalAs(UnmanagedType.Bool)] bool isTrailingHit, out float pointX, out float pointY, + out DWRITE_HIT_TEST_METRICS hitTestMetrics); + + /// + /// + /// The application calls this function to get a set of hit-test metrics corresponding to a range of text positions. One of the + /// main usages is to implement highlight selection of the text string. + /// + /// + /// The function returns E_NOT_SUFFICIENT_BUFFER, which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), when the + /// buffer size of hitTestMetrics is too small to hold all the regions calculated by the function. In this situation, the + /// function sets the output value *actualHitTestMetricsCount to the number of geometries calculated. + /// + /// The application is responsible for allocating a new buffer of greater size and calling the function again. + /// A good value to use as an initial value for maxHitTestMetricsCount may be calculated from the following equation: + /// + /// where lineCount is obtained from the value of the output argument *actualLineCount (from the function + /// IDWriteTextLayout::GetLineLengths), and the maxBidiReorderingDepth value from the DWRITE_TEXT_METRICSstructure of the output + /// argument *textMetrics (from the function IDWriteFactory::CreateTextLayout). + /// + /// + /// + /// Type: UINT32 + /// The first text position of the specified range. + /// + /// + /// Type: UINT32 + /// The number of positions of the specified range. + /// + /// + /// Type: FLOAT + /// The origin pixel location X at the left of the layout box. This offset is added to the hit-test metrics returned. + /// + /// + /// Type: FLOAT + /// The origin pixel location Y at the top of the layout box. This offset is added to the hit-test metrics returned. + /// + /// + /// Type: DWRITE_HIT_TEST_METRICS* + /// + /// When this method returns, contains a pointer to a buffer of the output geometry fully enclosing the specified position + /// range. The buffer must be at least as large as maxHitTestMetricsCount. + /// + /// + /// + /// Type: UINT32 + /// Maximum number of boxes hitTestMetrics could hold in its buffer memory. + /// + /// + /// Type: UINT32* + /// Actual number of geometries hitTestMetrics holds in its buffer memory. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextlayout-hittesttextrange HRESULT + // HitTestTextRange( UINT32 textPosition, UINT32 textLength, FLOAT originX, FLOAT originY, DWRITE_HIT_TEST_METRICS + // *hitTestMetrics, UINT32 maxHitTestMetricsCount, UINT32 *actualHitTestMetricsCount ); + void HitTestTextRange(uint textPosition, uint textLength, float originX, float originY, + [Out, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] DWRITE_HIT_TEST_METRICS[] hitTestMetrics, + uint maxHitTestMetricsCount, out uint actualHitTestMetricsCount); + } + + /// + /// Represents a set of application-defined callbacks that perform rendering of text, inline objects, and decorations such as underlines. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextrenderer + [PInvokeData("dwrite.h", MSDNShortId = "a2ac70c8-e33b-46f1-b53b-1ab07555f109")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("ef8a8135-5cc6-45fe-8825-c5a0724eb819")] + public interface IDWriteTextRenderer : IDWritePixelSnapping + { + /// + /// Determines whether pixel snapping is disabled. The recommended default is FALSE, unless doing animation that requires + /// subpixel vertical placement. + /// + /// + /// Type: void* + /// The context passed to IDWriteTextLayout::Draw. + /// + /// + /// [out] Type: BOOL* + /// Receives TRUE if pixel snapping is disabled; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/dd371281(v%3Dvs.85) virtual HRESULT + // IsPixelSnappingEnabled( void * clientDrawingContext, [out] BOOL * isDisabled ) = 0; + [return: MarshalAs(UnmanagedType.Bool)] + new bool IsPixelSnappingDisabled([In, Optional] IntPtr clientDrawingContext); + + /// Gets a transform that maps abstract coordinates to DIPs. + /// + /// Type: void* + /// The drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: DWRITE_MATRIX* + /// When this method returns, contains a structure which has transform information for pixel snapping. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritepixelsnapping-getcurrenttransform HRESULT + // GetCurrentTransform( void *clientDrawingContext, DWRITE_MATRIX *transform ); + new DWRITE_MATRIX GetCurrentTransform([In, Optional] IntPtr clientDrawingContext); + + /// Gets the number of physical pixels per DIP. + /// + /// Type: void* + /// The drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: FLOAT* + /// When this method returns, contains the number of physical pixels per DIP. + /// + /// + /// Because a DIP (device-independent pixel) is 1/96 inch, the pixelsPerDip value is the number of logical pixels per inch + /// divided by 96. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritepixelsnapping-getpixelsperdip HRESULT + // GetPixelsPerDip( void *clientDrawingContext, FLOAT *pixelsPerDip ); + new float GetPixelsPerDip([In, Optional] IntPtr clientDrawingContext); + + /// IDWriteTextLayout::Draw calls this function to instruct the client to render a run of glyphs. + /// + /// Type: void* + /// The application-defined drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: FLOAT + /// The pixel location (X-coordinate) at the baseline origin of the glyph run. + /// + /// + /// Type: FLOAT + /// The pixel location (Y-coordinate) at the baseline origin of the glyph run. + /// + /// + /// Type: DWRITE_MEASURING_MODE + /// The measuring method for glyphs in the run, used with the other properties to determine the rendering mode. + /// + /// + /// Type: const DWRITE_GLYPH_RUN* + /// Pointer to the glyph run instance to render. + /// + /// + /// Type: const DWRITE_GLYPH_RUN_DESCRIPTION* + /// A pointer to the glyph run description instance which contains properties of the characters associated with this run. + /// + /// + /// Type: IUnknown* + /// + /// Application-defined drawing effects for the glyphs to render. Usually this argument represents effects such as the + /// foreground brush filling the interior of text. + /// + /// + /// + /// The IDWriteTextLayout::Draw function calls this callback function with all the information about glyphs to render. The + /// application implements this callback by mostly delegating the call to the underlying platform's graphics API such as + /// Direct2D to draw glyphs on the drawing context. An application that uses GDI can implement this callback in terms of the + /// IDWriteBitmapRenderTarget::DrawGlyphRun method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextrenderer-drawglyphrun HRESULT DrawGlyphRun( + // void *clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE measuringMode, + // DWRITE_GLYPH_RUN const *glyphRun, DWRITE_GLYPH_RUN_DESCRIPTION const *glyphRunDescription, IUnknown *clientDrawingEffect ); + void DrawGlyphRun([In, Optional] IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, DWRITE_MEASURING_MODE measuringMode, + in DWRITE_GLYPH_RUN glyphRun, in DWRITE_GLYPH_RUN_DESCRIPTION glyphRunDescription, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object clientDrawingEffect); + + /// IDWriteTextLayout::Draw calls this function to instruct the client to draw an underline. + /// + /// Type: void* + /// The application-defined drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: FLOAT + /// The pixel location (X-coordinate) at the baseline origin of the run where underline applies. + /// + /// + /// Type: FLOAT + /// The pixel location (Y-coordinate) at the baseline origin of the run where underline applies. + /// + /// + /// Type: const DWRITE_UNDERLINE* + /// Pointer to a structure containing underline logical information. + /// + /// + /// Type: IUnknown* + /// + /// Application-defined effect to apply to the underline. Usually this argument represents effects such as the foreground brush + /// filling the interior of a line. + /// + /// + /// + /// A single underline can be broken into multiple calls, depending on how the formatting changes attributes. If font + /// sizes/styles change within an underline, the thickness and offset will be averaged weighted according to characters. To get + /// an appropriate starting pixel position, add underline::offset to the baseline. Otherwise there will be no spacing between + /// the text. The x coordinate will always be passed as the left side, regardless of text directionality. This simplifies + /// drawing and reduces the problem of round-off that could potentially cause gaps or a double stamped alpha blend. To avoid + /// alpha overlap, round the end points to the nearest device pixel. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextrenderer-drawunderline HRESULT DrawUnderline( + // void *clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_UNDERLINE const *underline, IUnknown + // *clientDrawingEffect ); + void DrawUnderline([In, Optional] IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, + in DWRITE_UNDERLINE underline, [In, Optional] [MarshalAs(UnmanagedType.IUnknown)] object clientDrawingEffect); + + /// IDWriteTextLayout::Draw calls this function to instruct the client to draw a strikethrough. + /// + /// Type: void* + /// The application-defined drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: FLOAT + /// The pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies. + /// + /// + /// Type: FLOAT + /// The pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies. + /// + /// + /// Type: const DWRITE_STRIKETHROUGH* + /// Pointer to a structure containing strikethrough logical information. + /// + /// + /// Type: IUnknown* + /// + /// Application-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground + /// brush filling the interior of a line. + /// + /// + /// + /// A single strikethrough can be broken into multiple calls, depending on how the formatting changes attributes. Strikethrough + /// is not averaged across font sizes/styles changes. To get an appropriate starting pixel position, add strikethrough::offset + /// to the baseline. Like underlines, the x coordinate will always be passed as the left side, regardless of text directionality. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextrenderer-drawstrikethrough HRESULT + // DrawStrikethrough( void *clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_STRIKETHROUGH const + // *strikethrough, IUnknown *clientDrawingEffect ); + void DrawStrikethrough([In, Optional] IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, + in DWRITE_STRIKETHROUGH strikethrough, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object clientDrawingEffect); + + /// IDWriteTextLayout::Draw calls this application callback when it needs to draw an inline object. + /// + /// Type: void* + /// The application-defined drawing context passed to IDWriteTextLayout::Draw. + /// + /// + /// Type: FLOAT + /// X-coordinate at the top-left corner of the inline object. + /// + /// + /// Type: FLOAT + /// Y-coordinate at the top-left corner of the inline object. + /// + /// + /// Type: IDWriteInlineObject* + /// The application-defined inline object set using IDWriteTextFormat::SetInlineObject. + /// + /// + /// Type: BOOL + /// A Boolean flag that indicates whether the object's baseline runs alongside the baseline axis of the line. + /// + /// + /// Type: BOOL + /// + /// A Boolean flag that indicates whether the object is in a right-to-left context, hinting that the drawing may want to mirror + /// the normal image. + /// + /// + /// + /// Type: IUnknown* + /// + /// Application-defined drawing effects for the glyphs to render. Usually this argument represents effects such as the + /// foreground brush filling the interior of a line. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextrenderer-drawinlineobject HRESULT + // DrawInlineObject( void *clientDrawingContext, FLOAT originX, FLOAT originY, IDWriteInlineObject *inlineObject, BOOL + // isSideways, BOOL isRightToLeft, IUnknown *clientDrawingEffect ); + void DrawInlineObject([In, Optional] IntPtr clientDrawingContext, float originX, float originY, [In] IDWriteInlineObject inlineObject, + [MarshalAs(UnmanagedType.Bool)] bool isSideways, [MarshalAs(UnmanagedType.Bool)] bool isRightToLeft, + [In, Optional] [MarshalAs(UnmanagedType.IUnknown)] object clientDrawingEffect); + } + + /// Represents a font typography setting. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetypography + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("55f1112b-1dc2-4b3c-9541-f46894ed85b6")] + public interface IDWriteTypography + { + /// Adds an OpenType font feature. + /// + /// Type: DWRITE_FONT_FEATURE + /// A structure that contains the OpenType name identifier and the execution parameter for the font feature being added. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetypography-addfontfeature HRESULT AddFontFeature( + // DWRITE_FONT_FEATURE fontFeature ); + void AddFontFeature(DWRITE_FONT_FEATURE fontFeature); + + /// Gets the number of OpenType font features for the current font. + /// + /// Type: UINT32 + /// The number of font features for the current text format. + /// + /// + /// A single run of text can be associated with more than one typographic feature. The IDWriteTypography object holds a list of + /// these font features. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetypography-getfontfeaturecount UINT32 GetFontFeatureCount(); + [PreserveSig] + uint GetFontFeatureCount(); + + /// Gets the font feature at the specified index. + /// + /// Type: UINT32 + /// The zero-based index of the font feature to retrieve. + /// + /// + /// Type: DWRITE_FONT_FEATURE* + /// When this method returns, contains the font feature which is at the specified index. + /// + /// + /// A single run of text can be associated with more than one typographic feature. The IDWriteTypography object holds a list of + /// these font features. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetypography-getfontfeature HRESULT GetFontFeature( + // UINT32 fontFeatureIndex, DWRITE_FONT_FEATURE *fontFeature ); + DWRITE_FONT_FEATURE GetFontFeature(uint fontFeatureIndex); + } + + /// Creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. + /// + /// Type: DWRITE_FACTORY_TYPE + /// A value that specifies whether the factory object will be shared or isolated. + /// + /// + /// Type: REFIID + /// A GUID value that identifies the DirectWrite factory interface, such as __uuidof(IDWriteFactory). + /// + /// + /// Type: IUnknown** + /// An address of a pointer to the newly created DirectWrite factory object. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This function creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. + /// DirectWrite factory contains internal state data such as font loader registration and cached font data. In most cases it is + /// recommended you use the shared factory object, because it allows multiple components that use DirectWrite to share internal + /// DirectWrite state data, and thereby reduce memory usage. However, there are cases when it is desirable to reduce the impact of a + /// component, such as a plug-in from an untrusted source, on the rest of the process, by sandboxing and isolating it from the rest + /// of the process components. In such cases, it is recommended you use an isolated factory for the sandboxed component. + /// + /// The following example shows how to create a shared DirectWrite factory. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-dwritecreatefactory HRESULT DWriteCreateFactory( + // DWRITE_FACTORY_TYPE factoryType, REFIID iid, IUnknown **factory ); + [DllImport("dwrite.dll", SetLastError = false, ExactSpelling = true)] + [PInvokeData("dwrite.h", MSDNShortId = "c74c0906-0a5c-4ab8-87cf-a195566e1d9e")] + public static extern HRESULT DWriteCreateFactory(DWRITE_FACTORY_TYPE factoryType, in Guid iid, [MarshalAs(UnmanagedType.IUnknown)] out object factory); + + /// Creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. + /// Identifies the DirectWrite factory interface, such as IDWriteFactory. + /// + /// Type: DWRITE_FACTORY_TYPE + /// A value that specifies whether the factory object will be shared or isolated. + /// + /// + /// Type: IUnknown** + /// An address of a pointer to the newly created DirectWrite factory object. + /// + /// + /// This function creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. + /// DirectWrite factory contains internal state data such as font loader registration and cached font data. In most cases it is + /// recommended you use the shared factory object, because it allows multiple components that use DirectWrite to share internal + /// DirectWrite state data, and thereby reduce memory usage. However, there are cases when it is desirable to reduce the impact of a + /// component, such as a plug-in from an untrusted source, on the rest of the process, by sandboxing and isolating it from the rest + /// of the process components. In such cases, it is recommended you use an isolated factory for the sandboxed component. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-dwritecreatefactory HRESULT DWriteCreateFactory( + // DWRITE_FACTORY_TYPE factoryType, REFIID iid, IUnknown **factory ); + [PInvokeData("dwrite.h", MSDNShortId = "c74c0906-0a5c-4ab8-87cf-a195566e1d9e")] + public static T DWriteCreateFactory(DWRITE_FACTORY_TYPE factoryType = DWRITE_FACTORY_TYPE.DWRITE_FACTORY_TYPE_SHARED) where T : class + { + DWriteCreateFactory(factoryType, typeof(T).GUID, out var factory).ThrowIfFailed(); + return (T)factory; + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/DirectWrite/Dwrite.cs b/PInvoke/Graphics/DirectWrite/Dwrite.cs new file mode 100644 index 00000000..fbbe225a --- /dev/null +++ b/PInvoke/Graphics/DirectWrite/Dwrite.cs @@ -0,0 +1,2362 @@ +using System; +using System.Runtime.InteropServices; +using Vanara.Extensions; + +namespace Vanara.PInvoke +{ + /// Items from the Dwrite.dll + public static partial class Dwrite + { + /// Maximum alpha value in a texture returned by IDWriteGlyphRunAnalysis::CreateAlphaTexture. + public const uint DWRITE_ALPHA_MAX = 255; + + /// Indicates the condition at the edges of inline object or text used to determine line-breaking behavior. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_break_condition typedef enum DWRITE_BREAK_CONDITION { + // DWRITE_BREAK_CONDITION_NEUTRAL, DWRITE_BREAK_CONDITION_CAN_BREAK, DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, + // DWRITE_BREAK_CONDITION_MUST_BREAK } ; + [PInvokeData("dwrite.h", MSDNShortId = "26dbe63e-eeee-486f-aa94-74320b190fcb")] + public enum DWRITE_BREAK_CONDITION + { + /// Indicates whether a break is allowed by determining the condition of the neighboring text span or inline object. + DWRITE_BREAK_CONDITION_NEUTRAL, + + /// + /// Indicates that a line break is allowed, unless overruled by the condition of the neighboring text span or inline object, + /// either prohibited by a "may not break" condition or forced by a "must break" condition. + /// + DWRITE_BREAK_CONDITION_CAN_BREAK, + + /// + /// Indicates that there should be no line break, unless overruled by a "must break" condition from the neighboring text span or + /// inline object. + /// + DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, + + /// Indicates that the line break must happen, regardless of the condition of the adjacent text span or inline object. + DWRITE_BREAK_CONDITION_MUST_BREAK, + } + + /// Specifies the type of DirectWrite factory object. + /// + /// A DirectWrite factory object contains information about its internal state, such as font loader registration and cached font + /// data. In most cases you should use the shared factory object, because it allows multiple components that use DirectWrite to + /// share internal DirectWrite state information, thereby reducing memory usage. However, there are cases when it is desirable to + /// reduce the impact of a component on the rest of the process, such as a plug-in from an untrusted source, by sandboxing and + /// isolating it from the rest of the process components. In such cases, you should use an isolated factory for the sandboxed component. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_factory_type typedef enum DWRITE_FACTORY_TYPE { + // DWRITE_FACTORY_TYPE_SHARED, DWRITE_FACTORY_TYPE_ISOLATED } ; + [PInvokeData("dwrite.h", MSDNShortId = "ce51d8cd-3125-49e3-878c-9d4b446e2422")] + public enum DWRITE_FACTORY_TYPE + { + /// + /// Indicates that the DirectWrite factory is a shared factory and that it allows for the reuse of cached font data across + /// multiple in-process components. Such factories also take advantage of cross process font caching components for better performance. + /// + DWRITE_FACTORY_TYPE_SHARED, + + /// + /// Indicates that the DirectWrite factory object is isolated. Objects created from the isolated factory do not interact with + /// internal DirectWrite state from other components. + /// + DWRITE_FACTORY_TYPE_ISOLATED, + } + + /// Indicates the direction of how lines of text are placed relative to one another. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_flow_direction typedef enum DWRITE_FLOW_DIRECTION { + // DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM, DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP, DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT, + // DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT } ; + [PInvokeData("dwrite.h", MSDNShortId = "35a78bde-ba80-4328-8fb8-77ca73c1c04b")] + public enum DWRITE_FLOW_DIRECTION + { + /// Specifies that text lines are placed from top to bottom. + DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM, + + /// Specifies that text lines are placed from bottom to top. + DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP, + + /// Specifies that text lines are placed from left to right. + DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT, + + /// Specifies that text lines are placed from right to left. + DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT, + } + + /// Indicates the file format of a complete font face. + /// Font formats that consist of multiple files, such as Type 1 .PFM and .PFB, have a single enum entry. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_face_type typedef enum DWRITE_FONT_FACE_TYPE { + // DWRITE_FONT_FACE_TYPE_CFF, DWRITE_FONT_FACE_TYPE_TRUETYPE, DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION, + // DWRITE_FONT_FACE_TYPE_TYPE1, DWRITE_FONT_FACE_TYPE_VECTOR, DWRITE_FONT_FACE_TYPE_BITMAP, DWRITE_FONT_FACE_TYPE_UNKNOWN, + // DWRITE_FONT_FACE_TYPE_RAW_CFF, DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION } ; + [PInvokeData("dwrite.h", MSDNShortId = "839527fb-2560-4472-8115-960bf5b6badd")] + public enum DWRITE_FONT_FACE_TYPE + { + /// OpenType font face with CFF outlines. + DWRITE_FONT_FACE_TYPE_CFF, + + /// OpenType font face with TrueType outlines. + DWRITE_FONT_FACE_TYPE_TRUETYPE, + + /// + DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION, + + /// A Type 1 font face. + DWRITE_FONT_FACE_TYPE_TYPE1, + + /// A vector .FON format font face. + DWRITE_FONT_FACE_TYPE_VECTOR, + + /// A bitmap .FON format font face. + DWRITE_FONT_FACE_TYPE_BITMAP, + + /// Font face type is not recognized by the DirectWrite font system. + DWRITE_FONT_FACE_TYPE_UNKNOWN, + + /// + /// The font data includes only the CFF table from an OpenType CFF font. This font face type can be used only for embedded fonts + /// (i.e., custom font file loaders) and the resulting font face object supports only the minimum functionality necessary to + /// render glyphs. + /// + DWRITE_FONT_FACE_TYPE_RAW_CFF, + + /// OpenType font face that is a part of a TrueType collection. + DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION, + } + + /// A value that indicates the typographic feature of text supplied by the font. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_feature_tag + [PInvokeData("dwrite.h", MSDNShortId = "31f0d1b5-36f2-4bde-b39c-b1392f9d925f")] + public enum DWRITE_FONT_FEATURE_TAG : uint + { + /// Replaces figures separated by a slash with an alternative form.Equivalent OpenType tag: 'afrc' + DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = ((byte)'a') | (((uint)(byte)'f') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'c') << 24), + + /// + /// Turns capital characters into petite capitals. It is generally used for words which would otherwise be set in all caps, such + /// as acronyms, but which are desired in petite-cap form to avoid disrupting the flow of text. See the pcap feature description + /// for notes on the relationship of caps, smallcaps and petite caps.Equivalent OpenType tag: 'c2pc' + /// + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = ((byte)'c') | (((uint)(byte)'2') << 8) | (((uint)(byte)'p') << 16) | (((uint)(byte)'c') << 24), + + /// + /// Turns capital characters into small capitals. It is generally used for words which would otherwise be set in all caps, such + /// as acronyms, but which are desired in small-cap form to avoid disrupting the flow of text. Equivalent OpenType tag: 'c2sc' + /// + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = ((byte)'c') | (((uint)(byte)'2') << 8) | (((uint)(byte)'s') << 16) | (((uint)(byte)'c') << 24), + + /// + /// In specified situations, replaces default glyphs with alternate forms which provide better joining behavior. Used in script + /// typefaces which are designed to have some or all of their glyphs join.Equivalent OpenType tag: 'calt' + /// + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = ((byte)'c') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Shifts various punctuation marks up to a position that works better with all-capital sequences or sets of lining figures; + /// also changes oldstyle figures to lining figures. By default, glyphs in a text face are designed to work with lowercase + /// characters. Some characters should be shifted vertically to fit the higher visual center of all-capital or lining text. + /// Also, lining figures are the same height (or close to it) as capitals, and fit much better with all-capital text.Equivalent + /// OpenType tag: 'case' + /// + DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = ((byte)'c') | (((uint)(byte)'a') << 8) | (((uint)(byte)'s') << 16) | (((uint)(byte)'e') << 24), + + /// + /// To minimize the number of glyph alternates, it is sometimes desired to decompose a character into two glyphs. Additionally, + /// it may be preferable to compose two characters into a single glyph for better glyph processing. This feature permits such + /// composition/decomposition. The feature should be processed as the first feature processed, and should be processed only when + /// it is called.Equivalent OpenType tag: 'ccmp' + /// + DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = ((byte)'c') | (((uint)(byte)'c') << 8) | (((uint)(byte)'m') << 16) | (((uint)(byte)'p') << 24), + + /// + /// Replaces a sequence of glyphs with a single glyph which is preferred for typographic purposes. Unlike other ligature + /// features, clig specifies the context in which the ligature is recommended. This capability is important in some script + /// designs and for swash ligatures.Equivalent OpenType tag: 'clig' + /// + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = ((byte)'c') | (((uint)(byte)'l') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'g') << 24), + + /// + /// Globally adjusts inter-glyph spacing for all-capital text. Most typefaces contain capitals and lowercase characters, and the + /// capitals are positioned to work with the lowercase. When capitals are used for words, they need more space between them for + /// legibility and esthetics. This feature would not apply to monospaced designs. Of course the user may want to override this + /// behavior in order to do more pronounced letterspacing for esthetic reasons.Equivalent OpenType tag: 'cpsp' + /// + DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = ((byte)'c') | (((uint)(byte)'p') << 8) | (((uint)(byte)'s') << 16) | (((uint)(byte)'p') << 24), + + /// + /// Replaces default character glyphs with corresponding swash glyphs in a specified context. Note that there may be more than + /// one swash alternate for a given character.Equivalent OpenType tag: 'cswh' + /// + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = ((byte)'c') | (((uint)(byte)'s') << 8) | (((uint)(byte)'w') << 16) | (((uint)(byte)'h') << 24), + + /// In cursive scripts like Arabic, this feature cursively positions adjacent glyphs.Equivalent OpenType tag: 'curs' + DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = ((byte)'c') | (((uint)(byte)'u') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'s') << 24), + + /// The default. + DWRITE_FONT_FEATURE_TAG_DEFAULT = ((byte)'d') | (((uint)(byte)'f') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Replaces a sequence of glyphs with a single glyph which is preferred for typographic purposes. This feature covers those + /// ligatures which may be used for special effect, at the user's preference.Equivalent OpenType tag: 'dlig' + /// + DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = ((byte)'d') | (((uint)(byte)'l') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'g') << 24), + + /// + /// Replaces standard forms in Japanese fonts with corresponding forms preferred by typographers. For example, a user would + /// invoke this feature to replace kanji character U+5516 with U+555E.Equivalent OpenType tag: 'expt' + /// + DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = ((byte)'e') | (((uint)(byte)'x') << 8) | (((uint)(byte)'p') << 16) | (((uint)(byte)'t') << 24), + + /// Replaces figures separated by a slash with 'common' (diagonal) fractions.Equivalent OpenType tag: 'frac' + DWRITE_FONT_FEATURE_TAG_FRACTIONS = ((byte)'f') | (((uint)(byte)'r') << 8) | (((uint)(byte)'a') << 16) | (((uint)(byte)'c') << 24), + + /// + /// Replaces glyphs set on other widths with glyphs set on full (usually em) widths. In a CJKV font, this may include "lower + /// ASCII" Latin characters and various symbols. In a European font, this feature replaces proportionally-spaced glyphs with + /// monospaced glyphs, which are generally set on widths of 0.6 em. For example, a user may invoke this feature in a Japanese + /// font to get full monospaced Latin glyphs instead of the corresponding proportionally-spaced versions.Equivalent OpenType + /// tag: 'fwid' + /// + DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = ((byte)'f') | (((uint)(byte)'w') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'d') << 24), + + /// + /// Produces the half forms of consonants in Indic scripts. For example, in Hindi (Devanagari script), the conjunct KKa, + /// obtained by doubling the Ka, is denoted with a half form of Ka followed by the full form. Equivalent OpenType tag: 'half' + /// + DWRITE_FONT_FEATURE_TAG_HALF_FORMS = ((byte)'h') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'f') << 24), + + /// + /// Produces the halant forms of consonants in Indic scripts. For example, in Sanskrit (Devanagari script), syllable final + /// consonants are frequently required in their halant form.Equivalent OpenType tag: 'haln' + /// + DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = ((byte)'h') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'n') << 24), + + /// + /// Respaces glyphs designed to be set on full-em widths, fitting them onto half-em widths. This differs from hwid in that it + /// does not substitute new glyphs.Equivalent OpenType tag: 'halt' + /// + DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = ((byte)'h') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Replaces the default (current) forms with the historical alternates. While some ligatures are also used for historical + /// effect, this feature deals only with single characters. Some fonts include the historical forms as alternates, so they can + /// be used for a 'period' effect. Equivalent OpenType tag: 'hist' + /// + DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = ((byte)'h') | (((uint)(byte)'i') << 8) | (((uint)(byte)'s') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Replaces standard kana with forms that have been specially designed for only horizontal writing. This is a typographic + /// optimization for improved fit and more even color.Equivalent OpenType tag: 'hkna' + /// + DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = ((byte)'h') | (((uint)(byte)'k') << 8) | (((uint)(byte)'n') << 16) | (((uint)(byte)'a') << 24), + + /// + /// Replaces the default (current) forms with the historical alternates. Some ligatures were in common use in the past, but + /// appear anachronistic today. Some fonts include the historical forms as alternates, so they can be used for a 'period' + /// effect.Equivalent OpenType tag: 'hlig' + /// + DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = ((byte)'h') | (((uint)(byte)'l') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'g') << 24), + + /// + /// Replaces glyphs on proportional widths, or fixed widths other than half an em, with glyphs on half-em (en) widths. Many CJKV + /// fonts have glyphs which are set on multiple widths; this feature selects the half-em version. There are various contexts in + /// which this is the preferred behavior, including compatibility with older desktop documents.Equivalent OpenType tag: 'hwid' + /// + DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = ((byte)'h') | (((uint)(byte)'w') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'d') << 24), + + /// + /// Used to access the JIS X 0212-1990 glyphs for the cases when the JIS X 0213:2004 form is encoded. The JIS X 0212-1990 (aka, + /// "Hojo Kanji") and JIS X 0213:2004 character sets overlap significantly. In some cases their prototypical glyphs differ. When + /// building fonts that support both JIS X 0212-1990 and JIS X 0213:2004 (such as those supporting the Adobe-Japan 1-6 character + /// collection), it is recommended that JIS X 0213:2004 forms be the preferred encoded form.Equivalent OpenType tag: 'hojo' + /// + DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = ((byte)'h') | (((uint)(byte)'o') << 8) | (((uint)(byte)'j') << 16) | (((uint)(byte)'o') << 24), + + /// + /// The National Language Council (NLC) of Japan has defined new glyph shapes for a number of JIS characters, which were + /// incorporated into JIS X 0213:2004 as new prototypical forms. The 'jp04' feature is A subset of the 'nlck' feature, and is + /// used to access these prototypical glyphs in a manner that maintains the integrity of JIS X 0213:2004.Equivalent OpenType + /// tag: 'jp04' + /// + DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = ((byte)'j') | (((uint)(byte)'p') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'4') << 24), + + /// + /// Replaces default (JIS90) Japanese glyphs with the corresponding forms from the JIS C 6226-1978 (JIS78) + /// specification.Equivalent OpenType tag: 'jp78' + /// + DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = ((byte)'j') | (((uint)(byte)'p') << 8) | (((uint)(byte)'7') << 16) | (((uint)(byte)'8') << 24), + + /// + /// Replaces default (JIS90) Japanese glyphs with the corresponding forms from the JIS X 0208-1983 (JIS83) + /// specification.Equivalent OpenType tag: 'jp83' + /// + DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = ((byte)'j') | (((uint)(byte)'p') << 8) | (((uint)(byte)'8') << 16) | (((uint)(byte)'3') << 24), + + /// + /// Replaces Japanese glyphs from the JIS78 or JIS83 specifications with the corresponding forms from the JIS X 0208-1990 + /// (JIS90) specification.Equivalent OpenType tag: 'jp90' + /// + DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = ((byte)'j') | (((uint)(byte)'p') << 8) | (((uint)(byte)'9') << 16) | (((uint)(byte)'0') << 24), + + /// + /// Adjusts amount of space between glyphs, generally to provide optically consistent spacing between glyphs. Although a + /// well-designed typeface has consistent inter-glyph spacing overall, some glyph combinations require adjustment for improved + /// legibility. Besides standard adjustment in the horizontal direction, this feature can supply size-dependent kerning data via + /// device tables, "cross-stream" kerning in the Y text direction, and adjustment of glyph placement independent of the advance + /// adjustment. Note that this feature may apply to runs of more than two glyphs, and would not be used in monospaced fonts. + /// Also note that this feature does not apply to text set vertically.Equivalent OpenType tag: 'kern' + /// + DWRITE_FONT_FEATURE_TAG_KERNING = ((byte)'k') | (((uint)(byte)'e') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'n') << 24), + + /// + /// Replaces a sequence of glyphs with a single glyph which is preferred for typographic purposes. This feature covers the + /// ligatures which the designer/manufacturer judges should be used in normal conditions.Equivalent OpenType tag: 'liga' + /// + DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = ((byte)'l') | (((uint)(byte)'i') << 8) | (((uint)(byte)'g') << 16) | (((uint)(byte)'a') << 24), + + /// + /// Changes selected figures from oldstyle to the default lining form. For example, a user may invoke this feature in order to + /// get lining figures, which fit better with all-capital text. This feature overrides results of the Oldstyle Figures feature + /// (onum).Equivalent OpenType tag: 'lnum' + /// + DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = ((byte)'l') | (((uint)(byte)'n') << 8) | (((uint)(byte)'u') << 16) | (((uint)(byte)'m') << 24), + + /// + /// Enables localized forms of glyphs to be substituted for default forms. Many scripts used to write multiple languages over + /// wide geographical areas have developed localized variant forms of specific letters, which are used by individual literary + /// communities. For example, a number of letters in the Bulgarian and Serbian alphabets have forms distinct from their Russian + /// counterparts and from each other. In some cases the localized form differs only subtly from the script 'norm', in others the + /// forms are radically distinct. Equivalent OpenType tag: 'locl' + /// + DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = ((byte)'l') | (((uint)(byte)'o') << 8) | (((uint)(byte)'c') << 16) | (((uint)(byte)'l') << 24), + + /// + /// Positions mark glyphs with respect to base glyphs. For example, in Arabic script positioning the Hamza above the + /// Yeh.Equivalent OpenType tag: 'mark' + /// + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = ((byte)'m') | (((uint)(byte)'a') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'k') << 24), + + /// + /// Replaces standard typographic forms of Greek glyphs with corresponding forms commonly used in mathematical notation (which + /// are a subset of the Greek alphabet).Equivalent OpenType tag: 'mgrk' + /// + DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = ((byte)'m') | (((uint)(byte)'g') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'k') << 24), + + /// + /// Positions marks with respect to other marks. Required in various non-Latin scripts like Arabic. For example, in Arabic, the + /// ligaturised mark Ha with Hamza above it can also be obtained by positioning these marks relative to one another.Equivalent + /// OpenType tag: 'mkmk' + /// + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = ((byte)'m') | (((uint)(byte)'k') << 8) | (((uint)(byte)'m') << 16) | (((uint)(byte)'k') << 24), + + /// + /// Replaces default glyphs with various notational forms (such as glyphs placed in open or solid circles, squares, parentheses, + /// diamonds or rounded boxes). In some cases an annotation form may already be present, but the user may want a different + /// one.Equivalent OpenType tag: 'nalt' + /// + DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = ((byte)'n') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Used to access glyphs made from glyph shapes defined by the National Language Council (NLC) of Japan for a number of JIS + /// characters in 2000. Equivalent OpenType tag: 'nlck' + /// + DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = ((byte)'n') | (((uint)(byte)'l') << 8) | (((uint)(byte)'c') << 16) | (((uint)(byte)'k') << 24), + + /// + /// Changes selected figures from the default lining style to oldstyle form. For example, a user may invoke this feature to get + /// oldstyle figures, which fit better into the flow of normal upper- and lowercase text. This feature overrides results of the + /// Lining Figures feature (lnum).Equivalent OpenType tag: 'onum' + /// + DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = ((byte)'o') | (((uint)(byte)'n') << 8) | (((uint)(byte)'u') << 16) | (((uint)(byte)'m') << 24), + + /// + /// Replaces default alphabetic glyphs with the corresponding ordinal forms for use after figures. One exception to the + /// follows-a-figure rule is the numero character (U+2116), which is actually a ligature substitution, but is best accessed + /// through this feature.Equivalent OpenType tag: 'ordn' + /// + DWRITE_FONT_FEATURE_TAG_ORDINALS = ((byte)'o') | (((uint)(byte)'r') << 8) | (((uint)(byte)'d') << 16) | (((uint)(byte)'n') << 24), + + /// + /// Respaces glyphs designed to be set on full-em widths, fitting them onto individual (more or less proportional) horizontal + /// widths. This differs from pwid in that it does not substitute new glyphs (GPOS, not GSUB feature). The user may prefer the + /// monospaced form, or may simply want to ensure that the glyph is well-fit and not rotated in vertical setting (Latin forms + /// designed for proportional spacing would be rotated).Equivalent OpenType tag: 'palt' + /// + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = ((byte)'p') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Turns lowercase characters into petite capitals. Forms related to petite capitals, such as specially designed figures, may + /// be included. Some fonts contain an additional size of capital letters, shorter than the regular smallcaps and it is referred + /// to as petite caps. Such forms are most likely to be found in designs with a small lowercase x-height, where they better + /// harmonise with lowercase text than the taller smallcaps (for examples of petite caps, see the Emigre type families Mrs Eaves + /// and Filosofia). Equivalent OpenType tag: 'pcap' + /// + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = ((byte)'p') | (((uint)(byte)'c') << 8) | (((uint)(byte)'a') << 16) | (((uint)(byte)'p') << 24), + + /// + /// Replaces figure glyphs set on uniform (tabular) widths with corresponding glyphs set on glyph-specific (proportional) + /// widths. Tabular widths will generally be the default, but this cannot be safely assumed. Of course this feature would not be + /// present in monospaced designs.Equivalent OpenType tag: 'pnum' + /// + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = ((byte)'p') | (((uint)(byte)'n') << 8) | (((uint)(byte)'u') << 16) | (((uint)(byte)'m') << 24), + + /// + /// Replaces glyphs set on uniform widths (typically full or half-em) with proportionally spaced glyphs. The proportional + /// variants are often used for the Latin characters in CJKV fonts, but may also be used for Kana in Japanese fonts.Equivalent + /// OpenType tag: 'pwid' + /// + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = ((byte)'p') | (((uint)(byte)'w') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'d') << 24), + + /// + /// Replaces glyphs on other widths with glyphs set on widths of one quarter of an em (half an en). The characters involved are + /// normally figures and some forms of punctuation.Equivalent OpenType tag: 'qwid' + /// + DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = ((byte)'q') | (((uint)(byte)'w') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'d') << 24), + + /// + /// Replaces a sequence of glyphs with a single glyph which is preferred for typographic purposes. This feature covers those + /// ligatures, which the script determines as required to be used in normal conditions. This feature is important for some + /// scripts to ensure correct glyph formation. Equivalent OpenType tag: 'rlig' + /// + DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = ((byte)'r') | (((uint)(byte)'l') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'g') << 24), + + /// + /// Identifies glyphs in the font which have been designed for "ruby", from the old typesetting term for four-point-sized type. + /// Japanese typesetting often uses smaller kana glyphs, generally in superscripted form, to clarify the meaning of kanji which + /// may be unfamiliar to the reader. Equivalent OpenType tag: 'ruby' + /// + DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = ((byte)'r') | (((uint)(byte)'u') << 8) | (((uint)(byte)'b') << 16) | (((uint)(byte)'y') << 24), + + /// + /// Replaces the default forms with the stylistic alternates. Many fonts contain alternate glyph designs for a purely esthetic + /// effect; these don't always fit into a clear category like swash or historical. As in the case of swash glyphs, there may be + /// more than one alternate form. Equivalent OpenType tag: 'salt' + /// + DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = ((byte)'s') | (((uint)(byte)'a') << 8) | (((uint)(byte)'l') << 16) | (((uint)(byte)'t') << 24), + + /// + /// Replaces lining or oldstyle figures with inferior figures (smaller glyphs which sit lower than the standard baseline, + /// primarily for chemical or mathematical notation). May also replace lowercase characters with alphabetic inferiors.Equivalent + /// OpenType tag: 'sinf' + /// + DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = ((byte)'s') | (((uint)(byte)'i') << 8) | (((uint)(byte)'n') << 16) | (((uint)(byte)'f') << 24), + + /// + /// Turns lowercase characters into small capitals. This corresponds to the common SC font layout. It is generally used for + /// display lines set in Large & small caps, such as titles. Forms related to small capitals, such as oldstyle figures, may + /// be included.Equivalent OpenType tag: 'smcp' + /// + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = ((byte)'s') | (((uint)(byte)'m') << 8) | (((uint)(byte)'c') << 16) | (((uint)(byte)'p') << 24), + + /// + /// Replaces 'traditional' Chinese or Japanese forms with the corresponding 'simplified' forms.Equivalent OpenType tag: 'smpl' + /// + DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = ((byte)'s') | (((uint)(byte)'m') << 8) | (((uint)(byte)'p') << 16) | (((uint)(byte)'l') << 24), + + /// + /// In addition to, or instead of, stylistic alternatives of individual glyphs (see 'salt' feature), some fonts may contain sets + /// of stylistic variant glyphs corresponding to portions of the character set, such as multiple variants for lowercase letters + /// in a Latin font. Glyphs in stylistic sets may be designed to harmonise visually, interract in particular ways, or otherwise + /// work together. Examples of fonts including stylistic sets are Zapfino Linotype and Adobe's Poetica. Individual features + /// numbered sequentially with the tag name convention 'ss01' 'ss02' 'ss03' . 'ss20' provide a mechanism for glyphs in these + /// sets to be associated via GSUB lookup indexes to default forms and to each other, and for users to select from available + /// stylistic setsEquivalent OpenType tag: 'ss01' + /// + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'1') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss02' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'2') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss03' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'3') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss04' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'4') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss05' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'5') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss06' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'6') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss07' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'7') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss08' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'8') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss09' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'0') << 16) | (((uint)(byte)'9') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss10' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'0') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss11' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'1') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss12' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'2') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss13' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'3') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss14' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'4') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss15' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'5') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss16' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'6') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss17' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'7') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss18' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'8') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss19' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'1') << 16) | (((uint)(byte)'9') << 24), + + /// See the description for DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1.Equivalent OpenType tag: 'ss20' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = ((byte)'s') | (((uint)(byte)'s') << 8) | (((uint)(byte)'2') << 16) | (((uint)(byte)'0') << 24), + + /// + /// May replace a default glyph with a subscript glyph, or it may combine a glyph substitution with positioning adjustments for + /// proper placement.Equivalent OpenType tag: 'subs' + /// + DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = ((byte)'s') | (((uint)(byte)'u') << 8) | (((uint)(byte)'b') << 16) | (((uint)(byte)'s') << 24), + + /// + /// Replaces lining or oldstyle figures with superior figures (primarily for footnote indication), and replaces lowercase + /// letters with superior letters (primarily for abbreviated French titles).Equivalent OpenType tag: 'sups' + /// + DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = ((byte)'s') | (((uint)(byte)'u') << 8) | (((uint)(byte)'p') << 16) | (((uint)(byte)'s') << 24), + + /// + /// Replaces default character glyphs with corresponding swash glyphs. Note that there may be more than one swash alternate for + /// a given character.Equivalent OpenType tag: 'swsh' + /// + DWRITE_FONT_FEATURE_TAG_SWASH = ((byte)'s') | (((uint)(byte)'w') << 8) | (((uint)(byte)'s') << 16) | (((uint)(byte)'h') << 24), + + /// + /// Replaces the default glyphs with corresponding forms designed specifically for titling. These may be all-capital and/or + /// larger on the body, and adjusted for viewing at larger sizes.Equivalent OpenType tag: 'titl' + /// + DWRITE_FONT_FEATURE_TAG_TITLING = ((byte)'t') | (((uint)(byte)'i') << 8) | (((uint)(byte)'t') << 16) | (((uint)(byte)'l') << 24), + + /// + /// Replaces 'simplified' Japanese kanji forms with the corresponding 'traditional' forms. This is equivalent to the Traditional + /// Forms feature, but explicitly limited to the traditional forms considered proper for use in personal names (as many as 205 + /// glyphs in some fonts).Equivalent OpenType tag: 'tnam' + /// + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = ((byte)'t') | (((uint)(byte)'n') << 8) | (((uint)(byte)'a') << 16) | (((uint)(byte)'m') << 24), + + /// + /// Replaces figure glyphs set on proportional widths with corresponding glyphs set on uniform (tabular) widths. Tabular widths + /// will generally be the default, but this cannot be safely assumed. Of course this feature would not be present in monospaced + /// designs.Equivalent OpenType tag: 'tnum' + /// + DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = ((byte)'t') | (((uint)(byte)'n') << 8) | (((uint)(byte)'u') << 16) | (((uint)(byte)'m') << 24), + + /// + /// Replaces 'simplified' Chinese hanzi or Japanese kanji forms with the corresponding 'traditional' forms.Equivalent OpenType + /// tag: 'trad' + /// + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = ((byte)'t') | (((uint)(byte)'r') << 8) | (((uint)(byte)'a') << 16) | (((uint)(byte)'d') << 24), + + /// + /// Replaces glyphs on other widths with glyphs set on widths of one third of an em. The characters involved are normally + /// figures and some forms of punctuation.Equivalent OpenType tag: 'twid' + /// + DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = ((byte)'t') | (((uint)(byte)'w') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'d') << 24), + + /// + /// Maps upper- and lowercase letters to a mixed set of lowercase and small capital forms, resulting in a single case alphabet + /// (for an example of unicase, see the Emigre type family Filosofia). The letters substituted may vary from font to font, as + /// appropriate to the design. If aligning to the x-height, smallcap glyphs may be substituted, or specially designed unicase + /// forms might be used. Substitutions might also include specially designed figures.Equivalent OpenType tag: 'unic' + /// + DWRITE_FONT_FEATURE_TAG_UNICASE = ((byte)'u') | (((uint)(byte)'n') << 8) | (((uint)(byte)'i') << 16) | (((uint)(byte)'c') << 24), + + /// Indicates that the font is displayed vertically. + DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = ((byte)'v') | (((uint)(byte)'e') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'t') << 24), + + /// Replaces normal figures with figures adjusted for vertical display. + DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = ((byte)'v') | (((uint)(byte)'r') << 8) | (((uint)(byte)'t') << 16) | (((uint)(byte)'2') << 24), + + /// + /// Allows the user to change from the default 0 to a slashed form. Some fonts contain both a default form of zero, and an + /// alternative form which uses a diagonal slash through the counter. Especially in condensed designs, it can be difficult to + /// distinguish between 0 and O (zero and capital O) in any situation where capitals and lining figures may be arbitrarily + /// mixed. Equivalent OpenType tag: 'zero' + /// + DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = ((byte)'z') | (((uint)(byte)'e') << 8) | (((uint)(byte)'r') << 16) | (((uint)(byte)'o') << 24), + } + + /// + /// The type of a font represented by a single font file. Font formats that consist of multiple files, for example Type 1 .PFM and + /// .PFB, have separate enum values for each of the file types. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_file_type typedef enum DWRITE_FONT_FILE_TYPE { + // DWRITE_FONT_FILE_TYPE_UNKNOWN, DWRITE_FONT_FILE_TYPE_CFF, DWRITE_FONT_FILE_TYPE_TRUETYPE, + // DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION, DWRITE_FONT_FILE_TYPE_TYPE1_PFM, DWRITE_FONT_FILE_TYPE_TYPE1_PFB, + // DWRITE_FONT_FILE_TYPE_VECTOR, DWRITE_FONT_FILE_TYPE_BITMAP, DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION } ; + [PInvokeData("dwrite.h", MSDNShortId = "04db41a6-b08b-4d01-a878-c05c0f1f2d9c")] + public enum DWRITE_FONT_FILE_TYPE + { + /// Font type is not recognized by the DirectWrite font system. + DWRITE_FONT_FILE_TYPE_UNKNOWN, + + /// OpenType font with CFF outlines. + DWRITE_FONT_FILE_TYPE_CFF, + + /// OpenType font with TrueType outlines. + DWRITE_FONT_FILE_TYPE_TRUETYPE, + + /// + DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION, + + /// Type 1 PFM font. + DWRITE_FONT_FILE_TYPE_TYPE1_PFM, + + /// Type 1 PFB font. + DWRITE_FONT_FILE_TYPE_TYPE1_PFB, + + /// Vector .FON font. + DWRITE_FONT_FILE_TYPE_VECTOR, + + /// Bitmap .FON font. + DWRITE_FONT_FILE_TYPE_BITMAP, + + /// OpenType font that contains a TrueType collection. + DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION, + } + + /// + /// Specifies algorithmic style simulations to be applied to the font face. Bold and oblique simulations can be combined via bitwise + /// OR operation. + /// + /// Style simulations are not recommended for good typographic quality. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_simulations typedef enum DWRITE_FONT_SIMULATIONS + // { DWRITE_FONT_SIMULATIONS_NONE, DWRITE_FONT_SIMULATIONS_BOLD, DWRITE_FONT_SIMULATIONS_OBLIQUE } ; + [PInvokeData("dwrite.h", MSDNShortId = "0881afec-2fa5-4f17-96a2-68a5293e0bba")] + [Flags] + public enum DWRITE_FONT_SIMULATIONS + { + /// Indicates that no simulations are applied to the font face. + DWRITE_FONT_SIMULATIONS_NONE = 0x0000, + + /// + /// Indicates that algorithmic emboldening is applied to the font face. DWRITE_FONT_SIMULATIONS_BOLD increases weight by + /// applying a widening algorithm to the glyph outline. This may be used to simulate a bold weight where no designed bold weight + /// is available. + /// + DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, + + /// + /// Indicates that algorithmic italicization is applied to the font face. DWRITE_FONT_SIMULATIONS_OBLIQUE applies obliquing + /// (shear) to the glyph outline. This may be used to simulate an oblique/italic style where no designed oblique/italic style is available. + /// + DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002 + } + + /// + /// Represents the degree to which a font has been stretched compared to a font's normal aspect ratio.The enumerated values + /// correspond to the usWidthClass definition in the OpenType specification. The usWidthClass represents an integer value between 1 + /// and 9—lower values indicate narrower widths; higher values indicate wider widths. + /// + /// + /// + /// A font stretch describes the degree to which a font form is stretched from its normal aspect ratio, which is the original width + /// to height ratio specified for the glyphs in the font. The following illustration shows an example of Normal and Condensed + /// stretches for the Rockwell Bold typeface. + /// + /// + /// Note Values other than the ones defined in the enumeration are considered to be invalid, and are rejected by font API functions. + /// + /// + + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_stretch typedef enum DWRITE_FONT_STRETCH { + // DWRITE_FONT_STRETCH_UNDEFINED, DWRITE_FONT_STRETCH_ULTRA_CONDENSED, DWRITE_FONT_STRETCH_EXTRA_CONDENSED, + // DWRITE_FONT_STRETCH_CONDENSED, DWRITE_FONT_STRETCH_SEMI_CONDENSED, DWRITE_FONT_STRETCH_NORMAL, DWRITE_FONT_STRETCH_MEDIUM, + // DWRITE_FONT_STRETCH_SEMI_EXPANDED, DWRITE_FONT_STRETCH_EXPANDED, DWRITE_FONT_STRETCH_EXTRA_EXPANDED, + // DWRITE_FONT_STRETCH_ULTRA_EXPANDED } ; + [PInvokeData("dwrite.h", MSDNShortId = "10b3a703-239b-4fb1-9a20-e466b123b060")] + // public enum DWRITE_FONT_STRETCH{DWRITE_FONT_STRETCH_UNDEFINED, DWRITE_FONT_STRETCH_ULTRA_CONDENSED, + // DWRITE_FONT_STRETCH_EXTRA_CONDENSED, DWRITE_FONT_STRETCH_CONDENSED, DWRITE_FONT_STRETCH_SEMI_CONDENSED, + // DWRITE_FONT_STRETCH_NORMAL, DWRITE_FONT_STRETCH_MEDIUM, DWRITE_FONT_STRETCH_SEMI_EXPANDED, DWRITE_FONT_STRETCH_EXPANDED, + // DWRITE_FONT_STRETCH_EXTRA_EXPANDED, DWRITE_FONT_STRETCH_ULTRA_EXPANDED, } + public enum DWRITE_FONT_STRETCH + { + /// Predefined font stretch : Not known (0). + DWRITE_FONT_STRETCH_UNDEFINED, + + /// Predefined font stretch : Ultra-condensed (1). + DWRITE_FONT_STRETCH_ULTRA_CONDENSED, + + /// Predefined font stretch : Extra-condensed (2). + DWRITE_FONT_STRETCH_EXTRA_CONDENSED, + + /// Predefined font stretch : Condensed (3). + DWRITE_FONT_STRETCH_CONDENSED, + + /// Predefined font stretch : Semi-condensed (4). + DWRITE_FONT_STRETCH_SEMI_CONDENSED, + + /// Predefined font stretch : Normal (5). + DWRITE_FONT_STRETCH_NORMAL, + + /// Predefined font stretch : Medium (5). + DWRITE_FONT_STRETCH_MEDIUM = DWRITE_FONT_STRETCH_NORMAL, + + /// Predefined font stretch : Semi-expanded (6). + DWRITE_FONT_STRETCH_SEMI_EXPANDED, + + /// Predefined font stretch : Expanded (7). + DWRITE_FONT_STRETCH_EXPANDED, + + /// Predefined font stretch : Extra-expanded (8). + DWRITE_FONT_STRETCH_EXTRA_EXPANDED, + + /// Predefined font stretch : Ultra-expanded (9). + DWRITE_FONT_STRETCH_ULTRA_EXPANDED, + } + + /// Represents the style of a font face as normal, italic, or oblique. + /// + /// Three terms categorize the slant of a font: normal, italic, and oblique. + /// + /// + /// Font style + /// Description + /// + /// + /// Normal + /// The characters in a normal, or roman, font are upright. + /// + /// + /// Italic + /// The characters in an italic font are truly slanted and appear as they were designed. + /// + /// + /// Oblique + /// The characters in an oblique font are artificially slanted. + /// + /// + /// + /// For Oblique, the slant is achieved by performing a shear transformation on the characters from a normal font. When a true italic + /// font is not available on a computer or printer, an oblique style can be generated from the normal font and used to simulate an + /// italic font. + /// + /// + /// The following illustration shows the normal, italic, and oblique font styles for the Palatino Linotype font. Notice how the + /// italic font style has a more flowing and visually appealing appearance than the oblique font style, which is simply created by + /// skewing the normal font style version of the text. + /// + /// + /// Note Values other than the ones defined in the enumeration are considered to be invalid, and they are rejected by font + /// API functions. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_style typedef enum DWRITE_FONT_STYLE { + // DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STYLE_OBLIQUE, DWRITE_FONT_STYLE_ITALIC } ; + [PInvokeData("dwrite.h", MSDNShortId = "e48a3b82-4a60-472d-8cb8-a6f63d7eeefc")] + public enum DWRITE_FONT_STYLE + { + /// Font style : Normal. + DWRITE_FONT_STYLE_NORMAL, + + /// Font style : Oblique. + DWRITE_FONT_STYLE_OBLIQUE, + + /// Font style : Italic. + DWRITE_FONT_STYLE_ITALIC, + } + + /// + /// Represents the density of a typeface, in terms of the lightness or heaviness of the strokes. The enumerated values correspond to + /// the usWeightClass definition in the OpenType specification. The usWeightClass represents an integer value between 1 and 999. + /// Lower values indicate lighter weights; higher values indicate heavier weights. + /// + /// + /// + /// Weight differences are generally differentiated by an increased stroke or thickness that is associated with a given character in + /// a typeface, as compared to a "normal" character from that same typeface. The following illustration shows an example of Normal + /// and UltraBold weights for the Palatino Linotype typeface. + /// + /// + /// Note Not all weights are available for all typefaces. When a weight is not available for a typeface, the closest matching + /// weight is returned. + /// + /// Font weight values less than 1 or greater than 999 are considered invalid, and they are rejected by font API functions. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_font_weight typedef enum DWRITE_FONT_WEIGHT { + // DWRITE_FONT_WEIGHT_THIN, DWRITE_FONT_WEIGHT_EXTRA_LIGHT, DWRITE_FONT_WEIGHT_ULTRA_LIGHT, DWRITE_FONT_WEIGHT_LIGHT, + // DWRITE_FONT_WEIGHT_SEMI_LIGHT, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_WEIGHT_MEDIUM, + // DWRITE_FONT_WEIGHT_DEMI_BOLD, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_WEIGHT_EXTRA_BOLD, + // DWRITE_FONT_WEIGHT_ULTRA_BOLD, DWRITE_FONT_WEIGHT_BLACK, DWRITE_FONT_WEIGHT_HEAVY, DWRITE_FONT_WEIGHT_EXTRA_BLACK, + // DWRITE_FONT_WEIGHT_ULTRA_BLACK } ; + [PInvokeData("dwrite.h", MSDNShortId = "82396f80-eb62-4865-ba07-9653220c84f2")] + public enum DWRITE_FONT_WEIGHT + { + /// Predefined font weight : Thin (100). + DWRITE_FONT_WEIGHT_THIN = 100, + + /// Predefined font weight : Extra-light (200). + DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, + + /// Predefined font weight : Ultra-light (200). + DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, + + /// Predefined font weight : Light (300). + DWRITE_FONT_WEIGHT_LIGHT = 300, + + /// Predefined font weight : Semi-light (350). + DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350, + + /// Predefined font weight : Normal (400). + DWRITE_FONT_WEIGHT_NORMAL = 400, + + /// Predefined font weight : Regular (400). + DWRITE_FONT_WEIGHT_REGULAR = 400, + + /// Predefined font weight : Medium (500). + DWRITE_FONT_WEIGHT_MEDIUM = 500, + + /// Predefined font weight : Demi-bold (600). + DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, + + /// Predefined font weight : Semi-bold (600). + DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, + + /// Predefined font weight : Bold (700). + DWRITE_FONT_WEIGHT_BOLD = 700, + + /// Predefined font weight : Extra-bold (800). + DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, + + /// Predefined font weight : Ultra-bold (800). + DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, + + /// Predefined font weight : Black (900). + DWRITE_FONT_WEIGHT_BLACK = 900, + + /// Predefined font weight : Heavy (900). + DWRITE_FONT_WEIGHT_HEAVY = 900, + + /// Predefined font weight : Extra-black (950). + DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, + + /// Predefined font weight : Ultra-black (950). + DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950 + } + + /// The informational string enumeration which identifies a string embedded in a font file. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_informational_string_id typedef enum + // DWRITE_INFORMATIONAL_STRING_ID { DWRITE_INFORMATIONAL_STRING_NONE, DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + // DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, DWRITE_INFORMATIONAL_STRING_TRADEMARK, DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + // DWRITE_INFORMATIONAL_STRING_DESIGNER, DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + // DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + // DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + // DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES, + // DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES, DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, + // DWRITE_INFORMATIONAL_STRING_FULL_NAME, DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, + // DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME, DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME, + // DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, + // DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, + // DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME } ; + [PInvokeData("dwrite.h", MSDNShortId = "bbd5ea62-0837-49e4-a1e8-1d55d5d39ee3")] + // public enum DWRITE_INFORMATIONAL_STRING_ID{DWRITE_INFORMATIONAL_STRING_NONE, DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + // DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, DWRITE_INFORMATIONAL_STRING_TRADEMARK, DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + // DWRITE_INFORMATIONAL_STRING_DESIGNER, DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + // DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + // DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + // DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES, + // DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES, DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, + // DWRITE_INFORMATIONAL_STRING_FULL_NAME, DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, + // DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME, DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME, + // DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, + // DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, + // DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME, } + public enum DWRITE_INFORMATIONAL_STRING_ID + { + /// Indicates the string containing the unspecified name ID. + DWRITE_INFORMATIONAL_STRING_NONE, + + /// Indicates the string containing the copyright notice provided by the font. + DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + + /// Indicates the string containing a version number. + DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, + + /// Indicates the string containing the trademark information provided by the font. + DWRITE_INFORMATIONAL_STRING_TRADEMARK, + + /// Indicates the string containing the name of the font manufacturer. + DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + + /// Indicates the string containing the name of the font designer. + DWRITE_INFORMATIONAL_STRING_DESIGNER, + + /// Indicates the string containing the URL of the font designer (with protocol, e.g., http://, ftp://). + DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, + + /// + /// Indicates the string containing the description of the font. This may also contain revision information, usage + /// recommendations, history, features, and so on. + /// + DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + + /// + /// Indicates the string containing the URL of the font vendor (with protocol, e.g., http://, ftp://). If a unique serial number + /// is embedded in the URL, it can be used to register the font. + /// + DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, + + /// + /// Indicates the string containing the description of how the font may be legally used, or different example scenarios for + /// licensed use. + /// + DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + + /// Indicates the string containing the URL where additional licensing information can be found. + DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, + + /// + /// Indicates the string containing the GDI-compatible family name. Since GDI allows a maximum of four fonts per family, fonts + /// in the same family may have different GDI-compatible family names (e.g., "Arial", "Arial Narrow", "Arial Black"). + /// + DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + + /// Indicates the string containing a GDI-compatible subfamily name. + DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, + + /// + DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES, + + /// + DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES, + + /// + /// Contains sample text for display in font lists. This can be the font name or any other text that the designer thinks is the + /// best example to display the font in. + /// + DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, + + /// The full name of the font, like Arial Bold, from name id 4 in the name table + DWRITE_INFORMATIONAL_STRING_FULL_NAME, + + /// The postscript name of the font, like GillSans-Bold, from name id 6 in the name table. + DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, + + /// The postscript CID findfont name, from name id 20 in the name table + DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME, + + /// + DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME, + + /// + DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, + + /// + DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, + + /// + /// Indicates the string containing the family name preferred by the designer. This enables font designers to group more than + /// four fonts in a single family without losing compatibility with GDI. This name is typically only present if it differs from + /// the GDI-compatible family name. + /// + DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES = DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES, + + /// + /// Indicates the string containing the subfamily name preferred by the designer. This name is typically only present if it + /// differs from the GDI-compatible subfamily name. + /// + DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES = DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES, + + /// + DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME = DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME, + } + + /// The method used for line spacing in a text layout. + /// + /// The line spacing method is set by using the SetLineSpacing method of the IDWriteTextFormat or IDWriteTextLayout interfaces. To + /// get the current line spacing method of a text format or text layou use the GetLineSpacing. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_line_spacing_method typedef enum + // DWRITE_LINE_SPACING_METHOD { DWRITE_LINE_SPACING_METHOD_DEFAULT, DWRITE_LINE_SPACING_METHOD_UNIFORM, + // DWRITE_LINE_SPACING_METHOD_PROPORTIONAL } ; + [PInvokeData("dwrite.h", MSDNShortId = "b75e8fee-ed6c-455d-8733-e6972792572c")] + public enum DWRITE_LINE_SPACING_METHOD + { + /// Line spacing depends solely on the content, adjusting to accommodate the size of fonts and inline objects. + DWRITE_LINE_SPACING_METHOD_DEFAULT, + + /// + /// Lines are explicitly set to uniform spacing, regardless of the size of fonts and inline objects. This can be useful to avoid + /// the uneven appearance that can occur from font fallback. + /// + DWRITE_LINE_SPACING_METHOD_UNIFORM, + + /// + /// Line spacing and baseline distances are proportional to the computed values based on the content, the size of the fonts and + /// inline objects. + /// + DWRITE_LINE_SPACING_METHOD_PROPORTIONAL, + } + + /// Indicates the measuring method used for text layout. + // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ne-dcommon-dwrite_measuring_mode typedef enum DWRITE_MEASURING_MODE { + // DWRITE_MEASURING_MODE_NATURAL, DWRITE_MEASURING_MODE_GDI_CLASSIC, DWRITE_MEASURING_MODE_GDI_NATURAL } ; + [PInvokeData("dcommon.h", MSDNShortId = "99e89754-8bc2-457d-bfdb-a3c9ccfe00c1")] + public enum DWRITE_MEASURING_MODE + { + /// + /// Specifies that text is measured using glyph ideal metrics whose values are independent to the current display resolution. + /// + DWRITE_MEASURING_MODE_NATURAL, + + /// + /// Specifies that text is measured using glyph display-compatible metrics whose values tuned for the current display resolution. + /// + DWRITE_MEASURING_MODE_GDI_CLASSIC, + + /// + /// Specifies that text is measured using the same glyph display metrics as text measured by GDI using a font created with CLEARTYPE_NATURAL_QUALITY. + /// + DWRITE_MEASURING_MODE_GDI_NATURAL, + } + + /// Specifies how to apply number substitution on digits and related punctuation. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_number_substitution_method typedef enum + // DWRITE_NUMBER_SUBSTITUTION_METHOD { DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, + // DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL + // } ; + [PInvokeData("dwrite.h", MSDNShortId = "9702007f-ab08-4ad2-9fac-6482e17161ca")] + public enum DWRITE_NUMBER_SUBSTITUTION_METHOD + { + /// + /// Specifies that the substitution method should be determined based on the LOCALE_IDIGITSUBSTITUTION value of the specified + /// text culture. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, + + /// + /// If the culture is Arabic or Persian, specifies that the number shapes depend on the context. Either traditional or nominal + /// number shapes are used, depending on the nearest preceding strong character or (if there is none) the reading direction of + /// the paragraph. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, + + /// + /// Specifies that code points 0x30-0x39 are always rendered as nominal numeral shapes (ones of the European number), that is, + /// no substitution is performed. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, + + /// + /// Specifies that numbers are rendered using the national number shapes as specified by the LOCALE_SNATIVEDIGITS value of the + /// specified text culture. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, + + /// + /// Specifies that numbers are rendered using the traditional shapes for the specified culture. For most cultures, this is the + /// same as NativeNational. However, NativeNational results in Latin numbers for some Arabic cultures, + /// whereasDWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL results in arabic numbers for all Arabic cultures. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, + } + + /// + /// Specifies the alignment of paragraph text along the flow direction axis, relative to the top and bottom of the flow's layout box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_paragraph_alignment typedef enum + // DWRITE_PARAGRAPH_ALIGNMENT { DWRITE_PARAGRAPH_ALIGNMENT_NEAR, DWRITE_PARAGRAPH_ALIGNMENT_FAR, DWRITE_PARAGRAPH_ALIGNMENT_CENTER } ; + [PInvokeData("dwrite.h", MSDNShortId = "fcd11308-741a-47cb-aa7a-0ae2c7a9e769")] + public enum DWRITE_PARAGRAPH_ALIGNMENT + { + /// The top of the text flow is aligned to the top edge of the layout box. + DWRITE_PARAGRAPH_ALIGNMENT_NEAR, + + /// The bottom of the text flow is aligned to the bottom edge of the layout box. + DWRITE_PARAGRAPH_ALIGNMENT_FAR, + + /// The center of the flow is aligned to the center of the layout box. + DWRITE_PARAGRAPH_ALIGNMENT_CENTER, + } + + /// + /// Represents the internal structure of a device pixel (that is, the physical arrangement of red, green, and blue color components) + /// that is assumed for purposes of rendering text. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_pixel_geometry typedef enum DWRITE_PIXEL_GEOMETRY { + // DWRITE_PIXEL_GEOMETRY_FLAT, DWRITE_PIXEL_GEOMETRY_RGB, DWRITE_PIXEL_GEOMETRY_BGR } ; + [PInvokeData("dwrite.h", MSDNShortId = "de84b37b-bcb1-432c-8876-d84eaa0e30e0")] + public enum DWRITE_PIXEL_GEOMETRY + { + /// The red, green, and blue color components of each pixel are assumed to occupy the same point. + DWRITE_PIXEL_GEOMETRY_FLAT, + + /// + /// Each pixel is composed of three vertical stripes, with red on the left, green in the center, and blue on the right. This is + /// the most common pixel geometry for LCD monitors. + /// + DWRITE_PIXEL_GEOMETRY_RGB, + + /// + /// Each pixel is composed of three vertical stripes, with blue on the left, green in the center, and red on the right. + /// + DWRITE_PIXEL_GEOMETRY_BGR, + } + + /// + /// Specifies the direction in which reading progresses. + /// + /// NoteDWRITE_READING_DIRECTION_TOP_TO_BOTTOM and DWRITE_READING_DIRECTION_BOTTOM_TO_TOP are available in + /// Windows 8.1 and later, only. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_reading_direction typedef enum + // DWRITE_READING_DIRECTION { DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, DWRITE_READING_DIRECTION_RIGHT_TO_LEFT, + // DWRITE_READING_DIRECTION_TOP_TO_BOTTOM, DWRITE_READING_DIRECTION_BOTTOM_TO_TOP } ; + [PInvokeData("dwrite.h", MSDNShortId = "37288d34-d533-474c-b3c0-8c6361074a9b")] + public enum DWRITE_READING_DIRECTION + { + /// Indicates that reading progresses from left to right. + DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, + + /// Indicates that reading progresses from right to left. + DWRITE_READING_DIRECTION_RIGHT_TO_LEFT, + + /// Indicates that reading progresses from top to bottom. + DWRITE_READING_DIRECTION_TOP_TO_BOTTOM, + + /// Indicates that reading progresses from bottom to top. + DWRITE_READING_DIRECTION_BOTTOM_TO_TOP, + } + + /// + /// Represents a method of rendering glyphs. + /// + /// Note This topic is about DWRITE_RENDERING_MODE in Windows 8 and later. For info on the previous version see the + /// Remarks section. + /// + /// + /// + /// DWRITE_RENDERING_MODE previous to Windows 8 + /// + /// enum DWRITE_RENDERING_MODE { DWRITE_RENDERING_MODE_DEFAULT, DWRITE_RENDERING_MODE_ALIASED, + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL, DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, DWRITE_RENDERING_MODE_OUTLINE }; + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_rendering_mode typedef enum DWRITE_RENDERING_MODE { + // DWRITE_RENDERING_MODE_DEFAULT, DWRITE_RENDERING_MODE_ALIASED, DWRITE_RENDERING_MODE_GDI_CLASSIC, + // DWRITE_RENDERING_MODE_GDI_NATURAL, DWRITE_RENDERING_MODE_NATURAL, DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + // DWRITE_RENDERING_MODE_OUTLINE, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, + // DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL, DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC } ; + [PInvokeData("dwrite.h", MSDNShortId = "c6b2c15a-be22-49ce-affd-1369e23f4d6b")] + public enum DWRITE_RENDERING_MODE + { + /// Specifies that the rendering mode is determined automatically, based on the font and size. + DWRITE_RENDERING_MODE_DEFAULT, + + /// + /// Specifies that no anti-aliasing is performed. Each pixel is either set to the foreground color of the text or retains the + /// color of the background. + /// + DWRITE_RENDERING_MODE_ALIASED, + + /// + /// Specifies that antialiasing is performed in the horizontal direction and the appearance of glyphs is layout-compatible with + /// GDI using CLEARTYPE_QUALITY. Use DWRITE_MEASURING_MODE_GDI_CLASSIC to get glyph advances. The antialiasing may be either + /// ClearType or grayscale depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_GDI_CLASSIC, + + /// + /// Specifies that antialiasing is performed in the horizontal direction and the appearance of glyphs is layout-compatible with + /// GDI using CLEARTYPE_NATURAL_QUALITY. Glyph advances are close to the font design advances, but are still rounded to whole + /// pixels. Use DWRITE_MEASURING_MODE_GDI_NATURAL to get glyph advances. The antialiasing may be either ClearType or grayscale + /// depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_GDI_NATURAL, + + /// + /// Specifies that antialiasing is performed in the horizontal direction. This rendering mode allows glyphs to be positioned + /// with subpixel precision and is therefore suitable for natural (i.e., resolution-independent) layout. The antialiasing may be + /// either ClearType or grayscale depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_NATURAL, + + /// + /// Similar to natural mode except that antialiasing is performed in both the horizontal and vertical directions. This is + /// typically used at larger sizes to make curves and diagonal lines look smoother. The antialiasing may be either ClearType or + /// grayscale depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + + /// + /// Specifies that rendering should bypass the rasterizer and use the outlines directly. This is typically used at very large sizes. + /// + DWRITE_RENDERING_MODE_OUTLINE, + + /// + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC, + + /// + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL, + + /// + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL, + + /// + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC + } + + /// Indicates additional shaping requirements for text. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_script_shapes typedef enum DWRITE_SCRIPT_SHAPES { + // DWRITE_SCRIPT_SHAPES_DEFAULT, DWRITE_SCRIPT_SHAPES_NO_VISUAL } ; + [PInvokeData("dwrite.h", MSDNShortId = "81ec0f3a-4dab-4497-893f-d791d9d9be6a")] + [Flags] + public enum DWRITE_SCRIPT_SHAPES + { + /// + /// Indicates that there is no additional shaping requirements for text. Text is shaped with the writing system default behavior. + /// + DWRITE_SCRIPT_SHAPES_DEFAULT, + + /// Indicates that text should leave no visible control or format control characters. + DWRITE_SCRIPT_SHAPES_NO_VISUAL, + } + + /// + /// Specifies the alignment of paragraph text along the reading direction axis, relative to the leading and trailing edge of the + /// layout box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_text_alignment typedef enum DWRITE_TEXT_ALIGNMENT { + // DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_TEXT_ALIGNMENT_JUSTIFIED } ; + [PInvokeData("dwrite.h", MSDNShortId = "76b347f8-185b-4da6-9647-4d066334ac12")] + public enum DWRITE_TEXT_ALIGNMENT + { + /// The leading edge of the paragraph text is aligned to the leading edge of the layout box. + DWRITE_TEXT_ALIGNMENT_LEADING, + + /// The trailing edge of the paragraph text is aligned to the trailing edge of the layout box. + DWRITE_TEXT_ALIGNMENT_TRAILING, + + /// The center of the paragraph text is aligned to the center of the layout box. + DWRITE_TEXT_ALIGNMENT_CENTER, + + /// Align text to the leading side, and also justify text to fill the lines. + DWRITE_TEXT_ALIGNMENT_JUSTIFIED, + } + + /// Identifies a type of alpha texture. + /// An alpha texture is a bitmap of alpha values, each representing opacity of a pixel or subpixel. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_texture_type typedef enum DWRITE_TEXTURE_TYPE { + // DWRITE_TEXTURE_ALIASED_1x1, DWRITE_TEXTURE_CLEARTYPE_3x1 } ; + [PInvokeData("dwrite.h", MSDNShortId = "c97ee0fd-2743-4f72-aa69-bf5e3780aa33")] + public enum DWRITE_TEXTURE_TYPE + { + /// + /// Specifies an alpha texture for aliased text rendering (that is, each pixel is either fully opaque or fully transparent), + /// with one byte per pixel. + /// + DWRITE_TEXTURE_ALIASED_1x1, + + /// + /// Specifies an alpha texture for ClearType text rendering, with three bytes per pixel in the horizontal dimension and one byte + /// per pixel in the vertical dimension. + /// + DWRITE_TEXTURE_CLEARTYPE_3x1, + } + + /// Specifies the text granularity used to trim text overflowing the layout box. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_trimming_granularity typedef enum + // DWRITE_TRIMMING_GRANULARITY { DWRITE_TRIMMING_GRANULARITY_NONE, DWRITE_TRIMMING_GRANULARITY_CHARACTER, + // DWRITE_TRIMMING_GRANULARITY_WORD } ; + [PInvokeData("dwrite.h", MSDNShortId = "81ab22cd-7b7f-4db6-9f67-2cafd54f4621")] + public enum DWRITE_TRIMMING_GRANULARITY + { + /// No trimming occurs. Text flows beyond the layout width. + DWRITE_TRIMMING_GRANULARITY_NONE, + + /// Trimming occurs at a character cluster boundary. + DWRITE_TRIMMING_GRANULARITY_CHARACTER, + + /// Trimming occurs at a word boundary. + DWRITE_TRIMMING_GRANULARITY_WORD, + } + + /// + /// Specifies the word wrapping to be used in a particular multiline paragraph. + /// + /// NoteDWRITE_WORD_WRAPPING_EMERGENCY_BREAK, DWRITE_WORD_WRAPPING_WHOLE _WORD, and + /// DWRITE_WORD_WRAPPING_CHARACTER are available in Windows 8.1 and later, only. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ne-dwrite-dwrite_word_wrapping typedef enum DWRITE_WORD_WRAPPING { + // DWRITE_WORD_WRAPPING_WRAP, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_WORD_WRAPPING_EMERGENCY_BREAK, DWRITE_WORD_WRAPPING_WHOLE_WORD, + // DWRITE_WORD_WRAPPING_CHARACTER } ; + [PInvokeData("dwrite.h", MSDNShortId = "5b0a5e15-1bbf-433e-9c7f-d7b8fa9313c2")] + public enum DWRITE_WORD_WRAPPING + { + /// Indicates that words are broken across lines to avoid text overflowing the layout box. + DWRITE_WORD_WRAPPING_WRAP, + + /// + /// Indicates that words are kept within the same line even when it overflows the layout box. This option is often used with + /// scrolling to reveal overflow text. + /// + DWRITE_WORD_WRAPPING_NO_WRAP, + + /// + /// Words are broken across lines to avoid text overflowing the layout box. Emergency wrapping occurs if the word is larger than + /// the maximum width. + /// + DWRITE_WORD_WRAPPING_EMERGENCY_BREAK, + + /// + /// When emergency wrapping, only wrap whole words, never breaking words when the layout width is too small for even a single word. + /// + DWRITE_WORD_WRAPPING_WHOLE_WORD, + + /// Wrap between any valid character clusters. + DWRITE_WORD_WRAPPING_CHARACTER, + } + + /// Contains information about a glyph cluster. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_cluster_metrics struct DWRITE_CLUSTER_METRICS { FLOAT + // width; UINT16 length; UINT16 canWrapLineAfter : 1; UINT16 isWhitespace : 1; UINT16 isNewline : 1; UINT16 isSoftHyphen : 1; UINT16 + // isRightToLeft : 1; UINT16 padding : 11; }; + [PInvokeData("dwrite.h", MSDNShortId = "738b7f15-fcc5-4960-ac1f-ca530c448271")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_CLUSTER_METRICS + { + /// + /// Type: FLOAT + /// The total advance width of all glyphs in the cluster. + /// + public float width; + + /// + /// Type: UINT16 + /// The number of text positions in the cluster. + /// + public ushort length; + + private ushort bits; + + /// + /// Type: UINT16 + /// Indicates whether a line can be broken right after the cluster. + /// + public bool canWrapLineAfter { get => BitHelper.GetBit(bits, 0); set => BitHelper.SetBit(ref bits, 0, value); } + + /// + /// Type: UINT16 + /// Indicates whether the cluster corresponds to a whitespace character. + /// + public bool isWhitespace { get => BitHelper.GetBit(bits, 1); set => BitHelper.SetBit(ref bits, 1, value); } + + /// + /// Type: UINT16 + /// Indicates whether the cluster corresponds to a newline character. + /// + public bool isNewline { get => BitHelper.GetBit(bits, 2); set => BitHelper.SetBit(ref bits, 2, value); } + + /// + /// Type: UINT16 + /// Indicates whether the cluster corresponds to a soft hyphen character. + /// + public bool isSoftHyphen { get => BitHelper.GetBit(bits, 3); set => BitHelper.SetBit(ref bits, 3, value); } + + /// + /// Type: UINT16 + /// Indicates whether the cluster is read from right to left. + /// + public bool isRightToLeft { get => BitHelper.GetBit(bits, 4); set => BitHelper.SetBit(ref bits, 4, value); } + } + + /// Specifies properties used to identify and execute typographic features in the current font face. + /// + /// + /// A non-zero value generally enables the feature execution, while the zero value disables it. A feature requiring a selector uses + /// this value to indicate the selector index. + /// + /// + /// The OpenType standard provides access to typographic features available in the font by means of a feature tag with the + /// associated parameters. The OpenType feature tag is a 4-byte identifier of the registered name of a feature. For example, the + /// 'kern' feature name tag is used to identify the 'Kerning' feature in OpenType font. Similarly, the OpenType feature tag for + /// 'Standard Ligatures' and 'Fractions' is 'liga' and 'frac' respectively. Since a single run can be associated with more than one + /// typographic features, the Text String API accepts typographic settings for a run as a list of features and are executed in the + /// order they are specified. + /// + /// + /// The value of the tag member represents the OpenType name tag of the feature, while the param value represents additional + /// parameter for the execution of the feature referred by the tag member. Both nameTag and parameter are stored as + /// little endian, the same convention followed by GDI. Most features treat the Param value as a binary value that indicates whether + /// to turn the execution of the feature on or off, with it being off by default in the majority of cases. Some features, however, + /// treat this value as an integral value representing the integer index to the list of alternate results it may produce during the + /// execution; for instance, the feature 'Stylistic Alternates' or 'salt' uses the parameter value as an index to the list of + /// alternate substituting glyphs it could produce for a specified glyph. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_font_feature struct DWRITE_FONT_FEATURE { + // DWRITE_FONT_FEATURE_TAG nameTag; UINT32 parameter; }; + [PInvokeData("dwrite.h", MSDNShortId = "f8c2b1b0-ecab-4556-b3e6-5eda75e206ed")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_FONT_FEATURE + { + /// + /// Type: DWRITE_FONT_FEATURE_TAG + /// The feature OpenType name identifier. + /// + public DWRITE_FONT_FEATURE_TAG nameTag; + + /// + /// Type: UINT32 + /// The execution parameter of the feature. + /// + public uint parameter; + } + + /// + /// The DWRITE_FONT_METRICS structure specifies the metrics that are applicable to all glyphs within the font face. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_font_metrics struct DWRITE_FONT_METRICS { UINT16 + // designUnitsPerEm; UINT16 ascent; UINT16 descent; INT16 lineGap; UINT16 capHeight; UINT16 xHeight; INT16 underlinePosition; UINT16 + // underlineThickness; INT16 strikethroughPosition; UINT16 strikethroughThickness; }; + [PInvokeData("dwrite.h", MSDNShortId = "ffbf987c-145e-4b93-a48f-8948944c6e33")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_FONT_METRICS + { + /// + /// Type: UINT16 + /// + /// The number of font design units per em unit. Font files use their own coordinate system of font design units. A font design + /// unit is the smallest measurable unit in the em square, an imaginary square that is used to size and align glyphs. The + /// concept of em square is used as a reference scale factor when defining font size and device transformation semantics. The + /// size of one em square is also commonly used to compute the paragraph identation value. + /// + /// + public ushort designUnitsPerEm; + + /// + /// Type: UINT16 + /// + /// The ascent value of the font face in font design units. Ascent is the distance from the top of font character alignment box + /// to the English baseline. + /// + /// + public ushort ascent; + + /// + /// Type: UINT16 + /// + /// The descent value of the font face in font design units. Descent is the distance from the bottom of font character alignment + /// box to the English baseline. + /// + /// + public ushort descent; + + /// + /// Type: INT16 + /// + /// The line gap in font design units. Recommended additional white space to add between lines to improve legibility. The + /// recommended line spacing (baseline-to-baseline distance) is the sum of ascent, descent, and lineGap. + /// The line gap is usually positive or zero but can be negative, in which case the recommended line spacing is less than the + /// height of the character alignment box. + /// + /// + public short lineGap; + + /// + /// Type: UINT16 + /// + /// The cap height value of the font face in font design units. Cap height is the distance from the English baseline to the top + /// of a typical English capital. Capital "H" is often used as a reference character for the purpose of calculating the cap + /// height value. + /// + /// + public ushort capHeight; + + /// + /// Type: UINT16 + /// + /// The x-height value of the font face in font design units. x-height is the distance from the English baseline to the top of + /// lowercase letter "x", or a similar lowercase character. + /// + /// + public ushort xHeight; + + /// + /// Type: INT16 + /// + /// The underline position value of the font face in font design units. Underline position is the position of underline relative + /// to the English baseline. The value is usually made negative in order to place the underline below the baseline. + /// + /// + public short underlinePosition; + + /// + /// Type: UINT16 + /// The suggested underline thickness value of the font face in font design units. + /// + public ushort underlineThickness; + + /// + /// Type: INT16 + /// + /// The strikethrough position value of the font face in font design units. Strikethrough position is the position of + /// strikethrough relative to the English baseline. The value is usually made positive in order to place the strikethrough above + /// the baseline. + /// + /// + public short strikethroughPosition; + + /// + /// Type: UINT16 + /// The suggested strikethrough thickness value of the font face in font design units. + /// + public ushort strikethroughThickness; + } + + /// Specifies the metrics of an individual glyph.The units depend on how the metrics are obtained. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_glyph_metrics struct DWRITE_GLYPH_METRICS { INT32 + // leftSideBearing; UINT32 advanceWidth; INT32 rightSideBearing; INT32 topSideBearing; UINT32 advanceHeight; INT32 + // bottomSideBearing; INT32 verticalOriginY; }; + [PInvokeData("dwrite.h", MSDNShortId = "d2a4ac9f-f510-4235-93bb-e7bdecc65873")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_GLYPH_METRICS + { + /// + /// Type: INT32 + /// + /// Specifies the X offset from the glyph origin to the left edge of the black box. The glyph origin is the current horizontal + /// writing position. A negative value means the black box extends to the left of the origin (often true for lowercase italic 'f'). + /// + /// + public int leftSideBearing; + + /// + /// Type: UINT32 + /// Specifies the X offset from the origin of the current glyph to the origin of the next glyph when writing horizontally. + /// + public uint advanceWidth; + + /// + /// Type: INT32 + /// + /// Specifies the X offset from the right edge of the black box to the origin of the next glyph when writing horizontally. The + /// value is negative when the right edge of the black box overhangs the layout box. + /// + /// + public int rightSideBearing; + + /// + /// Type: INT32 + /// + /// Specifies the vertical offset from the vertical origin to the top of the black box. Thus, a positive value adds whitespace + /// whereas a negative value means the glyph overhangs the top of the layout box. + /// + /// + public int topSideBearing; + + /// + /// Type: UINT32 + /// + /// Specifies the Y offset from the vertical origin of the current glyph to the vertical origin of the next glyph when writing + /// vertically. Note that the term "origin" by itself denotes the horizontal origin. The vertical origin is different. Its Y + /// coordinate is specified by verticalOriginY value, and its X coordinate is half the advanceWidth to the right + /// of the horizontal origin. + /// + /// + public uint advanceHeight; + + /// + /// Type: INT32 + /// + /// Specifies the vertical distance from the bottom edge of the black box to the advance height. This is positive when the + /// bottom edge of the black box is within the layout box, or negative when the bottom edge of black box overhangs the layout box. + /// + /// + public int bottomSideBearing; + + /// + /// Type: INT32 + /// + /// Specifies the Y coordinate of a glyph's vertical origin, in the font's design coordinate system. The y coordinate of a + /// glyph's vertical origin is the sum of the glyph's top side bearing and the top (that is, yMax) of the glyph's bounding box. + /// + /// + public int verticalOriginY; + } + + /// The optional adjustment to a glyph's position. + /// + /// An glyph offset changes the position of a glyph without affecting the pen position. Offsets are in logical, pre-transform units. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_glyph_offset struct DWRITE_GLYPH_OFFSET { FLOAT + // advanceOffset; FLOAT ascenderOffset; }; + [PInvokeData("dwrite.h", MSDNShortId = "f5a231c0-78df-4fe0-99a8-81fcad517cda")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_GLYPH_OFFSET + { + /// + /// Type: FLOAT + /// + /// The offset in the advance direction of the run. A positive advance offset moves the glyph to the right (in pre-transform + /// coordinates) if the run is left-to-right or to the left if the run is right-to-left. + /// + /// + public float advanceOffset; + + /// + /// Type: FLOAT + /// + /// The offset in the ascent direction, that is, the direction ascenders point. A positive ascender offset moves the glyph up + /// (in pre-transform coordinates). A negative ascender offset moves the glyph down. + /// + /// + public float ascenderOffset; + } + + /// + /// Contains the information needed by renderers to draw glyph runs. All coordinates are in device independent pixels (DIPs). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_glyph_run struct DWRITE_GLYPH_RUN { IDWriteFontFace + // *fontFace; FLOAT fontEmSize; UINT32 glyphCount; UINT16 const *glyphIndices; FLOAT const *glyphAdvances; DWRITE_GLYPH_OFFSET const + // *glyphOffsets; BOOL isSideways; UINT32 bidiLevel; }; + [PInvokeData("dwrite.h", MSDNShortId = "2997d63f-8d33-44c3-9617-cfffe5f61f7d")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_GLYPH_RUN + { + /// + /// Type: IDWriteFontFace* + /// The physical font face object to draw with. + /// + public IntPtr fontFace; + + /// + /// Type: FLOAT + /// The logical size of the font in DIPs (equals 1/96 inch), not points. + /// + public float fontEmSize; + + /// + /// Type: UINT32 + /// The number of glyphs in the glyph run. + /// + public uint glyphCount; + + /// + /// Type: const UINT16* + /// A pointer to an array of indices to render for the glyph run. + /// + public IntPtr glyphIndices; + + /// + /// Type: const FLOAT* + /// A pointer to an array containing glyph advance widths for the glyph run. + /// + public IntPtr glyphAdvances; + + /// + /// Type: const DWRITE_GLYPH_OFFSET* + /// A pointer to an array containing glyph offsets for the glyph run. + /// + public IntPtr glyphOffsets; + + /// + /// Type: BOOL + /// + /// If true, specifies that glyphs are rotated 90 degrees to the left and vertical metrics are used. Vertical writing is + /// achieved by specifying isSideways = true and rotating the entire run 90 degrees to the right via a rotate transform. + /// + /// + [MarshalAs(UnmanagedType.Bool)] public bool isSideways; + + /// + /// Type: UINT32 + /// + /// The implicit resolved bidi level of the run. Odd levels indicate right-to-left languages like Hebrew and Arabic, while even + /// levels indicate left-to-right languages like English and Japanese (when written horizontally). For right-to-left languages, + /// the text origin is on the right, and text should be drawn to the left. + /// + /// + public uint bidiLevel; + } + + /// Contains additional properties related to those in DWRITE_GLYPH_RUN. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_glyph_run_description struct + // DWRITE_GLYPH_RUN_DESCRIPTION { WCHAR const *localeName; WCHAR const *string; UINT32 stringLength; UINT16 const *clusterMap; + // UINT32 textPosition; }; + [PInvokeData("dwrite.h", MSDNShortId = "0fb25253-274a-42b7-8491-525d0550ce39")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_GLYPH_RUN_DESCRIPTION + { + /// + /// Type: const WCHAR* + /// An array of characters containing the locale name associated with this run. + /// + public IntPtr localeName; + + /// + /// Type: const WCHAR* + /// An array of characters containing the text associated with the glyphs. + /// + public IntPtr @string; + + /// + /// Type: UINT32 + /// The number of characters in UTF16 code-units. Note that this may be different than the number of glyphs. + /// + public uint stringLength; + + /// + /// Type: const UINT16* + /// An array of indices to the glyph indices array, of the first glyphs of all the glyph clusters of the glyphs to render. + /// + public IntPtr clusterMap; + + /// + /// Type: UINT32 + /// + /// Corresponding text position in the string this glyph run came from. This is relative to the beginning of the string + /// represented by the IDWriteTextLayout object. + /// + /// + public uint textPosition; + } + + /// Describes the region obtained by a hit test. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_hit_test_metrics struct DWRITE_HIT_TEST_METRICS { + // UINT32 textPosition; UINT32 length; FLOAT left; FLOAT top; FLOAT width; FLOAT height; UINT32 bidiLevel; BOOL isText; BOOL + // isTrimmed; }; + [PInvokeData("dwrite.h", MSDNShortId = "00aaed92-7078-4823-95c5-855c063c744a")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_HIT_TEST_METRICS + { + /// + /// Type: UINT32 + /// The first text position within the hit region. + /// + public uint textPosition; + + /// + /// Type: UINT32 + /// The number of text positions within the hit region. + /// + public uint length; + + /// + /// Type: FLOAT + /// The x-coordinate of the upper-left corner of the hit region. + /// + public float left; + + /// + /// Type: FLOAT + /// The y-coordinate of the upper-left corner of the hit region. + /// + public float top; + + /// + /// Type: FLOAT + /// The width of the hit region. + /// + public float width; + + /// + /// Type: FLOAT + /// The height of the hit region. + /// + public float height; + + /// + /// Type: UINT32 + /// The BIDI level of the text positions within the hit region. + /// + public uint bidiLevel; + + /// + /// Type: BOOL + /// true if the hit region contains text; otherwise, false. + /// + [MarshalAs(UnmanagedType.Bool)] public bool isText; + + /// + /// Type: BOOL + /// true if the text range is trimmed; otherwise, false. + /// + [MarshalAs(UnmanagedType.Bool)] public bool isTrimmed; + } + + /// Contains properties describing the geometric measurement of an application-defined inline object. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_inline_object_metrics struct + // DWRITE_INLINE_OBJECT_METRICS { FLOAT width; FLOAT height; FLOAT baseline; BOOL supportsSideways; }; + [PInvokeData("dwrite.h", MSDNShortId = "a42d612c-3d16-4c27-a1d8-1cfb9de2f8b1")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_INLINE_OBJECT_METRICS + { + /// + /// Type: FLOAT + /// The width of the inline object. + /// + public float width; + + /// + /// Type: FLOAT + /// The height of the inline object. + /// + public float height; + + /// + /// Type: FLOAT + /// + /// The distance from the top of the object to the point where it is lined up with the adjacent text. If the baseline is at the + /// bottom, then baseline simply equals height. + /// + /// + public float baseline; + + /// + /// Type: BOOL + /// + /// A Boolean flag that indicates whether the object is to be placed upright or alongside the text baseline for vertical text. + /// + /// + [MarshalAs(UnmanagedType.Bool)] public bool supportsSideways; + } + + /// Line breakpoint characteristics of a character. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_line_breakpoint struct DWRITE_LINE_BREAKPOINT { UINT8 + // breakConditionBefore : 2; UINT8 breakConditionAfter : 2; UINT8 isWhitespace : 1; UINT8 isSoftHyphen : 1; UINT8 padding : 2; }; + [PInvokeData("dwrite.h", MSDNShortId = "6f2b26e9-95b3-4ac5-ba8e-7055f873d1da")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_LINE_BREAKPOINT + { + private byte bits; + + /// + /// Type: UINT8 + /// Indicates a breaking condition before the character. + /// + public byte breakConditionBefore { get => BitHelper.GetBits(bits, 0, 2); set => BitHelper.SetBits(ref bits, 0, 2, value); } + + /// + /// Type: UINT8 + /// Indicates a breaking condition after the character. + /// + public byte breakConditionAfter { get => BitHelper.GetBits(bits, 2, 4); set => BitHelper.SetBits(ref bits, 2, 4, value); } + + /// + /// Type: UINT8 + /// Indicates that the character is some form of whitespace, which may be meaningful for justification. + /// + public bool isWhitespace { get => BitHelper.GetBit(bits, 4); set => BitHelper.SetBit(ref bits, 4, value); } + + /// + /// Type: UINT8 + /// Indicates that the character is a soft hyphen, often used to indicate hyphenation points inside words. + /// + public bool isSoftHyphen { get => BitHelper.GetBit(bits, 5); set => BitHelper.SetBit(ref bits, 5, value); } + } + + /// Contains information about a formatted line of text. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_line_metrics struct DWRITE_LINE_METRICS { UINT32 + // length; UINT32 trailingWhitespaceLength; UINT32 newlineLength; FLOAT height; FLOAT baseline; BOOL isTrimmed; }; + [PInvokeData("dwrite.h", MSDNShortId = "cb589949-2eba-4ebb-ada4-546802fb3d01")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_LINE_METRICS + { + /// + /// Type: UINT32 + /// The number of text positions in the text line. This includes any trailing whitespace and newline characters. + /// + public uint length; + + /// + /// Type: UINT32 + /// The number of whitespace positions at the end of the text line. Newline sequences are considered whitespace. + /// + public uint trailingWhitespaceLength; + + /// + /// Type: UINT32 + /// + /// The number of characters in the newline sequence at the end of the text line. If the count is zero, then the text line was + /// either wrapped or it is the end of the text. + /// + /// + public uint newlineLength; + + /// + /// Type: FLOAT + /// The height of the text line. + /// + public float height; + + /// + /// Type: FLOAT + /// The distance from the top of the text line to its baseline. + /// + public float baseline; + + /// + /// Type: BOOL + /// The line is trimmed. + /// + [MarshalAs(UnmanagedType.Bool)] public bool isTrimmed; + } + + /// The DWRITE_MATRIX structure specifies the graphics transform to be applied to rendered glyphs. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_matrix struct DWRITE_MATRIX { FLOAT m11; FLOAT m12; + // FLOAT m21; FLOAT m22; FLOAT dx; FLOAT dy; }; + [PInvokeData("dwrite.h", MSDNShortId = "fe4bd8ba-fc3b-4a04-8a72-9983d52f4404")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_MATRIX + { + /// + /// Type: FLOAT + /// A value indicating the horizontal scaling / cosine of rotation. + /// + public float m11; + + /// + /// Type: FLOAT + /// A value indicating the vertical shear / sine of rotation. + /// + public float m12; + + /// + /// Type: FLOAT + /// A value indicating the horizontal shear / negative sine of rotation. + /// + public float m21; + + /// + /// Type: FLOAT + /// A value indicating the vertical scaling / cosine of rotation. + /// + public float m22; + + /// + /// Type: FLOAT + /// A value indicating the horizontal shift (always orthogonal regardless of rotation). + /// + public float dx; + + /// + /// Type: FLOAT + /// A value indicating the vertical shift (always orthogonal regardless of rotation.) + /// + public float dy; + } + + /// + /// Indicates how much any visible DIPs (device independent pixels) overshoot each side of the layout or inline objects. + /// + /// Positive overhangs indicate that the visible area extends outside the layout box or inline object, while negative values mean + /// there is whitespace inside. The returned values are unaffected by rendering transforms or pixel snapping. Additionally, they may + /// not exactly match the final target's pixel bounds after applying grid fitting and hinting. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_overhang_metrics struct DWRITE_OVERHANG_METRICS { + // FLOAT left; FLOAT top; FLOAT right; FLOAT bottom; }; + [PInvokeData("dwrite.h", MSDNShortId = "a285f06b-a4d0-4ebe-80f5-157e59bfba31")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_OVERHANG_METRICS + { + /// + /// Type: FLOAT + /// The distance from the left-most visible DIP to its left-alignment edge. + /// + public float left; + + /// + /// Type: FLOAT + /// The distance from the top-most visible DIP to its top alignment edge. + /// + public float top; + + /// + /// Type: FLOAT + /// The distance from the right-most visible DIP to its right-alignment edge. + /// + public float right; + + /// + /// Type: FLOAT + /// The distance from the bottom-most visible DIP to its lower-alignment edge. + /// + public float bottom; + } + + /// Stores the association of text and its writing system script, as well as some display attributes. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_script_analysis struct DWRITE_SCRIPT_ANALYSIS { UINT16 + // script; DWRITE_SCRIPT_SHAPES shapes; }; + [PInvokeData("dwrite.h", MSDNShortId = "dafda5f6-39aa-4577-9213-898bdeddc7c2")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_SCRIPT_ANALYSIS + { + /// + /// Type: UINT16 + /// The zero-based index representation of writing system script. + /// + public ushort script; + + /// + /// Type: DWRITE_SCRIPT_SHAPES + /// A value that indicates additional shaping requirement of text. + /// + public DWRITE_SCRIPT_SHAPES shapes; + } + + /// Contains shaping output properties for an output glyph. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_shaping_glyph_properties struct + // DWRITE_SHAPING_GLYPH_PROPERTIES { UINT16 justification : 4; UINT16 isClusterStart : 1; UINT16 isDiacritic : 1; UINT16 + // isZeroWidthSpace : 1; UINT16 reserved : 9; }; + [PInvokeData("dwrite.h", MSDNShortId = "debaa84f-8883-4117-9be0-962857b55020")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_SHAPING_GLYPH_PROPERTIES + { + private ushort bits; + + /// + /// Type: UINT16 + /// Indicates that the glyph has justification applied. + /// + public ushort justification { get => BitHelper.GetBits(bits, 0, 4); set => BitHelper.SetBits(ref bits, 0, 4, value); } + + /// + /// Type: UINT16 + /// Indicates that the glyph is the start of a cluster. + /// + public bool isClusterStart { get => BitHelper.GetBit(bits, 4); set => BitHelper.SetBit(ref bits, 4, value); } + + /// + /// Type: UINT16 + /// Indicates that the glyph is a diacritic mark. + /// + public bool isDiacritic { get => BitHelper.GetBit(bits, 5); set => BitHelper.SetBit(ref bits, 5, value); } + + /// + /// Type: UINT16 + /// Indicates that the glyph is a word boundary with no visible space. + /// + public bool isZeroWidthSpace { get => BitHelper.GetBit(bits, 6); set => BitHelper.SetBit(ref bits, 6, value); } + } + + /// Shaping output properties for an output glyph. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_shaping_text_properties struct + // DWRITE_SHAPING_TEXT_PROPERTIES { UINT16 isShapedAlone : 1; UINT16 reserved1 : 1; UINT16 canBreakShapingAfter : 1; UINT16 reserved + // : 13; }; + [PInvokeData("dwrite.h", MSDNShortId = "2fd1af73-c2ea-4077-9cf5-77ab9f237f0a")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_SHAPING_TEXT_PROPERTIES + { + private ushort bits; + + /// + /// Type: UINT16 + /// Indicates that the glyph is shaped alone. + /// + public bool isShapedAlone { get => BitHelper.GetBit(bits, 0); set => BitHelper.SetBit(ref bits, 0, value); } + + /// + public bool canBreakShapingAfter { get => BitHelper.GetBit(bits, 2); set => BitHelper.SetBit(ref bits, 2, value); } + } + + /// + /// Contains information regarding the size and placement of strikethroughs.All coordinates are in device independent pixels (DIPs). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_strikethrough struct DWRITE_STRIKETHROUGH { FLOAT + // width; FLOAT thickness; FLOAT offset; DWRITE_READING_DIRECTION readingDirection; DWRITE_FLOW_DIRECTION flowDirection; WCHAR const + // *localeName; DWRITE_MEASURING_MODE measuringMode; }; + [PInvokeData("dwrite.h", MSDNShortId = "05d86485-2c34-4e3b-99e8-ca54a3b1e5f6")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_STRIKETHROUGH + { + /// + /// Type: FLOAT + /// A value that indicates the width of the strikethrough, measured parallel to the baseline. + /// + public float width; + + /// + /// Type: FLOAT + /// A value that indicates the thickness of the strikethrough, measured perpendicular to the baseline. + /// + public float thickness; + + /// + /// Type: FLOAT + /// + /// A value that indicates the offset of the strikethrough from the baseline. A positive offset represents a position below the + /// baseline and a negative offset is above. Typically, the offset will be negative. + /// + /// + public float offset; + + /// + /// Type: DWRITE_READING_DIRECTION + /// + /// Reading direction of the text associated with the strikethrough. This value is used to interpret whether the width value + /// runs horizontally or vertically. + /// + /// + public DWRITE_READING_DIRECTION readingDirection; + + /// + /// Type: DWRITE_FLOW_DIRECTION + /// + /// Flow direction of the text associated with the strikethrough. This value is used to interpret whether the thickness value + /// advances top to bottom, left to right, or right to left. + /// + /// + public DWRITE_FLOW_DIRECTION flowDirection; + + /// + /// Type: const WCHAR* + /// An array of characters containing the locale of the text that is the strikethrough is being drawn over. + /// + public IntPtr localeName; + + /// + /// Type: DWRITE_MEASURING_MODE + /// + /// The measuring mode can be useful to the renderer to determine how underlines are rendered, such as rounding the thickness to + /// a whole pixel in GDI-compatible modes. + /// + /// + public DWRITE_MEASURING_MODE measuringMode; + } + + /// Contains the metrics associated with text after layout. All coordinates are in device independent pixels (DIPs). + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_text_metrics struct DWRITE_TEXT_METRICS { FLOAT left; + // FLOAT top; FLOAT width; FLOAT widthIncludingTrailingWhitespace; FLOAT height; FLOAT layoutWidth; FLOAT layoutHeight; UINT32 + // maxBidiReorderingDepth; UINT32 lineCount; }; + [PInvokeData("dwrite.h", MSDNShortId = "4524ace3-fca6-4daf-9ecb-516771e53fc9")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_TEXT_METRICS + { + /// + /// Type: FLOAT + /// + /// A value that indicates the left-most point of formatted text relative to the layout box, while excluding any glyph overhang. + /// + /// + public float left; + + /// + /// Type: FLOAT + /// + /// A value that indicates the top-most point of formatted text relative to the layout box, while excluding any glyph overhang. + /// + /// + public float top; + + /// + /// Type: FLOAT + /// A value that indicates the width of the formatted text, while ignoring trailing whitespace at the end of each line. + /// + public float width; + + /// + /// Type: FLOAT + /// The width of the formatted text, taking into account the trailing whitespace at the end of each line. + /// + public float widthIncludingTrailingWhitespace; + + /// + /// Type: FLOAT + /// The height of the formatted text. The height of an empty string is set to the same value as that of the default font. + /// + public float height; + + /// + /// Type: FLOAT + /// + /// The initial width given to the layout. It can be either larger or smaller than the text content width, depending on whether + /// the text was wrapped. + /// + /// + public float layoutWidth; + + /// + /// Type: FLOAT + /// + /// Initial height given to the layout. Depending on the length of the text, it may be larger or smaller than the text content height. + /// + /// + public float layoutHeight; + + /// + /// Type: UINT32 + /// + /// The maximum reordering count of any line of text, used to calculate the most number of hit-testing boxes needed. If the + /// layout has no bidirectional text, or no text at all, the minimum level is 1. + /// + /// + public uint maxBidiReorderingDepth; + + /// + /// Type: UINT32 + /// Total number of lines. + /// + public uint lineCount; + } + + /// Specifies a range of text positions where format is applied in the text represented by an IDWriteTextLayout object. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_text_range struct DWRITE_TEXT_RANGE { UINT32 + // startPosition; UINT32 length; }; + [PInvokeData("dwrite.h", MSDNShortId = "2e37e060-69b9-4ca2-9d95-8e9a39f6cf83")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_TEXT_RANGE + { + /// + /// Type: UINT32 + /// The start position of the text range. + /// + public uint startPosition; + + /// + /// Type: UINT32 + /// The number positions in the text range. + /// + public uint length; + } + + /// Specifies the trimming option for text overflowing the layout box. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_trimming struct DWRITE_TRIMMING { + // DWRITE_TRIMMING_GRANULARITY granularity; UINT32 delimiter; UINT32 delimiterCount; }; + [PInvokeData("dwrite.h", MSDNShortId = "c252b936-8a09-45b4-8138-84cf54058f72")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_TRIMMING + { + /// + /// Type: DWRITE_TRIMMING_GRANULARITY + /// A value that specifies the text granularity used to trim text overflowing the layout box. + /// + public DWRITE_TRIMMING_GRANULARITY granularity; + + /// + /// Type: UINT32 + /// + /// A character code used as the delimiter that signals the beginning of the portion of text to be preserved. Text starting from + /// the Nth occurence of the delimiter (where N equals delimiterCount) counting backwards from the end of the text block will be + /// preserved. For example, given the text is a path like c:\A\B\C\D\file.txt and delimiter equal to '' and delimiterCount equal + /// to 1, the file.txt portion of the text would be preserved. Specifying a delimiterCount of 2 would preserve D\file.txt. + /// + /// + public uint delimiter; + + /// + /// Type: UINT32 + /// The delimiter count, counting from the end of the text, to preserve text from. + /// + public uint delimiterCount; + } + + /// Contains a set of typographic features to be applied during text shaping. + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_typographic_features struct + // DWRITE_TYPOGRAPHIC_FEATURES { DWRITE_FONT_FEATURE *features; UINT32 featureCount; }; + [PInvokeData("dwrite.h", MSDNShortId = "21ef4266-5dd6-48b6-9175-452b74e94a07")] + // [StructLayout(LayoutKind.Sequential)] struct DWRITE_TYPOGRAPHIC_FEATURES{public IntPtr features; public uint featureCount; public + // ; } + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_TYPOGRAPHIC_FEATURES + { + /// + /// Type: DWRITE_FONT_FEATURE* + /// A pointer to a structure that specifies properties used to identify and execute typographic features in the font. + /// + public IntPtr features; + + /// + /// Type: UINT32 + /// A value that indicates the number of features being applied to a font face. + /// + public uint featureCount; + } + + /// + /// Contains information about the width, thickness, offset, run height, reading direction, and flow direction of an underline. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_underline struct DWRITE_UNDERLINE { FLOAT width; FLOAT + // thickness; FLOAT offset; FLOAT runHeight; DWRITE_READING_DIRECTION readingDirection; DWRITE_FLOW_DIRECTION flowDirection; WCHAR + // const *localeName; DWRITE_MEASURING_MODE measuringMode; }; + [PInvokeData("dwrite.h", MSDNShortId = "01f6c48e-6986-4a6e-9dd8-9f4b098db7fd")] + [StructLayout(LayoutKind.Sequential)] + public struct DWRITE_UNDERLINE + { + /// All coordinates are in device independent pixels (DIPs). + /// + /// Type: FLOAT + /// A value that indicates the width of the underline, measured parallel to the baseline. + /// + public float width; + + /// + /// Type: FLOAT + /// A value that indicates the thickness of the underline, measured perpendicular to the baseline. + /// + public float thickness; + + /// + /// Type: FLOAT + /// + /// A value that indicates the offset of the underline from the baseline. A positive offset represents a position below the + /// baseline (away from the text) and a negative offset is above (toward the text). + /// + /// + public float offset; + + /// + /// Type: FLOAT + /// A value that indicates the height of the tallest run where the underline is applied. + /// + public float runHeight; + + /// + /// Type: DWRITE_READING_DIRECTION + /// + /// A value that indicates the reading direction of the text associated with the underline. This value is used to interpret + /// whether the width value runs horizontally or vertically. + /// + /// + public DWRITE_READING_DIRECTION readingDirection; + + /// + /// Type: DWRITE_FLOW_DIRECTION + /// + /// A value that indicates the flow direction of the text associated with the underline. This value is used to interpret whether + /// the thickness value advances top to bottom, left to right, or right to left. + /// + /// + public DWRITE_FLOW_DIRECTION flowDirection; + + /// + /// Type: const WCHAR* + /// + /// An array of characters which contains the locale of the text that the underline is being drawn under. For example, in + /// vertical text, the underline belongs on the left for Chinese but on the right for Japanese. + /// + /// + public IntPtr localeName; + + /// + /// Type: DWRITE_MEASURING_MODE + /// + /// The measuring mode can be useful to the renderer to determine how underlines are rendered, such as rounding the thickness to + /// a whole pixel in GDI-compatible modes. + /// + /// + public DWRITE_MEASURING_MODE measuringMode; + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/Vanara.PInvoke.Graphics.csproj b/PInvoke/Graphics/Vanara.PInvoke.Graphics.csproj new file mode 100644 index 00000000..69ef303b --- /dev/null +++ b/PInvoke/Graphics/Vanara.PInvoke.Graphics.csproj @@ -0,0 +1,32 @@ + + + + d2d1.dll;dxgi.dll;dwrite.dll;windowscodecs.dll + + + PInvoke API (methods, interfaces, structures and constants) imported from Windows Graphics APIs. Currently supports Windows Imaging Component (WIC), DirectWrite (full), Direct2D (partial), and Direct3D (DXGI only). + $(AssemblyName) + net20;net35;net40;net45;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 + Vanara.PInvoke.Graphics + $(AssemblyName) + pinvoke;vanara;net-extensions;interop;DirectX;DirectWrite;DXGI;Direct2D;Windows Imaging Component;WIC;windowscodecs + True + Currently implements: + +Functions +CreateDXGIFactory, CreateDXGIFactory1, CreateDXGIFactory2, D2D1ComputeMaximumScaleFactor, D2D1ConvertColorSpace, D2D1CreateDevice, D2D1CreateDeviceContext, D2D1CreateFactory, D2D1GetGradientMeshInteriorPointsFromCoonsPatch, D2D1InvertMatrix, D2D1IsMatrixInvertible, D2D1MakeRotateMatrix, D2D1MakeSkewMatrix, D2D1SinCos, D2D1Tan, D2D1Vec3Length, DWriteCreateFactory, DXGIDeclareAdapterRemovalSupport, DXGIGetDebugInterface1, WICConvertBitmapSource, WICCreateBitmapFromSection, WICCreateBitmapFromSectionEx, WICMapGuidToShortName, WICMapSchemaToName, WICMapShortNameToGuid + +Structures +D2D_MATRIX_3X2_F, D2D_POINT_2F, D2D_RECT_F, D2D_SIZE_F, D2D_SIZE_U, D2D1_ARC_SEGMENT, D2D1_BEZIER_SEGMENT, D2D1_BITMAP_BRUSH_PROPERTIES, D2D1_BITMAP_PROPERTIES, D2D1_BRUSH_PROPERTIES, D2D1_DRAWING_STATE_DESCRIPTION, D2D1_ELLIPSE, D2D1_FACTORY_OPTIONS, D2D1_GRADIENT_STOP, D2D1_HWND_RENDER_TARGET_PROPERTIES, D2D1_LAYER_PARAMETERS, D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES, D2D1_PIXEL_FORMAT, D2D1_PRINT_CONTROL_PROPERTIES, D2D1_QUADRATIC_BEZIER_SEGMENT, D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES, D2D1_RENDER_TARGET_PROPERTIES, D2D1_ROUNDED_RECT, D2D1_STROKE_STYLE_PROPERTIES, D2D1_TRIANGLE, D3DCOLORVALUE, DWRITE_GLYPH_RUN, DXGI_JPEG_AC_HUFFMAN_TABLE, DXGI_JPEG_DC_HUFFMAN_TABLE, DXGI_JPEG_QUANTIZATION_TABLE, D2D1_BITMAP_PROPERTIES1, D2D1_CREATION_PROPERTIES, D2D1_EFFECT_INPUT_DESCRIPTION, D2D1_IMAGE_BRUSH_PROPERTIES, D2D1_LAYER_PARAMETERS1, D2D1_MAPPED_RECT, D2D1_RENDERING_CONTROLS, DXGI_ADAPTER_DESC, DXGI_ADAPTER_DESC1, DXGI_FRAME_STATISTICS, DXGI_GAMMA_CONTROL, DXGI_GAMMA_CONTROL_CAPABILITIES, DXGI_MAPPED_RECT, DXGI_MODE_DESC, DXGI_OUTPUT_DESC, DXGI_RATIONAL, DXGI_RGB, DXGI_SAMPLE_DESC, DXGI_SHARED_RESOURCE, DXGI_SURFACE_DESC, DXGI_SWAP_CHAIN_DESC, DWRITE_CLUSTER_METRICS, DWRITE_FONT_FEATURE, DWRITE_FONT_METRICS, DWRITE_GLYPH_METRICS, DWRITE_GLYPH_OFFSET, DWRITE_GLYPH_RUN, DWRITE_GLYPH_RUN_DESCRIPTION, DWRITE_HIT_TEST_METRICS, DWRITE_INLINE_OBJECT_METRICS, DWRITE_LINE_BREAKPOINT, DWRITE_LINE_METRICS, DWRITE_MATRIX, DWRITE_OVERHANG_METRICS, DWRITE_SCRIPT_ANALYSIS, DWRITE_SHAPING_GLYPH_PROPERTIES, DWRITE_SHAPING_TEXT_PROPERTIES, DWRITE_STRIKETHROUGH, DWRITE_TEXT_METRICS, DWRITE_TEXT_RANGE, DWRITE_TRIMMING, DWRITE_TYPOGRAPHIC_FEATURES, DWRITE_UNDERLINE, WICBitmapPattern, WICBitmapPlane, WICBitmapPlaneDescription, WICDdsFormatInfo, WICDdsParameters, WICImageParameters, WICJpegFrameHeader, WICJpegScanHeader, WICMetadataHeader, WICMetadataPattern, WICRawCapabilitiesInfo, WICRawToneCurve, WICRawToneCurvePoint, WICRect, PWICRect + +Interfaces +ID2D1Bitmap, ID2D1BitmapBrush, ID2D1BitmapRenderTarget, ID2D1Brush, ID2D1DCRenderTarget, ID2D1Device, ID2D1DeviceContext, ID2D1DrawingStateBlock, ID2D1EllipseGeometry, ID2D1Factory, ID2D1Geometry, ID2D1GeometryGroup, ID2D1GeometrySink, ID2D1GradientStopCollection, ID2D1HwndRenderTarget, ID2D1Image, ID2D1Layer, ID2D1LinearGradientBrush, ID2D1Mesh, ID2D1PathGeometry, ID2D1PrintControl, ID2D1RadialGradientBrush, ID2D1RectangleGeometry, ID2D1RenderTarget, ID2D1Resource, ID2D1RoundedRectangleGeometry, ID2D1SimplifiedGeometrySink, ID2D1SolidColorBrush, ID2D1StrokeStyle, ID2D1TessellationSink, ID2D1TransformedGeometry, ID2D1Bitmap1, ID2D1BitmapBrush1, ID2D1ColorContext, ID2D1CommandList, ID2D1CommandSink, ID2D1Effect, ID2D1GdiMetafile, ID2D1GdiMetafileSink, ID2D1GradientStopCollection1, ID2D1ImageBrush, ID2D1Properties, IDXGIAdapter, IDXGIAdapter1, IDXGIDevice, IDXGIDeviceSubObject, IDXGIFactory, IDXGIFactory1, IDXGIObject, IDXGIOutput, IDXGISurface, IDXGISwapChain, IDWriteBitmapRenderTarget, IDWriteFactory, IDWriteFont, IDWriteFontCollection, IDWriteFontCollectionLoader, IDWriteFontFace, IDWriteFontFamily, IDWriteFontFile, IDWriteFontFileEnumerator, IDWriteFontFileLoader, IDWriteFontFileStream, IDWriteFontList, IDWriteGdiInterop, IDWriteGlyphRunAnalysis, IDWriteInlineObject, IDWriteLocalFontFileLoader, IDWriteLocalizedStrings, IDWriteNumberSubstitution, IDWritePixelSnapping, IDWriteRenderingParams, IDWriteTextAnalysisSink, IDWriteTextAnalysisSource, IDWriteTextAnalyzer, IDWriteTextFormat, IDWriteTextLayout, IDWriteTextRenderer, IDWriteTypography, IWICBitmap, IWICBitmapClipper, IWICBitmapCodecInfo, IWICBitmapCodecProgressNotification, IWICBitmapDecoder, IWICBitmapDecoderInfo, IWICBitmapEncoder, IWICBitmapEncoderInfo, IWICBitmapFlipRotator, IWICBitmapFrameDecode, IWICBitmapFrameEncode, IWICBitmapLock, IWICBitmapScaler, IWICBitmapSource, IWICBitmapSourceTransform, IWICColorContext, IWICColorTransform, IWICComponentFactory, IWICComponentInfo, IWICDdsDecoder, IWICDdsEncoder, IWICDevelopRaw, IWICDevelopRawNotificationCallback, IWICDdsFrameDecode, IWICEnumMetadataItem, IWICFastMetadataEncoder, IWICFormatConverter, IWICFormatConverterInfo, IWICImageEncoder, IWICImagingFactory, IWICImagingFactory2, IWICJpegFrameDecode, IWICJpegFrameEncode, IWICMetadataBlockReader, IWICMetadataBlockWriter, IWICMetadataHandlerInfo, IWICMetadataQueryReader, IWICMetadataQueryWriter, IWICMetadataReader, IWICMetadataReaderInfo, IWICMetadataWriter, IWICMetadataWriterInfo, IWICPalette, IWICPersistStream, IWICPixelFormatInfo, IWICPixelFormatInfo2, IWICPlanarBitmapFrameEncode, IWICPlanarBitmapSourceTransform, IWICPlanarFormatConverter, IWICProgressCallback, IWICProgressiveLevelControl, IWICStream, IWICStreamProvider + + + + + + + + + \ No newline at end of file diff --git a/PInvoke/Graphics/WIC/WindowsCodecs.Enums.cs b/PInvoke/Graphics/WIC/WindowsCodecs.Enums.cs new file mode 100644 index 00000000..6dcf4f2e --- /dev/null +++ b/PInvoke/Graphics/WIC/WindowsCodecs.Enums.cs @@ -0,0 +1,1739 @@ +using System; + +namespace Vanara.PInvoke +{ + /// Items from the WindowsCodecs.dll + public static partial class WindowsCodecs + { + /// + /// The format of the quantization table indices. Use one of the following constants, described in IWICJpegFrameDecode Constants. + /// + [PInvokeData("wincodec.h", MSDNShortId = "87A36F9B-CD6B-4343-AAA7-9FDBAD41E38A")] + public enum WIC_JPEG_HUFFMAN_BASELINE + { + /// + WIC_JPEG_HUFFMAN_BASELINE_ONE = 0, + + /// + WIC_JPEG_HUFFMAN_BASELINE_THREE = 0x111100 + } + + /// + /// The format of the quantization table indices. Use one of the following constants, described in IWICJpegFrameDecode Constants. + /// + [PInvokeData("wincodec.h", MSDNShortId = "BB207D78-9E27-49A4-91E4-601CED109389")] + public enum WIC_JPEG_QUANTIZATION_BASELINE + { + /// + WIC_JPEG_QUANTIZATION_BASELINE_ONE = 0, + + /// + WIC_JPEG_QUANTIZATION_BASELINE_THREE = 0x10100, + } + + /// The sample factors. Use one of the following constants, described in IWICJpegFrameDecode Constants. + [PInvokeData("wincodec.h", MSDNShortId = "BB207D78-9E27-49A4-91E4-601CED109389")] + public enum WIC_JPEG_SAMPLE_FACTORS + { + /// + WIC_JPEG_SAMPLE_FACTORS_ONE = 0x11, + + /// + WIC_JPEG_SAMPLE_FACTORS_THREE_420 = 0x111122, + + /// + WIC_JPEG_SAMPLE_FACTORS_THREE_422 = 0x111121, + + /// + WIC_JPEG_SAMPLE_FACTORS_THREE_440 = 0x111112, + + /// + WIC_JPEG_SAMPLE_FACTORS_THREE_444 = 0x111111, + } + + /// Specifies the identifiers of the metadata items in an 8BIM IPTC digest metadata block. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wic8bimiptcdigestproperties typedef enum + // WIC8BIMIptcDigestProperties { WIC8BIMIptcDigestPString, WIC8BIMIptcDigestIptcDigest, WIC8BIMIptcDigestProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "b0dbd1fa-face-4f6f-a943-60d108388b97")] + public enum WIC8BIMIptcDigestProperties + { + /// [VT_LPSTR] A name that identifies the 8BIM block. + WIC8BIMIptcDigestPString = 1, + + /// [VT_BLOB] The embedded IPTC digest value. + WIC8BIMIptcDigestIptcDigest, + + /// + WIC8BIMIptcDigestProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the identifiers of the metadata items in an 8BIM IPTC block. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wic8bimiptcproperties typedef enum WIC8BIMIptcProperties + // { WIC8BIMIptcPString, WIC8BIMIptcEmbeddedIPTC, WIC8BIMIptcProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "c752790c-6392-4406-b006-8f5da9f4e23d")] + public enum WIC8BIMIptcProperties + { + /// [VT_LPSTR] A name that identifies the 8BIM block. + WIC8BIMIptcPString, + + /// + WIC8BIMIptcEmbeddedIPTC, + + /// + WIC8BIMIptcProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the identifiers of the metadata items in an 8BIMResolutionInfo block. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wic8bimresolutioninfoproperties typedef enum + // WIC8BIMResolutionInfoProperties { WIC8BIMResolutionInfoPString, WIC8BIMResolutionInfoHResolution, + // WIC8BIMResolutionInfoHResolutionUnit, WIC8BIMResolutionInfoWidthUnit, WIC8BIMResolutionInfoVResolution, + // WIC8BIMResolutionInfoVResolutionUnit, WIC8BIMResolutionInfoHeightUnit, WIC8BIMResolutionInfoProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "a5bb984a-290c-4dd6-8b94-b8a221e78a6b")] + public enum WIC8BIMResolutionInfoProperties + { + /// [VT_LPSTR] A name that identifies the 8BIM block. + WIC8BIMResolutionInfoPString = 1, + + /// [VT_UI4] The horizontal resolution of the image. + WIC8BIMResolutionInfoHResolution, + + /// + /// [VT_UI2] The units that the horizontal resolution is specified in; a 1 indicates pixels per inch and a 2 indicates pixels + /// per centimeter. + /// + WIC8BIMResolutionInfoHResolutionUnit, + + /// + /// [VT_UI2] The units that the image width is specified in; a 1 indicates inches, a 2 indicates centimeters, a 3 indicates + /// points, a 4 specifies picas, and a 5 specifies columns. + /// + WIC8BIMResolutionInfoWidthUnit, + + /// [VT_UI4] The vertical resolution of the image. + WIC8BIMResolutionInfoVResolution, + + /// + /// [VT_UI2] The units that the vertical resolution is specified in; a 1 indicates pixels per inch and a 2 indicates pixels per centimeter. + /// + WIC8BIMResolutionInfoVResolutionUnit, + + /// + /// [VT_UI2] The units that the image height is specified in; a 1 indicates inches, a 2 indicates centimeters, a 3 indicates + /// points, a 4 specifies picas, and a 5 specifies columns. + /// + WIC8BIMResolutionInfoHeightUnit, + + /// + WIC8BIMResolutionInfoProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the desired alpha channel usage. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmapalphachanneloption typedef enum + // WICBitmapAlphaChannelOption { WICBitmapUseAlpha, WICBitmapUsePremultipliedAlpha, WICBitmapIgnoreAlpha, + // WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "caa10c35-9af4-4310-b031-3347cf795087")] + public enum WICBitmapAlphaChannelOption + { + /// Use alpha channel. + WICBitmapUseAlpha, + + /// Use a pre-multiplied alpha channel. + WICBitmapUsePremultipliedAlpha, + + /// Ignore alpha channel. + WICBitmapIgnoreAlpha, + + /// Sentinel value. + WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the desired cache usage. + /// + /// The CreateBitmap of the IWICImagingFactory interface does not support WICBitmapNoCache when the pixelFormat is a native + /// pixel format provided by Windows Imaging Component (WIC). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmapcreatecacheoption typedef enum + // WICBitmapCreateCacheOption { WICBitmapNoCache, WICBitmapCacheOnDemand, WICBitmapCacheOnLoad, + // WICBITMAPCREATECACHEOPTION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "121d394d-e818-44c5-bf44-3b01df61c780")] + [Flags] + public enum WICBitmapCreateCacheOption + { + /// Do not cache the bitmap. + WICBitmapNoCache = 0, + + /// Cache the bitmap when needed. + WICBitmapCacheOnDemand = 0x01, + + /// Cache the bitmap at initialization. + WICBitmapCacheOnLoad = 0x02, + + /// + WICBITMAPCREATECACHEOPTION_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the capabilities of the decoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmapdecodercapabilities typedef enum + // WICBitmapDecoderCapabilities { WICBitmapDecoderCapabilitySameEncoder, WICBitmapDecoderCapabilityCanDecodeAllImages, + // WICBitmapDecoderCapabilityCanDecodeSomeImages, WICBitmapDecoderCapabilityCanEnumerateMetadata, + // WICBitmapDecoderCapabilityCanDecodeThumbnail, WICBITMAPDECODERCAPABILITIES_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "e501b8f7-3c99-461d-be92-dca80f5657c5")] + [Flags] + public enum WICBitmapDecoderCapabilities + { + /// Decoder recognizes the image was encoded with an encoder produced by the same vendor. + WICBitmapDecoderCapabilitySameEncoder = 0x1, + + /// Decoder can decode all the images within an image container. + WICBitmapDecoderCapabilityCanDecodeAllImages = 0x2, + + /// Decoder can decode some of the images within an image container. + WICBitmapDecoderCapabilityCanDecodeSomeImages = 0x4, + + /// Decoder can enumerate the metadata blocks within a container format. + WICBitmapDecoderCapabilityCanEnumerateMetadata = 0x8, + + /// Decoder can find and decode a thumbnail. + WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x10, + + /// + WICBITMAPDECODERCAPABILITIES_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the type of dither algorithm to apply when converting between image formats. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmapdithertype typedef enum WICBitmapDitherType { + // WICBitmapDitherTypeNone, WICBitmapDitherTypeSolid, WICBitmapDitherTypeOrdered4x4, WICBitmapDitherTypeOrdered8x8, + // WICBitmapDitherTypeOrdered16x16, WICBitmapDitherTypeSpiral4x4, WICBitmapDitherTypeSpiral8x8, WICBitmapDitherTypeDualSpiral4x4, + // WICBitmapDitherTypeDualSpiral8x8, WICBitmapDitherTypeErrorDiffusion, WICBITMAPDITHERTYPE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "e3fd8f37-8ea9-4cdb-853b-d5119b7afdc9")] + public enum WICBitmapDitherType + { + /// A solid color algorithm without dither. + WICBitmapDitherTypeNone = 0, + + /// A solid color algorithm without dither. + WICBitmapDitherTypeSolid = WICBitmapDitherTypeNone, + + /// A 4x4 ordered dither algorithm. + WICBitmapDitherTypeOrdered4x4, + + /// An 8x8 ordered dither algorithm. + WICBitmapDitherTypeOrdered8x8, + + /// A 16x16 ordered dither algorithm. + WICBitmapDitherTypeOrdered16x16, + + /// A 4x4 spiral dither algorithm. + WICBitmapDitherTypeSpiral4x4, + + /// An 8x8 spiral dither algorithm. + WICBitmapDitherTypeSpiral8x8, + + /// A 4x4 dual spiral dither algorithm. + WICBitmapDitherTypeDualSpiral4x4, + + /// An 8x8 dual spiral dither algorithm. + WICBitmapDitherTypeDualSpiral8x8, + + /// An error diffusion algorithm. + WICBitmapDitherTypeErrorDiffusion, + + /// + WICBITMAPDITHERTYPE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the cache options available for an encoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmapencodercacheoption typedef enum + // WICBitmapEncoderCacheOption { WICBitmapEncoderCacheInMemory, WICBitmapEncoderCacheTempFile, WICBitmapEncoderNoCache, + // WICBITMAPENCODERCACHEOPTION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "cc23cd53-f29b-4e4e-a3d9-038c6f0c5629")] + [Flags] + public enum WICBitmapEncoderCacheOption + { + /// The encoder is cached in memory. This option is not supported. + WICBitmapEncoderCacheInMemory = 0, + + /// The encoder is cached to a temporary file. This option is not supported. + WICBitmapEncoderCacheTempFile = 0x1, + + /// The encoder is not cached. + WICBitmapEncoderNoCache = 0x2, + + /// + WICBITMAPENCODERCACHEOPTION_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the sampling or filtering mode to use when scaling an image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmapinterpolationmode typedef enum + // WICBitmapInterpolationMode { WICBitmapInterpolationModeNearestNeighbor, WICBitmapInterpolationModeLinear, + // WICBitmapInterpolationModeCubic, WICBitmapInterpolationModeFant, WICBitmapInterpolationModeHighQualityCubic, + // WICBITMAPINTERPOLATIONMODE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "7c707ab7-7cd5-418f-921c-e9114da92f2a")] + public enum WICBitmapInterpolationMode + { + /// + /// A nearest neighbor interpolation algorithm. Also known as nearest pixel or point interpolation. The output pixel is assigned + /// the value of the pixel that the point falls within. No other pixels are considered. + /// + WICBitmapInterpolationModeNearestNeighbor, + + /// + /// A bilinear interpolation algorithm. The output pixel values are computed as a weighted average of the nearest four pixels in + /// a 2x2 grid. + /// + WICBitmapInterpolationModeLinear, + + /// + /// A bicubic interpolation algorithm. Destination pixel values are computed as a weighted average of the nearest sixteen pixels + /// in a 4x4 grid. + /// + WICBitmapInterpolationModeCubic, + + /// + /// A Fant resampling algorithm. Destination pixel values are computed as a weighted average of the all the pixels that map to + /// the new pixel. + /// + WICBitmapInterpolationModeFant, + + /// + /// A high quality bicubic interpolation algorithm. Destination pixel values are computed using a much denser sampling kernel + /// than regular cubic. The kernel is resized in response to the scale factor, making it suitable for downscaling by factors + /// greater than 2. + /// + WICBitmapInterpolationModeHighQualityCubic, + + /// + WICBITMAPINTERPOLATIONMODE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies access to an IWICBitmap. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmaplockflags typedef enum WICBitmapLockFlags { + // WICBitmapLockRead, WICBitmapLockWrite, WICBITMAPLOCKFLAGS_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "d4d1bb38-3d1a-4e1e-a889-0491f3c01822")] + [Flags] + public enum WICBitmapLockFlags + { + /// A read access lock. + WICBitmapLockRead = 1, + + /// A write access lock. + WICBitmapLockWrite = 2, + + /// + WICBITMAPLOCKFLAGS_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the type of palette used for an indexed image format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmappalettetype typedef enum WICBitmapPaletteType { + // WICBitmapPaletteTypeCustom, WICBitmapPaletteTypeMedianCut, WICBitmapPaletteTypeFixedBW, WICBitmapPaletteTypeFixedHalftone8, + // WICBitmapPaletteTypeFixedHalftone27, WICBitmapPaletteTypeFixedHalftone64, WICBitmapPaletteTypeFixedHalftone125, + // WICBitmapPaletteTypeFixedHalftone216, WICBitmapPaletteTypeFixedWebPalette, WICBitmapPaletteTypeFixedHalftone252, + // WICBitmapPaletteTypeFixedHalftone256, WICBitmapPaletteTypeFixedGray4, WICBitmapPaletteTypeFixedGray16, + // WICBitmapPaletteTypeFixedGray256, WICBITMAPPALETTETYPE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "a8192905-2bae-4760-bf2d-64640c46e168")] + public enum WICBitmapPaletteType + { + /// An arbitrary custom palette provided by caller. + WICBitmapPaletteTypeCustom, + + /// An optimal palette generated using a median-cut algorithm. Derived from the colors in an image. + WICBitmapPaletteTypeMedianCut, + + /// A black and white palette. + WICBitmapPaletteTypeFixedBW, + + /// + /// A palette that has its 8-color on-off primaries and the 16 system colors added. With duplicates removed, 16 colors are available. + /// + WICBitmapPaletteTypeFixedHalftone8, + + /// + /// A palette that has 3 intensity levels of each primary: 27-color on-off primaries and the 16 system colors added. With + /// duplicates removed, 35 colors are available. + /// + WICBitmapPaletteTypeFixedHalftone27, + + /// + /// A palette that has 4 intensity levels of each primary: 64-color on-off primaries and the 16 system colors added. With + /// duplicates removed, 72 colors are available. + /// + WICBitmapPaletteTypeFixedHalftone64, + + /// + /// A palette that has 5 intensity levels of each primary: 125-color on-off primaries and the 16 system colors added. With + /// duplicates removed, 133 colors are available. + /// + WICBitmapPaletteTypeFixedHalftone125, + + /// + /// A palette that has 6 intensity levels of each primary: 216-color on-off primaries and the 16 system colors added. With + /// duplicates removed, 224 colors are available. This is the same as WICBitmapPaletteFixedHalftoneWeb. + /// + WICBitmapPaletteTypeFixedHalftone216, + + /// + /// A palette that has 6 intensity levels of each primary: 216-color on-off primaries and the 16 system colors added. With + /// duplicates removed, 224 colors are available. This is the same as WICBitmapPaletteTypeFixedHalftone216. + /// + WICBitmapPaletteTypeFixedWebPalette = WICBitmapPaletteTypeFixedHalftone216, + + /// + /// A palette that has its 252-color on-off primaries and the 16 system colors added. With duplicates removed, 256 colors are available. + /// + WICBitmapPaletteTypeFixedHalftone252, + + /// + /// A palette that has its 256-color on-off primaries and the 16 system colors added. With duplicates removed, 256 colors are available. + /// + WICBitmapPaletteTypeFixedHalftone256, + + /// A palette that has 4 shades of gray. + WICBitmapPaletteTypeFixedGray4, + + /// A palette that has 16 shades of gray. + WICBitmapPaletteTypeFixedGray16, + + /// A palette that has 256 shades of gray. + WICBitmapPaletteTypeFixedGray256, + + /// + WICBITMAPPALETTETYPE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the flip and rotation transforms. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicbitmaptransformoptions typedef enum + // WICBitmapTransformOptions { WICBitmapTransformRotate0, WICBitmapTransformRotate90, WICBitmapTransformRotate180, + // WICBitmapTransformRotate270, WICBitmapTransformFlipHorizontal, WICBitmapTransformFlipVertical, + // WICBITMAPTRANSFORMOPTIONS_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "e123bb4d-bc75-4f3f-98f1-bea9b008498b")] + [Flags] + public enum WICBitmapTransformOptions + { + /// A rotation of 0 degrees. + WICBitmapTransformRotate0, + + /// A clockwise rotation of 90 degrees. + WICBitmapTransformRotate90, + + /// A clockwise rotation of 180 degrees. + WICBitmapTransformRotate180, + + /// A clockwise rotation of 270 degrees. + WICBitmapTransformRotate270, + + /// A horizontal flip. Pixels are flipped around the vertical y-axis. + WICBitmapTransformFlipHorizontal = 0x8, + + /// A vertical flip. Pixels are flipped around the horizontal x-axis. + WICBitmapTransformFlipVertical = 0x10, + + /// + WICBITMAPTRANSFORMOPTIONS_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the color context types. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wiccolorcontexttype typedef enum WICColorContextType { + // WICColorContextUninitialized, WICColorContextProfile, WICColorContextExifColorSpace } ; + [PInvokeData("wincodec.h", MSDNShortId = "30fab53b-8edf-488c-a6f2-5224b94e0500")] + public enum WICColorContextType + { + /// An uninitialized color context. + WICColorContextUninitialized, + + /// A color context that is a full ICC color profile. + WICColorContextProfile, + + /// A color context that is one of a number of set color spaces (sRGB, AdobeRGB) that are defined in the EXIF specification. + WICColorContextExifColorSpace, + } + + /// Specifies component enumeration options. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wiccomponentenumerateoptions typedef enum + // WICComponentEnumerateOptions { WICComponentEnumerateDefault, WICComponentEnumerateRefresh, WICComponentEnumerateDisabled, + // WICComponentEnumerateUnsigned, WICComponentEnumerateBuiltInOnly, WICCOMPONENTENUMERATEOPTIONS_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "52cc0860-6164-4400-8e81-03eb0c44904e")] + [Flags] + public enum WICComponentEnumerateOptions : uint + { + /// + /// Enumerate any components that are not disabled. Because this value is 0x0, it is always included with the other options. + /// + WICComponentEnumerateDefault = 0x0, + + /// Force a read of the registry before enumerating components. + WICComponentEnumerateRefresh = 0x1, + + /// + /// Include disabled components in the enumeration. The set of disabled components is disjoint with the set of default + /// enumerated components + /// + WICComponentEnumerateDisabled = 0x80000000, + + /// Include unsigned components in the enumeration. This option has no effect. + WICComponentEnumerateUnsigned = 0x40000000, + + /// At the end of component enumeration, filter out any components that are not Windows provided. + WICComponentEnumerateBuiltInOnly = 0x20000000, + + /// + WICCOMPONENTENUMERATEOPTIONS_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the component signing status. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wiccomponentsigning typedef enum WICComponentSigning { + // WICComponentSigned, WICComponentUnsigned, WICComponentSafe, WICComponentDisabled, WICCOMPONENTSIGNING_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "64f3de6d-15da-4cc8-ad74-57759bcd4d07")] + [Flags] + public enum WICComponentSigning : uint + { + /// A signed component. + WICComponentSigned = 0x1, + + /// An unsigned component + WICComponentUnsigned = 0x2, + + /// + /// A component is safe. Components that do not have a binary component to sign, such as a pixel format, should return this value. + /// + WICComponentSafe = 0x4, + + /// A component has been disabled. + WICComponentDisabled = 0x80000000, + + /// + WICCOMPONENTSIGNING_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the type of Windows Imaging Component (WIC) component. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wiccomponenttype typedef enum WICComponentType { + // WICDecoder, WICEncoder, WICPixelFormatConverter, WICMetadataReader, WICMetadataWriter, WICPixelFormat, WICAllComponents, + // WICCOMPONENTTYPE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "eff6b77c-ea4b-4476-8d75-dec5bb2e1745")] + [Flags] + public enum WICComponentType + { + /// A WIC decoder. + WICDecoder = 0x1, + + /// A WIC encoder. + WICEncoder = 0x2, + + /// A WIC pixel converter. + WICPixelFormatConverter = 0x4, + + /// A WIC metadata reader. + WICMetadataReader = 0x8, + + /// A WIC metadata writer. + WICMetadataWriter = 0x10, + + /// A WIC pixel format. + WICPixelFormat = 0x20, + + /// All WIC components. + WICAllComponents = 0x3f, + + /// + WICCOMPONENTTYPE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the the meaning of pixel color component values contained in the DDS image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicddsalphamode typedef enum WICDdsAlphaMode { + // WICDdsAlphaModeUnknown, WICDdsAlphaModeStraight, WICDdsAlphaModePremultiplied, WICDdsAlphaModeOpaque, WICDdsAlphaModeCustom, + // WICDDSALPHAMODE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "67C9B07F-5259-4032-9EBF-CBC3B8637343")] + public enum WICDdsAlphaMode + { + /// Alpha behavior is unspecified and must be determined by the reader. + WICDdsAlphaModeUnknown, + + /// The alpha data is straight. + WICDdsAlphaModeStraight, + + /// The alpha data is premultiplied. + WICDdsAlphaModePremultiplied, + + /// + /// The alpha data is opaque (UNORM value of 1). This can be used by a compliant reader as a performance optimization. For + /// example, blending operations can be converted to copies. + /// + WICDdsAlphaModeOpaque, + + /// The alpha channel contains custom data that is not alpha. + WICDdsAlphaModeCustom, + + /// + WICDDSALPHAMODE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the dimension type of the data contained in DDS image. + /// + /// Both WICDdsTexture2d and WICDdsTextureCube correspond to D3D11_RESOURCE_DIMENSION_TEXTURE2D. When using + /// ID3D11Device::CreateTexture2D, they are distinguished by the flag D3D11_RESOURCE_MISC_TEXTURECUBE in the structure D3D11_TEXTURE2D_DESC. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicddsdimension typedef enum WICDdsDimension { + // WICDdsTexture1D, WICDdsTexture2D, WICDdsTexture3D, WICDdsTextureCube, WICDDSTEXTURE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "76CEBFD7-EE7D-48C4-9F88-9AD82C9FED55")] + public enum WICDdsDimension + { + /// DDS image contains a 1-dimensional texture . + WICDdsTexture1D, + + /// DDS image contains a 2-dimensional texture . + WICDdsTexture2D, + + /// DDS image contains a 3-dimensional texture . + WICDdsTexture3D, + + /// The DDS image contains a cube texture represented as an array of 6 faces. + WICDdsTextureCube, + + /// + WICDDSTEXTURE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies decode options. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicdecodeoptions typedef enum WICDecodeOptions { + // WICDecodeMetadataCacheOnDemand, WICDecodeMetadataCacheOnLoad, WICMETADATACACHEOPTION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "27b9d6e1-e171-4c7f-8f96-fa5a93923e35")] + [Flags] + public enum WICDecodeOptions + { + /// Cache metadata when needed. + WICDecodeMetadataCacheOnDemand = 0, + + /// Cache metadata when decoder is loaded. + WICDecodeMetadataCacheOnLoad = 0x1, + + /// + WICMETADATACACHEOPTION_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the application extension metadata properties for a Graphics Interchange Format (GIF) image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicgifapplicationextensionproperties typedef enum + // WICGifApplicationExtensionProperties { WICGifApplicationExtensionApplication, WICGifApplicationExtensionData, + // WICGifApplicationExtensionProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "e60da197-2510-4a13-91e3-896d6027ee57")] + public enum WICGifApplicationExtensionProperties + { + /// [VT_UI1|VT_VECTOR] Indicates a string that identifies the application. + WICGifApplicationExtensionApplication = 1, + + /// [VT_UI1|VT_VECTOR] Indicates data that is exposed by the application. + WICGifApplicationExtensionData, + + /// + WICGifApplicationExtensionProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the comment extension metadata properties for a Graphics Interchange Format (GIF) image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicgifcommentextensionproperties typedef enum + // WICGifCommentExtensionProperties { WICGifCommentExtensionText, WICGifCommentExtensionProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "900f1c1e-e8d2-4cee-acba-c9c2a45e9bcb")] + public enum WICGifCommentExtensionProperties + { + /// [VT_LPSTR] Indicates the comment text. + WICGifCommentExtensionText = 1, + + /// + WICGifCommentExtensionProperties_FORCE_DWORD = 0x7fffffff, + } + + /// + /// Specifies the graphic control extension metadata properties that define the transitions between each frame animation for + /// Graphics Interchange Format (GIF) images. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicgifgraphiccontrolextensionproperties typedef enum + // WICGifGraphicControlExtensionProperties { WICGifGraphicControlExtensionDisposal, WICGifGraphicControlExtensionUserInputFlag, + // WICGifGraphicControlExtensionTransparencyFlag, WICGifGraphicControlExtensionDelay, + // WICGifGraphicControlExtensionTransparentColorIndex, WICGifGraphicControlExtensionProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "32fbf62d-0479-4ead-8246-6c757467ccaa")] + public enum WICGifGraphicControlExtensionProperties + { + /// + /// [VT_UI1] Indicates the disposal requirements. 0 - no disposal, 1 - do not dispose, 2 - restore to background color, 3 - + /// restore to previous. + /// + WICGifGraphicControlExtensionDisposal = 1, + + /// [VT_BOOL] Indicates the user input flag. TRUE if user input should advance to the next frame; otherwise, FALSE. + WICGifGraphicControlExtensionUserInputFlag, + + /// + /// [VT_BOOL] Indicates the transparency flag. TRUE if a transparent color in is in the color table for this frame; otherwise, FALSE. + /// + WICGifGraphicControlExtensionTransparencyFlag, + + /// + /// [VT_UI2] Indicates how long to display the next frame before advancing to the next frame, in units of 1/100th of a second. + /// + WICGifGraphicControlExtensionDelay, + + /// [VT_UI1] Indicates which color in the palette should be treated as transparent. + WICGifGraphicControlExtensionTransparentColorIndex, + + /// + WICGifGraphicControlExtensionProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the image descriptor metadata properties for Graphics Interchange Format (GIF) frames. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicgifimagedescriptorproperties typedef enum + // WICGifImageDescriptorProperties { WICGifImageDescriptorLeft, WICGifImageDescriptorTop, WICGifImageDescriptorWidth, + // WICGifImageDescriptorHeight, WICGifImageDescriptorLocalColorTableFlag, WICGifImageDescriptorInterlaceFlag, + // WICGifImageDescriptorSortFlag, WICGifImageDescriptorLocalColorTableSize, WICGifImageDescriptorProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "5488e63b-503b-47cd-99f3-5d359c7e0070")] + public enum WICGifImageDescriptorProperties + { + /// [VT_UI2] Indicates the X offset at which to locate this frame within the logical screen. + WICGifImageDescriptorLeft = 1, + + /// [VT_UI2] Indicates the Y offset at which to locate this frame within the logical screen. + WICGifImageDescriptorTop, + + /// [VT_UI2] Indicates width of this frame, in pixels. + WICGifImageDescriptorWidth, + + /// [VT_UI2] Indicates height of this frame, in pixels. + WICGifImageDescriptorHeight, + + /// [VT_BOOL] Indicates the local color table flag. TRUE if global color table is present; otherwise, FALSE. + WICGifImageDescriptorLocalColorTableFlag, + + /// [VT_BOOL] Indicates the interlace flag. TRUE if image is interlaced; otherwise, FALSE. + WICGifImageDescriptorInterlaceFlag, + + /// + /// [VT_BOOL] Indicates the sorted color table flag. TRUE if the color table is sorted from most frequently to least frequently + /// used color; otherwise, FALSE. + /// + WICGifImageDescriptorSortFlag, + + /// + /// [VT_UI1] Indicates the value used to calculate the number of bytes contained in the global color table. To calculate the + /// actual size of the color table, raise 2 to the value of the field + 1. + /// + WICGifImageDescriptorLocalColorTableSize, + + /// + WICGifImageDescriptorProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the logical screen descriptor properties for Graphics Interchange Format (GIF) metadata. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicgiflogicalscreendescriptorproperties typedef enum + // WICGifLogicalScreenDescriptorProperties { WICGifLogicalScreenSignature, WICGifLogicalScreenDescriptorWidth, + // WICGifLogicalScreenDescriptorHeight, WICGifLogicalScreenDescriptorGlobalColorTableFlag, + // WICGifLogicalScreenDescriptorColorResolution, WICGifLogicalScreenDescriptorSortFlag, + // WICGifLogicalScreenDescriptorGlobalColorTableSize, WICGifLogicalScreenDescriptorBackgroundColorIndex, + // WICGifLogicalScreenDescriptorPixelAspectRatio, WICGifLogicalScreenDescriptorProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "edeaae2d-ba4a-4d03-b1ce-37bb5cd67e03")] + public enum WICGifLogicalScreenDescriptorProperties + { + /// [VT_UI1 + WICGifLogicalScreenSignature = 1, + + /// [VT_UI2] Indicates the width in pixels. + WICGifLogicalScreenDescriptorWidth, + + /// [VT_UI2] Indicates the height in pixels. + WICGifLogicalScreenDescriptorHeight, + + /// [VT_BOOL] Indicates the global color table flag. TRUE if a global color table is present; otherwise, FALSE. + WICGifLogicalScreenDescriptorGlobalColorTableFlag, + + /// [VT_UI1] Indicates the color resolution in bits per pixel. + WICGifLogicalScreenDescriptorColorResolution, + + /// [VT_BOOL] Indicates the sorted color table flag. TRUE if the table is sorted; otherwise, FALSE. + WICGifLogicalScreenDescriptorSortFlag, + + /// + /// [VT_UI1] Indicates the value used to calculate the number of bytes contained in the global color table. To calculate the + /// actual size of the color table, raise 2 to the value of the field + 1. + /// + WICGifLogicalScreenDescriptorGlobalColorTableSize, + + /// [VT_UI1] Indicates the index within the color table to use for the background (pixels not defined in the image). + WICGifLogicalScreenDescriptorBackgroundColorIndex, + + /// [VT_UI1] Indicates the factor used to compute an approximation of the aspect ratio. + WICGifLogicalScreenDescriptorPixelAspectRatio, + + /// + WICGifLogicalScreenDescriptorProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the HDR properties of a High Efficiency Image Format (HEIF) image. + /// + /// + /// Use IWicMetadataReader::GetValue to retrieve the value of the properties specified with this enumeration. Instantiate the + /// IWicMetadataReader instance using the GUID CLSID_WICMetadataReader. Call IWicMetadataReader::GetMetadataFormat and + /// confirm that the value is GUID_MetadataFormatHeifHDR to verify that the metadata format is HEIF HDR metadata. + /// + /// + /// Not all HEIF HDR images will have all of these properties present in the file, so only those properties that are available will + /// be exposed by the metadata reader. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicheifhdrproperties typedef enum WICHeifHdrProperties { + // WICHeifHdrMaximumLuminanceLevel, WICHeifHdrMaximumFrameAverageLuminanceLevel, WICHeifHdrMinimumMasteringDisplayLuminanceLevel, + // WICHeifHdrMaximumMasteringDisplayLuminanceLevel, WICHeifHdrCustomVideoPrimaries, WICHeifHdrProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h")] + public enum WICHeifHdrProperties + { + /// [VT_UI2] Specifies the maximum luminance level of the content in Nits. + WICHeifHdrMaximumLuminanceLevel = 1, + + /// [VT_UI2] Specifies the maximum average per-frame luminance level of the content in Nits. + WICHeifHdrMaximumFrameAverageLuminanceLevel, + + /// [VT_UI2] Specifies the maximum luminance of the display on which the content was authored, in Nits. + WICHeifHdrMinimumMasteringDisplayLuminanceLevel, + + /// [VT_UI2] Specifies the maximum luminance of the display on which the content was authored, in Nits. + WICHeifHdrMaximumMasteringDisplayLuminanceLevel, + + /// + /// [VT_BLOB] Specifies custom color primaries for a video media type. The value of this property is a + /// MT_CUSTOM_VIDEO_PRIMARIESstructure, returned as an array of bytes (VT_BLOB). + /// + WICHeifHdrCustomVideoPrimaries, + + /// + WICHeifHdrProperties_FORCE_DWORD, + } + + /// Specifies the JPEG chrominance table property. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegchrominanceproperties typedef enum + // WICJpegChrominanceProperties { WICJpegChrominanceTable, WICJpegChrominanceProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "edfa5f86-4c8b-4ba7-a017-d3ff9525b659")] + public enum WICJpegChrominanceProperties + { + /// [VT_UI2|VT_VECTOR] Indicates the metadata property is a chrominance table. + WICJpegChrominanceTable = 1, + + /// + WICJpegChrominanceProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the JPEG comment properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegcommentproperties typedef enum + // WICJpegCommentProperties { WICJpegCommentText, WICJpegCommentProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "aacf1f1a-49c6-4caf-acd5-8bba0415d41a")] + public enum WICJpegCommentProperties + { + /// Indicates the metadata property is comment text. + WICJpegCommentText = 1, + + /// + WICJpegCommentProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Flags used by the WICJpegScanHeader and WICJpegFrameHeader. + // https://docs.microsoft.com/en-us/windows/win32/wic/iwicjpegframedecode-constants + [PInvokeData("wincodec.h", MSDNShortId = "6C0139F3-DA3E-4D7C-80D5-BC8C2D76C6A9")] + public enum WICJpegFrameDecode + { + /// The maximum number of components supported by WIC. + WIC_JPEG_MAX_COMPONENT_COUNT = 4, + + /// The maximum number of tables supported by WIC. + WIC_JPEG_MAX_TABLE_INDEX = 3, + + /// Sample factor 1. + WIC_JPEG_SAMPLE_FACTORS_ONE = 0x11, + + /// Sample factor 4:2:0. + WIC_JPEG_SAMPLE_FACTORS_THREE_420 = 0x111122, + + /// Sample factor 4:2:2. + WIC_JPEG_SAMPLE_FACTORS_THREE_422 = 0x111121, + + /// Sample factor 4:4:0. + WIC_JPEG_SAMPLE_FACTORS_THREE_440 = 0x111112, + + /// Sample factor 4:4:4. + WIC_JPEG_SAMPLE_FACTORS_THREE_444 = 0x111111, + + /// Quantization indices use baseline 1. + WIC_JPEG_QUANTIZATION_BASELINE_ONE = 0, + + /// Quantization indices use baseline 3. + WIC_JPEG_QUANTIZATION_BASELINE_THREE = 0x10100, + + /// Huffman indices use baseline 1. + WIC_JPEG_HUFFMAN_BASELINE_ONE = 0, + + /// Huffman indices use baseline 3. + WIC_JPEG_HUFFMAN_BASELINE_THREE = 0x111100, + } + + /// Specifies the options for indexing a JPEG image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegindexingoptions typedef enum + // WICJpegIndexingOptions { WICJpegIndexingOptionsGenerateOnDemand, WICJpegIndexingOptionsGenerateOnLoad, + // WICJpegIndexingOptions_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "AFA9CC1B-847A-4237-9942-EC721FA86E4E")] + public enum WICJpegIndexingOptions + { + /// Index generation is deferred until IWICBitmapSource::CopyPixels is called on the image. + WICJpegIndexingOptionsGenerateOnDemand, + + /// Index generation is performed when the when the image is initially loaded. + WICJpegIndexingOptionsGenerateOnLoad, + + /// + /// Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to + /// compile to a size other than 32 bits. This value is not used. + /// + WICJpegIndexingOptions_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the JPEG luminance table property. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegluminanceproperties typedef enum + // WICJpegLuminanceProperties { WICJpegLuminanceTable, WICJpegLuminanceProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "391e96a3-372e-43b9-a752-0234d0fd37e1")] + public enum WICJpegLuminanceProperties + { + /// [VT_UI2|VT_VECTOR] Indicates the metadata property is a luminance table. + WICJpegLuminanceTable = 1, + + /// + WICJpegLuminanceProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the memory layout of pixel data in a JPEG image scan. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegscantype typedef enum WICJpegScanType { + // WICJpegScanTypeInterleaved, WICJpegScanTypePlanarComponents, WICJpegScanTypeProgressive, WICJpegScanType_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "DC8B42F0-66D3-4425-9AA8-6B8F0D9B8568")] + public enum WICJpegScanType + { + /// The pixel data is stored in an interleaved memory layout. + WICJpegScanTypeInterleaved, + + /// The pixel data is stored in a planar memory layout. + WICJpegScanTypePlanarComponents, + + /// The pixel data is stored in a progressive layout. + WICJpegScanTypeProgressive, + + /// + /// Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to + /// compile to a size other than 32 bits. This value is not used. + /// + WICJpegScanType_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies conversion matrix from Y'Cb'Cr' to R'G'B'. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegtransfermatrix typedef enum WICJpegTransferMatrix + // { WICJpegTransferMatrixIdentity, WICJpegTransferMatrixBT601, WICJpegTransferMatrix_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "393342C4-A906-4427-BEAA-842FF77C9E9D")] + public enum WICJpegTransferMatrix + { + /// Specifies the identity transfer matrix. + WICJpegTransferMatrixIdentity, + + /// Specifies the BT601 transfer matrix. + WICJpegTransferMatrixBT601, + + /// + /// Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to + /// compile to a size other than 32 bits. This value is not used. + /// + WICJpegTransferMatrix_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the JPEG YCrCB subsampling options. + /// The native JPEG encoder uses WICJpegYCrCbSubsampling420. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicjpegycrcbsubsamplingoption typedef enum + // WICJpegYCrCbSubsamplingOption { WICJpegYCrCbSubsamplingDefault, WICJpegYCrCbSubsampling420, WICJpegYCrCbSubsampling422, + // WICJpegYCrCbSubsampling444, WICJpegYCrCbSubsampling440, WICJPEGYCRCBSUBSAMPLING_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "6ff16a79-35c9-4230-8f1c-a5c40aecc09e")] + public enum WICJpegYCrCbSubsamplingOption + { + /// The default subsampling option. + WICJpegYCrCbSubsamplingDefault, + + /// Subsampling option that uses both horizontal and vertical decimation. + WICJpegYCrCbSubsampling420, + + /// Subsampling option that uses horizontal decimation . + WICJpegYCrCbSubsampling422, + + /// Subsampling option that uses no decimation. + WICJpegYCrCbSubsampling444, + + /// + /// Subsampling option that uses 2x vertical downsampling only. This option is only available in Windows 8.1 and later. + /// + WICJpegYCrCbSubsampling440, + + /// + WICJPEGYCRCBSUBSAMPLING_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies metadata creation options. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/ne-wincodecsdk-wicmetadatacreationoptions typedef enum + // WICMetadataCreationOptions { WICMetadataCreationDefault, WICMetadataCreationAllowUnknown, WICMetadataCreationFailUnknown, + // WICMetadataCreationMask } ; + [PInvokeData("wincodecsdk.h", MSDNShortId = "41fece55-1ce4-455a-99b5-5ff0ecd27e07")] + public enum WICMetadataCreationOptions + { + /// The default metadata creation options. The default value is WICMetadataCreationAllowUnknown. + WICMetadataCreationDefault, + + /// Allow unknown metadata creation. + WICMetadataCreationAllowUnknown, + + /// Fail on unknown metadata creation. + WICMetadataCreationFailUnknown, + + /// The WICMetadataCreationOptions mask. + WICMetadataCreationMask, + } + + /// Specifies named white balances for raw images. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicnamedwhitepoint typedef enum WICNamedWhitePoint { + // WICWhitePointDefault, WICWhitePointDaylight, WICWhitePointCloudy, WICWhitePointShade, WICWhitePointTungsten, + // WICWhitePointFluorescent, WICWhitePointFlash, WICWhitePointUnderwater, WICWhitePointCustom, WICWhitePointAutoWhiteBalance, + // WICWhitePointAsShot, WICNAMEDWHITEPOINT_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "e256a6d6-a035-47c3-a82c-d9aec284de17")] + [Flags] + public enum WICNamedWhitePoint + { + /// The default white balance. + WICWhitePointDefault = 0x1, + + /// A daylight white balance. + WICWhitePointDaylight = 0x2, + + /// A cloudy white balance. + WICWhitePointCloudy = 0x4, + + /// A shade white balance. + WICWhitePointShade = 0x8, + + /// A tungsten white balance. + WICWhitePointTungsten = 0x10, + + /// A fluorescent white balance. + WICWhitePointFluorescent = 0x20, + + /// Daylight white balance. + WICWhitePointFlash = 0x40, + + /// A flash white balance. + WICWhitePointUnderwater = 0x80, + + /// A custom white balance. This is typically used when using a picture (grey-card) as white balance. + WICWhitePointCustom = 0x100, + + /// An automatic balance. + WICWhitePointAutoWhiteBalance = 0x200, + + /// An "as shot" white balance. + WICWhitePointAsShot = WICWhitePointDefault, + + /// + WICNAMEDWHITEPOINT_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies Windows Imaging Component (WIC) options that are used when initializing a component with a stream. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/ne-wincodecsdk-wicpersistoptions typedef enum WICPersistOptions { + // WICPersistOptionDefault, WICPersistOptionLittleEndian, WICPersistOptionBigEndian, WICPersistOptionStrictFormat, + // WICPersistOptionNoCacheStream, WICPersistOptionPreferUTF8, WICPersistOptionMask } ; + [PInvokeData("wincodecsdk.h", MSDNShortId = "8c17cfcc-4f09-4cb5-a3fa-4eb865123ad6")] + public enum WICPersistOptions + { + /// The default persist options. The default is WICPersistOptionLittleEndian. + WICPersistOptionDefault, + + /// The data byte order is little endian. + WICPersistOptionLittleEndian, + + /// The data byte order is big endian. + WICPersistOptionBigEndian, + + /// The data format must strictly conform to the specification. + WICPersistOptionStrictFormat, + + /// + /// No cache for the metadata stream.Certain operations, such as IWICComponentFactory::CreateMetadataWriterFromReader require + /// that the reader have a stream. Therefore, these operations will be unavailable if the reader is initialized with WICPersistOptionNoCacheStream. + /// + WICPersistOptionNoCacheStream, + + /// Use UTF8 instead of the default UTF16. + WICPersistOptionPreferUTF8, + + /// The WICPersistOptions mask. + WICPersistOptionMask, + } + + /// Defines constants that specify a primitive type for numeric representation of a WIC pixel format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpixelformatnumericrepresentation typedef enum + // WICPixelFormatNumericRepresentation { WICPixelFormatNumericRepresentationUnspecified, WICPixelFormatNumericRepresentationIndexed, + // WICPixelFormatNumericRepresentationUnsignedInteger, WICPixelFormatNumericRepresentationSignedInteger, + // WICPixelFormatNumericRepresentationFixed, WICPixelFormatNumericRepresentationFloat, + // WICPixelFormatNumericRepresentation_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "10f32ac9-4b0d-4d21-b54a-657513fbd142")] + public enum WICPixelFormatNumericRepresentation + { + /// The format is not specified. + WICPixelFormatNumericRepresentationUnspecified, + + /// Specifies that the format is indexed. + WICPixelFormatNumericRepresentationIndexed, + + /// Specifies that the format is represented as an unsigned integer. + WICPixelFormatNumericRepresentationUnsignedInteger, + + /// Specifies that the format is represented as a signed integer. + WICPixelFormatNumericRepresentationSignedInteger, + + /// Specifies that the format is represented as a fixed-point number. + WICPixelFormatNumericRepresentationFixed, + + /// Specifies that the format is represented as a floating-point number. + WICPixelFormatNumericRepresentationFloat, + + /// This constant contains the maximum DWORD value. + WICPixelFormatNumericRepresentation_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies additional options to an IWICPlanarBitmapSourceTransform implementation. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicplanaroptions typedef enum WICPlanarOptions { + // WICPlanarOptionsDefault, WICPlanarOptionsPreserveSubsampling, WICPLANAROPTIONS_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "8B7F34AA-77A0-428D-800E-31AB43067102")] + public enum WICPlanarOptions + { + /// + /// No options specified. WIC JPEG Decoder: The default behavior for iDCT scaling is to preserve quality when downscaling by + /// downscaling only the Y plane in some cases, and the image may change to 4:4:4 chroma subsampling. + /// + WICPlanarOptionsDefault, + + /// + /// Asks the source to preserve the size ratio between planes when scaling.WIC JPEG Decoder: Specifying this option causes the + /// JPEG decoder to scale luma and chroma planes by the same amount, so a 4:2:0 chroma subsampled image outputs 4:2:0 data when + /// downscaling by 2x, 4x, or 8x. + /// + WICPlanarOptionsPreserveSubsampling, + + /// + WICPLANAROPTIONS_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) background (bKGD) chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngbkgdproperties typedef enum WICPngBkgdProperties { + // WICPngBkgdBackgroundColor, WICPngBkgdProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "979f6a91-79a2-4eba-8957-e2908636cdc5")] + public enum WICPngBkgdProperties + { + /// + /// Indicates the background color. There are three possible types, depending on the image's pixel format.#### VT_UI1Specifies + /// the index of the background color in an image with an indexed pixel format.#### VT_UI2Specifies the background color in a + /// grayscale image.#### VT_VECTOR + /// + WICPngBkgdBackgroundColor = 1, + + /// + WICPngBkgdProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) cHRM chunk metadata properties for CIE XYZ chromaticity. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngchrmproperties typedef enum WICPngChrmProperties { + // WICPngChrmWhitePointX, WICPngChrmWhitePointY, WICPngChrmRedX, WICPngChrmRedY, WICPngChrmGreenX, WICPngChrmGreenY, + // WICPngChrmBlueX, WICPngChrmBlueY, WICPngChrmProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "e4dede53-4c34-4e37-addf-28f51164717f")] + public enum WICPngChrmProperties + { + /// [VT_UI4] Indicates the whitepoint x value ratio. + WICPngChrmWhitePointX = 1, + + /// [VT_UI4] Indicates the whitepoint y value ratio. + WICPngChrmWhitePointY, + + /// [VT_UI4] Indicates the red x value ratio. + WICPngChrmRedX, + + /// [VT_UI4] Indicates the red y value ratio. + WICPngChrmRedY, + + /// [VT_UI4] Indicates the green x value ratio. + WICPngChrmGreenX, + + /// [VT_UI4] Indicates the green y value ratio. + WICPngChrmGreenY, + + /// [VT_UI4] Indicates the blue x value ratio. + WICPngChrmBlueX, + + /// [VT_UI4] Indicates the blue y value ratio. + WICPngChrmBlueY, + + /// + WICPngChrmProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) filters available for compression optimization. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngfilteroption typedef enum WICPngFilterOption { + // WICPngFilterUnspecified, WICPngFilterNone, WICPngFilterSub, WICPngFilterUp, WICPngFilterAverage, WICPngFilterPaeth, + // WICPngFilterAdaptive, WICPNGFILTEROPTION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "468033cf-62e8-4aef-b34f-c833df048115")] + public enum WICPngFilterOption + { + /// + /// Indicates an unspecified PNG filter. This enables WIC to algorithmically choose the best filtering option for the image. + /// + WICPngFilterUnspecified, + + /// Indicates no PNG filter. + WICPngFilterNone, + + /// Indicates a PNG sub filter. + WICPngFilterSub, + + /// Indicates a PNG up filter. + WICPngFilterUp, + + /// Indicates a PNG average filter. + WICPngFilterAverage, + + /// Indicates a PNG paeth filter. + WICPngFilterPaeth, + + /// Indicates a PNG adaptive filter. This enables WIC to choose the best filtering mode on a per-scanline basis. + WICPngFilterAdaptive, + + /// + WICPNGFILTEROPTION_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) gAMA chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpnggamaproperties typedef enum WICPngGamaProperties { + // WICPngGamaGamma, WICPngGamaProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "c70a3507-d598-4e33-872b-353389b19351")] + public enum WICPngGamaProperties + { + /// [VT_UI4] Indicates the gamma value. + WICPngGamaGamma = 1, + + /// + WICPngGamaProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) hIST chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpnghistproperties typedef enum WICPngHistProperties { + // WICPngHistFrequencies, WICPngHistProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "ab3ddddb-5916-43b8-8688-5361cee05902")] + public enum WICPngHistProperties + { + /// [VT_VECTOR + WICPngHistFrequencies = 1, + + /// + WICPngHistProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) iCCP chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngiccpproperties typedef enum WICPngIccpProperties { + // WICPngIccpProfileName, WICPngIccpProfileData, WICPngIccpProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "2c28a4f1-40c2-4886-be5f-0a2e6feb487a")] + public enum WICPngIccpProperties + { + /// [VT_LPSTR] Indicates the International Color Consortium (ICC) profile name. + WICPngIccpProfileName = 1, + + /// [VT_VECTOR + WICPngIccpProfileData, + + /// + WICPngIccpProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) iTXT chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngitxtproperties typedef enum WICPngItxtProperties { + // WICPngItxtKeyword, WICPngItxtCompressionFlag, WICPngItxtLanguageTag, WICPngItxtTranslatedKeyword, WICPngItxtText, + // WICPngItxtProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "905d37e2-39f3-4990-b737-f9194f798d83")] + public enum WICPngItxtProperties + { + /// [VT_LPSTR] Indicates the keywords in the iTXT metadata chunk. + WICPngItxtKeyword = 1, + + /// + /// [VT_UI1] Indicates whether the text in the iTXT chunk is compressed. 1 if the text is compressed; otherwise, 0. + /// + WICPngItxtCompressionFlag, + + /// [VT_LPSTR] Indicates the human language used by the translated keyword and the text. + WICPngItxtLanguageTag, + + /// [VT_LPWSTR] Indicates a translation of the keyword into the language indicated by the language tag. + WICPngItxtTranslatedKeyword, + + /// [VT_LPWSTR] Indicates additional text in the iTXT metadata chunk. + WICPngItxtText, + + /// + WICPngItxtProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) sRGB chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngsrgbproperties typedef enum WICPngSrgbProperties { + // WICPngSrgbRenderingIntent, WICPngSrgbProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "ec9bbdb7-9ce2-44bd-bd84-842394ce4c5f")] + public enum WICPngSrgbProperties + { + /// + /// [VT_UI1] Indicates the rendering intent for an sRGB color space image. The rendering intents have the following meaning. + /// + WICPngSrgbRenderingIntent = 1, + + /// + WICPngSrgbProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Portable Network Graphics (PNG) tIME chunk metadata properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicpngtimeproperties typedef enum WICPngTimeProperties { + // WICPngTimeYear, WICPngTimeMonth, WICPngTimeDay, WICPngTimeHour, WICPngTimeMinute, WICPngTimeSecond, + // WICPngTimeProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "202dc399-0173-4995-af74-09ee71e1dcf1")] + public enum WICPngTimeProperties + { + /// [VT_UI2] Indicates the year of the last modification. + WICPngTimeYear = 1, + + /// [VT_UI1] Indicates the month of the last modification. + WICPngTimeMonth, + + /// [VT_UI1] Indicates day of the last modification. + WICPngTimeDay, + + /// [VT_UI1] Indicates the hour of the last modification. + WICPngTimeHour, + + /// [VT_UI1] Indicates the minute of the last modification. + WICPngTimeMinute, + + /// [VT_UI1] Indicates the second of the last modification. + WICPngTimeSecond, + + /// + WICPngTimeProperties_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies when the progress notification callback should be called. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicprogressnotification typedef enum + // WICProgressNotification { WICProgressNotificationBegin, WICProgressNotificationEnd, WICProgressNotificationFrequent, + // WICProgressNotificationAll, WICPROGRESSNOTIFICATION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "6d7ef6f1-2024-4de5-9c2e-8edc6359f79b")] + [Flags] + public enum WICProgressNotification : uint + { + /// The callback should be called when codec operations begin. + WICProgressNotificationBegin = 0x10000, + + /// The callback should be called when codec operations end. + WICProgressNotificationEnd = 0x20000, + + /// The callback should be called frequently to report status. + WICProgressNotificationFrequent = 0x40000, + + /// The callback should be called on all available progress notifications. + WICProgressNotificationAll = 0xffff0000, + + /// + WICPROGRESSNOTIFICATION_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the progress operations to receive notifications for. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicprogressoperation typedef enum WICProgressOperation { + // WICProgressOperationCopyPixels, WICProgressOperationWritePixels, WICProgressOperationAll, WICPROGRESSOPERATION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "407b982d-7232-42ce-9ff5-7029b7d922a4")] + [Flags] + public enum WICProgressOperation + { + /// Receive copy pixel operation. + WICProgressOperationCopyPixels = 0x1, + + /// Receive write pixel operation. + WICProgressOperationWritePixels = 0x2, + + /// Receive all progress operations available. + WICProgressOperationAll = 0xffff, + + /// + WICPROGRESSOPERATION_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the capability support of a raw image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicrawcapabilities typedef enum WICRawCapabilities { + // WICRawCapabilityNotSupported, WICRawCapabilityGetSupported, WICRawCapabilityFullySupported, WICRAWCAPABILITIES_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "a82edbbe-a069-4ba8-ba15-524830cdf330")] + public enum WICRawCapabilities + { + /// The capability is not supported. + WICRawCapabilityNotSupported, + + /// The capability supports only get operations. + WICRawCapabilityGetSupported, + + /// The capability supports get and set operations. + WICRawCapabilityFullySupported, + + /// + WICRAWCAPABILITIES_FORCE_DWORD = 0x7fffffff, + } + + /// Flags used to by IWICDevelopRawNotificationCallback to indicate which members have changed. + // https://docs.microsoft.com/en-us/windows/win32/wic/-wic-codec-iwicdeveloprawnotification-constants + [PInvokeData("wincodec.h", MSDNShortId = "4e94b4f4-abd9-4395-87ec-a08e49a2cf88")] + [Flags] + public enum WICRawChangeNotification + { + /// Mask used to report a exposure compensation change. + WICRawChangeNotification_ExposureCompensation = 0x00000001, + + /// Mask used to report a WICNamedWhitePoint change. + WICRawChangeNotification_NamedWhitePoint = 0x00000002, + + /// Mask used to report a kelvin white point change. + WICRawChangeNotification_KelvinWhitePoint = 0x00000004, + + /// Mask used to report a RGB white point change. + WICRawChangeNotification_RGBWhitePoint = 0x00000008, + + /// Mask used to report a contrast change. + WICRawChangeNotification_Contrast = 0x00000010, + + /// Mask used to report a gamma change. + WICRawChangeNotification_Gamma = 0x00000020, + + /// Mask used to report a sharpness change. + WICRawChangeNotification_Sharpness = 0x00000040, + + /// Mask used to report a saturation change. + WICRawChangeNotification_Saturation = 0x00000080, + + /// Mask used to report a tint change. + WICRawChangeNotification_Tint = 0x00000100, + + /// Mask used to report a noise reduction change. + WICRawChangeNotification_NoiseReduction = 0x00000200, + + /// Mask used to report a destination color context change. + WICRawChangeNotification_DestinationColorContext = 0x00000400, + + /// Mask used to report a tone curve change. + WICRawChangeNotification_ToneCurve = 0x00000800, + + /// Mask used to report a WICRawRotationCapabilities change. + WICRawChangeNotification_Rotation = 0x00001000, + + /// Mask used to report a WICRawRenderMode change. + WICRawChangeNotification_RenderMode = 0x00002000, + } + + /// Specifies the parameter set used by a raw codec. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicrawparameterset typedef enum WICRawParameterSet { + // WICAsShotParameterSet, WICUserAdjustedParameterSet, WICAutoAdjustedParameterSet, WICRAWPARAMETERSET_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "0c39b769-9523-42ce-942f-761e6d39ec5b")] + public enum WICRawParameterSet + { + /// An as shot parameter set. + WICAsShotParameterSet = 1, + + /// A user adjusted parameter set. + WICUserAdjustedParameterSet, + + /// A codec adjusted parameter set. + WICAutoAdjustedParameterSet, + + /// + WICRAWPARAMETERSET_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the render intent of the next CopyPixels call. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicrawrendermode typedef enum WICRawRenderMode { + // WICRawRenderModeDraft, WICRawRenderModeNormal, WICRawRenderModeBestQuality, WICRAWRENDERMODE_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "dc020c78-a018-42ee-a500-65a743b96107")] + public enum WICRawRenderMode + { + /// Use speed priority mode. + WICRawRenderModeDraft = 1, + + /// Use normal priority mode. Balance of speed and quality. + WICRawRenderModeNormal, + + /// Use best quality mode. + WICRawRenderModeBestQuality, + + /// + WICRAWRENDERMODE_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the rotation capabilities of the codec. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicrawrotationcapabilities typedef enum + // WICRawRotationCapabilities { WICRawRotationCapabilityNotSupported, WICRawRotationCapabilityGetSupported, + // WICRawRotationCapabilityNinetyDegreesSupported, WICRawRotationCapabilityFullySupported, WICRAWROTATIONCAPABILITIES_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "f6713652-7d38-4ac6-80d8-fd53095c50a2")] + public enum WICRawRotationCapabilities + { + /// Rotation is not supported. + WICRawRotationCapabilityNotSupported, + + /// Set operations for rotation is not supported. + WICRawRotationCapabilityGetSupported, + + /// 90 degree rotations are supported. + WICRawRotationCapabilityNinetyDegreesSupported, + + /// All rotation angles are supported. + WICRawRotationCapabilityFullySupported, + + /// + WICRAWROTATIONCAPABILITIES_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the access level of a Windows Graphics Device Interface (GDI) section. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicsectionaccesslevel typedef enum WICSectionAccessLevel + // { WICSectionAccessLevelRead, WICSectionAccessLevelReadWrite, WICSectionAccessLevel_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "4b08bc8c-d67c-4bc4-a701-2903a971a478")] + public enum WICSectionAccessLevel + { + /// Indicates a read only access level. + WICSectionAccessLevelRead = 1, + + /// Indicates a read/write access level. + WICSectionAccessLevelReadWrite = 3, + + /// + WICSectionAccessLevel_FORCE_DWORD = 0x7fffffff, + } + + /// Specifies the Tagged Image File Format (TIFF) compression options. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wictiffcompressionoption typedef enum + // WICTiffCompressionOption { WICTiffCompressionDontCare, WICTiffCompressionNone, WICTiffCompressionCCITT3, + // WICTiffCompressionCCITT4, WICTiffCompressionLZW, WICTiffCompressionRLE, WICTiffCompressionZIP, + // WICTiffCompressionLZWHDifferencing, WICTIFFCOMPRESSIONOPTION_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "787f6d71-6481-4236-8c3f-1b18bfb7ee88")] + public enum WICTiffCompressionOption + { + /// Indicates a suitable compression algorithm based on the image and pixel format. + WICTiffCompressionDontCare, + + /// Indicates no compression. + WICTiffCompressionNone, + + /// Indicates a CCITT3 compression algorithm. This algorithm is only valid for 1bpp pixel formats. + WICTiffCompressionCCITT3, + + /// Indicates a CCITT4 compression algorithm. This algorithm is only valid for 1bpp pixel formats. + WICTiffCompressionCCITT4, + + /// Indicates a LZW compression algorithm. + WICTiffCompressionLZW, + + /// Indicates a RLE compression algorithm. This algorithm is only valid for 1bpp pixel formats. + WICTiffCompressionRLE, + + /// Indicates a ZIP compression algorithm. + WICTiffCompressionZIP, + + /// Indicates an LZWH differencing algorithm. + WICTiffCompressionLZWHDifferencing, + + /// + WICTIFFCOMPRESSIONOPTION_FORCE_DWORD = 0x7fffffff, + } + + /// + /// + /// [Some information relates to pre-released product which may be substantially modified before it's commercially released. + /// Microsoft makes no warranties, express or implied, with respect to the information provided here.] + /// + /// Specifies the animation properties of a WebP image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicwebpanimproperties typedef enum WICWebpAnimProperties + // { WICWebpAnimLoopCount, WICWebpAnimProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "BECCBE42-5546-4243-A0B4-1240992D42DC")] + public enum WICWebpAnimProperties + { + /// The number of times the animation loops. A value of 0 indicates that the animation will loop infinitely. + WICWebpAnimLoopCount = 1, + + /// + WICWebpAnimProperties_FORCE_DWORD, + } + + /// + /// + /// [Some information relates to pre-released product which may be substantially modified before it's commercially released. + /// Microsoft makes no warranties, express or implied, with respect to the information provided here.] + /// + /// Specifies the animation frame properties of a WebP image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ne-wincodec-wicwebpanmfproperties typedef enum WICWebpAnmfProperties + // { WICWebpAnmfFrameDuration, WICWebpAnmfProperties_FORCE_DWORD } ; + [PInvokeData("wincodec.h", MSDNShortId = "41C771FD-29FB-431B-B905-37C6A59C0677")] + public enum WICWebpAnmfProperties + { + /// The time to wait before displaying the next frame, in milliseconds. + WICWebpAnmfFrameDuration = 1, + + /// + WICWebpAnmfProperties_FORCE_DWORD, + } + + /// This document includes GUIDs and class identifiers (CLSIDs) tables of Windows Imaging Component (WIC). + // https://docs.microsoft.com/en-us/windows/win32/wic/-wic-guids-clsids + [PInvokeData("wincodec.h", MSDNShortId = "2be5cfeb-2dd3-4486-b639-35ee28a7dd7b")] + public static class WICGuids + { +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + public static readonly Guid CATID_WICBitmapDecoders = new Guid(0x7ed96837, 0x96f0, 0x4812, 0xb2, 0x11, 0xf1, 0x3c, 0x24, 0x11, 0x7e, 0xd3); + public static readonly Guid CATID_WICBitmapEncoders = new Guid(0xac757296, 0x3522, 0x4e11, 0x98, 0x62, 0xc1, 0x7b, 0xe5, 0xa1, 0x76, 0x7e); + public static readonly Guid CATID_WICFormatConverters = new Guid(0x7835eae8, 0xbf14, 0x49d1, 0x93, 0xce, 0x53, 0x3a, 0x40, 0x7b, 0x22, 0x48); + public static readonly Guid CATID_WICMetadataReader = new Guid(0x05af94d8, 0x7174, 0x4cd2, 0xbe, 0x4a, 0x41, 0x24, 0xb8, 0x0e, 0xe4, 0xb8); + public static readonly Guid CATID_WICMetadataWriter = new Guid(0xabe3b9a4, 0x257d, 0x4b97, 0xbd, 0x1a, 0x29, 0x4a, 0xf4, 0x96, 0x22, 0x2e); + public static readonly Guid CATID_WICPixelFormats = new Guid(0x2b46e70f, 0xcda7, 0x473e, 0x89, 0xf6, 0xdc, 0x96, 0x30, 0xa2, 0x39, 0x0b); + public static readonly Guid CLSID_WICAdngDecoder = new Guid(0x981d9411, 0x909e, 0x42a7, 0x8f, 0x5d, 0xa7, 0x47, 0xff, 0x05, 0x2e, 0xdb); + public static readonly Guid CLSID_WICBmpDecoder = new Guid(0x6b462062, 0x7cbf, 0x400d, 0x9f, 0xdb, 0x81, 0x3d, 0xd1, 0x0f, 0x27, 0x78); + public static readonly Guid CLSID_WICBmpEncoder = new Guid(0x69be8bb4, 0xd66d, 0x47c8, 0x86, 0x5a, 0xed, 0x15, 0x89, 0x43, 0x37, 0x82); + public static readonly Guid CLSID_WICDdsDecoder = new Guid(0x9053699f, 0xa341, 0x429d, 0x9e, 0x90, 0xee, 0x43, 0x7c, 0xf8, 0x0c, 0x73); + public static readonly Guid CLSID_WICDdsEncoder = new Guid(0xa61dde94, 0x66ce, 0x4ac1, 0x88, 0x1b, 0x71, 0x68, 0x05, 0x88, 0x89, 0x5e); + public static readonly Guid CLSID_WICDefaultFormatConverter = new Guid(0x1a3f11dc, 0xb514, 0x4b17, 0x8c, 0x5f, 0x21, 0x54, 0x51, 0x38, 0x52, 0xf1); + public static readonly Guid CLSID_WICFormatConverterHighColor = new Guid(0xac75d454, 0x9f37, 0x48f8, 0xb9, 0x72, 0x4e, 0x19, 0xbc, 0x85, 0x60, 0x11); + public static readonly Guid CLSID_WICFormatConverterNChannel = new Guid(0xc17cabb2, 0xd4a3, 0x47d7, 0xa5, 0x57, 0x33, 0x9b, 0x2e, 0xfb, 0xd4, 0xf1); + public static readonly Guid CLSID_WICFormatConverterWMPhoto = new Guid(0x9cb5172b, 0xd600, 0x46ba, 0xab, 0x77, 0x77, 0xbb, 0x7e, 0x3a, 0x00, 0xd9); + public static readonly Guid CLSID_WICGifDecoder = new Guid(0x381dda3c, 0x9ce9, 0x4834, 0xa2, 0x3e, 0x1f, 0x98, 0xf8, 0xfc, 0x52, 0xbe); + public static readonly Guid CLSID_WICGifEncoder = new Guid(0x114f5598, 0x0b22, 0x40a0, 0x86, 0xa1, 0xc8, 0x3e, 0xa4, 0x95, 0xad, 0xbd); + public static readonly Guid CLSID_WICHeifDecoder = new Guid(0xe9A4A80a, 0x44fe, 0x4DE4, 0x89, 0x71, 0x71, 0x50, 0XB1, 0X0a, 0X51, 0X99); + public static readonly Guid CLSID_WICHeifEncoder = new Guid(0x0dbecec1, 0x9eb3, 0x4860, 0x9c, 0x6f, 0xdd, 0xbe, 0x86, 0x63, 0x45, 0x75); + public static readonly Guid CLSID_WICIcoDecoder = new Guid(0xc61bfcdf, 0x2e0f, 0x4aad, 0xa8, 0xd7, 0xe0, 0x6b, 0xaf, 0xeb, 0xcd, 0xfe); + public static readonly Guid CLSID_WICImagingCategories = new Guid(0xfae3d380, 0xfea4, 0x4623, 0x8c, 0x75, 0xc6, 0xb6, 0x11, 0x10, 0xb6, 0x81); + public static readonly Guid CLSID_WICImagingFactory = new Guid(0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa); + public static readonly Guid CLSID_WICImagingFactory1 = new Guid(0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa); + public static readonly Guid CLSID_WICImagingFactory2 = new Guid(0x317d06e8, 0x5f24, 0x433d, 0xbd, 0xf7, 0x79, 0xce, 0x68, 0xd8, 0xab, 0xc2); + public static readonly Guid CLSID_WICJpegDecoder = new Guid(0x9456a480, 0xe88b, 0x43ea, 0x9e, 0x73, 0x0b, 0x2d, 0x9b, 0x71, 0xb1, 0xca); + public static readonly Guid CLSID_WICJpegEncoder = new Guid(0x1a34f5c1, 0x4a5a, 0x46dc, 0xb6, 0x44, 0x1f, 0x45, 0x67, 0xe7, 0xa6, 0x76); + public static readonly Guid CLSID_WICJpegQualcommPhoneEncoder = new Guid(0x68ed5c62, 0xf534, 0x4979, 0xb2, 0xb3, 0x68, 0x6a, 0x12, 0xb2, 0xb3, 0x4c); + public static readonly Guid CLSID_WICPlanarFormatConverter = new Guid(0x184132b8, 0x32f8, 0x4784, 0x91, 0x31, 0xdd, 0x72, 0x24, 0xb2, 0x34, 0x38); + public static readonly Guid CLSID_WICPngDecoder = new Guid(0x389ea17b, 0x5078, 0x4cde, 0xb6, 0xef, 0x25, 0xc1, 0x51, 0x75, 0xc7, 0x51); + public static readonly Guid CLSID_WICPngDecoder1 = new Guid(0x389ea17b, 0x5078, 0x4cde, 0xb6, 0xef, 0x25, 0xc1, 0x51, 0x75, 0xc7, 0x51); + public static readonly Guid CLSID_WICPngDecoder2 = new Guid(0xe018945b, 0xaa86, 0x4008, 0x9b, 0xd4, 0x67, 0x77, 0xa1, 0xe4, 0x0c, 0x11); + public static readonly Guid CLSID_WICPngEncoder = new Guid(0x27949969, 0x876a, 0x41d7, 0x94, 0x47, 0x56, 0x8f, 0x6a, 0x35, 0xa4, 0xdc); + public static readonly Guid CLSID_WICRAWDecoder = new Guid(0x41945702, 0x8302, 0x44A6, 0x94, 0x45, 0xAC, 0x98, 0xE8, 0xAF, 0xA0, 0x86); + public static readonly Guid CLSID_WICTiffDecoder = new Guid(0xb54e85d9, 0xfe23, 0x499f, 0x8b, 0x88, 0x6a, 0xce, 0xa7, 0x13, 0x75, 0x2b); + public static readonly Guid CLSID_WICTiffEncoder = new Guid(0x0131be10, 0x2001, 0x4c5f, 0xa9, 0xb0, 0xcc, 0x88, 0xfa, 0xb6, 0x4c, 0xe8); + public static readonly Guid CLSID_WICWebpDecoder = new Guid(0x7693E886, 0x51C9, 0x4070, 0x84, 0x19, 0x9F, 0x70, 0X73, 0X8E, 0XC8, 0XFA); + public static readonly Guid CLSID_WICWmpDecoder = new Guid(0xa26cec36, 0x234c, 0x4950, 0xae, 0x16, 0xe3, 0x4a, 0xac, 0xe7, 0x1d, 0x0d); + public static readonly Guid CLSID_WICWmpEncoder = new Guid(0xac4ce3cb, 0xe1c1, 0x44cd, 0x82, 0x15, 0x5a, 0x16, 0x65, 0x50, 0x9e, 0xc2); + public static readonly Guid GUID_ContainerFormatAdng = new Guid(0xf3ff6d0d, 0x38c0, 0x41c4, 0xb1, 0xfe, 0x1f, 0x38, 0x24, 0xf1, 0x7b, 0x84); + public static readonly Guid GUID_ContainerFormatBmp = new Guid(0x0af1d87e, 0xfcfe, 0x4188, 0xbd, 0xeb, 0xa7, 0x90, 0x64, 0x71, 0xcb, 0xe3); + public static readonly Guid GUID_ContainerFormatDds = new Guid(0x9967cb95, 0x2e85, 0x4ac8, 0x8c, 0xa2, 0x83, 0xd7, 0xcc, 0xd4, 0x25, 0xc9); + public static readonly Guid GUID_ContainerFormatGif = new Guid(0x1f8a5601, 0x7d4d, 0x4cbd, 0x9c, 0x82, 0x1b, 0xc8, 0xd4, 0xee, 0xb9, 0xa5); + public static readonly Guid GUID_ContainerFormatHeif = new Guid(0xe1e62521, 0x6787, 0x405b, 0xa3, 0x39, 0x50, 0x07, 0x15, 0xb5, 0x76, 0x3f); + public static readonly Guid GUID_ContainerFormatIco = new Guid(0xa3a860c4, 0x338f, 0x4c17, 0x91, 0x9a, 0xfb, 0xa4, 0xb5, 0x62, 0x8f, 0x21); + public static readonly Guid GUID_ContainerFormatJpeg = new Guid(0x19e4a5aa, 0x5662, 0x4fc5, 0xa0, 0xc0, 0x17, 0x58, 0x02, 0x8e, 0x10, 0x57); + public static readonly Guid GUID_ContainerFormatPng = new Guid(0x1b7cfaf4, 0x713f, 0x473c, 0xbb, 0xcd, 0x61, 0x37, 0x42, 0x5f, 0xae, 0xaf); + public static readonly Guid GUID_ContainerFormatRaw = new Guid(0xfe99ce60, 0xf19c, 0x433c, 0xa3, 0xae, 0x00, 0xac, 0xef, 0xa9, 0xca, 0x21); + public static readonly Guid GUID_ContainerFormatTiff = new Guid(0x163bcc30, 0xe2e9, 0x4f0b, 0x96, 0x1d, 0xa3, 0xe9, 0xfd, 0xb7, 0x88, 0xa3); + public static readonly Guid GUID_ContainerFormatWebp = new Guid(0xe094b0e2, 0x67f2, 0x45b3, 0xb0, 0xea, 0x11, 0x53, 0x37, 0xca, 0x7c, 0xf3); + public static readonly Guid GUID_ContainerFormatWmp = new Guid(0x57a37caa, 0x367a, 0x4540, 0x91, 0x6b, 0xf1, 0x83, 0xc5, 0x09, 0x3a, 0x4b); + public static readonly Guid GUID_VendorMicrosoft = new Guid(0xf0e749ca, 0xedef, 0x4589, 0xa7, 0x3a, 0xee, 0xe, 0x62, 0x6a, 0x2a, 0x2b); + public static readonly Guid GUID_VendorMicrosoftBuiltIn = new Guid(0x257a30fd, 0x6b6, 0x462b, 0xae, 0xa4, 0x63, 0xf7, 0xb, 0x86, 0xe5, 0x33); + public static readonly Guid GUID_WICPixelFormat112bpp6ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x37); + public static readonly Guid GUID_WICPixelFormat112bpp7Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2a); + public static readonly Guid GUID_WICPixelFormat128bpp7ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x38); + public static readonly Guid GUID_WICPixelFormat128bpp8Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2b); + public static readonly Guid GUID_WICPixelFormat128bppPRGBAFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1a); + public static readonly Guid GUID_WICPixelFormat128bppRGBAFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1e); + public static readonly Guid GUID_WICPixelFormat128bppRGBAFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x19); + public static readonly Guid GUID_WICPixelFormat128bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x41); + public static readonly Guid GUID_WICPixelFormat128bppRGBFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1b); + public static readonly Guid GUID_WICPixelFormat144bpp8ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x39); + public static readonly Guid GUID_WICPixelFormat16bppBGR555 = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x09); + public static readonly Guid GUID_WICPixelFormat16bppBGR565 = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0a); + public static readonly Guid GUID_WICPixelFormat16bppBGRA5551 = new Guid(0x05ec7c2b, 0xf1e6, 0x4961, 0xad, 0x46, 0xe1, 0xcc, 0x81, 0x0a, 0x87, 0xd2); + public static readonly Guid GUID_WICPixelFormat16bppCbCr = new Guid(0xFF95BA6E, 0x11E0, 0x4263, 0xBB, 0x45, 0x01, 0x72, 0x1F, 0x34, 0x60, 0xA4); + public static readonly Guid GUID_WICPixelFormat16bppCbQuantizedDctCoefficients = new Guid(0xD2C4FF61, 0x56A5, 0x49C2, 0x8B, 0x5C, 0x4C, 0x19, 0x25, 0x96, 0x48, 0x37); + public static readonly Guid GUID_WICPixelFormat16bppCrQuantizedDctCoefficients = new Guid(0x2FE354F0, 0x1680, 0x42D8, 0x92, 0x31, 0xE7, 0x3C, 0x05, 0x65, 0xBF, 0xC1); + public static readonly Guid GUID_WICPixelFormat16bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0b); + public static readonly Guid GUID_WICPixelFormat16bppGrayFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x13); + public static readonly Guid GUID_WICPixelFormat16bppGrayHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3e); + public static readonly Guid GUID_WICPixelFormat16bppYQuantizedDctCoefficients = new Guid(0xA355F433, 0x48E8, 0x4A42, 0x84, 0xD8, 0xE2, 0xAA, 0x26, 0xCA, 0x80, 0xA4); + public static readonly Guid GUID_WICPixelFormat1bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x01); + public static readonly Guid GUID_WICPixelFormat24bpp3Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x20); + public static readonly Guid GUID_WICPixelFormat24bppBGR = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0c); + public static readonly Guid GUID_WICPixelFormat24bppRGB = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0d); + public static readonly Guid GUID_WICPixelFormat2bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x06); + public static readonly Guid GUID_WICPixelFormat2bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x02); + public static readonly Guid GUID_WICPixelFormat32bpp3ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2e); + public static readonly Guid GUID_WICPixelFormat32bpp4Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x21); + public static readonly Guid GUID_WICPixelFormat32bppBGR = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0e); + public static readonly Guid GUID_WICPixelFormat32bppBGR101010 = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x14); + public static readonly Guid GUID_WICPixelFormat32bppBGRA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0f); + public static readonly Guid GUID_WICPixelFormat32bppCMYK = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1c); + public static readonly Guid GUID_WICPixelFormat32bppGrayFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3f); + public static readonly Guid GUID_WICPixelFormat32bppGrayFloat = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x11); + public static readonly Guid GUID_WICPixelFormat32bppPBGRA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x10); + public static readonly Guid GUID_WICPixelFormat32bppPRGBA = new Guid(0x3cc4a650, 0xa527, 0x4d37, 0xa9, 0x16, 0x31, 0x42, 0xc7, 0xeb, 0xed, 0xba); + public static readonly Guid GUID_WICPixelFormat32bppR10G10B10A2 = new Guid(0x604e1bb5, 0x8a3c, 0x4b65, 0xb1, 0x1c, 0xbc, 0x0b, 0x8d, 0xd7, 0x5b, 0x7f); + public static readonly Guid GUID_WICPixelFormat32bppR10G10B10A2HDR10 = new Guid(0x9c215c5d, 0x1acc, 0x4f0e, 0xa4, 0xbc, 0x70, 0xfb, 0x3a, 0xe8, 0xfd, 0x28); + public static readonly Guid GUID_WICPixelFormat32bppRGB = new Guid(0xd98c6b95, 0x3efe, 0x47d6, 0xbb, 0x25, 0xeb, 0x17, 0x48, 0xab, 0x0c, 0xf1); + public static readonly Guid GUID_WICPixelFormat32bppRGBA = new Guid(0xf5c7ad2d, 0x6a8d, 0x43dd, 0xa7, 0xa8, 0xa2, 0x99, 0x35, 0x26, 0x1a, 0xe9); + public static readonly Guid GUID_WICPixelFormat32bppRGBA1010102 = new Guid(0x25238D72, 0xFCF9, 0x4522, 0xb5, 0x14, 0x55, 0x78, 0xe5, 0xad, 0x55, 0xe0); + public static readonly Guid GUID_WICPixelFormat32bppRGBA1010102XR = new Guid(0x00DE6B9A, 0xC101, 0x434b, 0xb5, 0x02, 0xd0, 0x16, 0x5e, 0xe1, 0x12, 0x2c); + public static readonly Guid GUID_WICPixelFormat32bppRGBE = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3d); + public static readonly Guid GUID_WICPixelFormat40bpp4ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2f); + public static readonly Guid GUID_WICPixelFormat40bpp5Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x22); + public static readonly Guid GUID_WICPixelFormat40bppCMYKAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2c); + public static readonly Guid GUID_WICPixelFormat48bpp3Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x26); + public static readonly Guid GUID_WICPixelFormat48bpp5ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x30); + public static readonly Guid GUID_WICPixelFormat48bpp6Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x23); + public static readonly Guid GUID_WICPixelFormat48bppBGR = new Guid(0xe605a384, 0xb468, 0x46ce, 0xbb, 0x2e, 0x36, 0xf1, 0x80, 0xe6, 0x43, 0x13); + public static readonly Guid GUID_WICPixelFormat48bppBGRFixedPoint = new Guid(0x49ca140e, 0xcab6, 0x493b, 0x9d, 0xdf, 0x60, 0x18, 0x7c, 0x37, 0x53, 0x2a); + public static readonly Guid GUID_WICPixelFormat48bppRGB = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x15); + public static readonly Guid GUID_WICPixelFormat48bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x12); + public static readonly Guid GUID_WICPixelFormat48bppRGBHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3b); + public static readonly Guid GUID_WICPixelFormat4bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x07); + public static readonly Guid GUID_WICPixelFormat4bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x03); + public static readonly Guid GUID_WICPixelFormat56bpp6ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x31); + public static readonly Guid GUID_WICPixelFormat56bpp7Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x24); + public static readonly Guid GUID_WICPixelFormat64bpp3ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x34); + public static readonly Guid GUID_WICPixelFormat64bpp4Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x27); + public static readonly Guid GUID_WICPixelFormat64bpp7ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x32); + public static readonly Guid GUID_WICPixelFormat64bpp8Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x25); + public static readonly Guid GUID_WICPixelFormat64bppBGRA = new Guid(0x1562ff7c, 0xd352, 0x46f9, 0x97, 0x9e, 0x42, 0x97, 0x6b, 0x79, 0x22, 0x46); + public static readonly Guid GUID_WICPixelFormat64bppBGRAFixedPoint = new Guid(0x356de33c, 0x54d2, 0x4a23, 0xbb, 0x4, 0x9b, 0x7b, 0xf9, 0xb1, 0xd4, 0x2d); + public static readonly Guid GUID_WICPixelFormat64bppCMYK = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1f); + public static readonly Guid GUID_WICPixelFormat64bppPBGRA = new Guid(0x8c518e8e, 0xa4ec, 0x468b, 0xae, 0x70, 0xc9, 0xa3, 0x5a, 0x9c, 0x55, 0x30); + public static readonly Guid GUID_WICPixelFormat64bppPRGBA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x17); + public static readonly Guid GUID_WICPixelFormat64bppPRGBAHalf = new Guid(0x58ad26c2, 0xc623, 0x4d9d, 0xb3, 0x20, 0x38, 0x7e, 0x49, 0xf8, 0xc4, 0x42); + public static readonly Guid GUID_WICPixelFormat64bppRGB = new Guid(0xa1182111, 0x186d, 0x4d42, 0xbc, 0x6a, 0x9c, 0x83, 0x03, 0xa8, 0xdf, 0xf9); + public static readonly Guid GUID_WICPixelFormat64bppRGBA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x16); + public static readonly Guid GUID_WICPixelFormat64bppRGBAFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1d); + public static readonly Guid GUID_WICPixelFormat64bppRGBAHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3a); + public static readonly Guid GUID_WICPixelFormat64bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x40); + public static readonly Guid GUID_WICPixelFormat64bppRGBHalf = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x42); + public static readonly Guid GUID_WICPixelFormat72bpp8ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x33); + public static readonly Guid GUID_WICPixelFormat80bpp4ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x35); + public static readonly Guid GUID_WICPixelFormat80bpp5Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x28); + public static readonly Guid GUID_WICPixelFormat80bppCMYKAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2d); + public static readonly Guid GUID_WICPixelFormat8bppAlpha = new Guid(0xe6cd0116, 0xeeba, 0x4161, 0xaa, 0x85, 0x27, 0xdd, 0x9f, 0xb3, 0xa8, 0x95); + public static readonly Guid GUID_WICPixelFormat8bppCb = new Guid(0x1339F224, 0x6BFE, 0x4C3E, 0x93, 0x02, 0xE4, 0xF3, 0xA6, 0xD0, 0xCA, 0x2A); + public static readonly Guid GUID_WICPixelFormat8bppCr = new Guid(0xB8145053, 0x2116, 0x49F0, 0x88, 0x35, 0xED, 0x84, 0x4B, 0x20, 0x5C, 0x51); + public static readonly Guid GUID_WICPixelFormat8bppGray = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x08); + public static readonly Guid GUID_WICPixelFormat8bppIndexed = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x04); + public static readonly Guid GUID_WICPixelFormat8bppY = new Guid(0x91B4DB54, 0x2DF9, 0x42F0, 0xB4, 0x49, 0x29, 0x09, 0xBB, 0x3D, 0xF8, 0x8E); + public static readonly Guid GUID_WICPixelFormat96bpp5ChannelsAlpha = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x36); + public static readonly Guid GUID_WICPixelFormat96bpp6Channels = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x29); + public static readonly Guid GUID_WICPixelFormat96bppRGBFixedPoint = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x18); + public static readonly Guid GUID_WICPixelFormat96bppRGBFloat = new Guid(0xe3fed78f, 0xe8db, 0x4acf, 0x84, 0xc1, 0xe9, 0x7f, 0x61, 0x36, 0xb3, 0x27); + public static readonly Guid GUID_WICPixelFormatBlackWhite = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x05); + public static readonly Guid GUID_WICPixelFormatDontCare = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x00); +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/WIC/WindowsCodecs.Funcs.cs b/PInvoke/Graphics/WIC/WindowsCodecs.Funcs.cs new file mode 100644 index 00000000..3637cf25 --- /dev/null +++ b/PInvoke/Graphics/WIC/WindowsCodecs.Funcs.cs @@ -0,0 +1,248 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Vanara.PInvoke +{ + /// Items from the WindowsCodecs.dll + public static partial class WindowsCodecs + { + /// Application defined callback function called when codec component progress is made. + /// + /// Type: LPVOID + /// Component data passed to the callback function. + /// + /// + /// Type: ULONG + /// The current frame number. + /// + /// + /// Type: WICProgressOperation + /// The current operation the component is in. + /// + /// + /// Type: double + /// The progress value. The range is 0.0 to 1.0. + /// + /// + /// Type: HRESULT + /// If this callback function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// An operation can be canceled by returning . + /// + /// To register your callback function, query the encoder or decoder for the IWICBitmapCodecProgressNotification interface and call RegisterProgressNotification. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nc-wincodec-pfnprogressnotification PFNProgressNotification + // Pfnprogressnotification; HRESULT Pfnprogressnotification( LPVOID pvData, ULONG uFrameNum, WICProgressOperation operation, double + // dblProgress ) {...} + [PInvokeData("wincodec.h", MSDNShortId = "10dd9fbe-abff-4fc9-a3a5-7c01ecc10a7f")] + public delegate HRESULT PFNProgressNotification([In] IntPtr pvData, uint uFrameNum, WICProgressOperation operation, double dblProgress); + + /// Obtains a IWICBitmapSource in the desired pixel format from a given IWICBitmapSource. + /// + /// Type: REFWICPixelFormatGUID + /// The pixel format to convert to. + /// + /// + /// Type: IWICBitmapSource* + /// The source bitmap. + /// + /// + /// Type: IWICBitmapSource** + /// A pointer to the null-initialized destination bitmap pointer. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// If the pISrc bitmap is already in the desired format, then pISrc is copied to the destination bitmap pointer and a reference is + /// added. If it is not in the desired format however, WICConvertBitmapSource will instantiate a dstFormat format converter + /// and initialize it with pISrc. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-wicconvertbitmapsource HRESULT WICConvertBitmapSource( + // REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst ); + [DllImport(Lib.Windowscodecs, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wincodec.h", MSDNShortId = "ea735296-1bfd-4175-b8c9-cb5a61ab4203")] + public static extern HRESULT WICConvertBitmapSource(in Guid dstFormat, [In] IWICBitmapSource pISrc, out IWICBitmapSource ppIDst); + + /// Returns a IWICBitmapSource that is backed by the pixels of a Windows Graphics Device Interface (GDI) section handle. + /// + /// Type: UINT + /// The width of the bitmap pixels. + /// + /// + /// Type: UINT + /// The height of the bitmap pixels. + /// + /// + /// Type: REFWICPixelFormatGUID + /// The pixel format of the bitmap. + /// + /// + /// Type: HANDLE + /// The section handle. This is a file mapping object handle returned by the CreateFileMapping function. + /// + /// + /// Type: UINT + /// The byte count of each scanline. + /// + /// + /// Type: UINT + /// The offset into the section. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives the bitmap. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// The WICCreateBitmapFromSection function calls the WICCreateBitmapFromSectionEx function with the desiredAccessLevel + /// parameter set to WICSectionAccessLevelRead. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-wiccreatebitmapfromsection HRESULT + // WICCreateBitmapFromSection( UINT width, UINT height, REFWICPixelFormatGUID pixelFormat, HANDLE hSection, UINT stride, UINT + // offset, IWICBitmap **ppIBitmap ); + [DllImport(Lib.Windowscodecs, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wincodec.h", MSDNShortId = "a14022a0-7af6-4c06-9afa-4709b81efc96")] + public static extern HRESULT WICCreateBitmapFromSection(uint width, uint height, in Guid pixelFormat, HSECTION hSection, uint stride, uint offset, out IWICBitmap ppIBitmap); + + /// Returns a IWICBitmapSource that is backed by the pixels of a Windows Graphics Device Interface (GDI) section handle. + /// + /// Type: UINT + /// The width of the bitmap pixels. + /// + /// + /// Type: UINT + /// The height of the bitmap pixels. + /// + /// + /// Type: REFWICPixelFormatGUID + /// The pixel format of the bitmap. + /// + /// + /// Type: HANDLE + /// The section handle. This is a file mapping object handle returned by the CreateFileMapping function. + /// + /// + /// Type: UINT + /// The byte count of each scanline. + /// + /// + /// Type: UINT + /// The offset into the section. + /// + /// + /// Type: WICSectionAccessLevel + /// The desired access level. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives the bitmap. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-wiccreatebitmapfromsectionex HRESULT + // WICCreateBitmapFromSectionEx( UINT width, UINT height, REFWICPixelFormatGUID pixelFormat, HANDLE hSection, UINT stride, UINT + // offset, WICSectionAccessLevel desiredAccessLevel, IWICBitmap **ppIBitmap ); + [DllImport(Lib.Windowscodecs, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wincodec.h", MSDNShortId = "0c9892a5-c136-41f6-8161-8077afe1a9da")] + public static extern HRESULT WICCreateBitmapFromSectionEx(uint width, uint height, in Guid pixelFormat, HSECTION hSection, uint stride, uint offset, WICSectionAccessLevel desiredAccessLevel, out IWICBitmap ppIBitmap); + + /// Obtains the short name associated with a given GUID. + /// + /// Type: REFGUID + /// The GUID to retrieve the short name for. + /// + /// + /// Type: UINT + /// The size of the wzName buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives the short name associated with the GUID. + /// + /// + /// Type: UINT* + /// The actual size needed to retrieve the entire short name associated with the GUID. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// Windows Imaging Component (WIC) short name mappings can be found within the following registry key: + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-wicmapguidtoshortname HRESULT WICMapGuidToShortName( + // REFGUID guid, UINT cchName, WCHAR *wzName, UINT *pcchActual ); + [DllImport(Lib.Windowscodecs, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wincodec.h", MSDNShortId = "ae1e4680-2c20-4a3e-b931-206d26f4d09c")] + public static extern HRESULT WICMapGuidToShortName(in Guid guid, uint cchName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzName, out uint pcchActual); + + /// Obtains the name associated with a given schema. + /// + /// Type: REFGUID + /// The metadata format GUID. + /// + /// + /// Type: LPWSTR + /// The URI string of the schema for which the name is to be retrieved. + /// + /// + /// Type: UINT + /// The size of the wzName buffer. + /// + /// + /// Type: WCHAR* + /// A pointer to a buffer that receives the schema's name. + /// To obtain the required buffer size, call WICMapSchemaToName with cchName set to 0 and wzName set to NULL. + /// + /// + /// Type: UINT + /// The actual buffer size needed to retrieve the entire schema name. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// You can extend the schema name mapping by adding to the following registry key: + /// HKEY_CLASSES_ROOTCLSID{FAE3D380-FEA4-4623-8C75-C6B61110B681}SchemasBB5ACC38-F216-4CEC-A6C5-5F6E739763A9... + /// For more information, see How to Write a WIC-Enabled Codec. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-wicmapschematoname HRESULT WICMapSchemaToName( REFGUID + // guidMetadataFormat, LPWSTR pwzSchema, UINT cchName, WCHAR *wzName, UINT *pcchActual ); + [DllImport(Lib.Windowscodecs, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wincodec.h", MSDNShortId = "6e71b75a-a542-459c-9935-b05f3ce39217")] + public static extern HRESULT WICMapSchemaToName(in Guid guidMetadataFormat, [MarshalAs(UnmanagedType.LPWStr)] string pwzSchema, uint cchName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzName, out uint pcchActual); + + /// Obtains the GUID associated with the given short name. + /// + /// Type: const WCHAR* + /// A pointer to the short name. + /// + /// + /// Type: GUID* + /// A pointer that receives the GUID associated with the given short name. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// You can extend the short name mapping by adding to the following registry key: + /// HKEY_CLASSES_ROOTCLSID{FAE3D380-FEA4-4623-8C75-C6B61110B681}Namespace... + /// For more information, see How to Write a WIC-Enabled Codec. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-wicmapshortnametoguid HRESULT WICMapShortNameToGuid( + // PCWSTR wzName, GUID *pguid ); + [DllImport(Lib.Windowscodecs, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wincodec.h", MSDNShortId = "ceefa802-7930-4b01-b1a2-6db530032e88")] + public static extern HRESULT WICMapShortNameToGuid([MarshalAs(UnmanagedType.LPWStr)] string wzName, out Guid pguid); + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/WIC/WindowsCodecs.Interfaces.cs b/PInvoke/Graphics/WIC/WindowsCodecs.Interfaces.cs new file mode 100644 index 00000000..1940c24d --- /dev/null +++ b/PInvoke/Graphics/WIC/WindowsCodecs.Interfaces.cs @@ -0,0 +1,5080 @@ +using System; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Text; +using Vanara.InteropServices; +using static Vanara.PInvoke.Ole32; +using static Vanara.PInvoke.OleAut32; + +namespace Vanara.PInvoke +{ + /// Items from the WindowsCodecs.dll + public static partial class WindowsCodecs + { + /// Defines methods that add the concept of writeability and static in-memory representations of bitmaps to IWICBitmapSource. + /// + /// + /// IWICBitmap inherits from IWICBitmapSource and therefore also inherits the CopyPixels method. When pixels need to be moved + /// to a new memory location, CopyPixels is often the most efficient. + /// + /// + /// Because of to the internal memory representation implied by the IWICBitmap, in-place modification and processing using + /// the Lock is more efficient than CopyPixels, usually reducing to a simple pointer access directly into the memory owned by the + /// bitmap rather than a as a copy. This is contrasted to procedural bitmaps which implement only CopyPixels because there is + /// no internal memory representation and one would need to be created on demand to satisfy a call to Lock. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmap + [PInvokeData("wincodec.h", MSDNShortId = "15dcc80d-ef58-453d-a57a-348ffc7ddc6b")] + [ComImport, Guid("00000121-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmap : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Provides access to a rectangular area of the bitmap. + /// + /// Type: const WICRect* + /// The rectangle to be accessed. + /// + /// + /// Type: DWORD + /// + /// The access mode you wish to obtain for the lock. This is a bitwise combination of WICBitmapLockFlags for read, write, or + /// read and write access. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapLockRead + /// The read access lock. + /// + /// + /// WICBitmapLockWrite + /// The write access lock. + /// + /// + /// + /// + /// Type: IWICBitmapLock** + /// A pointer that receives the locked memory location. + /// + /// + /// + /// Locks are exclusive for writing but can be shared for reading. You cannot call CopyPixels while the IWICBitmap is locked for + /// writing. Doing so will return an error, since locks are exclusive. + /// + /// Examples + /// In the following example, an IWICBitmap is created and the image data is cleared using an IWICBitmapLock. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmap-lock HRESULT Lock( const WICRect *prcLock, + // DWORD flags, IWICBitmapLock **ppILock ); + IWICBitmapLock Lock([In, Optional] PWICRect prcLock, WICBitmapLockFlags flags); + + /// Provides access for palette modifications. + /// + /// Type: IWICPalette* + /// The palette to use for conversion. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmap-setpalette HRESULT SetPalette( IWICPalette + // *pIPalette ); + void SetPalette(IWICPalette pIPalette); + + /// Changes the physical resolution of the image. + /// + /// Type: double + /// The horizontal resolution. + /// + /// + /// Type: double + /// The vertical resolution. + /// + /// + /// This method has no effect on the actual pixels or samples stored in the bitmap. Instead the interpretation of the sampling + /// rate is modified. This means that a 96 DPI image which is 96 pixels wide is one inch. If the physical resolution is modified + /// to 48 DPI, then the bitmap is considered to be 2 inches wide but has the same number of pixels. If the resolution is less + /// than REAL_EPSILON (1.192092896e-07F) the error code WINCODEC_ERR_INVALIDPARAMETER is returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmap-setresolution HRESULT SetResolution( + // double dpiX, double dpiY ); + void SetResolution(double dpiX, double dpiY); + } + + /// Exposes methods that produce a clipped version of the input bitmap for a specified rectangular region of interest. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapclipper + [PInvokeData("wincodec.h", MSDNShortId = "a21fb11f-8622-46d6-8612-875ac59d3fbf")] + [ComImport, Guid("E4FBCF03-223D-4e81-9333-D635556DD1B5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapClipper : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Initializes the bitmap clipper with the provided parameters. + /// + /// Type: IWICBitmapSource* + /// he input bitmap source. + /// + /// + /// Type: const WICRect* + /// The rectangle of the bitmap source to clip. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapclipper-initialize HRESULT Initialize( + // IWICBitmapSource *pISource, const WICRect *prc ); + void Initialize(IWICBitmapSource pISource, in WICRect prc); + } + + /// Exposes methods that provide information about a particular codec. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapcodecinfo + [PInvokeData("wincodec.h", MSDNShortId = "502a94bf-3ec4-44d2-b0de-9994f2f9861f")] + [ComImport, Guid("E87A44C4-B76E-4c47-8B09-298EB12A2714"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapCodecInfo : IWICComponentInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves the container GUID associated with the codec. + /// + /// Type: GUID* + /// Receives the container GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + Guid GetContainerFormat(); + + /// Retrieves the pixel formats the codec supports. + /// + /// Type: UINT + /// The size of the pguidPixelFormats array. Use 0 on first call to determine the needed array size. + /// + /// + /// Type: GUID* + /// Receives the supported pixel formats. Use on first call to determine needed array size. + /// + /// + /// Type: UINT* + /// The array size needed to retrieve all supported pixel formats. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the array size needed to retrieve all the + /// supported pixel formats by calling it with cFormats set to 0 and pguidPixelFormats set to . This call + /// sets pcActual to the array size needed. Once the needed array size is determined, a second GetPixelFormats call with + /// pguidPixelFormats set to an array of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getpixelformats HRESULT + // GetPixelFormats( UINT cFormats, GUID *pguidPixelFormats, UINT *pcActual ); + void GetPixelFormats(uint cFormats, Guid[] pguidPixelFormats, out uint pcActual); + + /// Retrieves the color manangement version number the codec supports. + /// + /// Type: UINT + /// The size of the version buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives the color management version number. Use on first call to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve the full color management version number. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchColorManagementVersion set to 0 and wzColorManagementVersion set + /// to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a + /// second GetColorManagementVersion call with cchColorManagementVersion set to the buffer size and + /// wzColorManagementVersion set to a buffer of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getcolormanagementversion HRESULT + // GetColorManagementVersion( UINT cchColorManagementVersion, WCHAR *wzColorManagementVersion, UINT *pcchActual ); + void GetColorManagementVersion(uint cchColorManagementVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzColorManagementVersion, out uint pcchActual); + + /// Retrieves the name of the device manufacture associated with the codec. + /// + /// Type: UINT + /// The size of the device manufacture's name. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// Receives the device manufacture's name. Use on first call to determine needed buffer size. + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve the device manufacture's name. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchDeviceManufacturer set to 0 and wzDeviceManufacturer set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetDeviceManufacturer call with cchDeviceManufacturer set to the buffer size and wzDeviceManufacturer set to a buffer + /// of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getdevicemanufacturer HRESULT + // GetDeviceManufacturer( UINT cchDeviceManufacturer, WCHAR *wzDeviceManufacturer, UINT *pcchActual ); + void GetDeviceManufacturer(uint cchDeviceManufacturer, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceManufacturer, out uint pcchActual); + + /// Retrieves a comma delimited list of device models associated with the codec. + /// + /// Type: UINT + /// The size of the device models buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives a comma delimited list of device model names associated with the codec. Use on first call to + /// determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all of the device model names. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchDeviceModels set to 0 and wzDeviceModels set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetDeviceModels call with cchDeviceModels set to the buffer size and wzDeviceModels set to a buffer of the + /// appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getdevicemodels HRESULT + // GetDeviceModels( UINT cchDeviceModels, WCHAR *wzDeviceModels, UINT *pcchActual ); + void GetDeviceModels(uint cchDeviceModels, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceModels, out uint pcchActual); + + /// Retrieves a comma delimited sequence of mime types associated with the codec. + /// + /// Type: UINT + /// The size of the mime types buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives the mime types associated with the codec. Use on first call to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all mime types associated with the codec. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchMimeTypes set to 0 and wzMimeTypes set to . + /// This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second GetMimeTypes + /// call with cchMimeTypes set to the buffer size and wzMimeTypes set to a buffer of the appropriate size will retrieve the + /// pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getmimetypes HRESULT + // GetMimeTypes( UINT cchMimeTypes, WCHAR *wzMimeTypes, UINT *pcchActual ); + void GetMimeTypes(uint cchMimeTypes, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzMimeTypes, out uint pcchActual); + + /// Retrieves a comma delimited list of the file name extensions associated with the codec. + /// + /// Type: UINT + /// The size of the file name extension buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives a comma delimited list of file name extensions associated with the codec. Use on first call + /// to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all file name extensions associated with the codec. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// The default extension for an image encoder is the first item in the list of returned extensions. + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchFileExtensions set to 0 and wzFileExtensions set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetFileExtensions call with cchFileExtensions set to the buffer size and wzFileExtensions set to a buffer of the + /// appropriate size will retrieve the pixel formats. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getfileextensions HRESULT + // GetFileExtensions( UINT cchFileExtensions, WCHAR *wzFileExtensions, UINT *pcchActual ); + void GetFileExtensions(uint cchFileExtensions, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFileExtensions, out uint pcchActual); + + /// Retrieves a value indicating whether the codec supports animation. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports images with timing information; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportanimation HRESULT + // DoesSupportAnimation( BOOL *pfSupportAnimation ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportAnimation(); + + /// Retrieves a value indicating whether the codec supports chromakeys. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports chromakeys; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportchromakey HRESULT + // DoesSupportChromakey( BOOL *pfSupportChromakey ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportChromakey(); + + /// Retrieves a value indicating whether the codec supports lossless formats. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports lossless formats; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportlossless HRESULT + // DoesSupportLossless( BOOL *pfSupportLossless ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportLossless(); + + /// Retrieves a value indicating whether the codec supports multi frame images. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports multi frame images; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportmultiframe HRESULT + // DoesSupportMultiframe( BOOL *pfSupportMultiframe ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportMultiframe(); + + /// Retrieves a value indicating whether the given mime type matches the mime type of the codec. + /// + /// Type: LPCWSTR + /// The mime type to compare. + /// + /// + /// Type: BOOL* + /// Receives TRUE if the mime types match; otherwise, FALSE. + /// + /// Note The Windows provided codecs do not implement this method and return E_NOTIMPL. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-matchesmimetype HRESULT + // MatchesMimeType( LPCWSTR wzMimeType, BOOL *pfMatches ); + [return: MarshalAs(UnmanagedType.Bool)] + bool MatchesMimeType([MarshalAs(UnmanagedType.LPWStr)] string wzMimeType); + } + + /// Exposes methods used for progress notification for encoders and decoders. + /// This interface is not supported by the Windows provided codecs. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapcodecprogressnotification + [ComImport, Guid("64C1024E-C3CF-4462-8078-88C2B11C46D9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapCodecProgressNotification + { + /// Registers a progress notification callback function. + /// + /// Type: PFNProgressNotification + /// + /// A function pointer to the application defined progress notification callback function. See ProgressNotificationCallback for + /// the callback signature. + /// + /// + /// + /// Type: LPVOID + /// A pointer to component data for the callback method. + /// + /// + /// Type: DWORD + /// The and flags to use for progress notification. + /// + /// + /// + /// Applications can only register a single callback. Subsequent registration calls will replace the previously registered + /// callback. To unregister a callback, pass in NULL or register a new callback function. + /// + /// + /// Progress is reported in an increasing order between 0.0 and 1.0. If dwProgressFlags includes + /// WICProgressNotificationBegin, the callback is guaranteed to be called with progress 0.0. If dwProgressFlags includes + /// WICProgressNotificationEnd, the callback is guaranteed to be called with progress 1.0. + /// + /// + /// WICProgressNotificationFrequent increases the frequency in which the callback is called. If an operation is expected + /// to take more than 30 seconds, WICProgressNotificationFrequent should be added to dwProgressFlags. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecprogressnotification-registerprogressnotification + // HRESULT RegisterProgressNotification( PFNProgressNotification pfnProgressNotification, LPVOID pvData, DWORD dwProgressFlags ); + void RegisterProgressNotification([In, Optional] PFNProgressNotification pfnProgressNotification, [In, Optional] IntPtr pvData, uint dwProgressFlags); + } + + /// + /// Exposes methods that represent a decoder. + /// The interface provides access to the decoder's properties such as global thumbnails (if supported), frames, and palette. + /// + /// + /// + /// There are a number of concrete implemenations of this interface representing each of the standard decoders provided by the + /// platform including bitmap (BMP), Portable Network Graphics (PNG), icon (ICO), Joint Photographic Experts Group (JPEG), Graphics + /// Interchange Format (GIF), Tagged Image File Format (TIFF), and Microsoft Windows Digital Photo (WDP). The following table + /// includes the class identifier (CLSID) for each native decoder. + /// + /// + /// + /// CLSID Name + /// CLSID + /// + /// + /// CLSID_WICBmpDecoder + /// 0x6b462062, 0x7cbf, 0x400d, 0x9f, 0xdb, 0x81, 0x3d, 0xd1, 0xf, 0x27, 0x78 + /// + /// + /// CLSID_WICGifDecoder + /// 0x381dda3c, 0x9ce9, 0x4834, 0xa2, 0x3e, 0x1f, 0x98, 0xf8, 0xfc, 0x52, 0xbe + /// + /// + /// CLSID_WICHeifDecoder + /// 0xe9a4a80a, 0x44fe, 0x4de4, 0x89, 0x71, 0x71, 0x50, 0xb1, 0x0a, 0x51, 0x99 + /// + /// + /// CLSID_WICIcoDecoder + /// 0xc61bfcdf, 0x2e0f, 0x4aad, 0xa8, 0xd7, 0xe0, 0x6b, 0xaf, 0xeb, 0xcd, 0xfe + /// + /// + /// CLSID_WICJpegDecoder + /// 0x9456a480, 0xe88b, 0x43ea, 0x9e, 0x73, 0xb, 0x2d, 0x9b, 0x71, 0xb1, 0xca + /// + /// + /// CLSID_WICPngDecoder + /// 0x389ea17b, 0x5078, 0x4cde, 0xb6, 0xef, 0x25, 0xc1, 0x51, 0x75, 0xc7, 0x51 + /// + /// + /// CLSID_WICTiffDecoder + /// 0xb54e85d9, 0xfe23, 0x499f, 0x8b, 0x88, 0x6a, 0xce, 0xa7, 0x13, 0x75, 0x2b + /// + /// + /// CLSID_WICWebpDecoder + /// 0x7693e886, 0x51c9, 0x4070, 0x84, 0x19, 0x9f, 0x70, 0X73, 0X8e, 0Xc8, 0Xfa + /// + /// + /// CLSID_WICWmpDecoder + /// 0xa26cec36, 0x234c, 0x4950, 0xae, 0x16, 0xe3, 0x4a, 0xac, 0xe7, 0x1d, 0x0d + /// + /// + /// + /// This interface may be sub-classed to provide support for third party codecs as part of the extensibility model. See the AITCodec + /// Sample CODEC. + /// + /// + /// Codecs written as TIFF container formats that are not register will decode as a TIFF image. Client applications should check for + /// a zero frame count to determine if the codec is valid. + /// + /// CLSID_WICHeifDecoder operates on HEIF (High Efficiency Image Format) images. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapdecoder + [PInvokeData("wincodec.h", MSDNShortId = "91dafd5e-e4fb-4691-a3d0-ca8b6ff0aaf7")] + [ComImport, Guid("9EDDE9E7-8DEE-47ea-99DF-E6FAF2ED44BF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapDecoder + { + /// Retrieves the capabilities of the decoder based on the specified stream. + /// + /// Type: IStream* + /// The stream to retrieve the decoder capabilities from. + /// + /// + /// Type: DWORD* + /// The WICBitmapDecoderCapabilities of the decoder. + /// + /// + /// Custom decoder implementations should save the current position of the specified IStream, read whatever information is + /// necessary in order to determine which capabilities it can provide for the supplied stream, and restore the stream position. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-querycapability HRESULT + // QueryCapability( IStream *pIStream, DWORD *pdwCapability ); + WICBitmapDecoderCapabilities QueryCapability(IStream pIStream); + + /// Initializes the decoder with the provided stream. + /// + /// Type: IStream* + /// The stream to use for initialization. + /// + /// The stream contains the encoded pixels which are decoded each time the CopyPixels method on the IWICBitmapFrameDecode + /// interface (see GetFrame) is invoked. + /// + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use for initialization. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-initialize HRESULT Initialize( + // IStream *pIStream, WICDecodeOptions cacheOptions ); + void Initialize(IStream pIStream, WICDecodeOptions cacheOptions); + + /// Retrieves the image's container format. + /// + /// Type: GUID* + /// A pointer that receives the image's container format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + Guid GetContainerFormat(); + + /// Retrieves an IWICBitmapDecoderInfo for the image. + /// + /// Type: IWICBitmapDecoderInfo** + /// A pointer that receives a pointer to an IWICBitmapDecoderInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getdecoderinfo HRESULT + // GetDecoderInfo( IWICBitmapDecoderInfo **ppIDecoderInfo ); + IWICBitmapDecoderInfo GetDecoderInfo(); + + /// Copies the decoder's IWICPalette . + /// + /// Type: IWICPalette* + /// + /// AnIWICPalette to which the decoder's global palette is to be copied. Use CreatePalette to create the destination palette + /// before calling CopyPalette. + /// + /// + /// + /// CopyPalette returns a global palette (a palette that applies to all the frames in the image) if there is one; + /// otherwise, it returns WINCODEC_ERR_PALETTEUNAVAILABLE. If an image doesn't have a global palette, it may still have a + /// frame-level palette, which can be retrieved using IWICBitmapFrameDecode::CopyPalette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + void CopyPalette(IWICPalette pIPalette); + + /// Retrieves the metadata query reader from the decoder. + /// + /// Type: IWICMetadataQueryReader** + /// Receives a pointer to the decoder's IWICMetadataQueryReader. + /// + /// + /// If an image format does not support container-level metadata, this will return WINCODEC_ERR_UNSUPPORTEDOPERATION. The only + /// Windows provided image format that supports container-level metadata is GIF. Instead, use IWICBitmapFrameDecode::GetMetadataQueryReader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getmetadataqueryreader HRESULT + // GetMetadataQueryReader( IWICMetadataQueryReader **ppIMetadataQueryReader ); + IWICMetadataQueryReader GetMetadataQueryReader(); + + /// Retrieves a preview image, if supported. + /// + /// Type: IWICBitmapSource** + /// Receives a pointer to the preview bitmap if supported. + /// + /// Not all formats support previews. Only the native Microsoft Windows Digital Photo (WDP) codec support previews. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getpreview HRESULT GetPreview( + // IWICBitmapSource **ppIBitmapSource ); + IWICBitmapSource GetPreview(); + + /// Retrieves the IWICColorContext objects of the image. + /// + /// Type: UINT + /// The number of color contexts to retrieve. + /// This value must be the size of, or smaller than, the size available to ppIColorContexts. + /// + /// + /// Type: IWICColorContext** + /// A pointer that receives a pointer to the IWICColorContext. + /// + /// + /// Type: UINT* + /// A pointer that receives the number of color contexts contained in the image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getcolorcontexts HRESULT + // GetColorContexts( UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount ); + void GetColorContexts(uint cCount, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContexts, out uint pcActualCount); + + /// Retrieves a bitmap thumbnail of the image, if one exists + /// + /// Type: IWICBitmapSource** + /// Receives a pointer to the IWICBitmapSource of the thumbnail. + /// + /// + /// The returned thumbnail can be of any size, so the caller should scale the thumbnail to the desired size. The only Windows + /// provided image formats that support thumbnails are JPEG, TIFF, and JPEG-XR. If the thumbnail is not available, this will + /// return WINCODEC_ERR_CODECNOTHUMBNAIL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getthumbnail HRESULT GetThumbnail( + // IWICBitmapSource **ppIThumbnail ); + IWICBitmapSource GetThumbnail(); + + /// Retrieves the total number of frames in the image. + /// + /// Type: UINT* + /// A pointer that receives the total number of frames in the image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getframecount HRESULT + // GetFrameCount( UINT *pCount ); + uint GetFrameCount(); + + /// Retrieves the specified frame of the image. + /// + /// Type: UINT + /// The particular frame to retrieve. + /// + /// + /// Type: IWICBitmapFrameDecode** + /// A pointer that receives a pointer to the IWICBitmapFrameDecode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoder-getframe HRESULT GetFrame( UINT + // index, IWICBitmapFrameDecode **ppIBitmapFrame ); + IWICBitmapFrameDecode GetFrame(uint index); + } + + /// Exposes methods that provide information about a decoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapdecoderinfo + [PInvokeData("wincodec.h", MSDNShortId = "7edc6d1a-7eda-45ef-bf1d-c5835b37a90f")] + [ComImport, Guid("D8CD007F-D08F-4191-9BFC-236EA7F0E4B5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapDecoderInfo : IWICBitmapCodecInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves the container GUID associated with the codec. + /// + /// Type: GUID* + /// Receives the container GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + new Guid GetContainerFormat(); + + /// Retrieves the pixel formats the codec supports. + /// + /// Type: UINT + /// The size of the pguidPixelFormats array. Use 0 on first call to determine the needed array size. + /// + /// + /// Type: GUID* + /// Receives the supported pixel formats. Use on first call to determine needed array size. + /// + /// + /// Type: UINT* + /// The array size needed to retrieve all supported pixel formats. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the array size needed to retrieve all the + /// supported pixel formats by calling it with cFormats set to 0 and pguidPixelFormats set to . This call + /// sets pcActual to the array size needed. Once the needed array size is determined, a second GetPixelFormats call with + /// pguidPixelFormats set to an array of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getpixelformats HRESULT + // GetPixelFormats( UINT cFormats, GUID *pguidPixelFormats, UINT *pcActual ); + new void GetPixelFormats(uint cFormats, Guid[] pguidPixelFormats, out uint pcActual); + + /// Retrieves the color manangement version number the codec supports. + /// + /// Type: UINT + /// The size of the version buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives the color management version number. Use on first call to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve the full color management version number. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchColorManagementVersion set to 0 and wzColorManagementVersion set + /// to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a + /// second GetColorManagementVersion call with cchColorManagementVersion set to the buffer size and + /// wzColorManagementVersion set to a buffer of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getcolormanagementversion HRESULT + // GetColorManagementVersion( UINT cchColorManagementVersion, WCHAR *wzColorManagementVersion, UINT *pcchActual ); + new void GetColorManagementVersion(uint cchColorManagementVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzColorManagementVersion, out uint pcchActual); + + /// Retrieves the name of the device manufacture associated with the codec. + /// + /// Type: UINT + /// The size of the device manufacture's name. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// Receives the device manufacture's name. Use on first call to determine needed buffer size. + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve the device manufacture's name. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchDeviceManufacturer set to 0 and wzDeviceManufacturer set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetDeviceManufacturer call with cchDeviceManufacturer set to the buffer size and wzDeviceManufacturer set to a buffer + /// of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getdevicemanufacturer HRESULT + // GetDeviceManufacturer( UINT cchDeviceManufacturer, WCHAR *wzDeviceManufacturer, UINT *pcchActual ); + new void GetDeviceManufacturer(uint cchDeviceManufacturer, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceManufacturer, out uint pcchActual); + + /// Retrieves a comma delimited list of device models associated with the codec. + /// + /// Type: UINT + /// The size of the device models buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives a comma delimited list of device model names associated with the codec. Use on first call to + /// determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all of the device model names. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchDeviceModels set to 0 and wzDeviceModels set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetDeviceModels call with cchDeviceModels set to the buffer size and wzDeviceModels set to a buffer of the + /// appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getdevicemodels HRESULT + // GetDeviceModels( UINT cchDeviceModels, WCHAR *wzDeviceModels, UINT *pcchActual ); + new void GetDeviceModels(uint cchDeviceModels, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceModels, out uint pcchActual); + + /// Retrieves a comma delimited sequence of mime types associated with the codec. + /// + /// Type: UINT + /// The size of the mime types buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives the mime types associated with the codec. Use on first call to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all mime types associated with the codec. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchMimeTypes set to 0 and wzMimeTypes set to . + /// This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second GetMimeTypes + /// call with cchMimeTypes set to the buffer size and wzMimeTypes set to a buffer of the appropriate size will retrieve the + /// pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getmimetypes HRESULT + // GetMimeTypes( UINT cchMimeTypes, WCHAR *wzMimeTypes, UINT *pcchActual ); + new void GetMimeTypes(uint cchMimeTypes, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzMimeTypes, out uint pcchActual); + + /// Retrieves a comma delimited list of the file name extensions associated with the codec. + /// + /// Type: UINT + /// The size of the file name extension buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives a comma delimited list of file name extensions associated with the codec. Use on first call + /// to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all file name extensions associated with the codec. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// The default extension for an image encoder is the first item in the list of returned extensions. + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchFileExtensions set to 0 and wzFileExtensions set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetFileExtensions call with cchFileExtensions set to the buffer size and wzFileExtensions set to a buffer of the + /// appropriate size will retrieve the pixel formats. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getfileextensions HRESULT + // GetFileExtensions( UINT cchFileExtensions, WCHAR *wzFileExtensions, UINT *pcchActual ); + new void GetFileExtensions(uint cchFileExtensions, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFileExtensions, out uint pcchActual); + + /// Retrieves a value indicating whether the codec supports animation. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports images with timing information; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportanimation HRESULT + // DoesSupportAnimation( BOOL *pfSupportAnimation ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportAnimation(); + + /// Retrieves a value indicating whether the codec supports chromakeys. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports chromakeys; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportchromakey HRESULT + // DoesSupportChromakey( BOOL *pfSupportChromakey ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportChromakey(); + + /// Retrieves a value indicating whether the codec supports lossless formats. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports lossless formats; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportlossless HRESULT + // DoesSupportLossless( BOOL *pfSupportLossless ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportLossless(); + + /// Retrieves a value indicating whether the codec supports multi frame images. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports multi frame images; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportmultiframe HRESULT + // DoesSupportMultiframe( BOOL *pfSupportMultiframe ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportMultiframe(); + + /// Retrieves a value indicating whether the given mime type matches the mime type of the codec. + /// + /// Type: LPCWSTR + /// The mime type to compare. + /// + /// + /// Type: BOOL* + /// Receives TRUE if the mime types match; otherwise, FALSE. + /// + /// Note The Windows provided codecs do not implement this method and return E_NOTIMPL. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-matchesmimetype HRESULT + // MatchesMimeType( LPCWSTR wzMimeType, BOOL *pfMatches ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool MatchesMimeType([MarshalAs(UnmanagedType.LPWStr)] string wzMimeType); + + /// Retrieves the file pattern signatures supported by the decoder. + /// + /// Type: UINT + /// The array size of the pPatterns array. + /// + /// + /// Type: WICBitmapPattern* + /// Receives a list of WICBitmapPattern objects supported by the decoder. + /// + /// + /// Type: UINT* + /// Receives the number of patterns the decoder supports. + /// + /// + /// Type: UINT* + /// Receives the actual buffer size needed to retrieve all pattern signatures supported by the decoder. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// To retrieve all pattern signatures, this method should first be called with pPatterns set to to retrieve the actual buffer + /// size needed through pcbPatternsActual. Once the needed buffer size is known, allocate a buffer of the needed size and call + /// GetPatterns again with the allocated buffer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoderinfo-getpatterns HRESULT + // GetPatterns( UINT cbSizePatterns, WICBitmapPattern *pPatterns, UINT *pcPatterns, UINT *pcbPatternsActual ); + void GetPatterns(uint cbSizePatterns, [In, Out] IntPtr pPatterns, [Out, Optional] out uint pcPatterns, [Out] out uint pcbPatternsActual); + + /// Retrieves a value that indicates whether the codec recognizes the pattern within a specified stream. + /// + /// Type: IStream* + /// The stream to pattern match within. + /// + /// + /// Type: BOOL* + /// A pointer that receives TRUE if the patterns match; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoderinfo-matchespattern HRESULT + // MatchesPattern( IStream *pIStream, BOOL *pfMatches ); + [return: MarshalAs(UnmanagedType.Bool)] + bool MatchesPattern(IStream pIStream); + + /// Creates a new IWICBitmapDecoder instance. + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new instance of the IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoderinfo-createinstance HRESULT + // CreateInstance( IWICBitmapDecoder **ppIBitmapDecoder ); + IWICBitmapDecoder CreateInstance(); + } + + /// Defines methods for setting an encoder's properties such as thumbnails, frames, and palettes. + /// + /// + /// There are a number of concrete implemenations of this interface representing each of the standard encoders provided by the + /// platform including bitmap (BMP), Portable Network Graphics (PNG), Joint Photographic Experts Group (JPEG), Graphics Interchange + /// Format (GIF), Tagged Image File Format (TIFF), and Microsoft Windows Digital Photo (WDP). The following table includes the class + /// identifier (CLSID) for each native encoder. + /// + /// + /// + /// CLSID Name + /// CLSID + /// + /// + /// CLSID_WICBmpEncoder + /// 0x69be8bb4, 0xd66d, 0x47c8, 0x86, 0x5a, 0xed, 0x15, 0x89, 0x43, 0x37, 0x82 + /// + /// + /// CLSID_WICGifEncoder + /// 0x114f5598, 0xb22, 0x40a0, 0x86, 0xa1, 0xc8, 0x3e, 0xa4, 0x95, 0xad, 0xbd + /// + /// + /// CLSID_WICHeifEncoder + /// 0x0dbecec1, 0x9eb3, 0x4860, 0x9c, 0x6f, 0xdd, 0xbe, 0x86, 0x63, 0x45, 0x75 + /// + /// + /// CLSID_WICJpegEncoder + /// 0x1a34f5c1, 0x4a5a, 0x46dc, 0xb6, 0x44, 0x1f, 0x45, 0x67, 0xe7, 0xa6, 0x76 + /// + /// + /// CLSID_WICPngEncoder + /// 0x27949969, 0x876a, 0x41d7, 0x94, 0x47, 0x56, 0x8f, 0x6a, 0x35, 0xa4, 0xdc + /// + /// + /// CLSID_WICTiffEncoder + /// 0x0131be10, 0x2001, 0x4c5f, 0xa9, 0xb0, 0xcc, 0x88, 0xfa, 0xb6, 0x4c, 0xe8 + /// + /// + /// CLSID_WICWmpEncoder + /// 0xac4ce3cb, 0xe1c1, 0x44cd, 0x82, 0x15, 0x5a, 0x16, 0x65, 0x50, 0x9e, 0xc2 + /// + /// + /// + /// Additionally this interface may be sub-classed to provide support for third party codecs as part of the extensibility model. See + /// the AITCodec Sample CODEC. + /// + /// CLSID_WICHeifDecoder operates on HEIF (High Efficiency Image Format) images. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapencoder + [PInvokeData("wincodec.h", MSDNShortId = "fe87c9ae-dedf-4ec2-ac11-0ea5fc6aa3ad")] + [ComImport, Guid("00000103-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapEncoder + { + /// Initializes the encoder with an IStream which tells the encoder where to encode the bits. + /// + /// Type: IStream* + /// The output stream. + /// + /// + /// Type: WICBitmapEncoderCacheOption + /// The WICBitmapEncoderCacheOption used on initialization. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-initialize HRESULT Initialize( + // IStream *pIStream, WICBitmapEncoderCacheOption cacheOption ); + void Initialize(IStream pIStream, WICBitmapEncoderCacheOption cacheOption); + + /// Retrieves the encoder's container format. + /// + /// Type: GUID* + /// A pointer that receives the encoder's container format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + Guid GetContainerFormat(); + + /// Retrieves an IWICBitmapEncoderInfo for the encoder. + /// + /// Type: IWICBitmapEncoderInfo** + /// A pointer that receives a pointer to an IWICBitmapEncoderInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-getencoderinfo HRESULT + // GetEncoderInfo( IWICBitmapEncoderInfo **ppIEncoderInfo ); + IWICBitmapEncoderInfo GetEncoderInfo(); + + /// Sets the IWICColorContext objects for the encoder. + /// + /// Type: UINT + /// The number of IWICColorContext to set. + /// + /// + /// Type: IWICColorContext** + /// A pointer an IWICColorContext pointer containing the color contexts to set for the encoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-setcolorcontexts HRESULT + // SetColorContexts( UINT cCount, IWICColorContext **ppIColorContext ); + void SetColorContexts(uint cCount, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContext); + + /// Sets the global palette for the image. + /// + /// Type: IWICPalette* + /// The IWICPalette to use as the global palette. + /// + /// + /// Only GIF images support an optional global palette, and you must set the global palette before adding any frames to the + /// image. You only need to set the palette for indexed pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-setpalette HRESULT SetPalette( + // IWICPalette *pIPalette ); + void SetPalette(IWICPalette pIPalette); + + /// Sets the global thumbnail for the image. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to set as the global thumbnail. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-setthumbnail HRESULT SetThumbnail( + // IWICBitmapSource *pIThumbnail ); + void SetThumbnail(IWICBitmapSource pIThumbnail); + + /// Sets the global preview for the image. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to use as the global preview. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-setpreview HRESULT SetPreview( + // IWICBitmapSource *pIPreview ); + void SetPreview(IWICBitmapSource pIPreview); + + /// Creates a new IWICBitmapFrameEncode instance. + /// + /// Type: IWICBitmapFrameEncode** + /// A pointer that receives a pointer to the new instance of an IWICBitmapFrameEncode. + /// + /// + /// Type: IPropertyBag2** + /// Optional. Receives the named properties to use for subsequent frame initialization. See Remarks. + /// + /// + /// + /// The parameter ppIEncoderOptions can be used to receive an IPropertyBag2 that can then be used to specify encoder options. + /// This is done by passing a pointer to a NULL IPropertyBag2 pointer in ppIEncoderOptions. The returned IPropertyBag2 is + /// initialized with all encoder options that are available for the given format, at their default values. To specify + /// non-default encoding behavior, set the needed encoder options on the IPropertyBag2 and pass it to IWICBitmapFrameEncode::Initialize. + /// + /// + /// Note Do not pass in a pointer to an initialized IPropertyBag2. The pointer will be overwritten, and the original + /// IPropertyBag2 will not be freed. + /// + /// Otherwise, you can pass NULL in ppIEncoderOptions if you do not intend to specify encoder options. + /// See Encoding Overview for an example of how to set encoder options. + /// + /// For formats that support encoding multiple frames (for example, TIFF, JPEG-XR), you can work on only one frame at a time. + /// This means that you must call IWICBitmapFrameEncode::Commit before you call CreateNewFrame again. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-createnewframe HRESULT + // CreateNewFrame( IWICBitmapFrameEncode **ppIFrameEncode, IPropertyBag2 **ppIEncoderOptions ); + void CreateNewFrame(out IWICBitmapFrameEncode ppIFrameEncode, out IPropertyBag2 ppIEncoderOptions); + + /// Commits all changes for the image and closes the stream. + /// + /// + /// To finalize an image, both the frame Commit and the encoder Commit must be called. However, only call the encoder + /// Commit method after all frames have been committed. + /// + /// + /// After the encoder has been committed, it can't be re-initialized or reused with another stream. A new encoder interface must + /// be created, for example, with IWICImagingFactory::CreateEncoder. + /// + /// + /// For the encoder Commit to succeed, you must at a minimum call IWICBitmapEncoder::Initialize and either + /// IWICBitmapFrameEncode::WriteSource or IWICBitmapFrameEncode::WritePixels. + /// + /// + /// IWICBitmapFrameEncode::WriteSource specifies all parameters needed to encode the image data. + /// IWICBitmapFrameEncode::WritePixels requires that you also call IWICBitmapFrameEncode::SetSize, + /// IWICBitmapFrameEncode::SetPixelFormat, and IWICBitmapFrameEncode::SetPalette (if the pixel format is indexed). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-commit HRESULT Commit(); + void Commit(); + + /// Retrieves a metadata query writer for the encoder. + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to the encoder's metadata query writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoder-getmetadataquerywriter HRESULT + // GetMetadataQueryWriter( IWICMetadataQueryWriter **ppIMetadataQueryWriter ); + IWICMetadataQueryWriter GetMetadataQueryWriter(); + } + + /// Exposes methods that provide information about an encoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapencoderinfo + [PInvokeData("wincodec.h", MSDNShortId = "152b0dd2-1e5e-47fc-b6eb-a4c042e65047")] + [ComImport, Guid("94C9B4EE-A09F-4f92-8A1E-4A9BCE7E76FB"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapEncoderInfo : IWICBitmapCodecInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves the container GUID associated with the codec. + /// + /// Type: GUID* + /// Receives the container GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + new Guid GetContainerFormat(); + + /// Retrieves the pixel formats the codec supports. + /// + /// Type: UINT + /// The size of the pguidPixelFormats array. Use 0 on first call to determine the needed array size. + /// + /// + /// Type: GUID* + /// Receives the supported pixel formats. Use on first call to determine needed array size. + /// + /// + /// Type: UINT* + /// The array size needed to retrieve all supported pixel formats. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the array size needed to retrieve all the + /// supported pixel formats by calling it with cFormats set to 0 and pguidPixelFormats set to . This call + /// sets pcActual to the array size needed. Once the needed array size is determined, a second GetPixelFormats call with + /// pguidPixelFormats set to an array of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getpixelformats HRESULT + // GetPixelFormats( UINT cFormats, GUID *pguidPixelFormats, UINT *pcActual ); + new void GetPixelFormats(uint cFormats, Guid[] pguidPixelFormats, out uint pcActual); + + /// Retrieves the color manangement version number the codec supports. + /// + /// Type: UINT + /// The size of the version buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives the color management version number. Use on first call to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve the full color management version number. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchColorManagementVersion set to 0 and wzColorManagementVersion set + /// to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a + /// second GetColorManagementVersion call with cchColorManagementVersion set to the buffer size and + /// wzColorManagementVersion set to a buffer of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getcolormanagementversion HRESULT + // GetColorManagementVersion( UINT cchColorManagementVersion, WCHAR *wzColorManagementVersion, UINT *pcchActual ); + new void GetColorManagementVersion(uint cchColorManagementVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzColorManagementVersion, out uint pcchActual); + + /// Retrieves the name of the device manufacture associated with the codec. + /// + /// Type: UINT + /// The size of the device manufacture's name. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// Receives the device manufacture's name. Use on first call to determine needed buffer size. + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve the device manufacture's name. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchDeviceManufacturer set to 0 and wzDeviceManufacturer set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetDeviceManufacturer call with cchDeviceManufacturer set to the buffer size and wzDeviceManufacturer set to a buffer + /// of the appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getdevicemanufacturer HRESULT + // GetDeviceManufacturer( UINT cchDeviceManufacturer, WCHAR *wzDeviceManufacturer, UINT *pcchActual ); + new void GetDeviceManufacturer(uint cchDeviceManufacturer, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceManufacturer, out uint pcchActual); + + /// Retrieves a comma delimited list of device models associated with the codec. + /// + /// Type: UINT + /// The size of the device models buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives a comma delimited list of device model names associated with the codec. Use on first call to + /// determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all of the device model names. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchDeviceModels set to 0 and wzDeviceModels set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetDeviceModels call with cchDeviceModels set to the buffer size and wzDeviceModels set to a buffer of the + /// appropriate size will retrieve the pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getdevicemodels HRESULT + // GetDeviceModels( UINT cchDeviceModels, WCHAR *wzDeviceModels, UINT *pcchActual ); + new void GetDeviceModels(uint cchDeviceModels, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceModels, out uint pcchActual); + + /// Retrieves a comma delimited sequence of mime types associated with the codec. + /// + /// Type: UINT + /// The size of the mime types buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives the mime types associated with the codec. Use on first call to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all mime types associated with the codec. + /// + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchMimeTypes set to 0 and wzMimeTypes set to . + /// This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second GetMimeTypes + /// call with cchMimeTypes set to the buffer size and wzMimeTypes set to a buffer of the appropriate size will retrieve the + /// pixel formats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getmimetypes HRESULT + // GetMimeTypes( UINT cchMimeTypes, WCHAR *wzMimeTypes, UINT *pcchActual ); + new void GetMimeTypes(uint cchMimeTypes, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzMimeTypes, out uint pcchActual); + + /// Retrieves a comma delimited list of the file name extensions associated with the codec. + /// + /// Type: UINT + /// The size of the file name extension buffer. Use 0 on first call to determine needed buffer size. + /// + /// + /// Type: WCHAR* + /// + /// Receives a comma delimited list of file name extensions associated with the codec. Use on first call + /// to determine needed buffer size. + /// + /// + /// + /// Type: UINT* + /// The actual buffer size needed to retrieve all file name extensions associated with the codec. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// The default extension for an image encoder is the first item in the list of returned extensions. + /// + /// The usage pattern for this method is a two call process. The first call retrieves the buffer size needed to retrieve the + /// full color management version number by calling it with cchFileExtensions set to 0 and wzFileExtensions set to . This call sets pcchActual to the buffer size needed. Once the needed buffer size is determined, a second + /// GetFileExtensions call with cchFileExtensions set to the buffer size and wzFileExtensions set to a buffer of the + /// appropriate size will retrieve the pixel formats. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-getfileextensions HRESULT + // GetFileExtensions( UINT cchFileExtensions, WCHAR *wzFileExtensions, UINT *pcchActual ); + new void GetFileExtensions(uint cchFileExtensions, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFileExtensions, out uint pcchActual); + + /// Retrieves a value indicating whether the codec supports animation. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports images with timing information; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportanimation HRESULT + // DoesSupportAnimation( BOOL *pfSupportAnimation ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportAnimation(); + + /// Retrieves a value indicating whether the codec supports chromakeys. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports chromakeys; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportchromakey HRESULT + // DoesSupportChromakey( BOOL *pfSupportChromakey ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportChromakey(); + + /// Retrieves a value indicating whether the codec supports lossless formats. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports lossless formats; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportlossless HRESULT + // DoesSupportLossless( BOOL *pfSupportLossless ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportLossless(); + + /// Retrieves a value indicating whether the codec supports multi frame images. + /// + /// Type: BOOL* + /// Receives TRUE if the codec supports multi frame images; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-doessupportmultiframe HRESULT + // DoesSupportMultiframe( BOOL *pfSupportMultiframe ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportMultiframe(); + + /// Retrieves a value indicating whether the given mime type matches the mime type of the codec. + /// + /// Type: LPCWSTR + /// The mime type to compare. + /// + /// + /// Type: BOOL* + /// Receives TRUE if the mime types match; otherwise, FALSE. + /// + /// Note The Windows provided codecs do not implement this method and return E_NOTIMPL. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapcodecinfo-matchesmimetype HRESULT + // MatchesMimeType( LPCWSTR wzMimeType, BOOL *pfMatches ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool MatchesMimeType([MarshalAs(UnmanagedType.LPWStr)] string wzMimeType); + + /// Creates a new IWICBitmapEncoder instance. + /// + /// Type: IWICBitmapEncoder** + /// A pointer that receives a pointer to a new IWICBitmapEncoder instance. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapencoderinfo-createinstance HRESULT + // CreateInstance( IWICBitmapEncoder **ppIBitmapEncoder ); + IWICBitmapEncoder CreateInstance(); + } + + /// + /// Exposes methods that produce a flipped (horizontal or vertical) and/or rotated (by 90 degree increments) bitmap source. The flip + /// is done before the rotation. + /// + /// + /// IWICBitmapFipRotator requests data on a per-pixel basis, while WIC codecs provide data on a per-scanline basis. This causes the + /// fliprotator object to exhibit n behavior if there is no buffering. This occurs because each pixel in the transformed image + /// requires an entire scanline to be decoded in the file. It is recommended that you buffer the image using IWICBitmap, or + /// flip/rotate the image using Direct2D. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapfliprotator + [PInvokeData("wincodec.h", MSDNShortId = "1fcb19ba-34bd-48c0-9964-0c973c31cacc")] + [ComImport, Guid("5009834F-2D6A-41ce-9E1B-17C5AFF7A782"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapFlipRotator : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Initializes the bitmap flip rotator with the provided parameters. + /// + /// Type: IWICBitmapSource* + /// The input bitmap source. + /// + /// + /// Type: WICBitmapTransformOptions + /// The WICBitmapTransformOptions to flip or rotate the image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapfliprotator-initialize HRESULT Initialize( + // IWICBitmapSource *pISource, WICBitmapTransformOptions options ); + void Initialize(IWICBitmapSource pISource, WICBitmapTransformOptions options); + } + + /// Defines methods for decoding individual image frames of an encoded file. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapframedecode + [PInvokeData("wincodec.h", MSDNShortId = "1498b800-6449-440f-bed7-85891637e559")] + [ComImport, Guid("3B16811B-6A43-4ec9-A813-3D930C13B940"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapFrameDecode : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Retrieves a metadata query reader for the frame. + /// + /// Type: IWICMetadataQueryReader** + /// When this method returns, contains a pointer to the frame's metadata query reader. + /// + /// + /// For image formats with one frame (JPG, PNG, JPEG-XR), the frame-level query reader of the first frame is used to access all + /// image metadata, and the decoder-level query reader isnt used. For formats with more than one frame (GIF, TIFF), the + /// frame-level query reader for a given frame is used to access metadata specific to that frame, and in the case of GIF a + /// decoder-level metadata reader will be present. If the decoder doesnt support metadata (BMP, ICO), this will return WINCODEC_ERR_UNSUPPORTEDOPERATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframedecode-getmetadataqueryreader HRESULT + // GetMetadataQueryReader( IWICMetadataQueryReader **ppIMetadataQueryReader ); + IWICMetadataQueryReader GetMetadataQueryReader(); + + /// Retrieves the IWICColorContext associated with the image frame. + /// + /// Type: UINT + /// The number of color contexts to retrieve. + /// This value must be the size of, or smaller than, the size available to ppIColorContexts. + /// + /// + /// Type: IWICColorContext** + /// A pointer that receives a pointer to the IWICColorContext objects. + /// + /// + /// Type: UINT* + /// A pointer that receives the number of color contexts contained in the image frame. + /// + /// + /// + /// If NULL is passed for ppIColorContexts, and 0 is passed for cCount, this method will return the total number of color + /// contexts in the image in pcActualCount. + /// + /// + /// The ppIColorContexts array must be filled with valid data: each IWICColorContext* in the array must have been created using IWICImagingFactory::CreateColorContext. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframedecode-getcolorcontexts HRESULT + // GetColorContexts( UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount ); + void GetColorContexts(uint cCount, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContexts, out uint pcActualCount); + + /// Retrieves a small preview of the frame, if supported by the codec. + /// + /// Type: IWICBitmapSource** + /// A pointer that receives a pointer to the IWICBitmapSource of the thumbnail. + /// + /// + /// + /// Not all formats support thumbnails. Joint Photographic Experts Group (JPEG), Tagged Image File Format (TIFF), and Microsoft + /// Windows Digital Photo (WDP) support thumbnails. + /// + /// Note to Implementers + /// If the codec does not support thumbnails, return WINCODEC_ERROR_CODECNOTHUMBNAIL rather than E_NOTIMPL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframedecode-getthumbnail HRESULT + // GetThumbnail( IWICBitmapSource **ppIThumbnail ); + IWICBitmapSource GetThumbnail(); + } + + /// Represents an encoder's individual image frames. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapframeencode + [PInvokeData("wincodec.h", MSDNShortId = "a8de774b-3783-46be-9a21-c9fec2f10ffd")] + [ComImport, Guid("00000105-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapFrameEncode + { + /// Initializes the frame encoder using the given properties. + /// + /// Type: IPropertyBag2* + /// The set of properties to use for IWICBitmapFrameEncode initialization. + /// + /// + /// + /// If you don't want any encoding options, pass NULL for pIEncoderOptions. Otherwise, pass the IPropertyBag2 that was + /// provided by IWICBitmapEncoder::CreateNewFrame with updated values. + /// + /// For a complete list of encoding options supported by the Windows-provided codecs, see Native WIC Codecs. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-initialize HRESULT Initialize( + // IPropertyBag2 *pIEncoderOptions ); + void Initialize(IPropertyBag2 pIEncoderOptions); + + /// Sets the output image dimensions for the frame. + /// + /// Type: UINT + /// The width of the output image. + /// + /// + /// Type: UINT + /// The height of the output image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-setsize HRESULT SetSize( UINT + // uiWidth, UINT uiHeight ); + void SetSize(uint uiWidth, uint uiHeight); + + /// Sets the physical resolution of the output image. + /// + /// Type: double + /// The horizontal resolution value. + /// + /// + /// Type: double + /// The vertical resolution value. + /// + /// + /// Windows Imaging Component (WIC) doesn't perform any special processing as a result of DPI resolution values. For example, + /// data returned from IWICBitmapSource::CopyPixels isn't scaled by the DPI. The app must handle DPI resolution. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-setresolution HRESULT + // SetResolution( double dpiX, double dpiY ); + void SetResolution(double dpiX, double dpiY); + + /// Requests that the encoder use the specified pixel format. + /// + /// Type: WICPixelFormatGUID* + /// + /// On input, the requested pixel format GUID. On output, the closest pixel format GUID supported by the encoder; this may be + /// different than the requested format. For a list of pixel format GUIDs, see Native Pixel Formats. + /// + /// + /// + /// The encoder might not support the requested pixel format. If not, SetPixelFormat returns the closest match in the + /// memory block that pPixelFormat points to. If the returned pixel format doesn't match the requested format, you must use an + /// IWICFormatConverter object to convert the pixel data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-setpixelformat HRESULT + // SetPixelFormat( WICPixelFormatGUID *pPixelFormat ); + void SetPixelFormat(ref Guid pPixelFormat); + + /// Sets a given number IWICColorContext profiles to the frame. + /// + /// Type: UINT + /// The number of IWICColorContext profiles to set. + /// + /// + /// Type: IWICColorContext** + /// A pointer to an IWICColorContext pointer containing the color contexts profiles to set to the frame. + /// + /// + /// + /// + /// BMP Setting color contexts is unsupported. This function will return WINCODEC_ERR_UNSUPPORTEDOPERATION. + /// + /// + /// + /// PNG Setting at most one color context is supported, and additional color contexts will be ignored. This context must + /// be a WICColorContextProfile, and is used to encode the iCCP, gAMA, and cHRM chunks in the PNG file. + /// + /// + /// + /// + /// JPEG, TIFF, JPEG-XR Setting up to one WICColorContextProfile and one WICColorContextExifColorSpace is supported. + /// Users must not provide more than one of each type of color context, as all but the last context of each type will be + /// ignored. In JPEG, the WICColorContextProfile is encoded to JPEG APP2 ICC metadata block. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-setcolorcontexts HRESULT + // SetColorContexts( UINT cCount, IWICColorContext **ppIColorContext ); + void SetColorContexts(uint cCount, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContext); + + /// Sets the IWICPalette for indexed pixel formats. + /// + /// Type: IWICPalette* + /// The IWICPalette to use for indexed pixel formats. + /// The encoder may change the palette to reflect the pixel formats the encoder supports. + /// + /// + /// + /// This method doesn't fail if called on a frame whose pixel format is set to a non-indexed pixel format. If the target pixel + /// format is a non-indexed format, the palette will be ignored. + /// + /// + /// If you already called IWICBitmapEncoder::SetPalette to set a global palette, this method overrides that palette for the + /// current frame. + /// + /// + /// The palette must be specified before your first call to WritePixels/WriteSource. Doing so will cause WriteSource to + /// use the specified palette when converting the source image to the encoder pixel format. If no palette is specified, a + /// palette will be generated on the first call to WriteSource. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-setpalette HRESULT SetPalette( + // IWICPalette *pIPalette ); + void SetPalette([Optional] IWICPalette pIPalette); + + /// Sets the frame thumbnail if supported by the codec. + /// + /// Type: IWICBitmapSource* + /// The bitmap source to use as the thumbnail. + /// + /// + /// + /// We recommend that you call SetThumbnail before calling WritePixels or WriteSource. The thumbnail won't be added to + /// the encoded file if SetThumbnail is called after a call to WritePixels or WriteSource. + /// + /// + /// + /// BMP, PNG Setting thumbnails is unsupported. This function will return WINCODEC_ERR_UNSUPPORTEDOPERATION. + /// + /// + /// + /// JPEG Setting the thumbnail is supported. The source image will be re-encoded as either an 8bpp or 24bpp JPEG and will + /// be written to the JPEGs APP1 metadata block. + /// + /// + /// + /// + /// TIFF Setting the thumbnail is supported. The source image will be re-encoded as a TIFF and will be written to the + /// frames SubIFD block. + /// + /// + /// + /// + /// JPEG-XR Setting the thumbnail is supported. The source image will be re-encoded as an additional 8bpp or 24bpp frame. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-setthumbnail HRESULT + // SetThumbnail( IWICBitmapSource *pIThumbnail ); + void SetThumbnail([Optional] IWICBitmapSource pIThumbnail); + + /// Copies scan-line data from a caller-supplied buffer to the IWICBitmapFrameEncode object. + /// + /// Type: UINT + /// The number of lines to encode. + /// + /// + /// Type: UINT + /// The stride of the image pixels. + /// + /// + /// Type: UINT + /// The size of the pixel buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the pixel buffer. + /// + /// Successive WritePixels calls are assumed to be sequential scan-line access in the output image. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-writepixels HRESULT + // WritePixels( UINT lineCount, UINT cbStride, UINT cbBufferSize, BYTE *pbPixels ); + void WritePixels(uint lineCount, uint cbStride, uint cbBufferSize, [In] IntPtr pbPixels); + + /// Encodes a bitmap source. + /// + /// Type: IWICBitmapSource* + /// The bitmap source to encode. + /// + /// + /// Type: WICRect* + /// The size rectangle of the bitmap source. + /// + /// + /// + /// If SetSize is not called prior to calling WriteSource, the size given in prc is used if not NULL. Otherwise, + /// the size of the IWICBitmapSource given in pIBitmapSource is used. + /// + /// + /// If SetPixelFormat is not called prior to calling WriteSource, the pixel format of the IWICBitmapSource given in + /// pIBitmapSource is used. + /// + /// If SetResolution is not called prior to calling WriteSource, the pixel format of pIBitmapSource is used. + /// + /// If SetPalette is not called prior to calling WriteSource, the target pixel format is indexed, and the pixel format of + /// pIBitmapSource matches the encoder frame's pixel format, then the pIBitmapSource pixel format is used. + /// + /// + /// When encoding a GIF image, if the global palette is set and the frame level palette is not set directly by the user or by a + /// custom independent software vendor (ISV) GIF codec, WriteSource will use the global palette to encode the frame even + /// when pIBitmapSource has a frame level palette. + /// + /// + /// Starting with Windows Vista, repeated WriteSource calls can be made as long as the total accumulated source rect + /// height is the same as set through SetSize. + /// + /// + /// Starting with Windows 8.1, the source rect must be at least the dimensions set through SetSize. If the source rect width + /// exceeds the SetSize width, extra pixels on the right side are ignored. If the source rect height exceeds the + /// remaining unfilled height, extra scan lines on the bottom are ignored. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-writesource HRESULT + // WriteSource( IWICBitmapSource *pIBitmapSource, WICRect *prc ); + void WriteSource([Optional] IWICBitmapSource pIBitmapSource, [In, Optional] PWICRect prc); + + /// Commits the frame to the image. + /// + /// + /// After the frame Commit has been called, you can't use or reinitialize the IWICBitmapFrameEncode object and any + /// objects created from it. + /// + /// + /// To finalize the image, both the frame Commit and the encoder Commit must be called. However, only call the encoder + /// Commit method after all frames have been committed. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-commit HRESULT Commit(); + void Commit(); + + /// Gets the metadata query writer for the encoder frame. + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to metadata query writer for the encoder frame. + /// + /// + /// If you are setting metadata on the frame, you must do this before you use IWICBitmapFrameEncode::WritePixels or + /// IWICBitmapFrameEncode::WriteSource to write any image pixels to the frame + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframeencode-getmetadataquerywriter HRESULT + // GetMetadataQueryWriter( IWICMetadataQueryWriter **ppIMetadataQueryWriter ); + IWICMetadataQueryWriter GetMetadataQueryWriter(); + } + + /// Exposes methods that support the Lock method. + /// + /// + /// The bitmap lock is simply an abstraction for a rectangular memory window into the bitmap. For the simplest case, a system memory + /// bitmap, this is simply a pointer to the top left corner of the rectangle and a stride value. + /// + /// + /// To release the exclusive lock set by Lock method and the associated IWICBitmapLock object, call IUnknown::Release on the + /// IWICBitmapLock object. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmaplock + [PInvokeData("wincodec.h", MSDNShortId = "c0ddbc25-6abe-484b-a545-3b9376c514df")] + [ComImport, Guid("00000123-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapLock + { + /// Retrieves the width and height, in pixels, of the locked rectangle. + /// + /// Type: UINT* + /// A pointer that receives the width of the locked rectangle. + /// + /// + /// Type: UINT* + /// A pointer that receives the height of the locked rectangle. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmaplock-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + void GetSize(out uint puiWidth, out uint puiHeight); + + /// Provides access to the stride value for the memory. + /// The stride value. + /// + /// Note the stride value is specific to the IWICBitmapLock, not the bitmap. For example, two consecutive locks on the same + /// rectangle of a bitmap may return different pointers and stride values, depending on internal implementation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmaplock-getstride HRESULT GetStride( UINT + // *pcbStride ); + uint GetStride(); + + /// Gets the pointer to the top left pixel in the locked rectangle. + /// + /// Type: UINT* + /// A pointer that receives the size of the buffer. + /// + /// + /// Type: BYTE** + /// A pointer that receives a pointer to the top left pixel in the locked rectangle. + /// + /// + /// The pointer provided by this method should not be used outside of the lifetime of the lock itself. + /// GetDataPointer is not available in multi-threaded apartment applications. + /// Examples + /// In the following example, the data pointed to by the IWICBitmapLock is zero'd. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmaplock-getdatapointer HRESULT GetDataPointer( + // UINT *pcbBufferSize, WICInProcPointer *ppbData ); + void GetDataPointer(out uint pcbBufferSize, out IntPtr ppbData); + + /// + /// Gets the pixel format of for the locked area of pixels. This can be used to compute the number of bytes-per-pixel in the + /// locked area. + /// + /// + /// Type: WICPixelFormatGUID* + /// A pointer that receives the pixel format GUID of the locked area. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmaplock-getpixelformat HRESULT GetPixelFormat( + // WICPixelFormatGUID *pPixelFormat ); + Guid GetPixelFormat(); + } + + /// Represents a resized version of the input bitmap using a resampling or filtering algorithm. + /// + /// + /// Images can be scaled to larger sizes; however, even with sophisticated scaling algorithms, there is only so much information in + /// the image and artifacts tend to worsen the more you scale up. + /// + /// + /// The scaler will reapply the resampling algorithm every time CopyPixels is called. If the scaled image is to be animated, the + /// scaled image should be created once and cached in a new bitmap, after which the IWICBitmapScaler may be released. In this + /// way the scaling algorithm - which may be computationally expensive relative to drawing - is performed only once and the result + /// displayed many times. + /// + /// + /// The scaler is optimized to use the minimum amount of memory required to scale the image correctly. The scaler may be used to + /// produce parts of the image incrementally (banding) by calling CopyPixels with different rectangles representing the output bands + /// of the image. Resampling typically requires overlapping rectangles from the source image and thus may need to request the same + /// pixels from the source bitmap multiple times. Requesting scanlines out-of-order from some image decoders can have a significant + /// performance penalty. Because of this reason, the scaler is optimized to handle consecutive horizontal bands of scanlines + /// (rectangle width equal to the bitmap width). In this case the accumulator from the previous vertically adjacent rectangle is + /// re-used to avoid duplicate scanline requests from the source. This implies that banded output from the scaler may have better + /// performance if the bands are requested sequentially. Of course if the scaler is simply used to produce a single rectangle + /// output, this concern is eliminated because the scaler will internally request scanlines in the correct order. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapscaler + [PInvokeData("wincodec.h", MSDNShortId = "cc14be9d-d750-40db-a95f-309b392cefe8")] + [ComImport, Guid("00000302-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapScaler : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Initializes the bitmap scaler with the provided parameters. + /// + /// Type: IWICBitmapSource* + /// The input bitmap source. + /// + /// + /// Type: UINT + /// The destination width. + /// + /// + /// Type: UINT + /// The desination height. + /// + /// + /// Type: WICBitmapInterpolationMode + /// The WICBitmapInterpolationMode to use when scaling. + /// + /// + /// + /// IWICBitmapScaler can't be initialized multiple times. For example, when scaling every frame in a multi-frame image, a new + /// IWICBitmapScaler must be created and initialized for each frame. + /// + /// Examples + /// For an example using an IWICBitmapScaler, see the How to Scale a Bitmap Source topic. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapscaler-initialize HRESULT Initialize( + // IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight, WICBitmapInterpolationMode mode ); + void Initialize(IWICBitmapSource pISource, uint uiWidth, uint uiHeight, WICBitmapInterpolationMode mode); + } + + /// Exposes methods that refers to a source from which pixels are retrieved, but cannot be written back to. + /// + /// + /// This interface provides a common way of accessing and linking together bitmaps, decoders, format converters, and scalers. + /// Components that implement this interface can be connected together in a graph to pull imaging data through. + /// + /// + /// This interface defines only the notion of readability or being able to produce pixels. Modifying or writing to a bitmap is + /// considered to be a specialization specific to bitmaps which have storage and is defined in the descendant interface IWICBitmap. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsource + [PInvokeData("wincodec.h", MSDNShortId = "abcc84af-6067-4856-8618-fb66aff4255a")] + [ComImport, Guid("00000120-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + } + + /// Exposes methods for offloading certain operations to the underlying IWICBitmapSource implementation. + /// + /// The IWICBitmapSourceTransform interface is implemented by codecs which can natively scale, flip, rotate, or format + /// convert pixels during decoding. As the transformation is combined with the decoding process, native transformation will + /// generally offer performance advantages over non-native transformations. The inbox IWICBitmapScaler, IWICBitmapFlipRotator, and + /// IWICFormatConverter implementations all make use of the IWICBitmapSourceTransform interface when they are placed immediately + /// after a supported IWICBitmapFrameDecode, so in the typical case an application will automatically receive this performance + /// increase and does not need to directly use this interface. However, when chaining multiple transformations, or when implementing + /// a custom transformation, there may be a performance advantage to using the IWICBitmapSourceTransform interface directly. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsourcetransform + [PInvokeData("wincodec.h", MSDNShortId = "f9cc348f-d4f0-4e77-90d6-9ff563a1799c")] + [ComImport, Guid("3B16811B-6A43-4ec9-B713-3D5A0C13B940"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICBitmapSourceTransform + { + /// Copies pixel data using the supplied input parameters. + /// + /// Type: const WICRect* + /// The rectangle of pixels to copy. + /// + /// + /// Type: UINT + /// The width to scale the source bitmap. This parameter must equal the value obtainable through IWICBitmapSourceTransform::GetClosestSize. + /// + /// + /// Type: UINT + /// The height to scale the source bitmap. This parameter must equal the value obtainable through IWICBitmapSourceTransform::GetClosestSize. + /// + /// + /// Type: WICPixelFormatGUID* + /// The GUID of desired pixel format in which the pixels should be returned. + /// This GUID must be a format obtained through an GetClosestPixelFormat call. + /// + /// + /// Type: WICBitmapTransformOptions + /// The desired rotation or flip to perform prior to the pixel copy. + /// The transform must be an operation supported by an DoesSupportTransform call. + /// + /// If a dstTransform is specified, nStride is the transformed stride and is based on the pguidDstFormat pixel format, not the + /// original source's pixel format. + /// + /// + /// + /// Type: UINT + /// The stride of the destination buffer. + /// + /// + /// Type: UINT + /// The size of the destination buffer. + /// + /// + /// Type: BYTE* + /// The output buffer. + /// + /// + /// Codec Developer Remarks + /// If NULL is passed in for prc, the entire image is copied. + /// For codec developer implementation details for this method, see Implementing IWICBitmapSourceTransform. + /// + /// When multiple transform operations are requested, the result is dependent on the order in which the operations are + /// performed. To ensure predictability and consistency across CODECs, it's important that all CODECs perform these operations + /// in the same order. The recommended order of these operations is: + /// + /// + /// + /// Scale + /// + /// + /// Crop + /// + /// + /// Flip/Rotate + /// + /// + /// Pixel format conversion can be performed at any time, since it has no effect on the other transforms. + /// + /// The first parameter, prc is used to specify the region of interest for clipping the image. By convention, scaling is + /// performed before clipping so, if the image is to be scaled as well as clipped, the region of interest should be determined + /// after the image has been scaled. + /// + /// + /// If a dstTransform is specified, the stride is the transformed stride, and is based on the pixelFormat specified in the + /// CopyPixels call, not the original frame's pixel format. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsourcetransform-copypixels HRESULT + // CopyPixels( const WICRect *prc, UINT uiWidth, UINT uiHeight, WICPixelFormatGUID *pguidDstFormat, WICBitmapTransformOptions + // dstTransform, UINT nStride, UINT cbBufferSize, BYTE *pbBuffer ); + void CopyPixels([In, Optional] PWICRect prc, uint uiWidth, uint uiHeight, in Guid pguidDstFormat, WICBitmapTransformOptions dstTransform, uint nStride, uint cbBufferSize, [Out] IntPtr pbBuffer); + + /// Returns the closest dimensions the implementation can natively scale to given the desired dimensions. + /// + /// Type: UINT* + /// The desired width. A pointer that receives the closest supported width. + /// + /// + /// Type: UINT* + /// The desired height. A pointer that receives the closest supported height. + /// + /// + /// The Windows provided codecs provide the following support for native scaling: + /// + /// + /// BMP, ICO, GIF, TIFF: No implementation of IWICBitmapSourceTransform. + /// + /// + /// PNG: No scaling support. + /// + /// + /// JPEG: Native down-scaling by a factor of 8, 4, or 2. + /// + /// + /// JPEG-XR: Native scaling of the original image by powers of 2. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsourcetransform-getclosestsize HRESULT + // GetClosestSize( UINT *puiWidth, UINT *puiHeight ); + void GetClosestSize(out uint puiWidth, out uint puiHeight); + + /// + /// Retrieves the closest pixel format to which the implementation of IWICBitmapSourceTransform can natively copy pixels, given + /// a desired format. + /// + /// + /// Type: WICPixelFormatGUID* + /// A pointer that receives the GUID of the pixel format that is the closest supported pixel format of the desired format. + /// + /// + /// The Windows provided codecs provide the following support: + /// + /// + /// BMP, ICO, GIF, TIFF: No implementation of IWICBitmapSourceTransform. + /// + /// + /// JPEG, PNG, JPEG-XR: Trivial support (always returns the same value as IWICBitmapFrameDecode::GetPixelFormat). + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsourcetransform-getclosestpixelformat + // HRESULT GetClosestPixelFormat( WICPixelFormatGUID *pguidDstFormat ); + Guid GetClosestPixelFormat(); + + /// + /// Determines whether a specific transform option is supported natively by the implementation of the IWICBitmapSourceTransform interface. + /// + /// + /// Type: WICBitmapTransformOptions + /// The WICBitmapTransformOptions to check if they are supported. + /// + /// + /// Type: BOOL* + /// A pointer that receives a value specifying whether the transform option is supported. + /// + /// + /// The Windows provided codecs provide the following level of support: + /// + /// + /// BMP, ICO, GIF, TIFF: No implementation of IWICBitmapSourceTransform. + /// + /// + /// JPEG, PNG: Trivial support (WICBitmapTransformRotate0 only). + /// + /// + /// JPEG-XR: Support for all transformation/rotations. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsourcetransform-doessupporttransform + // HRESULT DoesSupportTransform( WICBitmapTransformOptions dstTransform, BOOL *pfIsSupported ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportTransform(WICBitmapTransformOptions dstTransform); + } + + /// Exposes methods for color management. + /// + /// A Color Context is an abstraction for a color profile. The profile can either be loaded from a file (like "sRGB Color Space Profile.icm"), read from a memory buffer, or can be defined by an EXIF color space. The system color profile directory can be obtained by calling GetColorDirectory. + /// Once a color context has been initialized, it cannot be re-initialized. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwiccolorcontext + [PInvokeData("wincodec.h", MSDNShortId = "b6817676-affb-4bb3-adba-e24e0b75ad10")] + [ComImport, Guid("3C613A02-34B2-44ea-9A7C-45AEA9C6FD6D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICColorContext + { + /// Initializes the color context from the given file. + /// + /// Type: LPCWSTR + /// The name of the file. + /// + /// Once a color context has been initialized, it can't be re-initialized. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolorcontext-initializefromfilename + // HRESULT InitializeFromFilename( LPCWSTR wzFilename ); + void InitializeFromFilename([MarshalAs(UnmanagedType.LPWStr)] string wzFilename); + + /// Initializes the color context from a memory block. + /// + /// Type: const BYTE* + /// The buffer used to initialize the IWICColorContext. + /// + /// + /// Type: UINT + /// The size of the pbBuffer buffer. + /// + /// Once a color context has been initialized, it can't be re-initialized. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolorcontext-initializefrommemory + // HRESULT InitializeFromMemory( const BYTE *pbBuffer, UINT cbBufferSize ); + void InitializeFromMemory([In] IntPtr pbBuffer, uint cbBufferSize); + + /// Initializes the color context using an Exchangeable Image File (EXIF) color space. + /// + /// Type: UINT + /// The value of the EXIF color space. + /// + /// + /// Value + /// Meaning + /// + /// + /// 1 + /// A sRGB color space. + /// + /// + /// 2 + /// An Adobe RGB color space. + /// + /// + /// + /// Once a color context has been initialized, it can't be re-initialized. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolorcontext-initializefromexifcolorspace + // HRESULT InitializeFromExifColorSpace( UINT value ); + void InitializeFromExifColorSpace(uint value); + + /// Retrieves the color context type. + /// + /// Type: WICColorContextType* + /// A pointer that receives the WICColorContextType of the color context. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolorcontext-gettype + // HRESULT GetType( WICColorContextType *pType ); + WICColorContextType GetType(); + + /// Retrieves the color context profile. + /// + /// Type: UINT + /// The size of the pbBuffer buffer. + /// + /// + /// Type: BYTE* + /// A pointer that receives the color context profile. + /// + /// + /// Type: UINT* + /// A pointer that receives the actual buffer size needed to retrieve the entire color context profile. + /// + /// + /// Only use this method if the context type is WICColorContextProfile. + /// Calling this method with pbBuffer set to NULL will cause it to return the required buffer size in pcbActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolorcontext-getprofilebytes + // HRESULT GetProfileBytes( UINT cbBuffer, BYTE *pbBuffer, UINT *pcbActual ); + void GetProfileBytes(uint cbBuffer, [Out] IntPtr pbBuffer, out uint pcbActual); + + /// Retrieves the Exchangeable Image File (EXIF) color space color context. + /// + /// Type: UINT* + /// A pointer that receives the EXIF color space color context. + /// + /// + /// Value + /// Meaning + /// + /// + /// 1 + /// A sRGB color space. + /// + /// + /// 2 + /// An Adobe RGB color space. + /// + /// + /// 3 through 65534 + /// Unused. + /// + /// + /// + /// This method should only be used when IWICColorContext::GetType indicates WICColorContextExifColorSpace. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolorcontext-getexifcolorspace + // HRESULT GetExifColorSpace( UINT *pValue ); + uint GetExifColorSpace(); + } + + /// Exposes methods that transforms an IWICBitmapSource from one color context to another. + /// + /// A IWICColorTransform is an imaging pipeline component that knows how to pull pixels obtained from a given IWICBitmapSource through a color transform. The color transform is defined by mapping colors from the source color context to the destination color context in a given output pixel format. + /// Once initialized, a color transform cannot be reinitialized. Because of this, a color transform cannot be used with multiple sources or varying parameters. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwiccolortransform + [PInvokeData("wincodec.h", MSDNShortId = "6c8ae787-3175-4128-ae9f-e11cb0e4c317")] + [ComImport, Guid("B66F034F-D0E2-40ab-B436-6DE39E321A94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICColorTransform : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// + /// Initializes an IWICColorTransform with a IWICBitmapSource and transforms it from one IWICColorContext to another. + /// + /// Type: IWICBitmapSource* + /// The bitmap source used to initialize the color transform. + /// Type: IWICColorContext* + /// The color context source. + /// Type: IWICColorContext* + /// The color context destination. + /// Type: in Guid + /// The GUID of the desired pixel format. + /// This parameter is limited to a subset of the native WIC pixel formats, see Remarks for a list. + /// + /// The currently supported formats for the pIContextSource and pixelFmtDest parameters are: + /// + /// + /// GUID_WICPixelFormat8bppGray + /// + /// + /// GUID_WICPixelFormat16bppGray + /// + /// + /// GUID_WICPixelFormat16bppBGR555 + /// + /// + /// GUID_WICPixelFormat16bppBGR565 + /// + /// + /// GUID_WICPixelFormat24bppBGR + /// + /// + /// GUID_WICPixelFormat24bppRGB + /// + /// + /// GUID_WICPixelFormat32bppBGR + /// + /// + /// GUID_WICPixelFormat32bppBGRA + /// + /// + /// GUID_WICPixelFormat32bppPBGRA + /// + /// + /// GUID_WICPixelFormat32bppPRGBA (Windows 8 and later) + /// + /// + /// GUID_WICPixelFormat32bppRGBA + /// + /// + /// GUID_WICPixelFormat32bppBGR101010 + /// + /// + /// GUID_WICPixelFormat32bppCMYK + /// + /// + /// GUID_WICPixelFormat48bppBGR + /// + /// + /// GUID_WICPixelFormat64bppBGRA (Windows 8 and later) + /// + /// + /// GUID_WICPixelFormat64bppPBGRA (Windows 8 and later) + /// + /// + /// GUID_WICPixelFormat64bppPRGBA (Windows 8 and later) + /// + /// + /// GUID_WICPixelFormat64bppRGBA (Windows 8 and later) + /// + /// + /// In order to get correct behavior from a color transform, the input and output pixel formats must be compatible with the source and destination color profiles. For example, an sRGB destination color profile will produce incorrect results when used with a CMYK destination pixel format. + /// Examples + /// The following example performs a color transform from one IWICColorContext to another. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccolortransform-initialize + // HRESULT Initialize( IWICBitmapSource *pIBitmapSource, IWICColorContext *pIContextSource, IWICColorContext *pIContextDest, in Guid pixelFmtDest ); + void Initialize([Optional] IWICBitmapSource pIBitmapSource, [Optional] IWICColorContext pIContextSource, [Optional] IWICColorContext pIContextDest, in Guid pixelFmtDest); + } + + /// Exposes methods that create components used by component developers. This includes metadata readers, writers and other services for use by codec and metadata handler developers. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwiccomponentfactory + [PInvokeData("wincodecsdk.h", MSDNShortId = "7aac7268-8f80-4169-9208-1002ca9703e5")] + [ComImport, Guid("412D0C3A-9650-44FA-AF5B-DD2A06C8E8FB"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICComponentFactory : IWICImagingFactory + { + /// Creates a new instance of the IWICBitmapDecoder class based on the given file. + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated string that specifies the name of an object to create or open. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: DWORD + /// The access to the object, which can be read, write, or both. + /// + /// + /// Value + /// Meaning + /// + /// + /// GENERIC_READ + /// Read access. + /// + /// + /// GENERIC_WRITE + /// Write access. + /// + /// + /// For more information, see Generic Access Rights. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to the new IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromfilename + // HRESULT CreateDecoderFromFilename( LPCWSTR wzFilename, const GUID *pguidVendor, DWORD dwDesiredAccess, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoderFromFilename([MarshalAs(UnmanagedType.LPWStr)] string wzFilename, [In] SafeGuidPtr pguidVendor, ACCESS_MASK dwDesiredAccess, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICBitmapDecoder class based on the given IStream. + /// + /// Type: IStream* + /// The stream to create the decoder from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromstream + // HRESULT CreateDecoderFromStream( IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoderFromStream(IStream pIStream, [In] SafeGuidPtr pguidVendor, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICBitmapDecoder based on the given file handle. + /// + /// Type: ULONG_PTR + /// The file handle to create the decoder from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. + /// + /// When a decoder is created using this method, the file handle must remain alive during the lifetime of the decoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromfilehandle + // HRESULT CreateDecoderFromFileHandle( ULONG_PTR hFile, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoderFromFileHandle(HFILE hFile, [In] SafeGuidPtr pguidVendor, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICComponentInfo class for the given component class identifier (CLSID). + /// + /// Type: REFCLSID + /// The CLSID for the desired component. + /// + /// + /// Type: IWICComponentInfo** + /// A pointer that receives a pointer to a new IWICComponentInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentinfo + // HRESULT CreateComponentInfo( REFCLSID clsidComponent, IWICComponentInfo **ppIInfo ); + new IWICComponentInfo CreateComponentInfo(in Guid clsidComponent); + + /// Creates a new instance of IWICBitmapDecoder. + /// + /// Type: REFGUID + /// The GUID for the desired container format. + /// + /// + /// Value + /// Meaning + /// + /// + /// GUID_ContainerFormatBmp + /// The BMP container format GUID. + /// + /// + /// GUID_ContainerFormatPng + /// The PNG container format GUID. + /// + /// + /// GUID_ContainerFormatIco + /// The ICO container format GUID. + /// + /// + /// GUID_ContainerFormatJpeg + /// The JPEG container format GUID. + /// + /// + /// GUID_ContainerFormatTiff + /// The TIFF container format GUID. + /// + /// + /// GUID_ContainerFormatGif + /// The GIF container format GUID. + /// + /// + /// GUID_ContainerFormatWmp + /// The HD Photo container format GUID. + /// + /// + /// + /// + /// Type: const GUID* + /// The GUID for the preferred encoder vendor. + /// + /// + /// Value + /// Meaning + /// + /// + /// SafeGuidPtr.Null + /// No preferred codec vendor. + /// + /// + /// GUID_VendorMicrosoft + /// Prefer to use Microsoft encoder. + /// + /// + /// GUID_VendorMicrosoftBuiltIn + /// Prefer to use the native Microsoft encoder. + /// + /// + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. You must initialize this IWICBitmapDecoder on a stream using the Initialize method later. + /// + /// Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. The values listed are those that are natively supported by the operating system. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoder + // HRESULT CreateDecoder( REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoder(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of the IWICBitmapEncoder class. + /// + /// Type: REFGUID + /// The GUID for the desired container format. + /// + /// + /// Value + /// Meaning + /// + /// + /// GUID_ContainerFormatBmp + /// The BMP container format GUID. + /// + /// + /// GUID_ContainerFormatPng + /// The PNG container format GUID. + /// + /// + /// GUID_ContainerFormatIco + /// The ICO container format GUID. + /// + /// + /// GUID_ContainerFormatJpeg + /// The JPEG container format GUID. + /// + /// + /// GUID_ContainerFormatTiff + /// The TIFF container format GUID. + /// + /// + /// GUID_ContainerFormatGif + /// The GIF container format GUID. + /// + /// + /// GUID_ContainerFormatWmp + /// The HD Photo container format GUID. + /// + /// + /// + /// + /// Type: const GUID* + /// The GUID for the preferred encoder vendor. + /// + /// + /// Value + /// Meaning + /// + /// + /// SafeGuidPtr.Null + /// No preferred codec vendor. + /// + /// + /// GUID_VendorMicrosoft + /// Prefer to use Microsoft encoder. + /// + /// + /// GUID_VendorMicrosoftBuiltIn + /// Prefer to use the native Microsoft encoder. + /// + /// + /// + /// + /// Type: IWICBitmapEncoder** + /// A pointer that receives a pointer to a new IWICBitmapEncoder. + /// + /// Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. The values listed are those that are natively supported by the operating system. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createencoder + // HRESULT CreateEncoder( REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapEncoder **ppIEncoder ); + new IWICBitmapDecoder CreateEncoder(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of the IWICPalette class. + /// + /// Type: IWICPalette** + /// A pointer that receives a pointer to a new IWICPalette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createpalette + // HRESULT CreatePalette( IWICPalette **ppIPalette ); + new IWICPalette CreatePalette(); + + /// Creates a new instance of the IWICFormatConverter class. + /// + /// Type: IWICFormatConverter** + /// A pointer that receives a pointer to a new IWICFormatConverter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createformatconverter + // HRESULT CreateFormatConverter( IWICFormatConverter **ppIFormatConverter ); + new IWICFormatConverter CreateFormatConverter(); + + /// Creates a new instance of an IWICBitmapScaler. + /// + /// Type: IWICBitmapScaler** + /// A pointer that receives a pointer to a new IWICBitmapScaler. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapscaler + // HRESULT CreateBitmapScaler( IWICBitmapScaler **ppIBitmapScaler ); + new IWICBitmapScaler CreateBitmapScaler(); + + /// Creates a new instance of an IWICBitmapClipper object. + /// + /// Type: IWICBitmapClipper** + /// A pointer that receives a pointer to a new IWICBitmapClipper. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapclipper + // HRESULT CreateBitmapClipper( IWICBitmapClipper **ppIBitmapClipper ); + new IWICBitmapClipper CreateBitmapClipper(); + + /// Creates a new instance of an IWICBitmapFlipRotator object. + /// + /// Type: IWICBitmapFlipRotator** + /// A pointer that receives a pointer to a new IWICBitmapFlipRotator. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfliprotator + // HRESULT CreateBitmapFlipRotator( IWICBitmapFlipRotator **ppIBitmapFlipRotator ); + new IWICBitmapFlipRotator CreateBitmapFlipRotator(); + + /// Creates a new instance of the IWICStream class. + /// + /// Type: IWICStream** + /// A pointer that receives a pointer to a new IWICStream. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createstream + // HRESULT CreateStream( IWICStream **ppIWICStream ); + new IWICStream CreateStream(); + + /// Creates a new instance of the IWICColorContext class. + /// + /// Type: IWICColorContext** + /// A pointer that receives a pointer to a new IWICColorContext. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcolorcontext + // HRESULT CreateColorContext( IWICColorContext **ppIWICColorContext ); + new IWICColorContext CreateColorContext(); + + /// Creates a new instance of the IWICColorTransform class. + /// + /// Type: IWICColorTransform** + /// A pointer that receives a pointer to a new IWICColorTransform. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcolortransformer + // HRESULT CreateColorTransformer( IWICColorTransform **ppIWICColorTransform ); + new IWICColorTransform CreateColorTransformer(); + + /// Creates an IWICBitmap object. + /// + /// Type: UINT + /// The width of the new bitmap . + /// + /// + /// Type: UINT + /// The height of the new bitmap. + /// + /// + /// Type: in Guid + /// The pixel format of the new bitmap. + /// + /// + /// Type: WICBitmapCreateCacheOption + /// The cache creation options of the new bitmap. This can be one of the values in the WICBitmapCreateCacheOption enumeration. + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapCacheOnDemand + /// Allocates system memory for the bitmap at initialization. + /// + /// + /// WICBitmapCacheOnLoad + /// Allocates system memory for the bitmap when the bitmap is first used. + /// + /// + /// WICBitmapNoCache + /// This option is not valid for this method and should not be used. + /// + /// + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmap + // HRESULT CreateBitmap( UINT uiWidth, UINT uiHeight, in Guid pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmap(uint uiWidth, uint uiHeight, in Guid pixelFormat, WICBitmapCreateCacheOption option); + + /// Creates a IWICBitmap from a IWICBitmapSource. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to create the bitmap from. + /// + /// + /// Type: WICBitmapCreateCacheOption + /// The cache options of the new bitmap. This can be one of the values in the WICBitmapCreateCacheOption enumeration. + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapNoCache + /// Do not create a system memory copy. Share the bitmap with the source. + /// + /// + /// WICBitmapCacheOnDemand + /// Create a system memory copy when the bitmap is first used. + /// + /// + /// WICBitmapCacheOnLoad + /// Create a system memory copy when this method is called. + /// + /// + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromsource + // HRESULT CreateBitmapFromSource( IWICBitmapSource *pIBitmapSource, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromSource(IWICBitmapSource pIBitmapSource, WICBitmapCreateCacheOption option); + + /// Creates an IWICBitmap from a specified rectangle of an IWICBitmapSource. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to create the bitmap from. + /// + /// + /// Type: UINT + /// The horizontal coordinate of the upper-left corner of the rectangle. + /// + /// + /// Type: UINT + /// The vertical coordinate of the upper-left corner of the rectangle. + /// + /// + /// Type: UINT + /// The width of the rectangle and the new bitmap. + /// + /// + /// Type: UINT + /// The height of the rectangle and the new bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// + /// Providing a rectangle that is larger than the source will produce undefined results. + /// This method always creates a separate copy of the source image, similar to the cache option WICBitmapCacheOnLoad. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromsourcerect + // HRESULT CreateBitmapFromSourceRect( IWICBitmapSource *pIBitmapSource, UINT x, UINT y, UINT width, UINT height, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromSourceRect(IWICBitmapSource pIBitmapSource, uint x, uint y, uint width, uint height); + + /// Creates an IWICBitmap from a memory block. + /// + /// Type: UINT + /// The width of the new bitmap. + /// + /// + /// Type: UINT + /// The height of the new bitmap. + /// + /// + /// Type: in Guid + /// The pixel format of the new bitmap. For valid pixel formats, see Native Pixel Formats. + /// + /// + /// Type: UINT + /// The number of bytes between successive scanlines in pbBuffer. + /// + /// + /// Type: UINT + /// The size of pbBuffer. + /// + /// + /// Type: BYTE* + /// The buffer used to create the bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// + /// The size of the IWICBitmap to be created must be smaller than or equal to the size of the image in pbBuffer. + /// The stride of the destination bitmap will equal the stride of the source data, regardless of the width and height specified. + /// The pixelFormat parameter defines the pixel format for both the input data and the output bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfrommemory + // HRESULT CreateBitmapFromMemory( UINT uiWidth, UINT uiHeight, in Guid pixelFormat, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromMemory(uint uiWidth, uint uiHeight, in Guid pixelFormat, uint cbStride, uint cbBufferSize, [In] IntPtr pbBuffer); + + /// Creates an IWICBitmap from a bitmap handle. + /// + /// Type: HBITMAP + /// A bitmap handle to create the bitmap from. + /// + /// + /// Type: HPALETTE + /// A palette handle used to create the bitmap. + /// + /// + /// Type: WICBitmapAlphaChannelOption + /// The alpha channel options to create the bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// For a non-palletized bitmap, set NULL for the hPalette parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromhbitmap + // HRESULT CreateBitmapFromHBITMAP( HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromHBITMAP(HBITMAP hBitmap, [Optional] HPALETTE hPalette, WICBitmapAlphaChannelOption options); + + /// Creates an IWICBitmap from an icon handle. + /// + /// Type: HICON + /// The icon handle to create the new bitmap from. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromhicon + // HRESULT CreateBitmapFromHICON( HICON hIcon, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromHICON(HICON hIcon); + + /// Creates an IEnumUnknown object of the specified component types. + /// + /// Type: DWORD + /// The types of WICComponentType to enumerate. + /// + /// + /// Type: DWORD + /// The WICComponentEnumerateOptions used to enumerate the given component types. + /// + /// + /// Type: IEnumUnknown** + /// A pointer that receives a pointer to a new component enumerator. + /// + /// Component types must be enumerated seperately. Combinations of component types and WICAllComponents are unsupported. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentenumerator + // HRESULT CreateComponentEnumerator( DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown ); + new IEnumUnknown CreateComponentEnumerator(WICComponentType componentTypes, WICComponentEnumerateOptions options); + + /// Creates a new instance of the fast metadata encoder based on the given IWICBitmapDecoder. + /// + /// Type: IWICBitmapDecoder* + /// The decoder to create the fast metadata encoder from. + /// + /// + /// Type: IWICFastMetadataEncoder** + /// When this method returns, contains a pointer to the new IWICFastMetadataEncoder. + /// + /// The Windows provided codecs do not support fast metadata encoding at the decoder level, and only support fast metadata encoding at the frame level. To create a fast metadata encoder from a frame, see CreateFastMetadataEncoderFromFrameDecode. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createfastmetadataencoderfromdecoder + // HRESULT CreateFastMetadataEncoderFromDecoder( IWICBitmapDecoder *pIDecoder, IWICFastMetadataEncoder **ppIFastEncoder ); + new IWICFastMetadataEncoder CreateFastMetadataEncoderFromDecoder(IWICBitmapDecoder pIDecoder); + + /// Creates a new instance of the fast metadata encoder based on the given image frame. + /// + /// Type: IWICBitmapFrameDecode* + /// The IWICBitmapFrameDecode to create the IWICFastMetadataEncoder from. + /// + /// + /// Type: IWICFastMetadataEncoder** + /// When this method returns, contains a pointer to a new fast metadata encoder. + /// + /// + /// For a list of support metadata formats for fast metadata encoding, see WIC Metadata Overview. + /// Examples + /// The following code demonstrates how to use the CreateFastMetadataEncoderFromFrameDecode method for fast metadata encoding. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createfastmetadataencoderfromframedecode + // HRESULT CreateFastMetadataEncoderFromFrameDecode( IWICBitmapFrameDecode *pIFrameDecoder, IWICFastMetadataEncoder **ppIFastEncoder ); + new IWICFastMetadataEncoder CreateFastMetadataEncoderFromFrameDecode(IWICBitmapFrameDecode pIFrameDecoder); + + /// Creates a new instance of a query writer. + /// + /// Type: REFGUID + /// The GUID for the desired metadata format. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred metadata writer vendor. Use NULL if no preferred vendor. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to a new IWICMetadataQueryWriter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createquerywriter + // HRESULT CreateQueryWriter( REFGUID guidMetadataFormat, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter ); + new IWICMetadataQueryWriter CreateQueryWriter(in Guid guidMetadataFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of a query writer based on the given query reader. The query writer will be pre-populated with metadata from the query reader. + /// + /// Type: IWICMetadataQueryReader* + /// The IWICMetadataQueryReader to create the IWICMetadataQueryWriter from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred metadata writer vendor. Use NULL if no preferred vendor. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to a new metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createquerywriterfromreader + // HRESULT CreateQueryWriterFromReader( IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter ); + new IWICMetadataQueryWriter CreateQueryWriterFromReader(IWICMetadataQueryReader pIQueryReader, [In] SafeGuidPtr pguidVendor); + + /// Creates an IWICMetadataReader based on the given parameters. + /// + /// Type: REFGUID + /// The GUID of the desired metadata format. + /// + /// + /// Type: const GUID* + /// Pointer to the GUID of the desired metadata reader vendor. + /// + /// + /// Type: DWORD + /// The WICPersistOptions and WICMetadataCreationOptions options to use when creating the metadata reader. + /// + /// + /// Type: IStream* + /// Pointer to a stream in which to initialize the reader with. If NULL, the metadata reader will be empty. + /// + /// + /// Type: IWICMetadataReader** + /// A pointer that receives a pointer to the new metadata reader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createmetadatareader + // HRESULT CreateMetadataReader( REFGUID guidMetadataFormat, const GUID *pguidVendor, DWORD dwOptions, IStream *pIStream, IWICMetadataReader **ppIReader ); + IWICMetadataReader CreateMetadataReader(in Guid guidMetadataFormat, [In] SafeGuidPtr pguidVendor, uint dwOptions, IStream pIStream); + + /// Creates an IWICMetadataReader based on the given parameters. + /// + /// Type: REFGUID + /// The container format GUID to base the reader on. + /// + /// + /// Type: const GUID* + /// Pointer to the vendor GUID of the metadata reader. + /// + /// + /// Type: DWORD + /// The WICPersistOptions and WICMetadataCreationOptions options to use when creating the metadata reader. + /// + /// + /// Type: IStream* + /// Pointer to a stream in which to initialize the reader with. If NULL, the metadata reader will be empty. + /// + /// + /// Type: IWICMetadataReader** + /// A pointer that receives a pointer to the new metadata reader + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createmetadatareaderfromcontainer + // HRESULT CreateMetadataReaderFromContainer( REFGUID guidContainerFormat, const GUID *pguidVendor, DWORD dwOptions, IStream *pIStream, IWICMetadataReader **ppIReader ); + IWICMetadataReader CreateMetadataReaderFromContainer(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor, uint dwOptions, IStream pIStream); + + /// Creates an IWICMetadataWriter based on the given parameters. + /// + /// Type: REFGUID + /// The GUID of the desired metadata format. + /// + /// + /// Type: const GUID* + /// Pointer to the GUID of the desired metadata reader vendor. + /// + /// + /// Type: DWORD + /// The WICPersistOptions and WICMetadataCreationOptions options to use when creating the metadata reader. + /// + /// + /// Type: IWICMetadataWriter** + /// A pointer that receives a pointer to the new metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createmetadatawriter + // HRESULT CreateMetadataWriter( REFGUID guidMetadataFormat, const GUID *pguidVendor, DWORD dwMetadataOptions, IWICMetadataWriter **ppIWriter ); + IWICMetadataWriter CreateMetadataWriter(in Guid guidMetadataFormat, [In] SafeGuidPtr pguidVendor, uint dwMetadataOptions); + + /// Creates an IWICMetadataWriter from the given IWICMetadataReader. + /// + /// Type: IWICMetadataReader* + /// Pointer to the metadata reader to base the metadata writer on. + /// + /// + /// Type: const GUID* + /// Pointer to the GUID of the desired metadata reader vendor. + /// + /// + /// Type: IWICMetadataWriter** + /// A pointer that receives a pointer to the new metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createmetadatawriterfromreader + // HRESULT CreateMetadataWriterFromReader( IWICMetadataReader *pIReader, const GUID *pguidVendor, IWICMetadataWriter **ppIWriter ); + IWICMetadataWriter CreateMetadataWriterFromReader(IWICMetadataReader pIReader, [In] SafeGuidPtr pguidVendor); + + /// Creates a IWICMetadataQueryReader from the given IWICMetadataBlockReader. + /// + /// Type: IWICMetadataBlockReader* + /// Pointer to the block reader to base the query reader on. + /// + /// + /// Type: IWICMetadataQueryReader** + /// A pointer that receives a pointer to the new metadata query reader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createqueryreaderfromblockreader + // HRESULT CreateQueryReaderFromBlockReader( IWICMetadataBlockReader *pIBlockReader, IWICMetadataQueryReader **ppIQueryReader ); + IWICMetadataQueryReader CreateQueryReaderFromBlockReader(IWICMetadataBlockReader pIBlockReader); + + /// Creates a IWICMetadataQueryWriter from the given IWICMetadataBlockWriter. + /// + /// Type: IWICMetadataBlockWriter* + /// Pointer to the metadata block reader to base the metadata query writer on. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// A pointer that receives a pointer to the new metadata query writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createquerywriterfromblockwriter + // HRESULT CreateQueryWriterFromBlockWriter( IWICMetadataBlockWriter *pIBlockWriter, IWICMetadataQueryWriter **ppIQueryWriter ); + IWICMetadataQueryWriter CreateQueryWriterFromBlockWriter(IWICMetadataBlockWriter pIBlockWriter); + + /// Creates an encoder property bag. + /// + /// Type: PROPBAG2* + /// Pointer to an array of PROPBAG2 options used to create the encoder property bag. + /// + /// + /// Type: UINT + /// The number of PROPBAG2 structures in the ppropOptions array. + /// + /// + /// Type: IPropertyBag2** + /// A pointer that receives a pointer to an encoder IPropertyBag2. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwiccomponentfactory-createencoderpropertybag + // HRESULT CreateEncoderPropertyBag( PROPBAG2 *ppropOptions, UINT cCount, IPropertyBag2 **ppIPropertyBag ); + IPropertyBag2 CreateEncoderPropertyBag([In] PROPBAG2[] ppropOptions, uint cCount); + } + + /// Exposes methods that provide component information. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwiccomponentinfo + [PInvokeData("wincodec.h", MSDNShortId = "a31267ed-60cd-4de9-9fed-26bb390b29e6")] + [ComImport, Guid("23BC3F0A-698B-4357-886B-F24D50671334"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICComponentInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + } + + /// Provides information and functionality specific to the DDS image format. + /// This interface is implemented by the WIC DDS codec. To obtain this interface, create an IWICBitmapDecoder using the DDS codec and QueryInterface for IWICDdsDecoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicddsdecoder + [PInvokeData("wincodec.h", MSDNShortId = "632D1E7B-9C1D-48FB-95B5-1A295FE99577")] + [ComImport, Guid("409cd537-8532-40cb-9774-e2feb2df4e9c"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICDdsDecoder + { + /// Gets DDS-specific data. + /// + /// Type: WICDdsParameters* + /// A pointer to the structure where the information is returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsdecoder-getparameters + // HRESULT GetParameters( WICDdsParameters *pParameters ); + WICDdsParameters GetParameters(); + + /// Retrieves the specified frame of the DDS image. + /// + /// Type: UINT + /// The requested index within the texture array. + /// + /// + /// Type: UINT + /// The requested mip level. + /// + /// + /// Type: UINT + /// The requested slice within the 3D texture. + /// + /// + /// Type: IWICBitmapFrameDecode** + /// A pointer to a IWICBitmapFrameDecode object. + /// + /// + /// A DDS file can contain multiple images that are organized into a three level hierarchy. First, DDS file may contain multiple textures in a texture array. Second, each texture can have multiple mip levels. Finally, the texture may be a 3D (volume) texture and have multiple slices, each of which is a 2D texture. See the DDS documentation for more information. + /// WIC maps this three level hierarchy into a linear array of IWICBitmapFrameDecode, accessible via IWICBitmapDecoder::GetFrame. However, determining which frame corresponds to a triad of arrayIndex, mipLevel, and sliceIndex value is not trivial because each mip level of a 3D texture has a different depth (number of slices). This method provides additional convenience over IWICBitmapDecoder::GetFrame for DDS images by calculating the correct frame given the three indices. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsdecoder-getframe + // HRESULT GetFrame( UINT arrayIndex, UINT mipLevel, UINT sliceIndex, IWICBitmapFrameDecode **ppIBitmapFrame ); + IWICBitmapFrameDecode GetFrame(uint arrayIndex, uint mipLevel, uint sliceIndex); + } + + /// Enables writing DDS format specific information to an encoder. + /// This interface is implemented by the WIC DDS codec. To obtain this interface, create an IWICBitmapEncoder using the DDS codec and QueryInterface for IWICDdsEncoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicddsencoder + [PInvokeData("wincodec.h", MSDNShortId = "DF14309F-7595-4ABE-BB6E-03D2914CC86D")] + [ComImport, Guid("5cacdb4c-407e-41b3-b936-d0f010cd6732"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICDdsEncoder + { + /// Sets DDS-specific data. + /// + /// Type: WICDdsParameters* + /// Points to the structure where the information is described. + /// + /// + /// You cannot call this method after you have started to write frame data, for example by calling IWICDdsEncoder::CreateNewFrame. + /// Setting DDS parameters using this method provides the DDS encoder with information about the expected number of frames and the dimensions and other parameters of each frame. The DDS encoder will fail if you do not set frame data that matches these expectations. For example, if you set WICDdsParameters::Width and Height to 32, and MipLevels to 6, the DDS encoder will expect 6 frames with the following dimensions: + /// + /// + /// 32x32 pixels. + /// + /// + /// 16x16 pixels. + /// + /// + /// 8x8 pixels. + /// + /// + /// 4x4 pixels. + /// + /// + /// 2x2 pixels. + /// + /// + /// 1x1 pixels. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsencoder-setparameters + // HRESULT SetParameters( WICDdsParameters *pParameters ); + void SetParameters(in WICDdsParameters pParameters); + + /// Gets DDS-specific data. + /// + /// Type: WICDdsParameters* + /// Points to the structure where the information is returned. + /// + /// An application can call GetParameters to obtain the default DDS parameters, modify some or all of them, and then call SetParameters. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsencoder-getparameters + // HRESULT GetParameters( WICDdsParameters *pParameters ); + WICDdsParameters GetParameters(); + + /// Creates a new frame to encode. + /// A pointer to the newly created frame object. + /// Points to the location where the array index is returned. + /// Points to the location where the mip level index is returned. + /// Points to the location where the slice index is returned. + /// This is equivalent to IWICBitmapEncoder::CreateNewFrame, but returns additional information about the array index, mip level and slice of the newly created frame. In contrast to IWICBitmapEncoder::CreateNewFrame, there is no IPropertyBag2* parameter because individual DDS frames do not have separate properties. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsencoder-createnewframe + // HRESULT CreateNewFrame( IWICBitmapFrameEncode **ppIFrameEncode, UINT *pArrayIndex, UINT *pMipLevel, UINT *pSliceIndex ); + void CreateNewFrame(out IWICBitmapFrameEncode ppIFrameEncode, out uint pArrayIndex, out uint pMipLevel, out uint pSliceIndex); + } + + /// Exposes methods that provide access to the capabilites of a raw codec format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicdevelopraw + [PInvokeData("wincodec.h", MSDNShortId = "d449f3f7-fd43-44b0-ab7f-2ae307a74191")] + [ComImport, Guid("fbec5e44-f7be-4b65-b7f8-c0c81fef026d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICDevelopRaw : IWICBitmapFrameDecode + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Retrieves a metadata query reader for the frame. + /// + /// Type: IWICMetadataQueryReader** + /// When this method returns, contains a pointer to the frame's metadata query reader. + /// + /// + /// For image formats with one frame (JPG, PNG, JPEG-XR), the frame-level query reader of the first frame is used to access all + /// image metadata, and the decoder-level query reader isnt used. For formats with more than one frame (GIF, TIFF), the + /// frame-level query reader for a given frame is used to access metadata specific to that frame, and in the case of GIF a + /// decoder-level metadata reader will be present. If the decoder doesnt support metadata (BMP, ICO), this will return WINCODEC_ERR_UNSUPPORTEDOPERATION. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframedecode-getmetadataqueryreader HRESULT + // GetMetadataQueryReader( IWICMetadataQueryReader **ppIMetadataQueryReader ); + new IWICMetadataQueryReader GetMetadataQueryReader(); + + /// Retrieves the IWICColorContext associated with the image frame. + /// + /// Type: UINT + /// The number of color contexts to retrieve. + /// This value must be the size of, or smaller than, the size available to ppIColorContexts. + /// + /// + /// Type: IWICColorContext** + /// A pointer that receives a pointer to the IWICColorContext objects. + /// + /// + /// Type: UINT* + /// A pointer that receives the number of color contexts contained in the image frame. + /// + /// + /// + /// If NULL is passed for ppIColorContexts, and 0 is passed for cCount, this method will return the total number of color + /// contexts in the image in pcActualCount. + /// + /// + /// The ppIColorContexts array must be filled with valid data: each IWICColorContext* in the array must have been created using IWICImagingFactory::CreateColorContext. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframedecode-getcolorcontexts HRESULT + // GetColorContexts( UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount ); + new void GetColorContexts(uint cCount, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 0)] IWICColorContext[] ppIColorContexts, out uint pcActualCount); + + /// Retrieves a small preview of the frame, if supported by the codec. + /// + /// Type: IWICBitmapSource** + /// A pointer that receives a pointer to the IWICBitmapSource of the thumbnail. + /// + /// + /// + /// Not all formats support thumbnails. Joint Photographic Experts Group (JPEG), Tagged Image File Format (TIFF), and Microsoft + /// Windows Digital Photo (WDP) support thumbnails. + /// + /// Note to Implementers + /// If the codec does not support thumbnails, return WINCODEC_ERROR_CODECNOTHUMBNAIL rather than E_NOTIMPL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapframedecode-getthumbnail HRESULT + // GetThumbnail( IWICBitmapSource **ppIThumbnail ); + new IWICBitmapSource GetThumbnail(); + + /// Retrieves information about which capabilities are supported for a raw image. + /// + /// Type: WICRawCapabilitiesInfo* + /// A pointer that receives WICRawCapabilitiesInfo that provides the capabilities supported by the raw image. + /// + /// It is recommended that a codec report that a capability is supported even if the results at the outer range limits are not of perfect quality. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-queryrawcapabilitiesinfo + // HRESULT QueryRawCapabilitiesInfo( WICRawCapabilitiesInfo *pInfo ); + WICRawCapabilitiesInfo QueryRawCapabilitiesInfo(); + + /// Sets the desired WICRawParameterSet option. + /// + /// Type: WICRawParameterSet + /// The desired WICRawParameterSet option. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-loadparameterset + // HRESULT LoadParameterSet( WICRawParameterSet ParameterSet ); + void LoadParameterSet(WICRawParameterSet ParameterSet); + + /// Gets the current set of parameters. + /// + /// Type: IPropertyBag2** + /// A pointer that receives a pointer to the current set of parameters. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getcurrentparameterset + // HRESULT GetCurrentParameterSet( IPropertyBag2 **ppCurrentParameterSet ); + IPropertyBag2 GetCurrentParameterSet(); + + /// Sets the exposure compensation stop value. + /// + /// Type: double + /// The exposure compensation value. The value range for exposure compensation is -5.0 through +5.0, which equates to 10 full stops. + /// + /// It is recommended that a codec report that this method is supported even if the results at the outer range limits are not of perfect quality. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setexposurecompensation + // HRESULT SetExposureCompensation( double ev ); + void SetExposureCompensation(double ev); + + /// Gets the exposure compensation stop value of the raw image. + /// + /// Type: double* + /// A pointer that receives the exposure compensation stop value. The default is the "as-shot" setting. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getexposurecompensation + // HRESULT GetExposureCompensation( double *pEV ); + double GetExposureCompensation(); + + /// Sets the white point RGB values. + /// + /// Type: UINT + /// The red white point value. + /// + /// + /// Type: UINT + /// The green white point value. + /// + /// + /// Type: UINT + /// The blue white point value. + /// + /// Due to other white point setting methods (e.g. SetWhitePointKelvin), care must be taken by codec implementers to ensure proper interoperability. For instance, if the caller sets via a named white point then the codec implementer may whis to disable reading back the correspoinding Kelvin temperature. In specific cases where the codec implementer wishes to deny a given action because of previous calls, WINCODEC_ERR_WRONGSTATE should be returned. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setwhitepointrgb + // HRESULT SetWhitePointRGB( UINT Red, UINT Green, UINT Blue ); + void SetWhitePointRGB(uint Red, uint Green, uint Blue); + + /// Gets the white point RGB values. + /// + /// Type: UINT* + /// A pointer that receives the red white point value. + /// + /// + /// Type: UINT* + /// A pointer that receives the green white point value. + /// + /// + /// Type: UINT* + /// A pointer that receives the blue white point value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getwhitepointrgb + // HRESULT GetWhitePointRGB( UINT *pRed, UINT *pGreen, UINT *pBlue ); + void GetWhitePointRGB(out uint pRed, out uint pGreen, out uint pBlue); + + /// Sets the named white point of the raw file. + /// + /// Type: WICNamedWhitePoint + /// A bitwise combination of the enumeration values. + /// + /// + /// If the named white points are not supported by the raw image or the raw file contains named white points that are not supported by this API, the codec implementer should still mark this capability as supported. + /// If the named white points are not supported by the raw image, a best effort should be made to adjust the image to the named white point even when it isn't a pre-defined white point of the raw file. + /// If the raw file containes named white points not supported by this API, the codec implementer should support the named white points in the API. + /// Due to other white point setting methods (e.g. SetWhitePointKelvin), care must be taken by codec implementers to ensure proper interoperability. For instance, if the caller sets via a named white point then the codec implementer may whis to disable reading back the correspoinding Kelvin temperature. In specific cases where the codec implementer wishes to deny a given action because of previous calls, WINCODEC_ERR_WRONGSTATE should be returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setnamedwhitepoint + // HRESULT SetNamedWhitePoint( WICNamedWhitePoint WhitePoint ); + void SetNamedWhitePoint(WICNamedWhitePoint WhitePoint); + + /// Gets the named white point of the raw image. + /// + /// Type: WICNamedWhitePoint* + /// A pointer that receives the bitwise combination of the enumeration values. + /// + /// + /// If the named white points are not supported by the raw image or the raw file contains named white points that are not supported by this API, the codec implementer should still mark this capability as supported. + /// If the named white points are not supported by the raw image, a best effort should be made to adjust the image to the named white point even when it isn't a pre-defined white point of the raw file. + /// If the raw file containes named white points not supported by this API, the codec implementer should support the named white points in WICNamedWhitePoint. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getnamedwhitepoint + // HRESULT GetNamedWhitePoint( WICNamedWhitePoint *pWhitePoint ); + WICNamedWhitePoint GetNamedWhitePoint(); + + /// Sets the white point Kelvin value. + /// + /// Type: UINT + /// The white point Kelvin value. Acceptable Kelvin values are 1,500 through 30,000. + /// + /// + /// Codec implementers should faithfully adjust the color temperature within the range supported natively by the raw image. For values outside the native support range, the codec implementer should provide a best effort representation of the image at that color temperature. + /// Codec implementers should return WINCODEC_ERR_VALUEOUTOFRANGE if the value is out of defined acceptable range. + /// Codec implementers must ensure proper interoperability with other white point setting methods such as SetWhitePointRGB. For example, if the caller sets the white point via SetNamedWhitePoint then the codec implementer may want to disable reading back the correspoinding Kelvin temperature. In specific cases where the codec implementer wants to deny a given action because of previous calls, WINCODEC_ERR_WRONGSTATE should be returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setwhitepointkelvin + // HRESULT SetWhitePointKelvin( UINT WhitePointKelvin ); + void SetWhitePointKelvin(uint WhitePointKelvin); + + /// Gets the white point Kelvin temperature of the raw image. + /// + /// Type: UINT* + /// A pointer that receives the white point Kelvin temperature of the raw image. The default is the "as-shot" setting value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getwhitepointkelvin + // HRESULT GetWhitePointKelvin( UINT *pWhitePointKelvin ); + uint GetWhitePointKelvin(); + + /// Gets the information about the current Kelvin range of the raw image. + /// + /// Type: UINT* + /// A pointer that receives the minimum Kelvin temperature. + /// + /// + /// Type: UINT* + /// A pointer that receives the maximum Kelvin temperature. + /// + /// + /// Type: UINT* + /// A pointer that receives the Kelvin step value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getkelvinrangeinfo + // HRESULT GetKelvinRangeInfo( UINT *pMinKelvinTemp, UINT *pMaxKelvinTemp, UINT *pKelvinTempStepValue ); + void GetKelvinRangeInfo(out uint pMinKelvinTemp, out uint pMaxKelvinTemp, out uint pKelvinTempStepValue); + + /// Sets the contrast value of the raw image. + /// + /// Type: double + /// The contrast value of the raw image. The default value is the "as-shot" setting. The value range for contrast is 0.0 through 1.0. The 0.0 lower limit represents no contrast applied to the image, while the 1.0 upper limit represents the highest amount of contrast that can be applied. + /// + /// The codec implementer must determine what the upper range value represents and must determine how to map the value to their image processing routines. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setcontrast + // HRESULT SetContrast( double Contrast ); + void SetContrast(double Contrast); + + /// Gets the contrast value of the raw image. + /// + /// Type: double* + /// A pointer that receives the contrast value of the raw image. The default value is the "as-shot" setting. The value range for contrast is 0.0 through 1.0. The 0.0 lower limit represents no contrast applied to the image, while the 1.0 upper limit represents the highest amount of contrast that can be applied. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getcontrast + // HRESULT GetContrast( double *pContrast ); + double GetContrast(); + + /// Sets the desired gamma value. + /// + /// Type: double + /// The desired gamma value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setgamma + // HRESULT SetGamma( double Gamma ); + void SetGamma(double Gamma); + + /// Gets the current gamma setting of the raw image. + /// + /// Type: double* + /// A pointer that receives the current gamma setting. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getgamma + // HRESULT GetGamma( double *pGamma ); + double GetGamma(); + + /// Sets the sharpness value of the raw image. + /// + /// Type: double + /// The sharpness value of the raw image. The default value is the "as-shot" setting. The value range for sharpness is 0.0 through 1.0. The 0.0 lower limit represents no sharpening applied to the image, while the 1.0 upper limit represents the highest amount of sharpness that can be applied. + /// + /// The codec implementer must determine what the upper range value represents and must determine how to map the value to their image processing routines. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setsharpness + // HRESULT SetSharpness( double Sharpness ); + void SetSharpness(double Sharpness); + + /// Gets the sharpness value of the raw image. + /// + /// Type: double* + /// A pointer that receives the sharpness value of the raw image. The default value is the "as-shot" setting. The value range for sharpness is 0.0 through 1.0. The 0.0 lower limit represents no sharpening applied to the image, while the 1.0 upper limit represents the highest amount of sharpness that can be applied. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getsharpness + // HRESULT GetSharpness( double *pSharpness ); + double GetSharpness(); + + /// Sets the saturation value of the raw image. + /// + /// Type: double + /// The saturation value of the raw image. The value range for saturation is 0.0 through 1.0. A value of 0.0 represents an image with a fully de-saturated image, while a value of 1.0 represents the highest amount of saturation that can be applied. + /// + /// The codec implementer must determine what the upper range value represents and must determine how to map the value to their image processing routines. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setsaturation + // HRESULT SetSaturation( double Saturation ); + void SetSaturation(double Saturation); + + /// Gets the saturation value of the raw image. + /// + /// Type: double* + /// A pointer that receives the saturation value of the raw image. The default value is the "as-shot" setting. The value range for saturation is 0.0 through 1.0. A value of 0.0 represents an image with a fully de-saturated image, while a value of 1.0 represents the highest amount of saturation that can be applied. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getsaturation + // HRESULT GetSaturation( double *pSaturation ); + double GetSaturation(); + + /// Sets the tint value of the raw image. + /// + /// Type: double + /// The tint value of the raw image. The default value is the "as-shot" setting if it exists or 0.0. The value range for sharpness is -1.0 through +1.0. The -1.0 lower limit represents a full green bias to the image, while the 1.0 upper limit represents a full magenta bias. + /// + /// The codec implementer must determine what the outer range values represent and must determine how to map the values to their image processing routines. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-settint + // HRESULT SetTint( double Tint ); + void SetTint(double Tint); + + /// Gets the tint value of the raw image. + /// + /// Type: double* + /// A pointer that receives the tint value of the raw image. The default value is the "as-shot" setting if it exists or 0.0. The value range for sharpness is -1.0 through +1.0. The -1.0 lower limit represents a full green bias to the image, while the 1.0 upper limit represents a full magenta bias. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-gettint + // HRESULT GetTint( double *pTint ); + double GetTint(); + + /// Sets the noise reduction value of the raw image. + /// + /// Type: double + /// The noise reduction value of the raw image. The default value is the "as-shot" setting if it exists or 0.0. The value range for noise reduction is 0.0 through 1.0. The 0.0 lower limit represents no noise reduction applied to the image, while the 1.0 upper limit represents highest noise reduction amount that can be applied. + /// + /// The codec implementer must determine what the upper range value represents and must determine how to map the value to their image processing routines. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setnoisereduction + // HRESULT SetNoiseReduction( double NoiseReduction ); + void SetNoiseReduction(double NoiseReduction); + + /// Gets the noise reduction value of the raw image. + /// + /// Type: double* + /// A pointer that receives the noise reduction value of the raw image. The default value is the "as-shot" setting if it exists or 0.0. The value range for noise reduction is 0.0 through 1.0. The 0.0 lower limit represents no noise reduction applied to the image, while the 1.0 upper limit represents full highest noise reduction amount that can be applied. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getnoisereduction + // HRESULT GetNoiseReduction( double *pNoiseReduction ); + double GetNoiseReduction(); + + /// Sets the destination color context. + /// + /// Type: const IWICColorContext* + /// The destination color context. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setdestinationcolorcontext + // HRESULT SetDestinationColorContext( IWICColorContext *pColorContext ); + void SetDestinationColorContext(IWICColorContext pColorContext); + + /// Sets the tone curve for the raw image. + /// + /// Type: UINT + /// The size of the pToneCurve structure. + /// + /// + /// Type: const WICRawToneCurve* + /// The desired tone curve. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-settonecurve + // HRESULT SetToneCurve( UINT cbToneCurveSize, const WICRawToneCurve *pToneCurve ); + void SetToneCurve(uint cbToneCurveSize, [In] IntPtr pToneCurve); + + /// Gets the tone curve of the raw image. + /// + /// Type: UINT + /// The size of the pToneCurve buffer. + /// + /// + /// Type: WICRawToneCurve* + /// A pointer that receives the WICRawToneCurve of the raw image. + /// + /// + /// Type: UINT* + /// A pointer that receives the size needed to obtain the tone curve structure. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-gettonecurve + // HRESULT GetToneCurve( UINT cbToneCurveBufferSize, WICRawToneCurve *pToneCurve, UINT *pcbActualToneCurveBufferSize ); + void GetToneCurve(uint cbToneCurveBufferSize, [Out] IntPtr pToneCurve, out uint pcbActualToneCurveBufferSize); + + /// Sets the desired rotation angle. + /// + /// Type: double + /// The desired rotation angle. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setrotation + // HRESULT SetRotation( double Rotation ); + void SetRotation(double Rotation); + + /// Gets the current rotation angle. + /// + /// Type: double* + /// A pointer that receives the current rotation angle. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getrotation + // HRESULT GetRotation( double *pRotation ); + double GetRotation(); + + /// Sets the current WICRawRenderMode. + /// + /// Type: WICRawRenderMode + /// The render mode to use. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setrendermode + // HRESULT SetRenderMode( WICRawRenderMode RenderMode ); + void SetRenderMode(WICRawRenderMode RenderMode); + + /// Gets the current WICRawRenderMode. + /// + /// Type: WICRawRenderMode* + /// A pointer that receives the current WICRawRenderMode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-getrendermode + // HRESULT GetRenderMode( WICRawRenderMode *pRenderMode ); + WICRawRenderMode GetRenderMode(); + + /// Sets the notification callback method. + /// + /// Type: IWICDevelopRawNotificationCallback* + /// Pointer to the notification callback method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-setnotificationcallback + // HRESULT SetNotificationCallback( IWICDevelopRawNotificationCallback *pCallback ); + void SetNotificationCallback(IWICDevelopRawNotificationCallback pCallback); + } + + /// Exposes a callback method for raw image change nofications. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicdeveloprawnotificationcallback + [PInvokeData("wincodec.h", MSDNShortId = "ccd162e4-84be-4ed5-a583-c9bd195f503b")] + [ComImport, Guid("95c75a6e-3e8c-4ec2-85a8-aebcc551e59b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICDevelopRawNotificationCallback + { + /// An application-defined callback method used for raw image parameter change notifications. + /// + /// Type: UINT + /// A set of IWICDevelopRawNotificationCallback Constants parameter notification flags. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdeveloprawnotificationcallback-notify + // HRESULT Notify( UINT NotificationMask ); + [PreserveSig] + HRESULT Notify(WICRawChangeNotification NotificationMask); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/WIC/WindowsCodecs.Interfaces2.cs b/PInvoke/Graphics/WIC/WindowsCodecs.Interfaces2.cs new file mode 100644 index 00000000..0d827e16 --- /dev/null +++ b/PInvoke/Graphics/WIC/WindowsCodecs.Interfaces2.cs @@ -0,0 +1,5508 @@ +using System; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Text; +using Vanara.InteropServices; +using static Vanara.PInvoke.D2d1; +using static Vanara.PInvoke.Ole32; + +namespace Vanara.PInvoke +{ + /// Items from the WindowsCodecs.dll + public static partial class WindowsCodecs + { + private delegate void GetArrayAction(uint cbSize, T[] value, out uint actualSize); + + private delegate void GetStringAction(uint cbSize, StringBuilder value, out uint actualSize); + + /// + /// Provides access to a single frame of DDS image data in its native DXGI_FORMAT form, as well as information about the image data. + /// + /// + /// This interface is implemented by the WIC DDS codec. To obtain this interface, create an IWICBitmapFrameDecode using the DDS + /// codec and QueryInterface for IID_IWICDdsFrameDecode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicddsframedecode + [PInvokeData("wincodec.h", MSDNShortId = "52E76A8D-E7E2-46F5-BBCC-B7C74F1B1122")] + [ComImport, Guid("3d4c0c61-18a4-41e4-bd80-481a4fc9f464"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICDdsFrameDecode + { + /// Gets the width and height, in blocks, of the DDS image. + /// + /// Type: UINT* + /// The width of the DDS image in blocks. + /// + /// + /// Type: UINT* + /// The height of the DDS image in blocks. + /// + /// + /// + /// For block compressed textures, the returned width and height values do not completely define the texture size because the + /// image is padded to fit the closest whole block size. For example, three BC1 textures with pixel dimensions of 1x1, 2x2 and + /// 4x4 will all report pWidthInBlocks = 1 and pHeightInBlocks = 1. + /// + /// + /// If the texture does not use a block-compressed DXGI_FORMAT, this method returns the texture size in pixels; for these + /// formats the block size returned by IWICDdsFrameDecoder::GetFormatInfo is 1x1. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsframedecode-getsizeinblocks HRESULT + // GetSizeInBlocks( UINT *pWidthInBlocks, UINT *pHeightInBlocks ); + void GetSizeInBlocks(out uint pWidthInBlocks, out uint pHeightInBlocks); + + /// Gets information about the format in which the DDS image is stored. + /// + /// Type: WICDdsFormatInfo* + /// Information about the DDS format. + /// + /// + /// This information can be used for allocating memory or constructing Direct3D or Direct2D resources, for example by using + /// ID3D11Device::CreateTexture2D or ID2D1DeviceContext::CreateBitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsframedecode-getformatinfo HRESULT + // GetFormatInfo( WICDdsFormatInfo *pFormatInfo ); + WICDdsFormatInfo GetFormatInfo(); + + /// Requests pixel data as it is natively stored within the DDS file. + /// + /// Type: const WICRect* + /// The rectangle to copy from the source. A NULL value specifies the entire texture. + /// + /// If the texture uses a block-compressed DXGI_FORMAT, all values of the rectangle are expressed in number of blocks, not pixels. + /// + /// + /// + /// Type: UINT + /// + /// The stride, in bytes, of the destination buffer. This represents the number of bytes from the buffer pointer to the next row + /// of data. If the texture uses a block-compressed DXGI_FORMAT, a "row of data" is defined as a row of blocks which contains + /// multiple pixel scanlines. + /// + /// + /// + /// Type: UINT + /// The size, in bytes, of the destination buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the destination buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// If the texture does not use a block-compressed DXGI_FORMAT, this method behaves similarly to IWICBitmapSource::CopyPixels. + /// However, it does not perform any pixel format conversion, and instead produces the raw data from the DDS file. + /// + /// + /// If the texture uses a block-compressed DXGI_FORMAT, this method copies the block data directly into the provided buffer. In + /// this case, the prcBoundsInBlocks parameter is defined in blocks, not pixels. To determine if this is the case, call + /// GetFormatInfo and read the DxgiFormat member of the returned WICDdsFormatInfo structure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicddsframedecode-copyblocks HRESULT CopyBlocks( + // const WICRect *prcBoundsInBlocks, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + void CopyBlocks([In, Optional] PWICRect prcBoundsInBlocks, uint cbStride, uint cbBufferSize, [Out] IntPtr pbBuffer); + } + + /// Exposes methods that provide enumeration services for individual metadata items. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicenummetadataitem + [PInvokeData("wincodec.h", MSDNShortId = "4fe0e47f-9ef4-4aa1-a3ae-578b3759f9ef")] + [ComImport, Guid("DC2BB46D-3F07-481E-8625-220C4AEDBB33"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICEnumMetadataItem + { + /// Advanced the current position in the enumeration. + /// + /// Type: ULONG + /// The number of items to be retrieved. + /// + /// + /// Type: PROPVARIANT* + /// An array of enumerated items. This parameter is optional. + /// + /// + /// Type: PROPVARIANT* + /// An array of enumerated items. + /// + /// + /// Type: PROPVARIANT* + /// An array of enumerated items. This parameter is optional. + /// + /// + /// Type: ULONG* + /// The number of items that were retrieved. This value is always less than or equal to the number of items requested. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicenummetadataitem-next HRESULT Next( ULONG celt, + // PROPVARIANT *rgeltSchema, PROPVARIANT *rgeltId, PROPVARIANT *rgeltValue, ULONG *pceltFetched ); + [PreserveSig] + HRESULT Next(uint celt, [In, Out, Optional] PROPVARIANT_IMMUTABLE[] rgeltSchema, [In, Out] PROPVARIANT_IMMUTABLE[] rgeltId, [In, Out, Optional] PROPVARIANT_IMMUTABLE[] rgeltValue, out uint pceltFetched); + + /// Skips to given number of objects. + /// + /// Type: ULONG + /// The number of objects to skip. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicenummetadataitem-skip HRESULT Skip( ULONG celt ); + [PreserveSig] + HRESULT Skip(uint celt); + + /// Resets the current position to the beginning of the enumeration. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicenummetadataitem-reset HRESULT Reset(); + void Reset(); + + /// Creates a copy of the current IWICEnumMetadataItem. + /// + /// Type: IWICEnumMetadataItem** + /// A pointer that receives a pointer to the IWICEnumMetadataItem copy. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicenummetadataitem-clone HRESULT Clone( + // IWICEnumMetadataItem **ppIEnumMetadataItem ); + IWICEnumMetadataItem Clone(); + } + + /// + /// Exposes methods used for in-place metadata editing. A fast metadata encoder enables you to add and remove metadata to an image + /// without having to fully re-encode the image. + /// + /// + /// + /// A decoder must be created using the WICDecodeOptions value WICDecodeMetadataCacheOnDemand to perform in-place metadata + /// updates. Using the WICDecodeMetadataCacheOnLoad option causes the decoder to release the file stream necessary to perform + /// the metadata updates. + /// + /// + /// Not all metadata formats support fast metadata encoding. The native metadata handlers that support metadata are IFD, Exif, XMP, + /// and GPS. + /// + /// If a fast metadata encoder fails, the image will need to be fully re-encoded to add the metadata. + /// Examples + /// + /// The following demonstrates how to obtain a fast metadata encoder from an image frame and use its query writer to write a + /// metadata item. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicfastmetadataencoder + [PInvokeData("wincodec.h", MSDNShortId = "c7b57a71-f1fe-4e30-a52e-72ab6ce021f7")] + [ComImport, Guid("B84E2C09-78C9-4AC4-8BD3-524AE1663A2F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICFastMetadataEncoder + { + /// Finalizes metadata changes to the image stream. + /// + /// + /// If the commit fails and returns WINCODEC_ERR_STREAMNOTAVAILABLE, ensure that the image decoder was loaded using the + /// WICDecodeMetadataCacheOnDemand option. A fast metadata encoder is not supported when the decoder is created using the + /// WICDecodeMetadataCacheOnLoad option. + /// + /// + /// If the commit fails for any reason, you will need to re-encode the image to ensure the new metadata is added to the image. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicfastmetadataencoder-commit HRESULT Commit(); + void Commit(); + + /// Retrieves a metadata query writer for fast metadata encoding. + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to the fast metadata encoder's metadata query writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicfastmetadataencoder-getmetadataquerywriter + // HRESULT GetMetadataQueryWriter( IWICMetadataQueryWriter **ppIMetadataQueryWriter ); + IWICMetadataQueryWriter GetMetadataQueryWriter(); + } + + /// + /// Represents an IWICBitmapSource that converts the image data from one pixel format to another, handling dithering and halftoning + /// to indexed formats, palette translation and alpha thresholding. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicformatconverter + [PInvokeData("wincodec.h", MSDNShortId = "d558aaa7-5962-424c-9e83-363fba09ad50")] + [ComImport, Guid("00000301-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICFormatConverter : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Initializes the format converter. + /// + /// Type: IWICBitmapSource* + /// The input bitmap to convert + /// + /// + /// Type: REFWICPixelFormatGUID + /// The destination pixel format GUID. + /// + /// + /// Type: WICBitmapDitherType + /// The WICBitmapDitherType used for conversion. + /// + /// + /// Type: IWICPalette* + /// The palette to use for conversion. + /// + /// + /// Type: double + /// The alpha threshold to use for conversion. + /// + /// + /// Type: WICBitmapPaletteType + /// The palette translation type to use for conversion. + /// + /// + /// + /// If you do not have a predefined palette, you must first create one. Use InitializeFromBitmap to create the palette object, + /// then pass it in along with your other parameters. + /// + /// + /// dither, pIPalette, alphaThresholdPercent, and paletteTranslate are used to mitigate color loss when converting to a reduced + /// bit-depth format. For conversions that do not need these settings, the following parameters values should be used: dither + /// set to WICBitmapDitherTypeNone, pIPalette set to NULL, alphaThresholdPercent set to 0.0f, and + /// paletteTranslate set to WICBitmapPaletteTypeCustom. + /// + /// + /// The basic algorithm involved when using an ordered dither requires a fixed palette, found in the WICBitmapPaletteType + /// enumeration, in a specific order. Often, the actual palette provided for the output may have a different ordering or some + /// slight variation in the actual colors. This is the case when using the Microsoft Windows palette which has slight + /// differences among versions of Windows. To provide for this, a palette and a palette translation are given to the format + /// converter. The pIPalette is the actual destination palette to be used and the paletteTranslate is a fixed palette. Once the + /// conversion is complete, the colors are mapped from the fixed palette to the actual colors in pIPalette using a nearest color + /// matching algorithm. + /// + /// + /// WICBitmapDitherTypeOrdered4x4 can be useful in format conversions from 8-bit formats to 5- or 6-bit formats as there + /// is no way to accurately convert color data. + /// + /// + /// WICBitmapDitherTypeErrorDiffusion selects the error diffusion algorithm and may be used with any palette. If an + /// arbitrary palette is provided, WICBitmapPaletteCustom should be passed in as the paletteTranslate. Error diffusion + /// often provides superior results compared to the ordered dithering algorithms especially when combined with the optimized + /// palette generation functionality on the IWICPalette. + /// + /// + /// Some 8bpp content can contains an alpha color; for instance, the Graphics Interchange Format (GIF) format allows for a + /// single palette entry to be used as a transparent color. For this type of content, alphaThresholdPercent specifies what + /// percentage of transparency should map to the transparent color. Because the alpha value is directly proportional to the + /// opacity (not transparency) of a pixel, the alphaThresholdPercent indicates what level of opacity is mapped to the fully + /// transparent color. For instance, 9.8% implies that any pixel with an alpha value of less than 25 will be mapped to the + /// transparent color. A value of 100% maps all pixels which are not fully opaque to the transparent color. Note that the + /// palette should provide a transparent color. If it does not, the 'transparent' color will be the one closest to zero - often black. + /// + /// Examples + /// + /// The following example converts an image frame to a 32bppPBGRA format with no dithering or alpha threshold. Direct2D requires + /// bitmap sources to be in the a 32bppPBGRA format for rendering. For a full sample demonstrating the use of the + /// IWICFormatConverter, see the WIC Image Viewer Using Direct2D Sample. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicformatconverter-initialize HRESULT Initialize( + // IWICBitmapSource *pISource, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, IWICPalette *pIPalette, double + // alphaThresholdPercent, WICBitmapPaletteType paletteTranslate ); + void Initialize(IWICBitmapSource pISource, in Guid dstFormat, WICBitmapDitherType dither, IWICPalette pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate); + + /// Determines if the source pixel format can be converted to the destination pixel format. + /// + /// Type: REFWICPixelFormatGUID + /// The source pixel format. + /// + /// + /// Type: REFWICPixelFormatGUID + /// The destionation pixel format. + /// + /// + /// Type: BOOL* + /// + /// A pointer that receives a value indicating whether the source pixel format can be converted to the destination pixel format. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicformatconverter-canconvert HRESULT CanConvert( + // REFWICPixelFormatGUID srcPixelFormat, REFWICPixelFormatGUID dstPixelFormat, BOOL *pfCanConvert ); + [return: MarshalAs(UnmanagedType.Bool)] + bool CanConvert(in Guid srcPixelFormat, in Guid dstPixelFormat); + } + + /// Exposes methods that provide information about a pixel format converter. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicformatconverterinfo + [PInvokeData("wincodec.h", MSDNShortId = "e6e2bade-66c1-4994-89b9-68aa038bdc8c")] + [ComImport, Guid("9F34FB65-13F4-4f15-BC57-3726B5E53D9F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICFormatConverterInfo : IWICComponentInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves a list of GUIDs that signify which pixel formats the converter supports. + /// + /// Type: UINT + /// The size of the pPixelFormatGUIDs array. + /// + /// + /// Type: WICPixelFormatGUID* + /// Pointer to a GUID array that receives the pixel formats the converter supports. + /// + /// + /// Type: UINT* + /// The actual array size needed to retrieve all pixel formats supported by the converter. + /// + /// + /// + /// The format converter does not necessarily guarantee symmetricality with respect to conversion; that is, a converter may be + /// able to convert FROM a particular format without actually being able to convert TO a particular format. In order to test + /// symmetricality, use CanConvert. + /// + /// + /// To determine the number of pixel formats a coverter can handle, set cFormats to and pPixelFormatGUIDs to . The converter + /// will fill pcActual with the number of formats supported by that converter. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicformatconverterinfo-getpixelformats HRESULT + // GetPixelFormats( UINT cFormats, WICPixelFormatGUID *pPixelFormatGUIDs, UINT *pcActual ); + void GetPixelFormats(uint cFormats, [In] Guid[] pPixelFormatGUIDs, out uint pcActual); + + /// Creates a new IWICFormatConverter instance. + /// + /// Type: IWICFormatConverter** + /// A pointer that receives a new IWICFormatConverter instance. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicformatconverterinfo-createinstance HRESULT + // CreateInstance( IWICFormatConverter **ppIConverter ); + IWICFormatConverter CreateInstance(); + } + + /// + /// Encodes ID2D1Image interfaces to an IWICBitmapEncoder. The input images can be larger than the maximum device texture size. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicimageencoder + [PInvokeData("wincodec.h", MSDNShortId = "D9854D82-0226-4DD8-AE54-93E5B6544B46")] + [ComImport, Guid("04C75BF8-3CE1-473B-ACC5-3CC4F5E94999"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICImageEncoder + { + /// Encodes the image to the frame given by the IWICBitmapFrameEncode. + /// + /// Type: ID2D1Image* + /// The Direct2D image that will be encoded. + /// + /// + /// Type: IWICBitmapFrameEncode* + /// The frame encoder to which the image is written. + /// + /// + /// Type: const WICImageParameters* + /// Additional parameters to control encoding. + /// + /// + /// + /// The image passed in must be created on the same device as in IWICImagingFactory2::CreateImageEncoder. If the + /// pImageParameters are not specified, a set of useful defaults will be assumed, see WICImageParameters for more info. + /// + /// You must correctly and independently have set up the IWICBitmapFrameEncode before calling this API. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimageencoder-writeframe HRESULT WriteFrame( + // ID2D1Image *pImage, IWICBitmapFrameEncode *pFrameEncode, const WICImageParameters *pImageParameters ); + void WriteFrame(ID2D1Image pImage, IWICBitmapFrameEncode pFrameEncode, in WICImageParameters pImageParameters); + + /// Encodes the image as a thumbnail to the frame given by the IWICBitmapFrameEncode. + /// + /// Type: ID2D1Image* + /// The Direct2D image that will be encoded. + /// + /// + /// Type: IWICBitmapFrameEncode* + /// The frame encoder on which the thumbnail is set. + /// + /// + /// Type: const WICImageParameters* + /// Additional parameters to control encoding. + /// + /// + /// + /// The image passed in must be created on the same device as in IWICImagingFactory2::CreateImageEncoder. If the + /// pImageParameters are not specified, a set of useful defaults will be assumed, see WICImageParameters for more info. + /// + /// You must correctly and independently have set up the IWICBitmapFrameEncode before calling this API. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimageencoder-writeframethumbnail HRESULT + // WriteFrameThumbnail( ID2D1Image *pImage, IWICBitmapFrameEncode *pFrameEncode, const WICImageParameters *pImageParameters ); + void WriteFrameThumbnail(ID2D1Image pImage, IWICBitmapFrameEncode pFrameEncode, in WICImageParameters pImageParameters); + + /// Encodes the given image as the thumbnail to the given WIC bitmap encoder. + /// + /// Type: ID2D1Image* + /// The Direct2D image that will be encoded. + /// + /// + /// Type: IWICBitmapEncoder* + /// The encoder on which the thumbnail is set. + /// + /// + /// Type: const WICImageParameters* + /// Additional parameters to control encoding. + /// + /// + /// + /// You must create the image that you pass in on the same device as in IWICImagingFactory2::CreateImageEncoder. If you don't + /// specify additional parameters in the variable that pImageParameters points to, the encoder uses a set of useful defaults. + /// For info about these defaults, see WICImageParameters. + /// + /// + /// Before you call WriteThumbnail, you must set up the IWICBitmapEncoder interface for the encoder on which you want to + /// set the thumbnail. + /// + /// + /// If WriteThumbnail fails, it might return E_OUTOFMEMORY, D2DERR_WRONG_RESOURCE_DOMAIN, or other error codes from the encoder. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimageencoder-writethumbnail HRESULT + // WriteThumbnail( ID2D1Image *pImage, IWICBitmapEncoder *pEncoder, const WICImageParameters *pImageParameters ); + void WriteThumbnail(ID2D1Image pImage, IWICBitmapEncoder pEncoder, in WICImageParameters pImageParameters); + } + + /// + /// Exposes methods used to create components for the Windows Imaging Component (WIC) such as decoders, encoders and pixel format converters. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicimagingfactory + [PInvokeData("wincodec.h", MSDNShortId = "30d155b1-a46c-46c4-9f8f-fb56dc6bf0a9")] + [ComImport, Guid("ec5ec8a9-c395-4314-9c77-54d7a935ff70"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICImagingFactory + { + /// Creates a new instance of the IWICBitmapDecoder class based on the given file. + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated string that specifies the name of an object to create or open. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: DWORD + /// The access to the object, which can be read, write, or both. + /// + /// + /// Value + /// Meaning + /// + /// + /// GENERIC_READ + /// Read access. + /// + /// + /// GENERIC_WRITE + /// Write access. + /// + /// + /// For more information, see Generic Access Rights. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to the new IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromfilename HRESULT + // CreateDecoderFromFilename( LPCWSTR wzFilename, const GUID *pguidVendor, DWORD dwDesiredAccess, WICDecodeOptions + // metadataOptions, IWICBitmapDecoder **ppIDecoder ); + IWICBitmapDecoder CreateDecoderFromFilename([MarshalAs(UnmanagedType.LPWStr)] string wzFilename, [In] SafeGuidPtr pguidVendor, ACCESS_MASK dwDesiredAccess, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICBitmapDecoder class based on the given IStream. + /// + /// Type: IStream* + /// The stream to create the decoder from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromstream HRESULT + // CreateDecoderFromStream( IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder + // **ppIDecoder ); + IWICBitmapDecoder CreateDecoderFromStream(IStream pIStream, [In] SafeGuidPtr pguidVendor, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICBitmapDecoder based on the given file handle. + /// + /// Type: ULONG_PTR + /// The file handle to create the decoder from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. + /// + /// When a decoder is created using this method, the file handle must remain alive during the lifetime of the decoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromfilehandle + // HRESULT CreateDecoderFromFileHandle( ULONG_PTR hFile, const GUID *pguidVendor, WICDecodeOptions metadataOptions, + // IWICBitmapDecoder **ppIDecoder ); + IWICBitmapDecoder CreateDecoderFromFileHandle(HFILE hFile, [In] SafeGuidPtr pguidVendor, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICComponentInfo class for the given component class identifier (CLSID). + /// + /// Type: REFCLSID + /// The CLSID for the desired component. + /// + /// + /// Type: IWICComponentInfo** + /// A pointer that receives a pointer to a new IWICComponentInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentinfo HRESULT + // CreateComponentInfo( REFCLSID clsidComponent, IWICComponentInfo **ppIInfo ); + IWICComponentInfo CreateComponentInfo(in Guid clsidComponent); + + /// Creates a new instance of IWICBitmapDecoder. + /// + /// Type: REFGUID + /// The GUID for the desired container format. + /// + /// + /// Value + /// Meaning + /// + /// + /// GUID_ContainerFormatBmp + /// The BMP container format GUID. + /// + /// + /// GUID_ContainerFormatPng + /// The PNG container format GUID. + /// + /// + /// GUID_ContainerFormatIco + /// The ICO container format GUID. + /// + /// + /// GUID_ContainerFormatJpeg + /// The JPEG container format GUID. + /// + /// + /// GUID_ContainerFormatTiff + /// The TIFF container format GUID. + /// + /// + /// GUID_ContainerFormatGif + /// The GIF container format GUID. + /// + /// + /// GUID_ContainerFormatWmp + /// The HD Photo container format GUID. + /// + /// + /// + /// + /// Type: const GUID* + /// The GUID for the preferred encoder vendor. + /// + /// + /// Value + /// Meaning + /// + /// + /// SafeGuidPtr.Null + /// No preferred codec vendor. + /// + /// + /// GUID_VendorMicrosoft + /// Prefer to use Microsoft encoder. + /// + /// + /// GUID_VendorMicrosoftBuiltIn + /// Prefer to use the native Microsoft encoder. + /// + /// + /// + /// + /// Type: IWICBitmapDecoder** + /// + /// A pointer that receives a pointer to a new IWICBitmapDecoder. You must initialize this IWICBitmapDecoder on a stream + /// using the Initialize method later. + /// + /// + /// + /// Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. + /// The values listed are those that are natively supported by the operating system. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoder HRESULT + // CreateDecoder( REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapDecoder **ppIDecoder ); + IWICBitmapDecoder CreateDecoder(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of the IWICBitmapEncoder class. + /// + /// Type: REFGUID + /// The GUID for the desired container format. + /// + /// + /// Value + /// Meaning + /// + /// + /// GUID_ContainerFormatBmp + /// The BMP container format GUID. + /// + /// + /// GUID_ContainerFormatPng + /// The PNG container format GUID. + /// + /// + /// GUID_ContainerFormatIco + /// The ICO container format GUID. + /// + /// + /// GUID_ContainerFormatJpeg + /// The JPEG container format GUID. + /// + /// + /// GUID_ContainerFormatTiff + /// The TIFF container format GUID. + /// + /// + /// GUID_ContainerFormatGif + /// The GIF container format GUID. + /// + /// + /// GUID_ContainerFormatWmp + /// The HD Photo container format GUID. + /// + /// + /// + /// + /// Type: const GUID* + /// The GUID for the preferred encoder vendor. + /// + /// + /// Value + /// Meaning + /// + /// + /// SafeGuidPtr.Null + /// No preferred codec vendor. + /// + /// + /// GUID_VendorMicrosoft + /// Prefer to use Microsoft encoder. + /// + /// + /// GUID_VendorMicrosoftBuiltIn + /// Prefer to use the native Microsoft encoder. + /// + /// + /// + /// + /// Type: IWICBitmapEncoder** + /// A pointer that receives a pointer to a new IWICBitmapEncoder. + /// + /// + /// Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. + /// The values listed are those that are natively supported by the operating system. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createencoder HRESULT + // CreateEncoder( REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapEncoder **ppIEncoder ); + IWICBitmapDecoder CreateEncoder(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of the IWICPalette class. + /// + /// Type: IWICPalette** + /// A pointer that receives a pointer to a new IWICPalette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createpalette HRESULT + // CreatePalette( IWICPalette **ppIPalette ); + IWICPalette CreatePalette(); + + /// Creates a new instance of the IWICFormatConverter class. + /// + /// Type: IWICFormatConverter** + /// A pointer that receives a pointer to a new IWICFormatConverter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createformatconverter HRESULT + // CreateFormatConverter( IWICFormatConverter **ppIFormatConverter ); + IWICFormatConverter CreateFormatConverter(); + + /// Creates a new instance of an IWICBitmapScaler. + /// + /// Type: IWICBitmapScaler** + /// A pointer that receives a pointer to a new IWICBitmapScaler. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapscaler HRESULT + // CreateBitmapScaler( IWICBitmapScaler **ppIBitmapScaler ); + IWICBitmapScaler CreateBitmapScaler(); + + /// Creates a new instance of an IWICBitmapClipper object. + /// + /// Type: IWICBitmapClipper** + /// A pointer that receives a pointer to a new IWICBitmapClipper. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapclipper HRESULT + // CreateBitmapClipper( IWICBitmapClipper **ppIBitmapClipper ); + IWICBitmapClipper CreateBitmapClipper(); + + /// Creates a new instance of an IWICBitmapFlipRotator object. + /// + /// Type: IWICBitmapFlipRotator** + /// A pointer that receives a pointer to a new IWICBitmapFlipRotator. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfliprotator HRESULT + // CreateBitmapFlipRotator( IWICBitmapFlipRotator **ppIBitmapFlipRotator ); + IWICBitmapFlipRotator CreateBitmapFlipRotator(); + + /// Creates a new instance of the IWICStream class. + /// + /// Type: IWICStream** + /// A pointer that receives a pointer to a new IWICStream. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createstream HRESULT CreateStream( + // IWICStream **ppIWICStream ); + IWICStream CreateStream(); + + /// Creates a new instance of the IWICColorContext class. + /// + /// Type: IWICColorContext** + /// A pointer that receives a pointer to a new IWICColorContext. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcolorcontext HRESULT + // CreateColorContext( IWICColorContext **ppIWICColorContext ); + IWICColorContext CreateColorContext(); + + /// Creates a new instance of the IWICColorTransform class. + /// + /// Type: IWICColorTransform** + /// A pointer that receives a pointer to a new IWICColorTransform. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcolortransformer HRESULT + // CreateColorTransformer( IWICColorTransform **ppIWICColorTransform ); + IWICColorTransform CreateColorTransformer(); + + /// Creates an IWICBitmap object. + /// + /// Type: UINT + /// The width of the new bitmap . + /// + /// + /// Type: UINT + /// The height of the new bitmap. + /// + /// + /// Type: in Guid + /// The pixel format of the new bitmap. + /// + /// + /// Type: WICBitmapCreateCacheOption + /// The cache creation options of the new bitmap. This can be one of the values in the WICBitmapCreateCacheOption enumeration. + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapCacheOnDemand + /// Allocates system memory for the bitmap at initialization. + /// + /// + /// WICBitmapCacheOnLoad + /// Allocates system memory for the bitmap when the bitmap is first used. + /// + /// + /// WICBitmapNoCache + /// This option is not valid for this method and should not be used. + /// + /// + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmap HRESULT CreateBitmap( + // UINT uiWidth, UINT uiHeight, in Guid pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap ); + IWICBitmap CreateBitmap(uint uiWidth, uint uiHeight, in Guid pixelFormat, WICBitmapCreateCacheOption option); + + /// Creates a IWICBitmap from a IWICBitmapSource. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to create the bitmap from. + /// + /// + /// Type: WICBitmapCreateCacheOption + /// The cache options of the new bitmap. This can be one of the values in the WICBitmapCreateCacheOption enumeration. + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapNoCache + /// Do not create a system memory copy. Share the bitmap with the source. + /// + /// + /// WICBitmapCacheOnDemand + /// Create a system memory copy when the bitmap is first used. + /// + /// + /// WICBitmapCacheOnLoad + /// Create a system memory copy when this method is called. + /// + /// + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromsource HRESULT + // CreateBitmapFromSource( IWICBitmapSource *pIBitmapSource, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap ); + IWICBitmap CreateBitmapFromSource(IWICBitmapSource pIBitmapSource, WICBitmapCreateCacheOption option); + + /// Creates an IWICBitmap from a specified rectangle of an IWICBitmapSource. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to create the bitmap from. + /// + /// + /// Type: UINT + /// The horizontal coordinate of the upper-left corner of the rectangle. + /// + /// + /// Type: UINT + /// The vertical coordinate of the upper-left corner of the rectangle. + /// + /// + /// Type: UINT + /// The width of the rectangle and the new bitmap. + /// + /// + /// Type: UINT + /// The height of the rectangle and the new bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// + /// Providing a rectangle that is larger than the source will produce undefined results. + /// This method always creates a separate copy of the source image, similar to the cache option WICBitmapCacheOnLoad. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromsourcerect HRESULT + // CreateBitmapFromSourceRect( IWICBitmapSource *pIBitmapSource, UINT x, UINT y, UINT width, UINT height, IWICBitmap **ppIBitmap ); + IWICBitmap CreateBitmapFromSourceRect(IWICBitmapSource pIBitmapSource, uint x, uint y, uint width, uint height); + + /// Creates an IWICBitmap from a memory block. + /// + /// Type: UINT + /// The width of the new bitmap. + /// + /// + /// Type: UINT + /// The height of the new bitmap. + /// + /// + /// Type: in Guid + /// The pixel format of the new bitmap. For valid pixel formats, see Native Pixel Formats. + /// + /// + /// Type: UINT + /// The number of bytes between successive scanlines in pbBuffer. + /// + /// + /// Type: UINT + /// The size of pbBuffer. + /// + /// + /// Type: BYTE* + /// The buffer used to create the bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// + /// The size of the IWICBitmap to be created must be smaller than or equal to the size of the image in pbBuffer. + /// + /// The stride of the destination bitmap will equal the stride of the source data, regardless of the width and height specified. + /// + /// The pixelFormat parameter defines the pixel format for both the input data and the output bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfrommemory HRESULT + // CreateBitmapFromMemory( UINT uiWidth, UINT uiHeight, in Guid pixelFormat, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, + // IWICBitmap **ppIBitmap ); + IWICBitmap CreateBitmapFromMemory(uint uiWidth, uint uiHeight, in Guid pixelFormat, uint cbStride, uint cbBufferSize, [In] IntPtr pbBuffer); + + /// Creates an IWICBitmap from a bitmap handle. + /// + /// Type: HBITMAP + /// A bitmap handle to create the bitmap from. + /// + /// + /// Type: HPALETTE + /// A palette handle used to create the bitmap. + /// + /// + /// Type: WICBitmapAlphaChannelOption + /// The alpha channel options to create the bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// For a non-palletized bitmap, set NULL for the hPalette parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromhbitmap HRESULT + // CreateBitmapFromHBITMAP( HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options, IWICBitmap **ppIBitmap ); + IWICBitmap CreateBitmapFromHBITMAP(HBITMAP hBitmap, [Optional] HPALETTE hPalette, WICBitmapAlphaChannelOption options); + + /// Creates an IWICBitmap from an icon handle. + /// + /// Type: HICON + /// The icon handle to create the new bitmap from. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromhicon HRESULT + // CreateBitmapFromHICON( HICON hIcon, IWICBitmap **ppIBitmap ); + IWICBitmap CreateBitmapFromHICON(HICON hIcon); + + /// Creates an IEnumUnknown object of the specified component types. + /// + /// Type: DWORD + /// The types of WICComponentType to enumerate. + /// + /// + /// Type: DWORD + /// The WICComponentEnumerateOptions used to enumerate the given component types. + /// + /// + /// Type: IEnumUnknown** + /// A pointer that receives a pointer to a new component enumerator. + /// + /// + /// Component types must be enumerated seperately. Combinations of component types and WICAllComponents are unsupported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentenumerator HRESULT + // CreateComponentEnumerator( DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown ); + IEnumUnknown CreateComponentEnumerator(WICComponentType componentTypes, WICComponentEnumerateOptions options); + + /// Creates a new instance of the fast metadata encoder based on the given IWICBitmapDecoder. + /// + /// Type: IWICBitmapDecoder* + /// The decoder to create the fast metadata encoder from. + /// + /// + /// Type: IWICFastMetadataEncoder** + /// When this method returns, contains a pointer to the new IWICFastMetadataEncoder. + /// + /// + /// The Windows provided codecs do not support fast metadata encoding at the decoder level, and only support fast metadata + /// encoding at the frame level. To create a fast metadata encoder from a frame, see CreateFastMetadataEncoderFromFrameDecode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createfastmetadataencoderfromdecoder + // HRESULT CreateFastMetadataEncoderFromDecoder( IWICBitmapDecoder *pIDecoder, IWICFastMetadataEncoder **ppIFastEncoder ); + IWICFastMetadataEncoder CreateFastMetadataEncoderFromDecoder(IWICBitmapDecoder pIDecoder); + + /// Creates a new instance of the fast metadata encoder based on the given image frame. + /// + /// Type: IWICBitmapFrameDecode* + /// The IWICBitmapFrameDecode to create the IWICFastMetadataEncoder from. + /// + /// + /// Type: IWICFastMetadataEncoder** + /// When this method returns, contains a pointer to a new fast metadata encoder. + /// + /// + /// For a list of support metadata formats for fast metadata encoding, see WIC Metadata Overview. + /// Examples + /// + /// The following code demonstrates how to use the CreateFastMetadataEncoderFromFrameDecode method for fast metadata encoding. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createfastmetadataencoderfromframedecode + // HRESULT CreateFastMetadataEncoderFromFrameDecode( IWICBitmapFrameDecode *pIFrameDecoder, IWICFastMetadataEncoder + // **ppIFastEncoder ); + IWICFastMetadataEncoder CreateFastMetadataEncoderFromFrameDecode(IWICBitmapFrameDecode pIFrameDecoder); + + /// Creates a new instance of a query writer. + /// + /// Type: REFGUID + /// The GUID for the desired metadata format. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred metadata writer vendor. Use NULL if no preferred vendor. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to a new IWICMetadataQueryWriter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createquerywriter HRESULT + // CreateQueryWriter( REFGUID guidMetadataFormat, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter ); + IWICMetadataQueryWriter CreateQueryWriter(in Guid guidMetadataFormat, [In] SafeGuidPtr pguidVendor); + + /// + /// Creates a new instance of a query writer based on the given query reader. The query writer will be pre-populated with + /// metadata from the query reader. + /// + /// + /// Type: IWICMetadataQueryReader* + /// The IWICMetadataQueryReader to create the IWICMetadataQueryWriter from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred metadata writer vendor. Use NULL if no preferred vendor. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to a new metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createquerywriterfromreader + // HRESULT CreateQueryWriterFromReader( IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor, IWICMetadataQueryWriter + // **ppIQueryWriter ); + IWICMetadataQueryWriter CreateQueryWriterFromReader(IWICMetadataQueryReader pIQueryReader, [In] SafeGuidPtr pguidVendor); + } + + /// + /// An extension of the WIC factory interface that includes the ability to create an IWICImageEncoder. This interface uses a + /// Direct2D device and an input image to encode to a destination IWICBitmapEncoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicimagingfactory2 + [PInvokeData("wincodec.h", MSDNShortId = "95F64E01-6174-4C1C-B0BE-331380E583C2")] + [ComImport, Guid("7B816B45-1996-4476-B132-DE9E247C8AF0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICImagingFactory2 : IWICImagingFactory + { + /// Creates a new instance of the IWICBitmapDecoder class based on the given file. + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated string that specifies the name of an object to create or open. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: DWORD + /// The access to the object, which can be read, write, or both. + /// + /// + /// Value + /// Meaning + /// + /// + /// GENERIC_READ + /// Read access. + /// + /// + /// GENERIC_WRITE + /// Write access. + /// + /// + /// For more information, see Generic Access Rights. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to the new IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromfilename HRESULT + // CreateDecoderFromFilename( LPCWSTR wzFilename, const GUID *pguidVendor, DWORD dwDesiredAccess, WICDecodeOptions + // metadataOptions, IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoderFromFilename([MarshalAs(UnmanagedType.LPWStr)] string wzFilename, [In] SafeGuidPtr pguidVendor, ACCESS_MASK dwDesiredAccess, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICBitmapDecoder class based on the given IStream. + /// + /// Type: IStream* + /// The stream to create the decoder from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromstream HRESULT + // CreateDecoderFromStream( IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder + // **ppIDecoder ); + new IWICBitmapDecoder CreateDecoderFromStream(IStream pIStream, [In] SafeGuidPtr pguidVendor, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICBitmapDecoder based on the given file handle. + /// + /// Type: ULONG_PTR + /// The file handle to create the decoder from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred decoder vendor. Use default if no preferred vendor. + /// + /// + /// Type: WICDecodeOptions + /// The WICDecodeOptions to use when creating the decoder. + /// + /// + /// Type: IWICBitmapDecoder** + /// A pointer that receives a pointer to a new IWICBitmapDecoder. + /// + /// When a decoder is created using this method, the file handle must remain alive during the lifetime of the decoder. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoderfromfilehandle + // HRESULT CreateDecoderFromFileHandle( ULONG_PTR hFile, const GUID *pguidVendor, WICDecodeOptions metadataOptions, + // IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoderFromFileHandle(HFILE hFile, [In] SafeGuidPtr pguidVendor, WICDecodeOptions metadataOptions); + + /// Creates a new instance of the IWICComponentInfo class for the given component class identifier (CLSID). + /// + /// Type: REFCLSID + /// The CLSID for the desired component. + /// + /// + /// Type: IWICComponentInfo** + /// A pointer that receives a pointer to a new IWICComponentInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentinfo HRESULT + // CreateComponentInfo( REFCLSID clsidComponent, IWICComponentInfo **ppIInfo ); + new IWICComponentInfo CreateComponentInfo(in Guid clsidComponent); + + /// Creates a new instance of IWICBitmapDecoder. + /// + /// Type: REFGUID + /// The GUID for the desired container format. + /// + /// + /// Value + /// Meaning + /// + /// + /// GUID_ContainerFormatBmp + /// The BMP container format GUID. + /// + /// + /// GUID_ContainerFormatPng + /// The PNG container format GUID. + /// + /// + /// GUID_ContainerFormatIco + /// The ICO container format GUID. + /// + /// + /// GUID_ContainerFormatJpeg + /// The JPEG container format GUID. + /// + /// + /// GUID_ContainerFormatTiff + /// The TIFF container format GUID. + /// + /// + /// GUID_ContainerFormatGif + /// The GIF container format GUID. + /// + /// + /// GUID_ContainerFormatWmp + /// The HD Photo container format GUID. + /// + /// + /// + /// + /// Type: const GUID* + /// The GUID for the preferred encoder vendor. + /// + /// + /// Value + /// Meaning + /// + /// + /// SafeGuidPtr.Null + /// No preferred codec vendor. + /// + /// + /// GUID_VendorMicrosoft + /// Prefer to use Microsoft encoder. + /// + /// + /// GUID_VendorMicrosoftBuiltIn + /// Prefer to use the native Microsoft encoder. + /// + /// + /// + /// + /// Type: IWICBitmapDecoder** + /// + /// A pointer that receives a pointer to a new IWICBitmapDecoder. You must initialize this IWICBitmapDecoder on a stream + /// using the Initialize method later. + /// + /// + /// + /// Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. + /// The values listed are those that are natively supported by the operating system. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createdecoder HRESULT + // CreateDecoder( REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapDecoder **ppIDecoder ); + new IWICBitmapDecoder CreateDecoder(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of the IWICBitmapEncoder class. + /// + /// Type: REFGUID + /// The GUID for the desired container format. + /// + /// + /// Value + /// Meaning + /// + /// + /// GUID_ContainerFormatBmp + /// The BMP container format GUID. + /// + /// + /// GUID_ContainerFormatPng + /// The PNG container format GUID. + /// + /// + /// GUID_ContainerFormatIco + /// The ICO container format GUID. + /// + /// + /// GUID_ContainerFormatJpeg + /// The JPEG container format GUID. + /// + /// + /// GUID_ContainerFormatTiff + /// The TIFF container format GUID. + /// + /// + /// GUID_ContainerFormatGif + /// The GIF container format GUID. + /// + /// + /// GUID_ContainerFormatWmp + /// The HD Photo container format GUID. + /// + /// + /// + /// + /// Type: const GUID* + /// The GUID for the preferred encoder vendor. + /// + /// + /// Value + /// Meaning + /// + /// + /// SafeGuidPtr.Null + /// No preferred codec vendor. + /// + /// + /// GUID_VendorMicrosoft + /// Prefer to use Microsoft encoder. + /// + /// + /// GUID_VendorMicrosoftBuiltIn + /// Prefer to use the native Microsoft encoder. + /// + /// + /// + /// + /// Type: IWICBitmapEncoder** + /// A pointer that receives a pointer to a new IWICBitmapEncoder. + /// + /// + /// Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. + /// The values listed are those that are natively supported by the operating system. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createencoder HRESULT + // CreateEncoder( REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapEncoder **ppIEncoder ); + new IWICBitmapDecoder CreateEncoder(in Guid guidContainerFormat, [In] SafeGuidPtr pguidVendor); + + /// Creates a new instance of the IWICPalette class. + /// + /// Type: IWICPalette** + /// A pointer that receives a pointer to a new IWICPalette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createpalette HRESULT + // CreatePalette( IWICPalette **ppIPalette ); + new IWICPalette CreatePalette(); + + /// Creates a new instance of the IWICFormatConverter class. + /// + /// Type: IWICFormatConverter** + /// A pointer that receives a pointer to a new IWICFormatConverter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createformatconverter HRESULT + // CreateFormatConverter( IWICFormatConverter **ppIFormatConverter ); + new IWICFormatConverter CreateFormatConverter(); + + /// Creates a new instance of an IWICBitmapScaler. + /// + /// Type: IWICBitmapScaler** + /// A pointer that receives a pointer to a new IWICBitmapScaler. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapscaler HRESULT + // CreateBitmapScaler( IWICBitmapScaler **ppIBitmapScaler ); + new IWICBitmapScaler CreateBitmapScaler(); + + /// Creates a new instance of an IWICBitmapClipper object. + /// + /// Type: IWICBitmapClipper** + /// A pointer that receives a pointer to a new IWICBitmapClipper. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapclipper HRESULT + // CreateBitmapClipper( IWICBitmapClipper **ppIBitmapClipper ); + new IWICBitmapClipper CreateBitmapClipper(); + + /// Creates a new instance of an IWICBitmapFlipRotator object. + /// + /// Type: IWICBitmapFlipRotator** + /// A pointer that receives a pointer to a new IWICBitmapFlipRotator. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfliprotator HRESULT + // CreateBitmapFlipRotator( IWICBitmapFlipRotator **ppIBitmapFlipRotator ); + new IWICBitmapFlipRotator CreateBitmapFlipRotator(); + + /// Creates a new instance of the IWICStream class. + /// + /// Type: IWICStream** + /// A pointer that receives a pointer to a new IWICStream. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createstream HRESULT CreateStream( + // IWICStream **ppIWICStream ); + new IWICStream CreateStream(); + + /// Creates a new instance of the IWICColorContext class. + /// + /// Type: IWICColorContext** + /// A pointer that receives a pointer to a new IWICColorContext. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcolorcontext HRESULT + // CreateColorContext( IWICColorContext **ppIWICColorContext ); + new IWICColorContext CreateColorContext(); + + /// Creates a new instance of the IWICColorTransform class. + /// + /// Type: IWICColorTransform** + /// A pointer that receives a pointer to a new IWICColorTransform. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcolortransformer HRESULT + // CreateColorTransformer( IWICColorTransform **ppIWICColorTransform ); + new IWICColorTransform CreateColorTransformer(); + + /// Creates an IWICBitmap object. + /// + /// Type: UINT + /// The width of the new bitmap . + /// + /// + /// Type: UINT + /// The height of the new bitmap. + /// + /// + /// Type: in Guid + /// The pixel format of the new bitmap. + /// + /// + /// Type: WICBitmapCreateCacheOption + /// The cache creation options of the new bitmap. This can be one of the values in the WICBitmapCreateCacheOption enumeration. + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapCacheOnDemand + /// Allocates system memory for the bitmap at initialization. + /// + /// + /// WICBitmapCacheOnLoad + /// Allocates system memory for the bitmap when the bitmap is first used. + /// + /// + /// WICBitmapNoCache + /// This option is not valid for this method and should not be used. + /// + /// + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmap HRESULT CreateBitmap( + // UINT uiWidth, UINT uiHeight, in Guid pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmap(uint uiWidth, uint uiHeight, in Guid pixelFormat, WICBitmapCreateCacheOption option); + + /// Creates a IWICBitmap from a IWICBitmapSource. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to create the bitmap from. + /// + /// + /// Type: WICBitmapCreateCacheOption + /// The cache options of the new bitmap. This can be one of the values in the WICBitmapCreateCacheOption enumeration. + /// + /// + /// Value + /// Meaning + /// + /// + /// WICBitmapNoCache + /// Do not create a system memory copy. Share the bitmap with the source. + /// + /// + /// WICBitmapCacheOnDemand + /// Create a system memory copy when the bitmap is first used. + /// + /// + /// WICBitmapCacheOnLoad + /// Create a system memory copy when this method is called. + /// + /// + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromsource HRESULT + // CreateBitmapFromSource( IWICBitmapSource *pIBitmapSource, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromSource(IWICBitmapSource pIBitmapSource, WICBitmapCreateCacheOption option); + + /// Creates an IWICBitmap from a specified rectangle of an IWICBitmapSource. + /// + /// Type: IWICBitmapSource* + /// The IWICBitmapSource to create the bitmap from. + /// + /// + /// Type: UINT + /// The horizontal coordinate of the upper-left corner of the rectangle. + /// + /// + /// Type: UINT + /// The vertical coordinate of the upper-left corner of the rectangle. + /// + /// + /// Type: UINT + /// The width of the rectangle and the new bitmap. + /// + /// + /// Type: UINT + /// The height of the rectangle and the new bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// + /// Providing a rectangle that is larger than the source will produce undefined results. + /// This method always creates a separate copy of the source image, similar to the cache option WICBitmapCacheOnLoad. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromsourcerect HRESULT + // CreateBitmapFromSourceRect( IWICBitmapSource *pIBitmapSource, UINT x, UINT y, UINT width, UINT height, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromSourceRect(IWICBitmapSource pIBitmapSource, uint x, uint y, uint width, uint height); + + /// Creates an IWICBitmap from a memory block. + /// + /// Type: UINT + /// The width of the new bitmap. + /// + /// + /// Type: UINT + /// The height of the new bitmap. + /// + /// + /// Type: in Guid + /// The pixel format of the new bitmap. For valid pixel formats, see Native Pixel Formats. + /// + /// + /// Type: UINT + /// The number of bytes between successive scanlines in pbBuffer. + /// + /// + /// Type: UINT + /// The size of pbBuffer. + /// + /// + /// Type: BYTE* + /// The buffer used to create the bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// + /// The size of the IWICBitmap to be created must be smaller than or equal to the size of the image in pbBuffer. + /// + /// The stride of the destination bitmap will equal the stride of the source data, regardless of the width and height specified. + /// + /// The pixelFormat parameter defines the pixel format for both the input data and the output bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfrommemory HRESULT + // CreateBitmapFromMemory( UINT uiWidth, UINT uiHeight, in Guid pixelFormat, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, + // IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromMemory(uint uiWidth, uint uiHeight, in Guid pixelFormat, uint cbStride, uint cbBufferSize, [In] IntPtr pbBuffer); + + /// Creates an IWICBitmap from a bitmap handle. + /// + /// Type: HBITMAP + /// A bitmap handle to create the bitmap from. + /// + /// + /// Type: HPALETTE + /// A palette handle used to create the bitmap. + /// + /// + /// Type: WICBitmapAlphaChannelOption + /// The alpha channel options to create the bitmap. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + /// For a non-palletized bitmap, set NULL for the hPalette parameter. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromhbitmap HRESULT + // CreateBitmapFromHBITMAP( HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromHBITMAP(HBITMAP hBitmap, [Optional] HPALETTE hPalette, WICBitmapAlphaChannelOption options); + + /// Creates an IWICBitmap from an icon handle. + /// + /// Type: HICON + /// The icon handle to create the new bitmap from. + /// + /// + /// Type: IWICBitmap** + /// A pointer that receives a pointer to the new bitmap. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createbitmapfromhicon HRESULT + // CreateBitmapFromHICON( HICON hIcon, IWICBitmap **ppIBitmap ); + new IWICBitmap CreateBitmapFromHICON(HICON hIcon); + + /// Creates an IEnumUnknown object of the specified component types. + /// + /// Type: DWORD + /// The types of WICComponentType to enumerate. + /// + /// + /// Type: DWORD + /// The WICComponentEnumerateOptions used to enumerate the given component types. + /// + /// + /// Type: IEnumUnknown** + /// A pointer that receives a pointer to a new component enumerator. + /// + /// + /// Component types must be enumerated seperately. Combinations of component types and WICAllComponents are unsupported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentenumerator HRESULT + // CreateComponentEnumerator( DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown ); + new IEnumUnknown CreateComponentEnumerator(WICComponentType componentTypes, WICComponentEnumerateOptions options); + + /// Creates a new instance of the fast metadata encoder based on the given IWICBitmapDecoder. + /// + /// Type: IWICBitmapDecoder* + /// The decoder to create the fast metadata encoder from. + /// + /// + /// Type: IWICFastMetadataEncoder** + /// When this method returns, contains a pointer to the new IWICFastMetadataEncoder. + /// + /// + /// The Windows provided codecs do not support fast metadata encoding at the decoder level, and only support fast metadata + /// encoding at the frame level. To create a fast metadata encoder from a frame, see CreateFastMetadataEncoderFromFrameDecode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createfastmetadataencoderfromdecoder + // HRESULT CreateFastMetadataEncoderFromDecoder( IWICBitmapDecoder *pIDecoder, IWICFastMetadataEncoder **ppIFastEncoder ); + new IWICFastMetadataEncoder CreateFastMetadataEncoderFromDecoder(IWICBitmapDecoder pIDecoder); + + /// Creates a new instance of the fast metadata encoder based on the given image frame. + /// + /// Type: IWICBitmapFrameDecode* + /// The IWICBitmapFrameDecode to create the IWICFastMetadataEncoder from. + /// + /// + /// Type: IWICFastMetadataEncoder** + /// When this method returns, contains a pointer to a new fast metadata encoder. + /// + /// + /// For a list of support metadata formats for fast metadata encoding, see WIC Metadata Overview. + /// Examples + /// + /// The following code demonstrates how to use the CreateFastMetadataEncoderFromFrameDecode method for fast metadata encoding. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createfastmetadataencoderfromframedecode + // HRESULT CreateFastMetadataEncoderFromFrameDecode( IWICBitmapFrameDecode *pIFrameDecoder, IWICFastMetadataEncoder + // **ppIFastEncoder ); + new IWICFastMetadataEncoder CreateFastMetadataEncoderFromFrameDecode(IWICBitmapFrameDecode pIFrameDecoder); + + /// Creates a new instance of a query writer. + /// + /// Type: REFGUID + /// The GUID for the desired metadata format. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred metadata writer vendor. Use NULL if no preferred vendor. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to a new IWICMetadataQueryWriter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createquerywriter HRESULT + // CreateQueryWriter( REFGUID guidMetadataFormat, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter ); + new IWICMetadataQueryWriter CreateQueryWriter(in Guid guidMetadataFormat, [In] SafeGuidPtr pguidVendor); + + /// + /// Creates a new instance of a query writer based on the given query reader. The query writer will be pre-populated with + /// metadata from the query reader. + /// + /// + /// Type: IWICMetadataQueryReader* + /// The IWICMetadataQueryReader to create the IWICMetadataQueryWriter from. + /// + /// + /// Type: const GUID* + /// The GUID for the preferred metadata writer vendor. Use NULL if no preferred vendor. + /// + /// + /// Type: IWICMetadataQueryWriter** + /// When this method returns, contains a pointer to a new metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createquerywriterfromreader + // HRESULT CreateQueryWriterFromReader( IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor, IWICMetadataQueryWriter + // **ppIQueryWriter ); + new IWICMetadataQueryWriter CreateQueryWriterFromReader(IWICMetadataQueryReader pIQueryReader, [In] SafeGuidPtr pguidVendor); + + /// Creates a new image encoder object. + /// The ID2D1Device object on which the corresponding image encoder is created. + /// + /// A pointer to a variable that receives a pointer to the IWICImageEncoder interface for the encoder object that you can use to + /// encode Direct2D images. + /// + /// + /// You must create images to pass to the image encoder on the same Direct2D device that you pass to this method. + /// + /// You are responsible for setting up the bitmap encoder itself through the existing IWICBitmapEncoder APIs. The + /// IWICBitmapEncoder or the IWICBitmapFrameEncode object is passed to each of the IWICImageEncoder methods: + /// WriteThumbnail, WriteFrame, and WriteFrameThumbnail. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory2-createimageencoder HRESULT + // CreateImageEncoder( ID2D1Device *pD2DDevice, IWICImageEncoder **ppWICImageEncoder ); + IWICImageEncoder CreateImageEncoder(ID2D1Device pD2DDevice); + } + + /// + /// Exposes methods for decoding JPEG images. Provides access to the Start Of Frame (SOF) header, Start of Scan (SOS) header, the + /// Huffman and Quantization tables, and the compressed JPEG JPEG data. Also enables indexing for efficient random access. + /// + /// + /// Obtain this interface by calling IUnknown::QueryInterface on the Windows-provided IWICBitmapFrameDecoder interface for the JPEG decoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicjpegframedecode + [PInvokeData("wincodec.h", MSDNShortId = "E6310320-53A8-40F1-8964-D21D8054E1B8")] + [ComImport, Guid("8939F66E-C46A-4c21-A9D1-98B327CE1679"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICJpegFrameDecode + { + /// Retrieves a value indicating whether this decoder supports indexing for efficient random access. + /// + /// Type: BOOL* + /// True if indexing is supported; otherwise, false. + /// + /// Indexing is only supported for some JPEG types. Call this method + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-doessupportindexing HRESULT + // DoesSupportIndexing( BOOL *pfIndexingSupported ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportIndexing(); + + /// Enables indexing of the JPEG for efficient random access. + /// + /// Type: WICJpegIndexingOptions + /// A value specifying whether indexes should be generated immediately or deferred until a future call to IWICBitmapSource::CopyPixels. + /// + /// + /// Type: UINT + /// The granularity of the indexing, in pixels. + /// + /// + /// + /// This method enables efficient random-access to the image pixels at the expense of memory usage. The amount of memory + /// required for indexing depends on the requested index granularity. Unless SetIndexing is called, it is much more + /// efficient to access a JPEG by progressing through its pixels top-down during calls to IWICBitmapSource::CopyPixels. + /// + /// + /// This method will fail if indexing is unsupported on the file. IWICJpegFrameDecode::DoesSupportIndexing should be called to + /// first determine whether indexing is supported. If this method is called multiple times, the final call changes the index + /// granularity to the requested size. + /// + /// + /// The provided interval size controls horizontal spacing of index entries. This value is internally rounded up according to + /// the JPEGs MCU (minimum coded unit) size, which is typically either 8 or 16 unscaled pixels. The vertical size of the index + /// interval is always equal to one MCU size. + /// + /// + /// Indexes can be generated immediately, or during future calls to IWICBitmapSource::CopyPixels to reduce redundant + /// decompression work. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-setindexing HRESULT SetIndexing( + // WICJpegIndexingOptions options, UINT horizontalIntervalSize ); + void SetIndexing(WICJpegIndexingOptions options, uint horizontalIntervalSize); + + /// Removes the indexing from a JPEG that has been indexed using IWICJpegFrameDecode::SetIndexing. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-clearindexing HRESULT ClearIndexing(); + void ClearIndexing(); + + /// Retrieves a copy of the AC Huffman table for the specified scan and table. + /// + /// Type: UINT + /// The zero-based index of the scan for which data is retrieved. + /// + /// + /// Type: UINT + /// + /// The index of the AC Huffman table to retrieve. Valid indices for a given scan can be determined by retrieving the scan + /// header with IWICJpegFrameDecode::GetScanHeader. + /// + /// + /// + /// Type: DXGI_JPEG_AC_HUFFMAN_TABLE* + /// A pointer that receives the table data. This parameter must not be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-getachuffmantable HRESULT + // GetAcHuffmanTable( UINT scanIndex, UINT tableIndex, DXGI_JPEG_AC_HUFFMAN_TABLE *pAcHuffmanTable ); + DXGI_JPEG_AC_HUFFMAN_TABLE GetAcHuffmanTable(uint scanIndex, uint tableIndex); + + /// Retrieves a copy of the DC Huffman table for the specified scan and table. + /// + /// Type: UINT + /// The zero-based index of the scan for which data is retrieved. + /// + /// + /// Type: UINT + /// + /// The index of the DC Huffman table to retrieve. Valid indices for a given scan can be determined by retrieving the scan + /// header with IWICJpegFrameDecode::GetScanHeader. + /// + /// + /// + /// Type: DXGI_JPEG_AC_HUFFMAN_TABLE* + /// A pointer that receives the table data. This parameter must not be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-getdchuffmantable HRESULT + // GetDcHuffmanTable( UINT scanIndex, UINT tableIndex, DXGI_JPEG_DC_HUFFMAN_TABLE *pDcHuffmanTable ); + DXGI_JPEG_DC_HUFFMAN_TABLE GetDcHuffmanTable(uint scanIndex, uint tableIndex); + + /// Retrieves a copy of the quantization table. + /// + /// Type: UINT + /// The zero-based index of the scan for which data is retrieved. + /// + /// + /// Type: UINT + /// + /// The index of the quantization table to retrieve. Valid indices for a given scan can be determined by retrieving the scan + /// header with IWICJpegFrameDecode::GetScanHeader. + /// + /// + /// + /// Type: DXGI_JPEG_QUANTIZATION_TABLE* + /// A pointer that receives the table data. This parameter must not be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-getquantizationtable HRESULT + // GetQuantizationTable( UINT scanIndex, UINT tableIndex, DXGI_JPEG_QUANTIZATION_TABLE *pQuantizationTable ); + DXGI_JPEG_QUANTIZATION_TABLE GetQuantizationTable(uint scanIndex, uint tableIndex); + + /// + /// Retrieves header data from the entire frame. The result includes parameters from the Start Of Frame (SOF) marker for the + /// scan as well as parameters derived from other metadata such as the color model of the compressed data. + /// + /// + /// Type: WICJpegFrameHeader* + /// A pointer that receives the frame header data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-getframeheader HRESULT + // GetFrameHeader( WICJpegFrameHeader *pFrameHeader ); + WICJpegFrameHeader GetFrameHeader(); + + /// Retrieves parameters from the Start Of Scan (SOS) marker for the scan with the specified index. + /// + /// Type: UINT + /// The index of the scan for which header data is retrieved. + /// + /// + /// Type: WICJpegScanHeader* + /// A pointer that receives the frame header data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-getscanheader HRESULT + // GetScanHeader( UINT scanIndex, WICJpegScanHeader *pScanHeader ); + WICJpegScanHeader GetScanHeader(uint scanIndex); + + /// Retrieves a copy of the compressed JPEG scan directly from the WIC decoder frame's output stream. + /// + /// Type: UINT + /// The zero-based index of the scan for which data is retrieved. + /// + /// + /// Type: UINT + /// + /// The byte position in the scan data to begin copying. Use 0 on the first call. If the output buffer size is insufficient to + /// store the entire scan, this offset allows you to resume copying from the end of the previous copy operation. + /// + /// + /// + /// Type: UINT + /// The size, in bytes, of the pbScanData array. + /// + /// + /// Type: BYTE* + /// A pointer that receives the table data. This parameter must not be NULL. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the size of the scan data actually copied into pbScanData. The size returned may be smaller that the + /// size of cbScanData. This parameter may be NULL. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframedecode-copyscan HRESULT CopyScan( UINT + // scanIndex, UINT scanOffset, UINT cbScanData, BYTE *pbScanData, UINT *pcbScanDataActual ); + void CopyScan(uint scanIndex, uint scanOffset, uint cbScanData, [Out] IntPtr pbScanData, out uint pcbScanDataActual); + + /// Undocumented + /// + /// The byte position in the stream data to begin copying. Use 0 on the first call. If the output buffer size is insufficient to + /// store the entire stream, this offset allows you to resume copying from the end of the previous copy operation. + /// + /// The size, in bytes, of the pbStreamData array.. + /// A pointer that receives the stream data. This parameter must not be NULL. + /// + /// A pointer that receives the size of the stream data actually copied into pbStreamData. The size returned may be smaller that + /// the size of cbStreamData. This parameter may be NULL. + /// + void CopyMinimalStream(uint streamOffset, uint cbStreamData, [Out] IntPtr pbStreamData, out uint pcbStreamDataActual); + } + + /// + /// Exposes methods for writing compressed JPEG scan data directly to the WIC encoder's output stream. Also provides access to the + /// Huffman and quantization tables. + /// + /// + /// + /// Obtain this interface by calling IUnknown::QueryInterface on the Windows-provided IWICBitmapFrameEncoder interface for the JPEG encoder. + /// + /// The WIC JPEG encoder supports a smaller subset of JPEG features than the decoder does. + /// + /// + /// + /// The encoder is limited to a single scan. It does not support encoding images that are multi-scan, either for progressive + /// encoding or planar component data. + /// + /// + /// + /// + /// The encoder supports two quantization tables, two AC Huffman tables, and two DC Huffman tables. The luma tables are used for the + /// Y channel and, in the case of YCCK, the black channel. The chroma tables are used for the CbCr channels. + /// + /// + /// + /// The encoder supports encoding gray, YCbCr (RGB), and YCCK (CMYK). + /// + /// + /// The encoder supports 4 fixed compontent subsampling, 4:2:0, 4:2:2, 4:4:0, and 4:4:4. This subsamples chroma only. + /// + /// + /// The encoder does not support restart markers. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicjpegframeencode + [PInvokeData("wincodec.h", MSDNShortId = "631571A2-AA15-4A4B-B705-6CCC81392A6A")] + [ComImport, Guid("2F0C601F-D2C6-468C-ABFA-49495D983ED1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICJpegFrameEncode + { + /// Retrieves a copy of the AC Huffman table for the specified scan and table. + /// + /// Type: UINT + /// The zero-based index of the scan for which data is retrieved. + /// + /// + /// Type: UINT + /// The index of the AC Huffman table to retrieve. + /// + /// + /// Type: DXGI_JPEG_AC_HUFFMAN_TABLE* + /// A pointer that receives the table data. This parameter must not be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframeencode-getachuffmantable HRESULT + // GetAcHuffmanTable( UINT scanIndex, UINT tableIndex, DXGI_JPEG_AC_HUFFMAN_TABLE *pAcHuffmanTable ); + DXGI_JPEG_AC_HUFFMAN_TABLE GetAcHuffmanTable(uint scanIndex, uint tableIndex); + + /// Retrieves a copy of the DC Huffman table for the specified scan and table. + /// The zero-based index of the scan for which data is retrieved. + /// The index of the DC Huffman table to retrieve. + /// A pointer that receives the table data. This parameter must not be NULL. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframeencode-getdchuffmantable HRESULT + // GetDcHuffmanTable( UINT scanIndex, UINT tableIndex, DXGI_JPEG_DC_HUFFMAN_TABLE *pDcHuffmanTable ); + DXGI_JPEG_DC_HUFFMAN_TABLE GetDcHuffmanTable(uint scanIndex, uint tableIndex); + + /// Retrieves a copy of the quantization table. + /// + /// Type: UINT + /// The zero-based index of the scan for which data is retrieved. + /// + /// + /// Type: UINT + /// The index of the quantization table to retrieve. + /// + /// + /// Type: DXGI_JPEG_QUANTIZATION_TABLE* + /// A pointer that receives the table data. This parameter must not be NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframeencode-getquantizationtable HRESULT + // GetQuantizationTable( UINT scanIndex, UINT tableIndex, DXGI_JPEG_QUANTIZATION_TABLE *pQuantizationTable ); + DXGI_JPEG_QUANTIZATION_TABLE GetQuantizationTable(uint scanIndex, uint tableIndex); + + /// Writes scan data to a JPEG frame. + /// + /// Type: UINT + /// The size of the data in the pbScanData parameter. + /// + /// + /// Type: BYTE* + /// The scan data to write. + /// + /// + /// + /// WriteScan may be called multiple times. Each call appends the scan data specified to any previous scan data. Complete + /// the scan by calling IWICBitmapFrameEncode::Commit. + /// + /// + /// Any calls to set encoder parameters or image metadata that will appear before the scan data in the resulting JPEG file must + /// be completed before the first call to this method. This includes calls to IWICBitmapFrameEncode::SetColorContexts , + /// IWICBitmapFrameEncode::SetPalette, IWICBitmapFrameEncode::SetPixelFormat, IWICBitmapFrameEncode::SetResolution, and + /// IWICBitmapFrameEncode::SetThumbnail. IWICBitmapFrameEncode::SetSize is required as it has no default value for encoded image size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicjpegframeencode-writescan HRESULT WriteScan( UINT + // cbScanData, const BYTE *pbScanData ); + void WriteScan(uint cbScanData, [In] IntPtr pbScanData); + } + + /// Exposes methods that provide access to all of the codec's top level metadata blocks. + /// + /// + /// IWICMetadataBlockReader and IWICMetadataBlockWriter operate at the root level only; that is, they provide read and write + /// access, respectively, to the top level metadata blocks. They are implemented by IWICBitmapFrameDecode and IWICBitmapFrameEncode, + /// respectively. To handle any metadata blocks that are not at the top level of the hierarchy, use IWICMetadataReader or IWICMetadataWriter. + /// + /// + /// Note The codec's decoder and encoder implement this interface to expose the enumeration of all top level metadata blocks. + /// While the codec parses the image stream, it calls services like CreateMetadataReaderFromContainer to instantiate metadata + /// readers for any block that is recognized as being able to be embedded in the decoder's container format. The collection of + /// metadata readers is exposed through this interface. For more info, see How to Write a WIC-Enabled CODEC. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatablockreader + [PInvokeData("wincodecsdk.h", MSDNShortId = "09614b44-ebc2-44f4-9755-9df62f1b2178")] + [ComImport, Guid("FEAA2A8D-B3F3-43E4-B25C-D1DE990A1AE1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataBlockReader + { + /// Retrieves the container format of the decoder. + /// + /// Type: GUID* + /// The container format of the decoder. The native container format GUIDs are listed in WIC GUIDs and CLSIDs. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getcontainerformat + // HRESULT GetContainerFormat( GUID *pguidContainerFormat ); + Guid GetContainerFormat(); + + /// Retrieves the number of top level metadata blocks. + /// + /// Type: UINT* + /// When this method returns, contains the number of top level metadata blocks. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getcount HRESULT + // GetCount( UINT *pcCount ); + uint GetCount(); + + /// Retrieves an IWICMetadataReader for a specified top level metadata block. + /// + /// Type: UINT + /// The index of the desired top level metadata block to retrieve. + /// + /// + /// Type: IWICMetadataReader** + /// When this method returns, contains a pointer to the IWICMetadataReader specified by nIndex. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getreaderbyindex + // HRESULT GetReaderByIndex( UINT nIndex, IWICMetadataReader **ppIMetadataReader ); + IWICMetadataReader GetReaderByIndex(uint nIndex); + + /// Retrieves an enumeration of IWICMetadataReader objects representing each of the top level metadata blocks. + /// + /// Type: IEnumUnknown** + /// When this method returns, contains a pointer to an enumeration of IWICMetadataReader objects. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getenumerator HRESULT + // GetEnumerator( IEnumUnknown **ppIEnumMetadata ); + IEnumUnknown GetEnumerator(); + } + + /// + /// Exposes methods that enable the encoding of metadata. This interface is implemented by the decoder and its image frames. + /// + /// + /// When the encoder is told to commit, it goes through each metadata writer and serializes the metadata content into the encoding + /// stream. If the metadata block contains metadata important to the integrity of the file, such as the image width or height or + /// other intrinsic information about the image, the encoder must set the critical metadata items prior to serializing the metadata. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatablockwriter + [PInvokeData("wincodecsdk.h", MSDNShortId = "d8e44c64-dd58-4d36-8add-0a0b2e2af5a4")] + [ComImport, Guid("08FB9676-B444-41E8-8DBE-6A53A542BFF1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataBlockWriter : IWICMetadataBlockReader + { + /// Retrieves the container format of the decoder. + /// + /// Type: GUID* + /// The container format of the decoder. The native container format GUIDs are listed in WIC GUIDs and CLSIDs. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getcontainerformat + // HRESULT GetContainerFormat( GUID *pguidContainerFormat ); + new Guid GetContainerFormat(); + + /// Retrieves the number of top level metadata blocks. + /// + /// Type: UINT* + /// When this method returns, contains the number of top level metadata blocks. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getcount HRESULT + // GetCount( UINT *pcCount ); + new uint GetCount(); + + /// Retrieves an IWICMetadataReader for a specified top level metadata block. + /// + /// Type: UINT + /// The index of the desired top level metadata block to retrieve. + /// + /// + /// Type: IWICMetadataReader** + /// When this method returns, contains a pointer to the IWICMetadataReader specified by nIndex. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getreaderbyindex + // HRESULT GetReaderByIndex( UINT nIndex, IWICMetadataReader **ppIMetadataReader ); + new IWICMetadataReader GetReaderByIndex(uint nIndex); + + /// Retrieves an enumeration of IWICMetadataReader objects representing each of the top level metadata blocks. + /// + /// Type: IEnumUnknown** + /// When this method returns, contains a pointer to an enumeration of IWICMetadataReader objects. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockreader-getenumerator HRESULT + // GetEnumerator( IEnumUnknown **ppIEnumMetadata ); + new IEnumUnknown GetEnumerator(); + + /// + /// Initializes an IWICMetadataBlockWriter from the given IWICMetadataBlockReader. This will prepopulate the metadata block + /// writer with all the metadata in the metadata block reader. + /// + /// + /// Type: IWICMetadataBlockReader* + /// Pointer to the IWICMetadataBlockReader used to initialize the block writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockwriter-initializefromblockreader + // HRESULT InitializeFromBlockReader( IWICMetadataBlockReader *pIMDBlockReader ); + void InitializeFromBlockReader(IWICMetadataBlockReader pIMDBlockReader); + + /// Retrieves the IWICMetadataWriter that resides at the specified index. + /// + /// Type: UINT + /// The index of the metadata writer to be retrieved. This index is zero-based. + /// + /// + /// Type: IWICMetadataWriter** + /// When this method returns, contains a pointer to the metadata writer that resides at the specified index. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockwriter-getwriterbyindex + // HRESULT GetWriterByIndex( UINT nIndex, IWICMetadataWriter **ppIMetadataWriter ); + IWICMetadataWriter GetWriterByIndex(uint nIndex); + + /// Adds a top-level metadata block by adding a IWICMetadataWriter for it. + /// + /// Type: IWICMetadataWriter* + /// A pointer to the metadata writer to add to the image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockwriter-addwriter HRESULT + // AddWriter( IWICMetadataWriter *pIMetadataWriter ); + void AddWriter(IWICMetadataWriter pIMetadataWriter); + + /// Replaces the metadata writer at the specified index location. + /// + /// Type: UINT + /// The index position at which to place the metadata writer. This index is zero-based. + /// + /// + /// Type: IWICMetadataWriter* + /// A pointer to the IWICMetadataWriter. + /// + /// + /// + /// Typically, the current metadata writer at the specified index will be replaced with the new writer. However, the App0 + /// metadata writer cannot be replaced within a JPEG stream. + /// + /// + /// This function cannot be used to add metadata writers. If no metadata writer exists at the specified index, the function will fail. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockwriter-setwriterbyindex + // HRESULT SetWriterByIndex( UINT nIndex, IWICMetadataWriter *pIMetadataWriter ); + void SetWriterByIndex(uint nIndex, IWICMetadataWriter pIMetadataWriter); + + /// Removes the metadata writer from the specified index location. + /// + /// Type: UINT + /// The index of the metadata writer to remove. + /// + /// + /// After removing a metadata writer, remaining metadata writers can be expected to move up to occupy the vacated location. + /// Indexes for remaining metadata items as well as the count will change. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatablockwriter-removewriterbyindex + // HRESULT RemoveWriterByIndex( UINT nIndex ); + void RemoveWriterByIndex(uint nIndex); + } + + /// Exposes methods that provide basic information about the registered metadata handler. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatahandlerinfo + [ComImport, Guid("ABA958BF-C672-44D1-8D61-CE6DF2E682C2"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataHandlerInfo : IWICComponentInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves the metadata format of the metadata handler. + /// + /// Type: GUID* + /// Pointer that receives the metadata format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getmetadataformat + // HRESULT GetMetadataFormat( GUID *pguidMetadataFormat ); + Guid GetMetadataFormat(); + + /// Retrieves the container formats supported by the metadata handler. + /// + /// Type: UINT + /// The size of the pguidContainerFormats array. + /// + /// + /// Type: GUID* + /// Pointer to an array that receives the container formats supported by the metadata handler. + /// + /// + /// Type: UINT* + /// The actual number of GUIDs added to the array. + /// To obtain the number of supported container formats, pass to pguidContainerFormats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getcontainerformats + // HRESULT GetContainerFormats( UINT cContainerFormats, GUID *pguidContainerFormats, UINT *pcchActual ); + void GetContainerFormats(uint cContainerFormats, [Out] Guid[] pguidContainerFormats, out uint pcchActual); + + /// Retrieves the device manufacturer of the metadata handler. + /// + /// Type: UINT + /// The size of the wzDeviceManufacturer buffer. + /// + /// + /// Type: WCHAR* + /// Pointer to the buffer that receives the name of the device manufacturer. + /// + /// + /// Type: UINT* + /// The actual string buffer length needed to obtain the entire name of the device manufacturer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getdevicemanufacturer + // HRESULT GetDeviceManufacturer( UINT cchDeviceManufacturer, WCHAR *wzDeviceManufacturer, UINT *pcchActual ); + void GetDeviceManufacturer(uint cchDeviceManufacturer, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceManufacturer, out uint pcchActual); + + /// Retrieves the device models that support the metadata handler. + /// + /// Type: UINT + /// The length of the wzDeviceModels buffer. + /// + /// + /// Type: WCHAR* + /// Pointer that receives the device models supported by the metadata handler. + /// + /// + /// Type: UINT* + /// The actual length needed to retrieve the device models. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getdevicemodels HRESULT + // GetDeviceModels( UINT cchDeviceModels, WCHAR *wzDeviceModels, UINT *pcchActual ); + void GetDeviceModels(uint cchDeviceModels, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceModels, out uint pcchActual); + + /// Determines if the handler requires a full stream. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if a full stream is required; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doesrequirefullstream + // HRESULT DoesRequireFullStream( BOOL *pfRequiresFullStream ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesRequireFullStream(); + + /// Determines if the metadata handler supports padding. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if padding is supported; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doessupportpadding + // HRESULT DoesSupportPadding( BOOL *pfSupportsPadding ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportPadding(); + + /// Determines if the metadata handler requires a fixed size. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if a fixed size is required; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doesrequirefixedsize + // HRESULT DoesRequireFixedSize( BOOL *pfFixedSize ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesRequireFixedSize(); + } + + /// + /// Exposes methods for retrieving metadata blocks and items from a decoder or its image frames using a metadata query expression. + /// + /// + /// + /// A metadata query reader uses metadata query expressions to access embedded metadata. For more information on the metadata query + /// language, see the Metadata Query Language Overview. + /// + /// The benefit of the query reader is the ability to access a metadata item in a single step. + /// + /// The query reader also provides the way to traverse the whole set of metadata hierarchy with the help of the GetEnumerator + /// method. However, it is not recommended to use this method since IWICMetadataBlockReader and IWICMetadataReader provide a more + /// convenient and cheaper way. + /// + /// Examples + /// The following code demonstrates how to obtain a query reader and use it to retrieve a metadata item. + /// The following code demonstrates how to obtain query reader and use it to retrieve a nested metadata block. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicmetadataqueryreader + [PInvokeData("wincodec.h", MSDNShortId = "588e00d2-e166-4ce5-bd8a-50ad0d5a3db9")] + [ComImport, Guid("30989668-E1C9-4597-B395-458EEDB808DF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataQueryReader + { + /// Gets the metadata query readers container format. + /// + /// Type: GUID* + /// Pointer that receives the cointainer format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + Guid GetContainerFormat(); + + /// Retrieves the current path relative to the root metadata block. + /// + /// Type: UINT + /// The length of the wzNamespace buffer. + /// + /// + /// Type: WCHAR* + /// Pointer that receives the current namespace location. + /// + /// + /// Type: UINT* + /// The actual buffer length that was needed to retrieve the current namespace location. + /// + /// + /// + /// If you pass NULL to wzNamespace, GetLocation ignores cchMaxLength and returns the required buffer length to + /// store the path in the variable that pcchActualLength points to. + /// + /// If the query reader is relative to the top of the metadata hierarchy, it will return a single-char string. + /// + /// If the query reader is relative to a nested metadata block, this method will return the path to the current query reader. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getlocation HRESULT + // GetLocation( UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength ); + void GetLocation(uint cchMaxLength, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzNamespace, out uint pcchActualLength); + + /// Retrieves the metadata block or item identified by a metadata query expression. + /// + /// Type: LPCWSTR + /// The query expression to the requested metadata block or item. + /// + /// + /// Type: PROPVARIANT* + /// When this method returns, contains the metadata block or item requested. + /// + /// + /// + /// GetMetadataByName uses metadata query expressions to access embedded metadata. For more information on the metadata + /// query language, see the Metadata Query Language Overview. + /// + /// + /// If multiple blocks or items exist that are expressed by the same query expression, the first metadata block or item found + /// will be returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getmetadatabyname HRESULT + // GetMetadataByName( LPCWSTR wzName, PROPVARIANT *pvarValue ); + void GetMetadataByName([MarshalAs(UnmanagedType.LPWStr)] string wzName, [Out] PROPVARIANT pvarValue); + + /// Gets an enumerator of all metadata items at the current relative location within the metadata hierarchy. + /// + /// Type: IEnumString** + /// + /// A pointer to a variable that receives a pointer to the IEnumString interface for the enumerator that contains query strings + /// that can be used in the current IWICMetadataQueryReader. + /// + /// + /// + /// The retrieved enumerator only contains query strings for the metadata blocks and items in the current level of the hierarchy. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getenumerator HRESULT + // GetEnumerator( IEnumString **ppIEnumString ); + IEnumString GetEnumerator(); + } + + /// + /// Exposes methods for setting or removing metadata blocks and items to an encoder or its image frames using a metadata query expression. + /// + /// + /// + /// A metadata query writer uses metadata query expressions to set or remove metadata. For more information on the metadata query + /// language, see the Metadata Query Language Overview. + /// + /// Examples + /// The following code demonstrates how to create an XMP query writer and add a new metadata item to it. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicmetadataquerywriter + [PInvokeData("wincodec.h", MSDNShortId = "065cccc3-778f-42c4-823a-354b08bbd1f1")] + [ComImport, Guid("A721791A-0DEF-4d06-BD91-2118BF1DB10B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataQueryWriter : IWICMetadataQueryReader + { + /// Gets the metadata query readers container format. + /// + /// Type: GUID* + /// Pointer that receives the cointainer format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getcontainerformat HRESULT + // GetContainerFormat( GUID *pguidContainerFormat ); + new Guid GetContainerFormat(); + + /// Retrieves the current path relative to the root metadata block. + /// + /// Type: UINT + /// The length of the wzNamespace buffer. + /// + /// + /// Type: WCHAR* + /// Pointer that receives the current namespace location. + /// + /// + /// Type: UINT* + /// The actual buffer length that was needed to retrieve the current namespace location. + /// + /// + /// + /// If you pass NULL to wzNamespace, GetLocation ignores cchMaxLength and returns the required buffer length to + /// store the path in the variable that pcchActualLength points to. + /// + /// If the query reader is relative to the top of the metadata hierarchy, it will return a single-char string. + /// + /// If the query reader is relative to a nested metadata block, this method will return the path to the current query reader. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getlocation HRESULT + // GetLocation( UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength ); + new void GetLocation(uint cchMaxLength, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzNamespace, out uint pcchActualLength); + + /// Retrieves the metadata block or item identified by a metadata query expression. + /// + /// Type: LPCWSTR + /// The query expression to the requested metadata block or item. + /// + /// + /// Type: PROPVARIANT* + /// When this method returns, contains the metadata block or item requested. + /// + /// + /// + /// GetMetadataByName uses metadata query expressions to access embedded metadata. For more information on the metadata + /// query language, see the Metadata Query Language Overview. + /// + /// + /// If multiple blocks or items exist that are expressed by the same query expression, the first metadata block or item found + /// will be returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getmetadatabyname HRESULT + // GetMetadataByName( LPCWSTR wzName, PROPVARIANT *pvarValue ); + new void GetMetadataByName([MarshalAs(UnmanagedType.LPWStr)] string wzName, [Out] PROPVARIANT pvarValue); + + /// Gets an enumerator of all metadata items at the current relative location within the metadata hierarchy. + /// + /// Type: IEnumString** + /// + /// A pointer to a variable that receives a pointer to the IEnumString interface for the enumerator that contains query strings + /// that can be used in the current IWICMetadataQueryReader. + /// + /// + /// + /// The retrieved enumerator only contains query strings for the metadata blocks and items in the current level of the hierarchy. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataqueryreader-getenumerator HRESULT + // GetEnumerator( IEnumString **ppIEnumString ); + new IEnumString GetEnumerator(); + + /// Sets a metadata item to a specific location. + /// + /// Type: LPCWSTR + /// The name of the metadata item. + /// + /// + /// Type: const PROPVARIANT* + /// The metadata to set. + /// + /// + /// + /// SetMetadataByName uses metadata query expressions to remove metadata. For more information on the metadata query + /// language, see the Metadata Query Language Overview. + /// + /// + /// If the value set is a nested metadata block then use variant type and pvarValue pointing to the IWICMetadataQueryWriter of + /// the new metadata block. The ordering of metadata items is at the discretion of the query writer since relative locations are + /// not specified. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataquerywriter-setmetadatabyname HRESULT + // SetMetadataByName( LPCWSTR wzName, const PROPVARIANT *pvarValue ); + void SetMetadataByName([MarshalAs(UnmanagedType.LPWStr)] string wzName, [In] PROPVARIANT pvarValue); + + /// Removes a metadata item from a specific location using a metadata query expression. + /// + /// Type: LPCWSTR + /// The name of the metadata item to remove. + /// + /// + /// + /// RemoveMetadataByName uses metadata query expressions to remove metadata. For more information on the metadata query + /// language, see the Metadata Query Language Overview. + /// + /// If the metadata item is a metadata block, it is removed from the metadata hierarchy. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicmetadataquerywriter-removemetadatabyname HRESULT + // RemoveMetadataByName( LPCWSTR wzName ); + void RemoveMetadataByName([MarshalAs(UnmanagedType.LPWStr)] string wzName); + } + + /// + /// Exposes methods that provide access to underlining metadata content. This interface is implemented by independent software + /// vendors (ISVs) to create new metadata readers. + /// + /// + /// A metadata reader can be used to access metadata blocks and items within a metadata block instead of using a query reader. To + /// directly access the metadata reader, query a decoder or its frames for the IWICMetadataBlockReader interface to enumerate each + /// metadata reader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatareader + [PInvokeData("wincodecsdk.h", MSDNShortId = "0495ecf1-128a-4576-8420-0e79f1454015")] + [ComImport, Guid("9204FE99-D8FC-4FD5-A001-9536B067A899"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataReader + { + /// Gets the metadata format associated with the reader. + /// + /// Type: GUID* + /// Pointer that receives the metadata format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getmetadataformat HRESULT + // GetMetadataFormat( GUID *pguidMetadataFormat ); + Guid GetMetadataFormat(); + + /// Gets the metadata handler info associated with the reader. + /// + /// Type: IWICMetadataHandlerInfo** + /// Pointer that receives a pointer to the IWICMetadataHandlerInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getmetadatahandlerinfo + // HRESULT GetMetadataHandlerInfo( IWICMetadataHandlerInfo **ppIHandler ); + IWICMetadataHandlerInfo GetMetadataHandlerInfo(); + + /// Gets the number of metadata items within the reader. + /// + /// Type: UINT* + /// Pointer that receives the number of metadata items within the reader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getcount HRESULT GetCount( + // UINT *pcCount ); + uint GetCount(); + + /// Gets the metadata item at the given index. + /// + /// Type: UINT + /// The index of the metadata item to retrieve. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the schema property. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the id property. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the metadata value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getvaluebyindex HRESULT + // GetValueByIndex( UINT nIndex, PROPVARIANT *pvarSchema, PROPVARIANT *pvarId, PROPVARIANT *pvarValue ); + void GetValueByIndex(uint nIndex, [In, Out] PROPVARIANT pvarSchema, [In, Out] PROPVARIANT pvarId, [In, Out] PROPVARIANT pvarValue); + + /// Gets the metadata item value. + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata item's schema property. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata item's id. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the metadata value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getvalue HRESULT GetValue( + // const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, PROPVARIANT *pvarValue ); + void GetValue([In, Optional] PROPVARIANT pvarSchema, [In] PROPVARIANT pvarId, [In, Out, Optional] PROPVARIANT pvarValue); + + /// Gets an enumerator of all the metadata items. + /// + /// Type: IWICEnumMetadataItem** + /// Pointer that receives a pointer to the metadata enumerator. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getenumerator HRESULT + // GetEnumerator( IWICEnumMetadataItem **ppIEnumMetadata ); + IWICEnumMetadataItem GetEnumerator(); + } + + /// Exposes methods that provide basic information about the registered metadata reader. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatareaderinfo + [PInvokeData("wincodecsdk.h", MSDNShortId = "f72d9a06-0568-4e46-a904-202aad2f8859")] + [ComImport, Guid("EEBF1F5B-07C1-4447-A3AB-22ACAF78A804"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataReaderInfo : IWICMetadataHandlerInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves the metadata format of the metadata handler. + /// + /// Type: GUID* + /// Pointer that receives the metadata format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getmetadataformat + // HRESULT GetMetadataFormat( GUID *pguidMetadataFormat ); + new Guid GetMetadataFormat(); + + /// Retrieves the container formats supported by the metadata handler. + /// + /// Type: UINT + /// The size of the pguidContainerFormats array. + /// + /// + /// Type: GUID* + /// Pointer to an array that receives the container formats supported by the metadata handler. + /// + /// + /// Type: UINT* + /// The actual number of GUIDs added to the array. + /// To obtain the number of supported container formats, pass to pguidContainerFormats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getcontainerformats + // HRESULT GetContainerFormats( UINT cContainerFormats, GUID *pguidContainerFormats, UINT *pcchActual ); + new void GetContainerFormats(uint cContainerFormats, [Out] Guid[] pguidContainerFormats, out uint pcchActual); + + /// Retrieves the device manufacturer of the metadata handler. + /// + /// Type: UINT + /// The size of the wzDeviceManufacturer buffer. + /// + /// + /// Type: WCHAR* + /// Pointer to the buffer that receives the name of the device manufacturer. + /// + /// + /// Type: UINT* + /// The actual string buffer length needed to obtain the entire name of the device manufacturer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getdevicemanufacturer + // HRESULT GetDeviceManufacturer( UINT cchDeviceManufacturer, WCHAR *wzDeviceManufacturer, UINT *pcchActual ); + new void GetDeviceManufacturer(uint cchDeviceManufacturer, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceManufacturer, out uint pcchActual); + + /// Retrieves the device models that support the metadata handler. + /// + /// Type: UINT + /// The length of the wzDeviceModels buffer. + /// + /// + /// Type: WCHAR* + /// Pointer that receives the device models supported by the metadata handler. + /// + /// + /// Type: UINT* + /// The actual length needed to retrieve the device models. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getdevicemodels HRESULT + // GetDeviceModels( UINT cchDeviceModels, WCHAR *wzDeviceModels, UINT *pcchActual ); + new void GetDeviceModels(uint cchDeviceModels, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceModels, out uint pcchActual); + + /// Determines if the handler requires a full stream. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if a full stream is required; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doesrequirefullstream + // HRESULT DoesRequireFullStream( BOOL *pfRequiresFullStream ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesRequireFullStream(); + + /// Determines if the metadata handler supports padding. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if padding is supported; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doessupportpadding + // HRESULT DoesSupportPadding( BOOL *pfSupportsPadding ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportPadding(); + + /// Determines if the metadata handler requires a fixed size. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if a fixed size is required; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doesrequirefixedsize + // HRESULT DoesRequireFixedSize( BOOL *pfFixedSize ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesRequireFixedSize(); + + /// Gets the metadata patterns associated with the metadata reader. + /// + /// Type: REFGUID + /// The cointainer format GUID. + /// + /// + /// Type: UINT + /// The size, in bytes, of the pPattern buffer. + /// + /// + /// Type: WICMetadataPattern* + /// Pointer that receives the metadata patterns. + /// + /// + /// Type: UINT* + /// Pointer that receives the number of metadata patterns. + /// + /// + /// Type: UINT* + /// Pointer that receives the size, in bytes, needed to obtain the metadata patterns. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareaderinfo-getpatterns HRESULT + // GetPatterns( REFGUID guidContainerFormat, UINT cbSize, WICMetadataPattern *pPattern, UINT *pcCount, UINT *pcbActual ); + void GetPatterns(in Guid guidContainerFormat, uint cbSize, [Out, Optional] IntPtr pPattern, out uint pcCount, out uint pcbActual); + + /// Determines if a stream contains a metadata item pattern. + /// + /// Type: REFGUID + /// The container format of the metadata item. + /// + /// + /// Type: IStream* + /// The stream to search for the metadata pattern. + /// + /// + /// Type: BOOL* + /// Pointer that receives if the stream contains the pattern; otherwise, . + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareaderinfo-matchespattern HRESULT + // MatchesPattern( REFGUID guidContainerFormat, IStream *pIStream, BOOL *pfMatches ); + [return: MarshalAs(UnmanagedType.Bool)] + bool MatchesPattern(in Guid guidContainerFormat, IStream pIStream); + + /// Creates an instance of an IWICMetadataReader. + /// + /// Type: IWICMetadataReader** + /// Pointer that receives a pointer to a metadata reader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareaderinfo-createinstance HRESULT + // CreateInstance( IWICMetadataReader **ppIReader ); + IWICMetadataReader CreateInstance(); + } + + /// + /// Exposes methods that provide access to writing metadata content. This is implemented by independent software vendors (ISVs) to + /// create new metadata writers. + /// + /// + /// A metadata writer can be used to write metadata blocks and items within a metadata block instead of using a query writer. To + /// directly access the metadata writer, query an encoder or its frames for the IWICMetadataBlockWriter interface to enumerate each + /// metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatawriter + [PInvokeData("wincodecsdk.h", MSDNShortId = "7e742a96-f9d0-49e1-80e4-31ec90680e60")] + [ComImport, Guid("F7836E16-3BE0-470B-86BB-160D0AECD7DE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataWriter : IWICMetadataReader + { + /// Gets the metadata format associated with the reader. + /// + /// Type: GUID* + /// Pointer that receives the metadata format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getmetadataformat HRESULT + // GetMetadataFormat( GUID *pguidMetadataFormat ); + new Guid GetMetadataFormat(); + + /// Gets the metadata handler info associated with the reader. + /// + /// Type: IWICMetadataHandlerInfo** + /// Pointer that receives a pointer to the IWICMetadataHandlerInfo. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getmetadatahandlerinfo + // HRESULT GetMetadataHandlerInfo( IWICMetadataHandlerInfo **ppIHandler ); + new IWICMetadataHandlerInfo GetMetadataHandlerInfo(); + + /// Gets the number of metadata items within the reader. + /// + /// Type: UINT* + /// Pointer that receives the number of metadata items within the reader. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getcount HRESULT GetCount( + // UINT *pcCount ); + new uint GetCount(); + + /// Gets the metadata item at the given index. + /// + /// Type: UINT + /// The index of the metadata item to retrieve. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the schema property. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the id property. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the metadata value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getvaluebyindex HRESULT + // GetValueByIndex( UINT nIndex, PROPVARIANT *pvarSchema, PROPVARIANT *pvarId, PROPVARIANT *pvarValue ); + new void GetValueByIndex(uint nIndex, [In, Out] PROPVARIANT pvarSchema, [In, Out] PROPVARIANT pvarId, [In, Out] PROPVARIANT pvarValue); + + /// Gets the metadata item value. + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata item's schema property. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata item's id. + /// + /// + /// Type: PROPVARIANT* + /// Pointer that receives the metadata value. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getvalue HRESULT GetValue( + // const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, PROPVARIANT *pvarValue ); + new void GetValue([In, Optional] PROPVARIANT pvarSchema, [In] PROPVARIANT pvarId, [In, Out, Optional] PROPVARIANT pvarValue); + + /// Gets an enumerator of all the metadata items. + /// + /// Type: IWICEnumMetadataItem** + /// Pointer that receives a pointer to the metadata enumerator. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareader-getenumerator HRESULT + // GetEnumerator( IWICEnumMetadataItem **ppIEnumMetadata ); + new IWICEnumMetadataItem GetEnumerator(); + + /// Sets the given metadata item. + /// + /// Type: const PROPVARIANT* + /// Pointer to the schema property of the metadata item. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the id property of the metadata item. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata value to set + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriter-setvalue HRESULT SetValue( + // const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, const PROPVARIANT *pvarValue ); + void SetValue([In, Optional] PROPVARIANT pvarSchema, [In] PROPVARIANT pvarId, [In] PROPVARIANT pvarValue); + + /// Sets the metadata item to the specified index. + /// + /// Type: UINT + /// The index to place the metadata item. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the schema property of the metadata item. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the id property of the metadata item. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata value to set at the given index. + /// + /// + /// After removing an item, expect the remaining metadata items to move up to occupy the vacated metadata item location. + /// Therefore indices for remaining metadata items as well as the count will change. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriter-setvaluebyindex HRESULT + // SetValueByIndex( UINT nIndex, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, const PROPVARIANT *pvarValue ); + void SetValueByIndex(uint nIndex, [In, Optional] PROPVARIANT pvarSchema, [In] PROPVARIANT pvarId, [In] PROPVARIANT pvarValue); + + /// Removes the metadata item that matches the given parameters. + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata schema property. + /// + /// + /// Type: const PROPVARIANT* + /// Pointer to the metadata id property. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriter-removevalue HRESULT + // RemoveValue( const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId ); + void RemoveValue([In, Optional] PROPVARIANT pvarSchema, [In] PROPVARIANT pvarId); + + /// Removes the metadata item at the specified index. + /// + /// Type: UINT + /// The index of the metadata item to remove. + /// + /// + /// After removing an item, expect the remaining metadata items to move up to occupy the vacated metadata item location. + /// Therefore indices for remaining metadata items as well as the count will change. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriter-removevaluebyindex HRESULT + // RemoveValueByIndex( UINT nIndex ); + void RemoveValueByIndex(uint nIndex); + } + + /// Exposes methods that provide basic information about the registered metadata writer. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicmetadatawriterinfo + [PInvokeData("wincodecsdk.h", MSDNShortId = "467200e7-9b08-4372-9a01-660e56a15bfe")] + [ComImport, Guid("B22E3FBA-3925-4323-B5C1-9EBFC430F236"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICMetadataWriterInfo : IWICMetadataHandlerInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Retrieves the metadata format of the metadata handler. + /// + /// Type: GUID* + /// Pointer that receives the metadata format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getmetadataformat + // HRESULT GetMetadataFormat( GUID *pguidMetadataFormat ); + new Guid GetMetadataFormat(); + + /// Retrieves the container formats supported by the metadata handler. + /// + /// Type: UINT + /// The size of the pguidContainerFormats array. + /// + /// + /// Type: GUID* + /// Pointer to an array that receives the container formats supported by the metadata handler. + /// + /// + /// Type: UINT* + /// The actual number of GUIDs added to the array. + /// To obtain the number of supported container formats, pass to pguidContainerFormats. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getcontainerformats + // HRESULT GetContainerFormats( UINT cContainerFormats, GUID *pguidContainerFormats, UINT *pcchActual ); + new void GetContainerFormats(uint cContainerFormats, [Out] Guid[] pguidContainerFormats, out uint pcchActual); + + /// Retrieves the device manufacturer of the metadata handler. + /// + /// Type: UINT + /// The size of the wzDeviceManufacturer buffer. + /// + /// + /// Type: WCHAR* + /// Pointer to the buffer that receives the name of the device manufacturer. + /// + /// + /// Type: UINT* + /// The actual string buffer length needed to obtain the entire name of the device manufacturer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getdevicemanufacturer + // HRESULT GetDeviceManufacturer( UINT cchDeviceManufacturer, WCHAR *wzDeviceManufacturer, UINT *pcchActual ); + new void GetDeviceManufacturer(uint cchDeviceManufacturer, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceManufacturer, out uint pcchActual); + + /// Retrieves the device models that support the metadata handler. + /// + /// Type: UINT + /// The length of the wzDeviceModels buffer. + /// + /// + /// Type: WCHAR* + /// Pointer that receives the device models supported by the metadata handler. + /// + /// + /// Type: UINT* + /// The actual length needed to retrieve the device models. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-getdevicemodels HRESULT + // GetDeviceModels( UINT cchDeviceModels, WCHAR *wzDeviceModels, UINT *pcchActual ); + new void GetDeviceModels(uint cchDeviceModels, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDeviceModels, out uint pcchActual); + + /// Determines if the handler requires a full stream. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if a full stream is required; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doesrequirefullstream + // HRESULT DoesRequireFullStream( BOOL *pfRequiresFullStream ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesRequireFullStream(); + + /// Determines if the metadata handler supports padding. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if padding is supported; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doessupportpadding + // HRESULT DoesSupportPadding( BOOL *pfSupportsPadding ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesSupportPadding(); + + /// Determines if the metadata handler requires a fixed size. + /// + /// Type: BOOL* + /// Pointer that receives TRUE if a fixed size is required; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatahandlerinfo-doesrequirefixedsize + // HRESULT DoesRequireFixedSize( BOOL *pfFixedSize ); + [return: MarshalAs(UnmanagedType.Bool)] + new bool DoesRequireFixedSize(); + + /// Gets the metadata header for the metadata writer. + /// + /// Type: REFGUID + /// The format container GUID to obtain the header for. + /// + /// + /// Type: UINT + /// The size of the pHeader buffer. + /// + /// + /// Type: WICMetadataHeader* + /// Pointer that receives the WICMetadataHeader. + /// + /// + /// Type: UINT* + /// The actual size of the header. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriterinfo-getheader HRESULT + // GetHeader( REFGUID guidContainerFormat, UINT cbSize, WICMetadataHeader *pHeader, UINT *pcbActual ); + void GetHeader(in Guid guidContainerFormat, uint cbSize, [Out] IntPtr pHeader, out uint pcbActual); + + /// Creates an instance of an IWICMetadataWriter. + /// + /// Type: IWICMetadataWriter** + /// Pointer that receives a pointer to a metadata writer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriterinfo-createinstance HRESULT + // CreateInstance( IWICMetadataWriter **ppIWriter ); + IWICMetadataWriter CreateInstance(); + } + + /// Exposes methods for accessing and building a color table, primarily for indexed pixel formats. + /// + /// + /// If the WICBitmapPaletteType is not WICBitmapPaletteCustom, then the colors are automatically generated based on the table + /// above. If the user subsequently changes a color palette entry the WICBitmapPalette is set to Custom by that action. + /// + /// + /// InitializeFromBitmap's fAddTransparentColor parameter will add a transparent color to the end of the color collection if its + /// size if less than 256, otherwise index 255 will be replaced with the transparent color. If a pre-defined palette type is used, + /// it will change to BitmapPaletteTypeCustom since it no longer matches the predefined palette. + /// + /// + /// The palette interface is an auxiliary imaging interface in that it does not directly concern bitmaps and pixels; rather it + /// provides indexed color translation for indexed bitmaps. For an indexed pixel format with M bits per pixels: (The number of + /// colors in the palette) greater than 2^M. + /// + /// + /// Traditionally the basic operation of the palette is to provide a translation from a byte (or smaller) index into a 32bpp color + /// value. This is often accomplished by a 256 entry table of color values. + /// + /// Examples + /// In this example code, WICColor is defined as a UINT32 value with this layout: + /// The wincodec.h header type-defines WICColor as UINT32. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicpalette + [PInvokeData("wincodec.h", MSDNShortId = "cb0e4f92-4aff-48c7-af62-5f7154539289")] + [ComImport, Guid("00000040-a8f2-4877-ba0a-fd2b6645fb94"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPalette + { + /// + /// Initializes the palette to one of the pre-defined palettes specified by WICBitmapPaletteType and optionally adds a + /// transparent color. + /// + /// + /// Type: WICBitmapPaletteType + /// The desired pre-defined palette type. + /// + /// + /// Type: BOOL + /// + /// The optional transparent color to add to the palette. If no transparent color is needed, use 0. When initializing to a + /// grayscale or black and white palette, set this parameter to FALSE. + /// + /// + /// + /// If a transparent color is added to a palette, the palette is no longer predefined and is returned as + /// WICBitmapPaletteTypeCustom. For palettes with less than 256 entries, the transparent entry is added to the end of the + /// palette (that is, a 16-color palette becomes a 17-color palette). For palettes with 256 colors, the transparent palette + /// entry will replace the last entry in the pre-defined palette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-initializepredefined HRESULT + // InitializePredefined( WICBitmapPaletteType ePaletteType, BOOL fAddTransparentColor ); + void InitializePredefined(WICBitmapPaletteType ePaletteType, [MarshalAs(UnmanagedType.Bool)] bool fAddTransparentColor); + + /// Initializes a palette to the custom color entries provided. + /// + /// Type: WICColor* + /// Pointer to the color array. + /// + /// + /// Type: UINT + /// The number of colors in pColors. + /// + /// + /// + /// If a transparent color is required, provide it as part of the custom entries. To add a transparent value to the palette, its + /// alpha value must be 0 (0x00RRGGBB). + /// + /// The entry count is limited to 256. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-initializecustom HRESULT + // InitializeCustom( WICColor *pColors, UINT cCount ); + void InitializeCustom([In] uint[] pColors, uint cCount); + + /// Initializes a palette using a computed optimized values based on the reference bitmap. + /// + /// Type: IWICBitmapSource* + /// Pointer to the source bitmap. + /// + /// + /// Type: UINT + /// The number of colors to initialize the palette with. + /// + /// + /// Type: BOOL + /// A value to indicate whether to add a transparent color. + /// + /// + /// The resulting palette contains the specified number of colors which best represent the colors present in the bitmap. The + /// algorithm operates on the opaque RGB color value of each pixel in the reference bitmap and hence ignores any alpha values. + /// If a transparent color is required, set the fAddTransparentColor parameter to TRUE and one fewer optimized color will + /// be computed, reducing the colorCount, and a fully transparent color entry will be added. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-initializefrombitmap HRESULT + // InitializeFromBitmap( IWICBitmapSource *pISurface, UINT cCount, BOOL fAddTransparentColor ); + void InitializeFromBitmap([Optional] IWICBitmapSource pISurface, uint cCount, [MarshalAs(UnmanagedType.Bool)] bool fAddTransparentColor); + + /// Initialize the palette based on a given palette. + /// + /// Type: IWICPalette* + /// Pointer to the source palette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-initializefrompalette HRESULT + // InitializeFromPalette( IWICPalette *pIPalette ); + void InitializeFromPalette(IWICPalette pIPalette); + + /// Retrieves the WICBitmapPaletteType that describes the palette. + /// + /// Type: WICBitmapPaletteType* + /// Pointer that receives the palette type of the bimtap. + /// + /// + /// WICBitmapPaletteCustom is used for palettes initialized from both InitializeCustom and InitializeFromBitmap. There is + /// no distinction is made between optimized and custom palettes. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-gettype HRESULT GetType( + // WICBitmapPaletteType *pePaletteType ); + WICBitmapPaletteType GetType(); + + /// Retrieves the number of colors in the color table. + /// + /// Type: UINT* + /// Pointer that receives the number of colors in the color table. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-getcolorcount HRESULT GetColorCount( UINT + // *pcCount ); + uint GetColorCount(); + + /// + /// Fills out the supplied color array with the colors from the internal color table. The color array should be sized according + /// to the return results from GetColorCount. + /// + /// + /// Type: UINT + /// The size of the pColors array. + /// + /// + /// Type: WICColor* + /// Pointer that receives the colors of the palette. + /// + /// + /// Type: UINT* + /// The actual size needed to obtain the palette colors. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-getcolors HRESULT GetColors( UINT cCount, + // WICColor *pColors, UINT *pcActualColors ); + void GetColors(uint cCount, [In] uint[] pColors, out uint pcActualColors); + + /// Retrieves a value that describes whether the palette is black and white. + /// + /// Type: BOOL* + /// + /// A pointer to a variable that receives a boolean value that indicates whether the palette is black and white. TRUE + /// indicates that the palette is black and white; otherwise, FALSE. + /// + /// + /// + /// A palette is considered to be black and white only if it contains exactly two entries, one full black (0xFF000000) and one + /// full white (0xFFFFFFF). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-isblackwhite HRESULT IsBlackWhite( BOOL + // *pfIsBlackWhite ); + [return: MarshalAs(UnmanagedType.Bool)] + bool IsBlackWhite(); + + /// Retrieves a value that describes whether a palette is grayscale. + /// + /// Type: BOOL* + /// + /// A pointer to a variable that receives a boolean value that indicates whether the palette is grayscale. TRUE indicates + /// that the palette is grayscale; otherwise FALSE. + /// + /// + /// + /// A palette is considered grayscale only if, for every entry, the alpha value is 0xFF and the red, green and blue values match. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-isgrayscale HRESULT IsGrayscale( BOOL + // *pfIsGrayscale ); + [return: MarshalAs(UnmanagedType.Bool)] + bool IsGrayscale(); + + /// + /// Indicates whether the palette contains an entry that is non-opaque (that is, an entry with an alpha that is less than 1). + /// + /// + /// Type: BOOL* + /// Pointer that receives if the palette contains a transparent color; otherwise, . + /// + /// + /// Various image formats support alpha in different ways. PNG has full alpha support by supporting partially transparent + /// palette entries. GIF stores colors as 24bpp, without alpha, but allows one palette entry to be specified as fully + /// transparent. If a palette has multiple fully transparent entries (0x00RRGGBB), GIF will use the last one as its transparent index. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpalette-hasalpha HRESULT HasAlpha( BOOL + // *pfHasAlpha ); + [return: MarshalAs(UnmanagedType.Bool)] + bool HasAlpha(); + } + + /// Exposes methods that provide additional load and save methods that take WICPersistOptions. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicpersiststream + [PInvokeData("wincodecsdk.h", MSDNShortId = "9381cc2c-9554-4071-b9b5-3464d857c02d")] + [ComImport, Guid("00675040-6908-45F8-86A3-49C7DFD6D9AD"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPersistStream : IPersistStream + { + /// Retrieves the class identifier (CLSID) of the object. + /// + /// + /// A pointer to the location that receives the CLSID on return. The CLSID is a globally unique identifier (GUID) that uniquely + /// represents an object class that defines the code that can manipulate the object's data. + /// + /// If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL. + /// + /// + /// + /// The GetClassID method retrieves the class identifier (CLSID) for an object, used in later operations to load + /// object-specific code into the caller's context. + /// + /// Notes to Callers + /// + /// A container application might call this method to retrieve the original CLSID of an object that it is treating as a + /// different class. Such a call would be necessary if a user performed an editing operation that required the object to be + /// saved. If the container were to save it using the treat-as CLSID, the original application would no longer be able to edit + /// the object. Typically, in this case, the container calls the OleSave helper function, which performs all the necessary + /// steps. For this reason, most container applications have no need to call this method directly. + /// + /// + /// The exception would be a container that provides an object handler for certain objects. In particular, a container + /// application should not get an object's CLSID and then use it to retrieve class specific information from the registry. + /// Instead, the container should use IOleObject and IDataObject interfaces to retrieve such class-specific information directly + /// from the object. + /// + /// Notes to Implementers + /// + /// Typically, implementations of this method simply supply a constant CLSID for an object. If, however, the object's + /// TreatAs registry key has been set by an application that supports emulation (and so is treating the object as one of + /// a different class), a call to GetClassID must supply the CLSID specified in the TreatAs key. For more + /// information on emulation, see CoTreatAsClass. + /// + /// + /// When an object is in the running state, the default handler calls an implementation of GetClassID that delegates the + /// call to the implementation in the object. When the object is not running, the default handler instead calls the ReadClassStg + /// function to read the CLSID that is saved in the object's storage. + /// + /// + /// If you are writing a custom object handler for your object, you might want to simply delegate this method to the default + /// handler implementation (see OleCreateDefaultHandler). + /// + /// URL Moniker Notes + /// This method returns CLSID_StdURLMoniker. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersist-getclassid HRESULT GetClassID( CLSID *pClassID ); + new Guid GetClassID(); + + /// Determines whether an object has changed since it was last saved to its stream. + /// This method returns S_OK to indicate that the object has changed. Otherwise, it returns S_FALSE. + /// + /// + /// Use this method to determine whether an object should be saved before closing it. The dirty flag for an object is + /// conditionally cleared in the IPersistStream::Save method. + /// + /// Notes to Callers + /// + /// You should treat any error return codes as an indication that the object has changed. Unless this method explicitly returns + /// S_FALSE, assume that the object must be saved. + /// + /// + /// Note that the OLE-provided implementations of the IPersistStream::IsDirty method in the OLE-provided moniker + /// interfaces always return S_FALSE because their internal state never changes. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-isdirty HRESULT IsDirty( ); + [PreserveSig] + new HRESULT IsDirty(); + + /// Initializes an object from the stream where it was saved previously. + /// The PSTM. + /// + /// + /// This method loads an object from its associated stream. The seek pointer is set as it was in the most recent + /// IPersistStream::Save method. This method can seek and read from the stream, but cannot write to it. + /// + /// Notes to Callers + /// + /// Rather than calling IPersistStream::Load directly, you typically call the OleLoadFromStream function does the following: + /// + /// + /// + /// Calls the ReadClassStm function to get the class identifier from the stream. + /// + /// + /// Calls the CoCreateInstance function to create an instance of the object. + /// + /// + /// Queries the instance for IPersistStream. + /// + /// + /// Calls IPersistStream::Load. + /// + /// + /// + /// The OleLoadFromStream function assumes that objects are stored in the stream with a class identifier followed by the object + /// data. This storage pattern is used by the generic, composite-moniker implementation provided by OLE. + /// + /// If the objects are not stored using this pattern, you must call the methods separately yourself. + /// URL Moniker Notes + /// + /// Initializes an URL moniker from data within a stream, usually stored there previously using its IPersistStream::Save (using + /// OleSaveToStream). The binary format of the URL moniker is its URL string in Unicode (may be a full or partial URL string, + /// see CreateURLMonikerEx for details). This is represented as a ULONG count of characters followed by that many Unicode characters. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-load HRESULT Load( IStream *pStm ); + new void Load([In, MarshalAs(UnmanagedType.Interface)] IStream pstm); + + /// Saves an object to the specified stream. + /// The PSTM. + /// + /// Indicates whether to clear the dirty flag after the save is complete. If TRUE, the flag should be cleared. If + /// FALSE, the flag should be left unchanged. + /// + /// + /// + /// IPersistStream::Save saves an object into the specified stream and indicates whether the object should reset its + /// dirty flag. + /// + /// + /// The seek pointer is positioned at the location in the stream at which the object should begin writing its data. The object + /// calls the ISequentialStream::Write method to write its data. + /// + /// + /// On exit, the seek pointer must be positioned immediately past the object data. The position of the seek pointer is undefined + /// if an error returns. + /// + /// Notes to Callers + /// + /// Rather than calling IPersistStream::Save directly, you typically call the OleSaveToStream helper function which does + /// the following: + /// + /// + /// + /// Calls GetClassID to get the object's CLSID. + /// + /// + /// Calls the WriteClassStm function to write the object's CLSID to the stream. + /// + /// + /// Calls IPersistStream::Save. + /// + /// + /// If you call these methods directly, you can write other data into the stream after the CLSID before calling IPersistStream::Save. + /// The OLE-provided implementation of IPersistStream follows this same pattern. + /// Notes to Implementers + /// + /// The IPersistStream::Save method does not write the CLSID to the stream. The caller is responsible for writing the CLSID. + /// + /// + /// The IPersistStream::Save method can read from, write to, and seek in the stream; but it must not seek to a location + /// in the stream before that of the seek pointer on entry. + /// + /// URL Moniker Notes + /// + /// Saves an URL moniker to a stream. The binary format of URL moniker is its URL string in Unicode (may be a full or partial + /// URL string, see CreateURLMonikerEx for details). This is represented as a ULONG count of characters followed by that + /// many Unicode characters. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-save HRESULT Save( IStream *pStm, BOOL + // fClearDirty ); + new void Save([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty); + + /// Retrieves the size of the stream needed to save the object. + /// The size in bytes of the stream needed to save this object, in bytes. + /// + /// + /// This method returns the size needed to save an object. You can call this method to determine the size and set the necessary + /// buffers before calling the IPersistStream::Save method. + /// + /// Notes to Implementers + /// + /// The GetSizeMax implementation should return a conservative estimate of the necessary size because the caller might + /// call the IPersistStream::Save method with a non-growable stream. + /// + /// URL Moniker Notes + /// + /// This method retrieves the maximum number of bytes in the stream that will be required by a subsequent call to + /// IPersistStream::Save. This value is sizeof(ULONG)==4 plus sizeof(WCHAR)*n where n is the length of the full or partial URL + /// string, including the NULL terminator. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-getsizemax HRESULT GetSizeMax( + // ULARGE_INTEGER *pcbSize ); + new ulong GetSizeMax(); + + /// Loads data from an input stream using the given parameters. + /// + /// Type: IStream* + /// Pointer to the input stream. + /// + /// + /// Type: const GUID* + /// Pointer to the GUID of the preferred vendor . + /// + /// + /// Type: DWORD + /// The WICPersistOptions used to load the stream. + /// + /// NULL can be passed in for pguidPreferredVendor to indicate no preference. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicpersiststream-loadex HRESULT LoadEx( + // IStream *pIStream, const GUID *pguidPreferredVendor, DWORD dwPersistOptions ); + void LoadEx([In, Optional] IStream pIStream, [In] SafeGuidPtr pguidPreferredVendor, WICPersistOptions dwPersistOptions); + + /// Saves the IWICPersistStream to the given input IStream using the given parameters. + /// + /// Type: IStream* + /// The stream to save to. + /// + /// + /// Type: DWORD + /// The WICPersistOptions to use when saving. + /// + /// + /// Type: BOOL + /// Indicates whether the "dirty" value will be cleared from all metadata after saving. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicpersiststream-saveex HRESULT SaveEx( + // IStream *pIStream, DWORD dwPersistOptions, BOOL fClearDirty ); + void SaveEx([In, Optional] IStream pIStream, WICPersistOptions dwPersistOptions, [MarshalAs(UnmanagedType.Bool)] bool fClearDirty); + } + + /// Exposes methods that provide information about a pixel format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicpixelformatinfo + [PInvokeData("wincodec.h", MSDNShortId = "d5853b27-4329-40d8-bfd0-b4b0f39ba6d5")] + [ComImport, Guid("E8EDA601-3D48-431a-AB44-69059BE88BBE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPixelFormatInfo : IWICComponentInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Gets the pixel format GUID. + /// + /// Type: GUID* + /// Pointer that receives the pixel format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getformatguid HRESULT + // GetFormatGUID( GUID *pFormat ); + Guid GetFormatGUID(); + + /// Gets the pixel format's IWICColorContext. + /// + /// Type: IWICColorContext** + /// Pointer that receives the pixel format's color context. + /// + /// + /// The returned color context is the default color space for the pixel format. However, if an IWICBitmapSource specifies its + /// own color context, the source's context should be preferred over the pixel format's default. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getcolorcontext HRESULT + // GetColorContext( IWICColorContext **ppIColorContext ); + IWICColorContext GetColorContext(); + + /// Gets the bits per pixel (BPP) of the pixel format. + /// + /// Type: UINT* + /// Pointer that receives the BPP of the pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getbitsperpixel HRESULT + // GetBitsPerPixel( UINT *puiBitsPerPixel ); + uint GetBitsPerPixel(); + + /// Gets the number of channels the pixel format contains. + /// + /// Type: UINT* + /// Pointer that receives the channel count. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getchannelcount HRESULT + // GetChannelCount( UINT *puiChannelCount ); + uint GetChannelCount(); + + /// Gets the pixel format's channel mask. + /// + /// Type: UINT + /// The index to the channel mask to retrieve. + /// + /// + /// Type: UINT + /// The size of the pbMaskBuffer buffer. + /// + /// + /// Type: BYTE* + /// Pointer to the mask buffer. + /// + /// + /// Type: UINT* + /// The actual buffer size needed to obtain the channel mask. + /// + /// + /// If 0 and NULL are passed in for cbMaskBuffer and pbMaskBuffer, respectively, the required buffer size will be returned + /// through pcbActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getchannelmask HRESULT + // GetChannelMask( UINT uiChannelIndex, UINT cbMaskBuffer, BYTE *pbMaskBuffer, UINT *pcbActual ); + void GetChannelMask(uint uiChannelIndex, uint cbMaskBuffer, [Out] IntPtr pbMaskBuffer, out uint pcbActual); + } + + /// Extends IWICPixelFormatInfo by providing additional information about a pixel format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicpixelformatinfo2 + [PInvokeData("wincodec.h", MSDNShortId = "6c36fb08-f0c7-4654-bd8e-ef8ef737bc41")] + [ComImport, Guid("A9DB33A2-AF5F-43C7-B679-74F5984B5AA4"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPixelFormatInfo2 : IWICPixelFormatInfo + { + /// Retrieves the component's WICComponentType. + /// + /// Type: WICComponentType* + /// A pointer that receives the WICComponentType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getcomponenttype HRESULT + // GetComponentType( WICComponentType *pType ); + new WICComponentType GetComponentType(); + + /// Retrieves the component's class identifier (CLSID) + /// + /// Type: CLSID* + /// A pointer that receives the component's CLSID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getclsid HRESULT GetCLSID( CLSID + // *pclsid ); + new Guid GetCLSID(); + + /// Retrieves the signing status of the component. + /// + /// Type: DWORD* + /// A pointer that receives the WICComponentSigning status of the component. + /// + /// + /// Signing is unused by WIC. Therefore, all components WICComponentSigned. + /// + /// This function can be used to determine whether a component has no binary component or has been added to the disabled + /// components list in the registry. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getsigningstatus HRESULT + // GetSigningStatus( DWORD *pStatus ); + new WICComponentSigning GetSigningStatus(); + + /// Retrieves the name of component's author. + /// + /// Type: UINT + /// The size of the wzAuthor buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the name of the component's author. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's authors name. The author name is optional; if an author name is + /// not specified by the component, the length returned is 0. + /// + /// + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getauthor HRESULT GetAuthor( UINT + // cchAuthor, WCHAR *wzAuthor, UINT *pcchActual ); + new void GetAuthor(uint cchAuthor, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAuthor, out uint pcchActual); + + /// Retrieves the vendor GUID. + /// + /// Type: GUID* + /// A pointer that receives the component's vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getvendorguid HRESULT + // GetVendorGUID( GUID *pguidVendor ); + new Guid GetVendorGUID(); + + /// Retrieves the component's version. + /// + /// Type: UINT + /// The size of the wzVersion buffer. + /// + /// + /// Type: WCHAR* + /// A pointer that receives a culture invariant string of the component's version. + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's version. The version is optional; if a value is not specified + /// by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getversion HRESULT GetVersion( UINT + // cchVersion, WCHAR *wzVersion, UINT *pcchActual ); + new void GetVersion(uint cchVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzVersion, out uint pcchActual); + + /// Retrieves the component's specification version. + /// + /// Type: UINT + /// The size of the wzSpecVersion buffer. + /// + /// + /// Type: WCHAR* + /// + /// When this method returns, contain a culture invarient string of the component's specification version. The version form is NN.NN.NN.NN. + /// + /// + /// + /// Type: UINT* + /// + /// A pointer that receives the actual length of the component's specification version. The specification version is optional; + /// if a value is not specified by the component, the length returned is 0. + /// + /// + /// + /// All built-in components return "1.0.0.0", except for pixel formats, which do not have a spec version. + /// If cchAuthor is 0 and wzAuthor is NULL, the required buffer size is returned in pccchActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getspecversion HRESULT + // GetSpecVersion( UINT cchSpecVersion, WCHAR *wzSpecVersion, UINT *pcchActual ); + new void GetSpecVersion(uint cchSpecVersion, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzSpecVersion, out uint pcchActual); + + /// Retrieves the component's friendly name, which is a human-readable display name for the component. + /// + /// Type: UINT + /// The size of the wzFriendlyName buffer. + /// + /// + /// Type: WCHAR* + /// + /// A pointer that receives the friendly name of the component. The locale of the string depends on the value that the codec + /// wrote to the registry at install time. For built-in components, these strings are always in English. + /// + /// + /// + /// Type: UINT* + /// A pointer that receives the actual length of the component's friendly name. + /// + /// If cchFriendlyName is 0 and wzFriendlyName is NULL, the required buffer size is returned in pccchActual. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwiccomponentinfo-getfriendlyname HRESULT + // GetFriendlyName( UINT cchFriendlyName, WCHAR *wzFriendlyName, UINT *pcchActual ); + new void GetFriendlyName(uint cchFriendlyName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFriendlyName, out uint pcchActual); + + /// Gets the pixel format GUID. + /// + /// Type: GUID* + /// Pointer that receives the pixel format GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getformatguid HRESULT + // GetFormatGUID( GUID *pFormat ); + new Guid GetFormatGUID(); + + /// Gets the pixel format's IWICColorContext. + /// + /// Type: IWICColorContext** + /// Pointer that receives the pixel format's color context. + /// + /// + /// The returned color context is the default color space for the pixel format. However, if an IWICBitmapSource specifies its + /// own color context, the source's context should be preferred over the pixel format's default. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getcolorcontext HRESULT + // GetColorContext( IWICColorContext **ppIColorContext ); + new IWICColorContext GetColorContext(); + + /// Gets the bits per pixel (BPP) of the pixel format. + /// + /// Type: UINT* + /// Pointer that receives the BPP of the pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getbitsperpixel HRESULT + // GetBitsPerPixel( UINT *puiBitsPerPixel ); + new uint GetBitsPerPixel(); + + /// Gets the number of channels the pixel format contains. + /// + /// Type: UINT* + /// Pointer that receives the channel count. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getchannelcount HRESULT + // GetChannelCount( UINT *puiChannelCount ); + new uint GetChannelCount(); + + /// Gets the pixel format's channel mask. + /// + /// Type: UINT + /// The index to the channel mask to retrieve. + /// + /// + /// Type: UINT + /// The size of the pbMaskBuffer buffer. + /// + /// + /// Type: BYTE* + /// Pointer to the mask buffer. + /// + /// + /// Type: UINT* + /// The actual buffer size needed to obtain the channel mask. + /// + /// + /// If 0 and NULL are passed in for cbMaskBuffer and pbMaskBuffer, respectively, the required buffer size will be returned + /// through pcbActual. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo-getchannelmask HRESULT + // GetChannelMask( UINT uiChannelIndex, UINT cbMaskBuffer, BYTE *pbMaskBuffer, UINT *pcbActual ); + new void GetChannelMask(uint uiChannelIndex, uint cbMaskBuffer, [Out] IntPtr pbMaskBuffer, out uint pcbActual); + + /// Returns whether the format supports transparent pixels. + /// + /// Type: BOOL* + /// Returns TRUE if the pixel format supports transparency; otherwise, FALSE. + /// + /// An indexed pixel format will not return TRUE even though it may have some transparency support. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo2-supportstransparency HRESULT + // SupportsTransparency( BOOL *pfSupportsTransparency ); + [return: MarshalAs(UnmanagedType.Bool)] + bool SupportsTransparency(); + + /// Retrieves the WICPixelFormatNumericRepresentation of the pixel format. + /// + /// Type: WICPixelFormatNumericRepresentation* + /// + /// The address of a WICPixelFormatNumericRepresentation variable that you've defined. On successful completion, the function + /// sets your variable to the WICPixelFormatNumericRepresentation of the pixel format. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicpixelformatinfo2-getnumericrepresentation HRESULT + // GetNumericRepresentation( WICPixelFormatNumericRepresentation *pNumericRepresentation ); + WICPixelFormatNumericRepresentation GetNumericRepresentation(); + } + + /// + /// + /// Allows planar component image pixels to be written to an encoder. When supported by the encoder, this allows an application to + /// encode planar component image data without first converting to an interleaved pixel format. + /// + /// You can use + /// + /// QueryInterface to obtain this interface from the Windows provided implementation of IWICBitmapFrameEncode for the JPEG encoder. + /// + /// + /// + /// Encoding YCbCr data using IWICPlanarBitmapFrameEncode is similar but not identical to encoding interleaved data using + /// IWICBitmapFrameEncode. The planar interface only exposes the ability to write planar frame image data, and you should continue + /// to use the frame encode interface to set metadata or a thumbnail and to commit at the end of the operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicplanarbitmapframeencode + [PInvokeData("wincodec.h", MSDNShortId = "7ACA58CC-E132-4836-B955-322375ADDAA1")] + [ComImport, Guid("F928B7B8-2221-40C1-B72E-7E82F1974D1A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPlanarBitmapFrameEncode + { + /// Writes lines from the source planes to the encoded format. + /// + /// Type: UINT + /// The number of lines to encode. See the Remarks section for WIC Jpeg specific line count restrictions. + /// + /// + /// Type: WICBitmapPlane* + /// Specifies the source buffers for each component plane encoded. + /// + /// + /// Type: UINT + /// The number of component planes specified by the pPlanes parameter. + /// + /// + /// + /// Successive WritePixels calls are assumed sequentially add scanlines to the output image. + /// IWICBitmapFrameEncode::Initialize, IWICBitmapFrameEncode::SetSize and IWICBitmapFrameEncode::SetPixelFormat must be called + /// before this method or it will fail. + /// + /// + /// The interleaved pixel format set via IWICBitmapFrameEncode::SetPixelFormat and the codec specific encode parameters + /// determine the supported planar formats. + /// + /// + /// WIC JPEG Encoder: QueryInterface can be used to obtain this interface from the WIC JPEG IWICBitmapFrameEncode + /// implementation. When using this method to encode YCbCr data with the WIC JPEG encoder, chroma subsampling can be configured + /// with encoder options during frame creation. See the Encoding Overview and IWICBitmapEncoder::CreateNewFrame for more details. + /// + /// Depending upon the configured chroma subsampling, the lineCount parameter has the following restrictions: + /// + /// + /// Chroma Subsampling + /// Line Count Restriction + /// Chroma Plane Width + /// Chroma Plane Height + /// + /// + /// 4:2:0 + /// Multiple of 2, unless the call covers the last scanline of the image + /// lumaWidth / 2 Rounded up to the nearest integer. + /// lumaHeight / 2 Rounded up to the nearest integer. + /// + /// + /// 4:2:2 + /// Any + /// lumaWidth / 2 Rounded up to the nearest integer. + /// Any + /// + /// + /// 4:4:4 + /// Any + /// Any + /// Any + /// + /// + /// 4:4:0 + /// Multiple of 2, unless the call covers the last scanline of the image + /// Any + /// llumaHeight / 2 Rounded up to the nearest integer. + /// + /// + /// The full scanline width must be encoded, and the width of the bitmap sources must match their planar configuration. + /// Additionally, if a pixel format is set via IWICBitmapFrameEncode::SetPixelFormat, it must be GUID_WICPixelFormat24bppBGR. + /// The supported pixel formats of the bitmap sources passed into this method are as follows: + /// + /// + /// Plane Count + /// Plane 1 + /// Plane 2 + /// Plane 3 + /// + /// + /// 3 + /// GUID_WICPixelFormat8bppY + /// GUID_WICPixelFormat8bppCb + /// GUID_WICPixelFormat8bppCr + /// + /// + /// 2 + /// GUID_WICPixelFormat8bppY + /// GUID_WICPixelFormat16bppCbCr + /// N/A + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicplanarbitmapframeencode-writepixels HRESULT + // WritePixels( UINT lineCount, WICBitmapPlane *pPlanes, UINT cPlanes ); + void WritePixels(uint lineCount, [In] WICBitmapPlane[] pPlanes, uint cPlanes); + + /// Writes lines from the source planes to the encoded format. + /// + /// Type: IWICBitmapSource** + /// Specifies an array of IWICBitmapSource that represent image planes. + /// + /// + /// Type: UINT + /// The number of component planes specified by the planes parameter. + /// + /// + /// Type: WICRect* + /// + /// The source rectangle of pixels to encode from the IWICBitmapSource planes. Null indicates the entire source. The source rect + /// width must match the width set through SetSize. Repeated WriteSource calls can be made as long as the total + /// accumulated source rect height is the same as set through SetSize. + /// + /// + /// + /// + /// Successive WriteSource calls are assumed sequentially add scanlines to the output image. + /// IWICBitmapFrameEncode::Initialize, IWICBitmapFrameEncode::SetSize and IWICBitmapFrameEncode::SetPixelFormat must be called + /// before this method or it will fail. + /// + /// + /// The interleaved pixel format set via IWICBitmapFrameEncode::SetPixelFormat and the codec specific encode parameters + /// determine the supported planar formats. + /// + /// + /// WIC JPEG Encoder: QueryInterface can be used to obtain this interface from the WIC JPEG IWICBitmapFrameEncode + /// implementation. When using this method to encode YCbCr data with the WIC JPEG encoder, chroma subsampling can be configured + /// with encoder options during frame creation. See the Encoding Overview and IWICBitmapEncoder::CreateNewFrame for more details. + /// + /// Depending upon the configured chroma subsampling, the lineCount parameter has the following restrictions: + /// + /// + /// Chroma Subsampling + /// X Coordinate + /// Y Coordinate + /// Chroma Width + /// Chroma Height + /// + /// + /// 4:2:0 + /// Multiple of 2 + /// Multiple of 2 + /// lumaWidth / 2 Rounded up to the nearest integer. + /// lumaHeight / 2 Rounded up to the nearest integer. + /// + /// + /// 4:2:2 + /// Multiple of 2 + /// Any + /// lumaWidth / 2 Rounded up to the nearest integer. + /// Any + /// + /// + /// 4:4:4 + /// Any + /// Any + /// Any + /// Any + /// + /// + /// 4:4:0 + /// Any + /// Multiple of 2 + /// lumaWidth + /// llumaHeight / 2 Rounded up to the nearest integer. + /// + /// + /// The full scanline width must be encoded, and the width of the bitmap sources must match their planar configuration. + /// Additionally, if a pixel format is set via IWICBitmapFrameEncode::SetPixelFormat, it must be GUID_WICPixelFormat24bppBGR. + /// The supported pixel formats of the bitmap sources passed into this method are as follows: + /// + /// + /// Plane Count + /// Plane 1 + /// Plane 2 + /// Plane 3 + /// + /// + /// 3 + /// GUID_WICPixelFormat8bppY + /// GUID_WICPixelFormat8bppCb + /// GUID_WICPixelFormat8bppCr + /// + /// + /// 2 + /// GUID_WICPixelFormat8bppY + /// GUID_WICPixelFormat16bppCbCr + /// N/A + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicplanarbitmapframeencode-writesource HRESULT + // WriteSource( IWICBitmapSource **ppPlanes, UINT cPlanes, WICRect *prcSource ); + void WriteSource([In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 1)] IWICBitmapSource[] ppPlanes, uint cPlanes, [In] PWICRect prcSource); + } + + /// + /// + /// Provides access to planar YCbCr pixel formats where pixel components are stored in separate component planes. This interface + /// also allows access to other codec optimizations for flip/rotate, scale, and format conversion to other YCbCr planar formats; + /// this is similar to the pre-existing IWICBitmapSourceTransform interface. + /// + /// + /// QueryInterface can be used to obtain this interface from the Windows provided implementations of IWICBitmapFrameDecode for the + /// JPEG decoder, IWICBitmapScaler, IWICBitmapFlipRotator, and IWICColorTransform. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicplanarbitmapsourcetransform + [ComImport, Guid("3AFF9CCE-BE95-4303-B927-E7D16FF4A613"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPlanarBitmapSourceTransform + { + /// + /// + /// Use this method to determine if a desired planar output is supported and allow the caller to choose an optimized code path + /// if it is. Otherwise, callers should fall back to IWICBitmapSourceTransform or IWICBitmapSource and retrieve interleaved pixels. + /// + /// The following transforms can be checked: + /// + /// + /// Determine if the flip/rotate option specified via WICBitmapTransformOptions is supported. + /// + /// + /// Determine if the requested planar pixel format configuration is supported. + /// + /// + /// Determine the closest dimensions the implementation can natively scale to given the desired dimensions. + /// + /// + /// + /// When a transform is supported, this method returns the description of the resulting planes in the pPlaneDescriptions parameter. + /// + /// + /// + /// Type: UINT* + /// + /// On input, the desired width. On output, the closest supported width to the desired width; this is the same size or larger + /// than the desired width. + /// + /// + /// + /// Type: UINT* + /// + /// On input, the desired height. On output, the closest supported height to the desired height; this is the same size or larger + /// than the desired width. + /// + /// + /// + /// Type: WICBitmapTransformOptions + /// + /// The desired rotation or flip operation. Multiple WICBitmapTransformOptions can be combined in this flag parameter, see WICBitmapTransformOptions. + /// + /// + /// + /// Type: WICPlanarOptions + /// Used to specify additional configuration options for the transform. See WICPlanarOptions for more detail. + /// WIC JPEG Decoder: + /// + /// WICPlanarOptionsPreserveSubsampling can be specified to retain the subsampling ratios when downscaling. By default, the JPEG + /// decoder attempts to preserve quality by downscaling only the Y plane in some cases, changing the image to 4:4:4 chroma subsampling. + /// + /// + /// + /// Type: const WICPixelFormatGUID* + /// The requested pixel formats of the respective planes. + /// + /// + /// Type: WICBitmapPlaneDescription* + /// When *pfIsSupported == TRUE, the array of plane descriptions contains the size and format of each of the planes. + /// + /// WIC JPEG Decoder: The Cb and Cr planes can be a different size from the values returned by puiWidth and puiHeight due to + /// chroma subsampling. + /// + /// + /// + /// Type: UINT + /// The number of component planes requested. + /// + /// + /// Type: BOOL* + /// Set to TRUE if the requested transforms are natively supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicplanarbitmapsourcetransform-doessupporttransform + // HRESULT DoesSupportTransform( UINT *puiWidth, UINT *puiHeight, WICBitmapTransformOptions dstTransform, WICPlanarOptions + // dstPlanarOptions, const WICPixelFormatGUID *pguidDstFormats, WICBitmapPlaneDescription *pPlaneDescriptions, UINT cPlanes, + // BOOL *pfIsSupported ); + [return: MarshalAs(UnmanagedType.Bool)] + bool DoesSupportTransform(ref uint puiWidth, ref uint puiHeight, WICBitmapTransformOptions dstTransform, WICPlanarOptions dstPlanarOptions, [In] Guid[] pguidDstFormats, [Out] WICBitmapPlaneDescription[] pPlaneDescriptions, uint cPlanes); + + /// + /// Copies pixels into the destination planes. Configured by the supplied input parameters. + /// + /// If a dstTransform, scale, or format conversion is specified, cbStride is the transformed stride and is based on the + /// destination pixel format of the pDstPlanes parameter, not the original source's pixel format. + /// + /// + /// + /// Type: const WICRect* + /// The source rectangle of pixels to copy. + /// + /// + /// Type: UINT + /// + /// The width to scale the source bitmap. This parameter must be equal to a value obtainable through + /// IWICPlanarBitmapSourceTransform:: DoesSupportTransform. + /// + /// + /// + /// Type: UINT + /// + /// The height to scale the source bitmap. This parameter must be equal to a value obtainable through + /// IWICPlanarBitmapSourceTransform:: DoesSupportTransform. + /// + /// + /// + /// Type: WICBitmapTransformOptions + /// + /// The desired rotation or flip to perform prior to the pixel copy. A rotate can be combined with a flip horizontal or a flip + /// vertical, see WICBitmapTransformOptions. + /// + /// + /// + /// Type: const WICPlanarOptions + /// Used to specify additional configuration options for the transform. See WICPlanarOptions for more detail. + /// + /// WIC JPEG Decoder: WICPlanarOptionsPreserveSubsampling can be specified to retain the subsampling ratios when downscaling. By + /// default, the JPEG decoder attempts to preserve quality by downscaling only the Y plane in some cases, changing the image to + /// 4:4:4 chroma subsampling. + /// + /// + /// + /// Type: WICBitmapPlane + /// + /// Specifies the pixel format and output buffer for each component plane. The number of planes and pixel format of each plane + /// must match values obtainable through IWICPlanarBitmapSourceTransform::DoesSupportTransform. + /// + /// + /// + /// Type: UINT + /// The number of component planes specified by the pDstPlanes parameter. + /// + /// + /// + /// WIC JPEG Decoder: Depending on the configured chroma subsampling of the image, the source rectangle has the following restrictions: + /// + /// + /// + /// Chroma Subsampling + /// X Coordinate + /// Y Coordinate + /// Chroma Width + /// Chroma Height + /// + /// + /// 4:2:0 + /// Multiple of 2 + /// Multiple of 2 + /// lumaWidth / 2 Rounded up to the nearest integer. + /// lumaHeight / 2 Rounded up to the nearest integer. + /// + /// + /// 4:2:2 + /// Multiple of 2 + /// Any + /// lumaWidth / 2 Rounded up to the nearest integer. + /// lumaHeight + /// + /// + /// 4:4:4 + /// Any + /// Any + /// llumaWidth + /// llumaHeight + /// + /// + /// 4:4:0 + /// Any + /// Multiple of 2 + /// lumaWidth + /// llumaHeight / 2 Rounded up to the nearest integer. + /// + /// + /// The pDstPlanes parameter supports the following pixel formats. + /// + /// + /// Plane Count + /// Plane 1 + /// Plane 2 + /// Plane 3 + /// + /// + /// 3 + /// GUID_WICPixelFormat8bppY + /// GUID_WICPixelFormat8bppCb + /// GUID_WICPixelFormat8bppCr + /// + /// + /// 2 + /// GUID_WICPixelFormat8bppY + /// GUID_WICPixelFormat16bppCbCr + /// N/A + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicplanarbitmapsourcetransform-copypixels HRESULT + // CopyPixels( const WICRect *prcSource, UINT uiWidth, UINT uiHeight, WICBitmapTransformOptions dstTransform, WICPlanarOptions + // dstPlanarOptions, const WICBitmapPlane *pDstPlanes, UINT cPlanes ); + void CopyPixels([In] PWICRect prcSource, uint uiWidth, uint uiHeight, WICBitmapTransformOptions dstTransform, WICPlanarOptions dstPlanarOptions, [In] WICBitmapPlane[] pDstPlanes, uint cPlanes); + } + + /// + /// Allows a format converter to be initialized with a planar source. You can use QueryInterface to obtain this interface from the + /// Windows provided implementation of IWICFormatConverter. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicplanarformatconverter + [PInvokeData("wincodec.h", MSDNShortId = "07258A07-84AA-4DC2-B2E3-14A43AED5617")] + [ComImport, Guid("BEBEE9CB-83B0-4DCC-8132-B0AAA55EAC96"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICPlanarFormatConverter : IWICBitmapSource + { + /// Retrieves the pixel width and height of the bitmap. + /// + /// Type: UINT* + /// A pointer that receives the pixel width of the bitmap. + /// + /// + /// Type: UINT* + /// A pointer that receives the pixel height of the bitmap + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getsize HRESULT GetSize( UINT + // *puiWidth, UINT *puiHeight ); + new void GetSize(out uint puiWidth, out uint puiHeight); + + /// Retrieves the pixel format of the bitmap source.. + /// + /// Receives the pixel format GUID the bitmap is stored in. For a list of available pixel formats, see the Native Pixel Formats topic. + /// + /// + /// The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a + /// format conversion from the storage pixel format to an output pixel format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getpixelformat HRESULT + // GetPixelFormat( Guid *pPixelFormat ); + new Guid GetPixelFormat(); + + /// Retrieves the sampling rate between pixels and physical world measurements. + /// + /// Type: double* + /// A pointer that receives the x-axis dpi resolution. + /// + /// + /// Type: double* + /// A pointer that receives the y-axis dpi resolution. + /// + /// + /// + /// Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the + /// aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns + /// (96.0,96.0) for ICO images. + /// + /// + /// Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform + /// an image based on the resolution returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-getresolution HRESULT GetResolution( + // double *pDpiX, double *pDpiY ); + new void GetResolution(out double pDpiX, out double pDpiY); + + /// Retrieves the color table for indexed pixel formats. + /// + /// Type: IWICPalette* + /// An IWICPalette. A palette can be created using the CreatePalette method. + /// + /// + /// Type: HRESULT + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// WINCODEC_ERR_PALETTEUNAVAILABLE + /// The palette was unavailable. + /// + /// + /// S_OK + /// The palette was successfully copied. + /// + /// + /// + /// + /// If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level + /// palette is not available. The global palette may also be retrieved using the CopyPalette method. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypalette HRESULT CopyPalette( + // IWICPalette *pIPalette ); + [PreserveSig] + new HRESULT CopyPalette(IWICPalette pIPalette); + + /// Instructs the object to produce pixels. + /// + /// Type: const WICRect* + /// The rectangle to copy. A NULL value specifies the entire bitmap. + /// + /// + /// Type: UINT + /// The stride of the bitmap + /// + /// + /// Type: UINT + /// The size of the buffer. + /// + /// + /// Type: BYTE* + /// A pointer to the buffer. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. + /// It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored + /// on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent + /// on the object implementing the interface. + /// + /// + /// The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must + /// be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned. + /// + /// + /// The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along + /// with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent + /// pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, + /// height and pixel format of the bitmap and the sub-rectangle provided to the copy method. + /// + /// + /// If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create + /// an in-memory IWICBitmap first. + /// + /// Codec Developer Remarks + /// + /// The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this + /// case, a line is a consecutive string of cbStride bytes). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapsource-copypixels HRESULT CopyPixels( const + // WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer ); + new void CopyPixels([In, Optional] PWICRect prc, uint cbStride, uint cbBufferSize, [In, Out] IntPtr pbBuffer); + + /// Initializes a format converter with a planar source, and specifies the interleaved output pixel format. + /// + /// Type: IWICBitmapSource** + /// An array of IWICBitmapSource that represents image planes. + /// + /// + /// Type: UINT + /// The number of component planes specified by the planes parameter. + /// + /// + /// Type: REFWICPixelFormatGUID + /// The destination interleaved pixel format. + /// + /// + /// Type: WICBitmapDitherType + /// The WICBitmapDitherType used for conversion. + /// + /// + /// Type: IWICPalette* + /// The palette to use for conversion. + /// + /// + /// Type: double + /// The alpha threshold to use for conversion. + /// + /// + /// Type: WICBitmapPaletteType + /// The palette translation type to use for conversion. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicplanarformatconverter-initialize HRESULT + // Initialize( IWICBitmapSource **ppPlanes, UINT cPlanes, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, + // IWICPalette *pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate ); + void Initialize([In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 1)] IWICBitmapSource[] ppPlanes, uint cPlanes, + in Guid dstFormat, WICBitmapDitherType dither, [Optional] IWICPalette pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate); + + /// Query if the format converter can convert from one format to another. + /// An array of WIC pixel formats that represents source image planes. + /// The number of source pixel formats specified by the pSrcFormats parameter. + /// The destination interleaved pixel format. + /// True if the conversion is supported. + /// To specify an interleaved input pixel format, provide a length 1 array to pSrcPixelFormats. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicplanarformatconverter-canconvert HRESULT + // CanConvert( const WICPixelFormatGUID *pSrcPixelFormats, UINT cSrcPlanes, REFWICPixelFormatGUID dstPixelFormat, BOOL + // *pfCanConvert ); + [return: MarshalAs(UnmanagedType.Bool)] + bool CanConvert([In] Guid[] pSrcPixelFormats, uint cSrcPlanes, in Guid dstPixelFormat); + } + + /// + /// IWICProgressCallback interface is documented only for compliance; its use is not recommended and may be altered or + /// unavailable in the future. Instead, and use RegisterProgressNotification. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicprogresscallback + [PInvokeData("wincodec.h", MSDNShortId = "cd94e0a1-c275-458e-ae7f-85b703fc660e")] + [ComImport, Guid("4776F9CD-9517-45FA-BF24-E89C5EC5C60C"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICProgressCallback + { + /// + /// Notify method is documented only for compliance; its use is not recommended and may be altered or unavailable in the + /// future. Instead, and use RegisterProgressNotification. + /// + /// + /// Type: ULONG + /// The current frame number. + /// + /// + /// Type: WICProgressOperation + /// The operation on which progress is being reported. + /// + /// + /// Type: double + /// + /// The progress value ranging from is 0.0 to 1.0. 0.0 indicates the beginning of the operation. 1.0 indicates the end of the operation. + /// + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicprogresscallback-notify HRESULT Notify( ULONG + // uFrameNum, WICProgressOperation operation, double dblProgress ); + [PreserveSig] + HRESULT Notify(uint uFrameNum, WICProgressOperation operation, double dblProgress); + } + + /// Exposes methods for obtaining information about and controlling progressive decoding. + /// + /// + /// Images can only be progressively decoded if they were progressively encoded. Progressive images automatically start at the + /// highest (best quality) progressive level. The caller must manually set the decoder to a lower progressive level. + /// + /// E_NOTIMPL is returned if the codec does not support progressive level decoding. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicprogressivelevelcontrol + [PInvokeData("wincodec.h", MSDNShortId = "d77244bc-b9d4-4b7d-b718-4ee38de46614")] + [ComImport, Guid("DAAC296F-7AA5-4dbf-8D15-225C5976F891"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICProgressiveLevelControl + { + /// Gets the number of levels of progressive decoding supported by the CODEC. + /// + /// Type: UINT* + /// Indicates the number of levels supported by the CODEC. + /// + /// + /// + /// Users should not use this function to iterate through the progressive levels of a progressive JPEG image. JPEG progressive + /// levels are determined by the image and do not have a fixed level count. Using this method will force the application to wait + /// for all progressive levels to be downloaded before it can return. Instead, applications should use the following code to + /// iterate through the progressive levels of a progressive JPEG image. + /// + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicprogressivelevelcontrol-getlevelcount HRESULT + // GetLevelCount( UINT *pcLevels ); + uint GetLevelCount(); + + /// Gets the decoder's current progressive level. + /// + /// Type: UINT* + /// Indicates the current level specified. + /// + /// + /// The level always defaults to the highest progressive level. In order to decode a lower progressive level, SetCurrentLevel + /// must first be called. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicprogressivelevelcontrol-getcurrentlevel HRESULT + // GetCurrentLevel( UINT *pnLevel ); + uint GetCurrentLevel(); + + /// Specifies the level to retrieve on the next call to CopyPixels. + /// + /// Type: UINT + /// Specifies which level to return next. If greater than the total number of levels supported, an error will be returned. + /// + /// + /// + /// A call does not have to request every level supported. If a caller requests level 1, without having previously requested + /// level 0, the bits returned by the next call to CopyPixels will include both levels. + /// + /// If the requested level is invalid, the error returned is WINCODEC_ERR_INVALIDPROGRESSIVELEVEL. + /// Examples + /// + /// Users should use this method to iterate through the progressive levels of a progressive JPEG image rather than the + /// GetCurrentLevel method. JPEG progressive levels are determined by the image and do not have a fixed level count. Using + /// GetCurrentLevel method will force the application to wait for all progressive levels to be downloaded before it can + /// return. Instead, applications should use the following code to iterate through the progressive levels of a progressive JPEG image. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicprogressivelevelcontrol-setcurrentlevel HRESULT + // SetCurrentLevel( UINT nLevel ); + void SetCurrentLevel(uint nLevel); + } + + /// Represents a Windows Imaging Component (WIC) stream for referencing imaging and metadata content. + /// + /// + /// Decoders and metadata handlers are expected to create sub streams of whatever stream they hold when handing off control for + /// embedded metadata to another metadata handler. If the stream is not restricted then use MAXLONGLONG as the max size and offset 0. + /// + /// + /// The IWICStream interface methods do not enable you to provide a file sharing option. To create a file stream for an + /// image, use the SHCreateStreamOnFileEx function. This stream can then be used to create an IWICBitmapDecoder using the + /// CreateDecoderFromStream method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicstream + [PInvokeData("wincodec.h", MSDNShortId = "bc398732-037d-4f48-940f-c70975447972")] + [ComImport, Guid("135FF860-22B7-4ddf-B0F6-218F4F299A43"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICStream : IStream + { + /// + new void Read(byte[] pv, int cb, IntPtr pcbRead); + + /// + new void Write(byte[] pv, int cb, IntPtr pcbWritten); + + /// + new void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition); + + /// + new void SetSize(long libNewSize); + + /// + new void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten); + + /// + new void Commit(int grfCommitFlags); + + /// + new void Revert(); + + /// + new void LockRegion(long libOffset, long cb, int dwLockType); + + /// + new void UnlockRegion(long libOffset, long cb, int dwLockType); + + /// + new void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag); + + /// + new void Clone(out IStream ppstm); + + /// Initializes a stream from another stream. Access rights are inherited from the underlying stream. + /// + /// Type: IStream* + /// The initialize stream. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicstream-initializefromistream HRESULT + // InitializeFromIStream( IStream *pIStream ); + void InitializeFromIStream(IStream pIStream); + + /// Initializes a stream from a particular file. + /// + /// Type: LPCWSTR + /// The file used to initialize the stream. + /// + /// + /// Type: DWORD + /// The desired file access mode. + /// + /// + /// Value + /// Meaning + /// + /// + /// GENERIC_READ + /// Read access. + /// + /// + /// GENERIC_WRITE + /// Write access. + /// + /// + /// + /// + /// + /// The IWICStream interface methods do not enable you to provide a file sharing option. To create a shared file stream for an + /// image, use the SHCreateStreamOnFileEx function. This stream can then be used to create an IWICBitmapDecoder using the + /// CreateDecoderFromStream method. + /// + /// Examples + /// This example demonstrates the use of the InitializeFromFilename to create an image decoder. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicstream-initializefromfilename HRESULT + // InitializeFromFilename( LPCWSTR wzFileName, DWORD dwDesiredAccess ); + void InitializeFromFilename([MarshalAs(UnmanagedType.LPWStr)] string wzFileName, ACCESS_MASK dwDesiredAccess); + + /// Initializes a stream to treat a block of memory as a stream. The stream cannot grow beyond the buffer size. + /// + /// Type: BYTE* + /// Pointer to the buffer used to initialize the stream. + /// + /// + /// Type: DWORD + /// The size of buffer. + /// + /// + /// + /// This method should be avoided whenever possible. The caller is responsible for ensuring the memory block is valid for the + /// lifetime of the stream when using InitializeFromMemory. A workaround for this behavior is to create an IStream and + /// use InitializeFromIStream to create the IWICStream. + /// + /// If you require a growable memory stream, use CreateStreamOnHGlobal. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicstream-initializefrommemory HRESULT + // InitializeFromMemory( WICInProcPointer pbBuffer, DWORD cbBufferSize ); + void InitializeFromMemory([In] IntPtr pbBuffer, uint cbBufferSize); + + /// Initializes the stream as a substream of another stream. + /// + /// Type: IStream* + /// Pointer to the input stream. + /// + /// + /// Type: ULARGE_INTEGER + /// The stream offset used to create the new stream. + /// + /// + /// Type: ULARGE_INTEGER + /// The maximum size of the stream. + /// + /// + /// The stream functions with its own stream position, independent of the underlying stream but restricted to a region. All seek + /// positions are relative to the sub region. It is allowed, though not recommended, to have multiple writable sub streams + /// overlapping the same range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicstream-initializefromistreamregion HRESULT + // InitializeFromIStreamRegion( IStream *pIStream, ULARGE_INTEGER ulOffset, ULARGE_INTEGER ulMaxSize ); + void InitializeFromIStreamRegion(IStream pIStream, ulong ulOffset, ulong ulMaxSize); + } + + /// Exposes methods for a stream provider. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nn-wincodecsdk-iwicstreamprovider + [PInvokeData("wincodecsdk.h", MSDNShortId = "fdcaf668-a5c3-4852-8bc9-5535f0756592")] + [ComImport, Guid("449494BC-B468-4927-96D7-BA90D31AB505"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWICStreamProvider + { + /// Gets the stream held by the component. + /// + /// Type: IStream** + /// Pointer that receives a pointer to the stream held by the component. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicstreamprovider-getstream HRESULT GetStream( + // IStream **ppIStream ); + IStream GetStream(); + + /// Gets the persist options used when initializing the component with a stream. + /// + /// Type: DWORD* + /// + /// Pointer that receives the persist options used when initializing the component with a stream. If none were provided, + /// WICPersistOptionDefault is returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicstreamprovider-getpersistoptions HRESULT + // GetPersistOptions( DWORD *pdwPersistOptions ); + WICPersistOptions GetPersistOptions(); + + /// Gets the preferred vendor GUID. + /// + /// Type: GUID* + /// Pointer that receives the preferred vendor GUID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicstreamprovider-getpreferredvendorguid + // HRESULT GetPreferredVendorGUID( GUID *pguidPreferredVendor ); + Guid GetPreferredVendorGUID(); + + /// + /// Informs the component that the content of the stream it's holding onto may have changed. The component should respond by + /// dirtying any cached information from the stream. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicstreamprovider-refreshstream HRESULT RefreshStream(); + void RefreshStream(); + } + + private static T[] GetArray(GetArrayAction action) + { + action(0, null, out var sz); + var a = new T[(int)sz]; + action(sz, a, out _); + return a; + } + + private static string GetString(GetStringAction action) + { + action(0, null, out var sz); + var sb = new StringBuilder((int)sz); + action(sz, sb, out _); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/PInvoke/Graphics/WIC/WindowsCodecs.Structs.cs b/PInvoke/Graphics/WIC/WindowsCodecs.Structs.cs new file mode 100644 index 00000000..7875f67f --- /dev/null +++ b/PInvoke/Graphics/WIC/WindowsCodecs.Structs.cs @@ -0,0 +1,673 @@ +using System; +using System.Runtime.InteropServices; +using Vanara.InteropServices; +using static Vanara.PInvoke.D2d1; +using static Vanara.PInvoke.DXGI; + +namespace Vanara.PInvoke +{ + /// Items from the WindowsCodecs.dll + public static partial class WindowsCodecs + { + /// Contains members that identify a pattern within an image file which can be used to identify a particular format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicbitmappattern typedef struct WICBitmapPattern { + // ULARGE_INTEGER Position; ULONG Length; BYTE *Pattern; BYTE *Mask; BOOL EndOfStream; } WICBitmapPattern; + [PInvokeData("wincodec.h", MSDNShortId = "6f0cd639-c0db-46e4-b3a3-bc21222d97ee")] + [StructLayout(LayoutKind.Sequential)] + public struct WICBitmapPattern + { + /// + /// Type: ULARGE_INTEGER + /// The offset the pattern is located in the file. + /// + public ulong Position; + + /// + /// Type: ULONG + /// The pattern length. + /// + public uint Length; + + /// + /// Type: BYTE* + /// The actual pattern. + /// + public IntPtr Pattern; + + /// + /// Type: BYTE* + /// The pattern mask. + /// + public IntPtr Mask; + + /// + /// Type: BOOL + /// The end of the stream. + /// + [MarshalAs(UnmanagedType.Bool)] public bool EndOfStream; + } + + /// Specifies the pixel format, buffer, stride and size of a component plane for a planar pixel format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicbitmapplane typedef struct WICBitmapPlane { + // WICPixelFormatGUID Format; BYTE *pbBuffer; UINT cbStride; UINT cbBufferSize; } WICBitmapPlane; + [PInvokeData("wincodec.h", MSDNShortId = "4E988284-DE71-48B2-BF77-D616FAA2A3B1")] + [StructLayout(LayoutKind.Sequential)] + public struct WICBitmapPlane + { + /// + /// Type: WICPixelFormatGUID + /// Describes the pixel format of the plane. + /// + public Guid Format; + + /// + /// Type: BYTE* + /// Pointer to the buffer that holds the planes pixel components. + /// + public IntPtr pbBuffer; + + /// + /// Type: UINT + /// + /// The stride of the buffer ponted to by pbData. Stride indicates the total number of bytes to go from the beginning of one + /// scanline to the beginning of the next scanline. + /// + /// + public uint cbStride; + + /// + /// Type: UINT + /// The total size of the buffer pointed to by pbBuffer. + /// + public uint cbBufferSize; + } + + /// Specifies the pixel format and size of a component plane. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicbitmapplanedescription typedef struct + // WICBitmapPlaneDescription { WICPixelFormatGUID Format; UINT Width; UINT Height; } WICBitmapPlaneDescription; + [PInvokeData("wincodec.h", MSDNShortId = "A5685E9B-F2B9-4A1B-9CEA-044E5FA1CC6D")] + [StructLayout(LayoutKind.Sequential)] + public struct WICBitmapPlaneDescription + { + /// Describes the pixel format of the plane. + public Guid Format; + + /// Component width of the plane. + public uint Width; + + /// Component height of the plane. + public uint Height; + } + + /// Specifies the DXGI_FORMAT and block information of a DDS format. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicddsformatinfo typedef struct WICDdsFormatInfo { + // DXGI_FORMAT DxgiFormat; UINT BytesPerBlock; UINT BlockWidth; UINT BlockHeight; } WICDdsFormatInfo; + [PInvokeData("wincodec.h", MSDNShortId = "C5F1DA49-EC11-4068-9DC6-D721894371F9")] + [StructLayout(LayoutKind.Sequential)] + public struct WICDdsFormatInfo + { + /// + /// Type: DXGI_FORMAT + /// The DXGI_FORMAT + /// + public DXGI_FORMAT DxgiFormat; + + /// + /// Type: UINT + /// + /// The size of a single block in bytes. For DXGI_FORMAT values that are not block-based, the value is equal to the size of a + /// single pixel in bytes. + /// + /// + public uint BytesPerBlock; + + /// + /// Type: UINT + /// The width of a single block in pixels. For DXGI_FORMAT values that are not block-based, the value is 1. + /// + public uint BlockWidth; + + /// + /// Type: UINT + /// The height of a single block in pixels. For DXGI_FORMAT values that are not block-based, the value is 1. + /// + public uint BlockHeight; + } + + /// Specifies the DDS image dimension, DXGI_FORMAT and alpha mode of contained data. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicddsparameters typedef struct WICDdsParameters { UINT + // Width; UINT Height; UINT Depth; UINT MipLevels; UINT ArraySize; DXGI_FORMAT DxgiFormat; WICDdsDimension Dimension; + // WICDdsAlphaMode AlphaMode; } WICDdsParameters; + [PInvokeData("wincodec.h", MSDNShortId = "2E5755B4-E8DC-40B2-8DA1-B053A261079B")] + [StructLayout(LayoutKind.Sequential)] + public struct WICDdsParameters + { + /// + /// Type: UINT + /// The width, in pixels, of the texture at the largest mip size (mip level 0). + /// + public uint Width; + + /// + /// Type: UINT + /// + /// The height, in pixels, of the texture at the largest mip size (mip level 0). When the DDS image contains a 1-dimensional + /// texture, this value is equal to 1. + /// + /// + public uint Height; + + /// + /// Type: UINT + /// + /// The number of slices in the 3D texture. This is equivalent to the depth, in pixels, of the 3D texture at the largest mip + /// size (mip level 0). When the DDS image contains a 1- or 2-dimensional texture, this value is equal to 1. + /// + /// + public uint Depth; + + /// + /// Type: UINT + /// The number of mip levels contained in the DDS image. + /// + public uint MipLevels; + + /// + /// Type: UINT + /// The number of textures in the array in the DDS image. + /// + public uint ArraySize; + + /// + /// Type: DXGI_FORMAT + /// The DXGI_FORMAT of the DDS pixel data. + /// + public DXGI_FORMAT DxgiFormat; + + /// + /// Type: WICDdsDimension + /// Specifies the dimension type of the data contained in DDS image (1D, 2D, 3D or cube texture). + /// + public WICDdsDimension Dimension; + + /// + /// Type: WICDdsAlphaMode + /// Specifies the alpha behavior of the DDS image. + /// + public WICDdsAlphaMode AlphaMode; + } + + /// This defines parameters that you can use to override the default parameters normally used when encoding an image. + /// + /// If this parameter is not passed to the encoding API, the encoder uses these settings. + /// + /// + /// A pixel format of (DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED). + /// + /// + /// An x and y DPI of 96. + /// + /// + /// The entire image bounds will be used for encoding. + /// + /// + /// + /// Note The parameters as specified can't result in a scale. The encoder can use a larger portion of the input image based + /// on the passed in DPI and the pixel width and height. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicimageparameters typedef struct WICImageParameters { + // D2D1_PIXEL_FORMAT PixelFormat; FLOAT DpiX; FLOAT DpiY; FLOAT Top; FLOAT Left; UINT32 PixelWidth; UINT32 PixelHeight; } WICImageParameters; + [PInvokeData("wincodec.h", MSDNShortId = "0B461697-C7ED-48C9-A880-1B5F4A26FCFC")] + [StructLayout(LayoutKind.Sequential)] + public struct WICImageParameters + { + /// The pixel format to which the image is processed before it is written to the encoder. + public D2D1_PIXEL_FORMAT PixelFormat; + + /// The DPI in the x dimension. + public float DpiX; + + /// The DPI in the y dimension. + public float DpiY; + + /// The top corner in pixels of the image space to be encoded to the destination. + public float Top; + + /// The left corner in pixels of the image space to be encoded to the destination. + public float Left; + + /// The width in pixels of the part of the image to write. + public uint PixelWidth; + + /// The height in pixels of the part of the image to write. + public uint PixelHeight; + } + + /// Represents a JPEG frame header. + /// Get the frame header for an image by calling IWICJpegFrameDecode::GetFrameHeader. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicjpegframeheader typedef struct WICJpegFrameHeader { + // UINT Width; UINT Height; WICJpegTransferMatrix TransferMatrix; WICJpegScanType ScanType; UINT cComponents; DWORD + // ComponentIdentifiers; DWORD SampleFactors; DWORD QuantizationTableIndices; } WICJpegFrameHeader; + [PInvokeData("wincodec.h", MSDNShortId = "BB207D78-9E27-49A4-91E4-601CED109389")] + [StructLayout(LayoutKind.Sequential)] + public struct WICJpegFrameHeader + { + /// The width of the JPEG frame. + public uint Width; + + /// The height of the JPEG frame. + public uint Height; + + /// The transfer matrix of the JPEG frame. + public WICJpegTransferMatrix TransferMatrix; + + /// The scan type of the JPEG frame. + public WICJpegScanType ScanType; + + /// The number of components in the frame. + public uint cComponents; + + /// The component identifiers. + public uint ComponentIdentifiers; + + /// + /// The sample factors. Use one of the following constants, described in IWICJpegFrameDecode Constants. + /// + /// + /// WIC_JPEG_SAMPLE_FACTORS_ONE + /// + /// + /// WIC_JPEG_SAMPLE_FACTORS_THREE_420 + /// + /// + /// WIC_JPEG_SAMPLE_FACTORS_THREE_422 + /// + /// + /// WIC_JPEG_SAMPLE_FACTORS_THREE_440 + /// + /// + /// WIC_JPEG_SAMPLE_FACTORS_THREE_444 + /// + /// + /// + public WIC_JPEG_SAMPLE_FACTORS SampleFactors; + + /// + /// + /// The format of the quantization table indices. Use one of the following constants, described in IWICJpegFrameDecode Constants. + /// + /// + /// + /// WIC_JPEG_QUANTIZATION_BASELINE_ONE + /// + /// + /// WIC_JPEG_QUANTIZATION_BASELINE_THREE + /// + /// + /// + public WIC_JPEG_QUANTIZATION_BASELINE QuantizationTableIndices; + } + + /// Represents a JPEG frame header. + /// Get the scan header for an image by calling IWICJpegFrameDecode::GetScanHeader. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicjpegscanheader typedef struct WICJpegScanHeader { UINT + // cComponents; UINT RestartInterval; DWORD ComponentSelectors; DWORD HuffmanTableIndices; BYTE StartSpectralSelection; BYTE + // EndSpectralSelection; BYTE SuccessiveApproximationHigh; BYTE SuccessiveApproximationLow; } WICJpegScanHeader; + [PInvokeData("wincodec.h", MSDNShortId = "87A36F9B-CD6B-4343-AAA7-9FDBAD41E38A")] + [StructLayout(LayoutKind.Sequential)] + public struct WICJpegScanHeader + { + /// The number of components in the scan. + public uint cComponents; + + /// The interval of reset markers within the scan. + public uint RestartInterval; + + /// The component identifiers. + public uint ComponentSelectors; + + /// + /// + /// The format of the quantization table indices. Use one of the following constants, described in IWICJpegFrameDecode Constants. + /// + /// + /// + /// WIC_JPEG_HUFFMAN_BASELINE_ONE + /// + /// + /// WIC_JPEG_HUFFMAN_BASELINE_THREE + /// + /// + /// + public WIC_JPEG_HUFFMAN_BASELINE HuffmanTableIndices; + + /// The start of the spectral selection. + public byte StartSpectralSelection; + + /// The end of the spectral selection. + public byte EndSpectralSelection; + + /// The successive approximation high. + public byte SuccessiveApproximationHigh; + + /// The successive approximation low. + public byte SuccessiveApproximationLow; + } + + /// Represents metadata header. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/ns-wincodecsdk-wicmetadataheader typedef struct WICMetadataHeader + // { ULARGE_INTEGER Position; ULONG Length; BYTE *Header; ULARGE_INTEGER DataOffset; } WICMetadataHeader; + [PInvokeData("wincodecsdk.h", MSDNShortId = "f643b163-55b2-4691-a4eb-fc162949e936")] + [StructLayout(LayoutKind.Sequential)] + public struct WICMetadataHeader + { + /// + /// Type: ULARGE_INTEGER + /// The position of the header. + /// + public ulong Position; + + /// + /// Type: ULONG + /// The length of the header. + /// + public uint Length; + + /// + /// Type: BYTE* + /// Pointer to the header. + /// + public IntPtr Header; + + /// + /// Type: ULARGE_INTEGER + /// The offset of the header. + /// + public ulong DataOffset; + } + + /// Represents a metadata pattern. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/ns-wincodecsdk-wicmetadatapattern typedef struct + // WICMetadataPattern { ULARGE_INTEGER Position; ULONG Length; BYTE *Pattern; BYTE *Mask; ULARGE_INTEGER DataOffset; } WICMetadataPattern; + [PInvokeData("wincodecsdk.h", MSDNShortId = "cea9e07d-5e55-4320-9744-b5864b58cfd6")] + [StructLayout(LayoutKind.Sequential)] + public struct WICMetadataPattern + { + /// + /// Type: ULARGE_INTEGER + /// The position of the pattern. + /// + public ulong Position; + + /// + /// Type: ULONG + /// The length of the pattern. + /// + public uint Length; + + /// + /// Type: BYTE* + /// Pointer to the pattern. + /// + public IntPtr Pattern; + + /// + /// Type: BYTE* + /// Pointer to the pattern mask. + /// + public IntPtr Mask; + + /// + /// Type: ULARGE_INTEGER + /// The offset location of the pattern. + /// + public ulong DataOffset; + } + + /// Defines raw codec capabilites. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicrawcapabilitiesinfo typedef struct + // WICRawCapabilitiesInfo { UINT cbSize; UINT CodecMajorVersion; UINT CodecMinorVersion; WICRawCapabilities + // ExposureCompensationSupport; WICRawCapabilities ContrastSupport; WICRawCapabilities RGBWhitePointSupport; WICRawCapabilities + // NamedWhitePointSupport; UINT NamedWhitePointSupportMask; WICRawCapabilities KelvinWhitePointSupport; WICRawCapabilities + // GammaSupport; WICRawCapabilities TintSupport; WICRawCapabilities SaturationSupport; WICRawCapabilities SharpnessSupport; + // WICRawCapabilities NoiseReductionSupport; WICRawCapabilities DestinationColorProfileSupport; WICRawCapabilities ToneCurveSupport; + // WICRawRotationCapabilities RotationSupport; WICRawCapabilities RenderModeSupport; } WICRawCapabilitiesInfo; + [PInvokeData("wincodec.h", MSDNShortId = "1466cd90-8eab-4c5c-bb77-c75d35fe586b")] + [StructLayout(LayoutKind.Sequential)] + public struct WICRawCapabilitiesInfo + { + /// + /// Type: UINT + /// Size of the WICRawCapabilitiesInfo structure. + /// + public uint cbSize; + + /// + /// Type: UINT + /// The codec's major version. + /// + public uint CodecMajorVersion; + + /// + /// Type: UINT + /// The codec's minor version. + /// + public uint CodecMinorVersion; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of exposure compensation support. + /// + public WICRawCapabilities ExposureCompensationSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of contrast support. + /// + public WICRawCapabilities ContrastSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of RGB white point support. + /// + public WICRawCapabilities RGBWhitePointSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of WICNamedWhitePoint support. + /// + public WICRawCapabilities NamedWhitePointSupport; + + /// + /// Type: UINT + /// The WICNamedWhitePoint mask. + /// + public uint NamedWhitePointSupportMask; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of kelvin white point support. + /// + public WICRawCapabilities KelvinWhitePointSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of gamma support. + /// + public WICRawCapabilities GammaSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of tint support. + /// + public WICRawCapabilities TintSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of saturation support. + /// + public WICRawCapabilities SaturationSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of sharpness support. + /// + public WICRawCapabilities SharpnessSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of noise reduction support. + /// + public WICRawCapabilities NoiseReductionSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of destination color profile support. + /// + public WICRawCapabilities DestinationColorProfileSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of tone curve support. + /// + public WICRawCapabilities ToneCurveSupport; + + /// + /// Type: WICRawRotationCapabilities + /// The WICRawRotationCapabilities of rotation support. + /// + public WICRawRotationCapabilities RotationSupport; + + /// + /// Type: WICRawCapabilities + /// The WICRawCapabilities of WICRawRenderMode support. + /// + public WICRawCapabilities RenderModeSupport; + } + + /// Represents a raw image tone curve. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicrawtonecurve typedef struct WICRawToneCurve { UINT + // cPoints; WICRawToneCurvePoint aPoints[1]; } WICRawToneCurve; + [PInvokeData("wincodec.h", MSDNShortId = "45eedc32-a642-4ef6-a02a-63eaeacf0012")] + [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(cPoints))] + [StructLayout(LayoutKind.Sequential)] + public struct WICRawToneCurve + { + /// + /// Type: UINT + /// The number of tone curve points. + /// + public uint cPoints; + + /// + /// Type: WICRawToneCurvePoint[1] + /// The array of tone curve points. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] + public WICRawToneCurvePoint[] aPoints; + } + + /// Represents a raw image tone curve point. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicrawtonecurvepoint typedef struct WICRawToneCurvePoint + // { double Input; double Output; } WICRawToneCurvePoint; + [PInvokeData("wincodec.h", MSDNShortId = "c5fbcd25-2884-4313-93d5-c1f290de4a77")] + [StructLayout(LayoutKind.Sequential)] + public struct WICRawToneCurvePoint + { + /// + /// Type: double + /// The tone curve input. + /// + public double Input; + + /// + /// Type: double + /// The tone curve output. + /// + public double Output; + } + + /// Represents a rectangle for Windows Imaging Component (WIC) API. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicrect typedef struct WICRect { INT X; INT Y; INT Width; + // INT Height; } WICRect; + [PInvokeData("wincodec.h", MSDNShortId = "e07c26bf-b645-4382-bb93-8472ba397026")] + [StructLayout(LayoutKind.Sequential)] + public struct WICRect + { + /// + /// Type: INT + /// The horizontal coordinate of the rectangle. + /// + public int X; + + /// + /// Type: INT + /// The vertical coordinate of the rectangle. + /// + public int Y; + + /// + /// Type: INT + /// The width of the rectangle. + /// + public int Width; + + /// + /// Type: INT + /// The height of the rectangle. + /// + public int Height; + } + + /// Represents a rectangle for Windows Imaging Component (WIC) API. + // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/ns-wincodec-wicrect typedef struct WICRect { INT X; INT Y; INT Width; + // INT Height; } WICRect; + [PInvokeData("wincodec.h", MSDNShortId = "e07c26bf-b645-4382-bb93-8472ba397026")] + [StructLayout(LayoutKind.Sequential)] + public class PWICRect + { + /// + /// Type: INT + /// The horizontal coordinate of the rectangle. + /// + public int X; + + /// + /// Type: INT + /// The vertical coordinate of the rectangle. + /// + public int Y; + + /// + /// Type: INT + /// The width of the rectangle. + /// + public int Width; + + /// + /// Type: INT + /// The height of the rectangle. + /// + public int Height; + + /// Initializes a new instance of the class. + /// The x. + /// The y. + /// The width. + /// The height. + public PWICRect(int x, int y, int width, int height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + /// Performs an implicit conversion from to . + /// The rect. + /// The resulting instance from the conversion. + public static implicit operator PWICRect(in WICRect rect) => new PWICRect(rect.X, rect.Y, rect.Width, rect.Height); + } + } +} \ No newline at end of file diff --git a/UnitTests/PInvoke/Graphics/Direct2DTests.cs b/UnitTests/PInvoke/Graphics/Direct2DTests.cs new file mode 100644 index 00000000..c148a7b9 --- /dev/null +++ b/UnitTests/PInvoke/Graphics/Direct2DTests.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Vanara.Extensions; +using Vanara.InteropServices; +using static Vanara.PInvoke.D2d1; + +namespace Vanara.PInvoke.Tests +{ + public class Direct2DTests + { + [Test] + public void DXGITest() + { + using var pFactory = ComReleaserFactory.Create(D2D1CreateFactory()); + + using var form = new System.Windows.Forms.Form { Text = "Sample App" }; + } + } +} \ No newline at end of file diff --git a/UnitTests/PInvoke/Graphics/DirectWriteTests.cs b/UnitTests/PInvoke/Graphics/DirectWriteTests.cs new file mode 100644 index 00000000..d14ed055 --- /dev/null +++ b/UnitTests/PInvoke/Graphics/DirectWriteTests.cs @@ -0,0 +1,263 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Vanara.Extensions; +using Vanara.InteropServices; +using static Vanara.PInvoke.D2d1; +using static Vanara.PInvoke.Dwrite; + +namespace Vanara.PInvoke.Tests +{ + public class DirectWriteTests : GenericComTester + { + private const string fontDir = @"C:\Temp\Fonts"; + + protected override IDWriteFactory InitInstance() => DWriteCreateFactory(); + + [Test] + public void EnumFontsTest() + { + Instance.GetSystemFontCollection(out var coll); + using var pColl = ComReleaserFactory.Create(coll); + EnumFonts(pColl.Item); + } + + private static void EnumFonts(IDWriteFontCollection coll) + { + var count = coll.GetFontFamilyCount(); + var locale = System.Globalization.CultureInfo.CurrentCulture.Name; + for (var i = 0U; i < count; i++) + { + try + { + using var pFontFam = ComReleaserFactory.Create(coll.GetFontFamily(i)); + using var pFamNames = ComReleaserFactory.Create(pFontFam.Item.GetFamilyNames()); + pFamNames.Item.FindLocaleName(locale, out var index, out var exists); + if (!exists) index = 0; + var len = pFamNames.Item.GetStringLength(index) + 1; + var str = new StringBuilder((int)len); + pFamNames.Item.GetString(index, str, len); + TestContext.WriteLine(str); + } + catch (Exception ex) + { + TestContext.WriteLine("ERROR: " + ex.Message); + } + } + } + + [Test] + public void LoadCustomFontsTest() + { + var loader = new FontLoader(); + Instance.RegisterFontCollectionLoader(loader); + try + { + using var pDir = new SafeCoTaskMemString(fontDir); + using var pColl = ComReleaserFactory.Create(Instance.CreateCustomFontCollection(loader, pDir, pDir.Size)); + EnumFonts(pColl.Item); + } + finally + { + Instance.UnregisterFontCollectionLoader(loader); + } + } + + [Test] + public void CreateFontFaceTest() + { + var ldr = new FontLoader(); + var pList = Directory.EnumerateFiles(fontDir).Take(1).Select(f => Instance.CreateFontFileReference(f)).ToArray(); + try + { + pList[0].Analyze(out var sup, out var ft, out var fc, out var fcn); + TestContext.WriteLine($"Supported={sup}; FileType={ft}; FaceType={fc}; FaceCnt={fcn}"); + var pFF = ComReleaserFactory.Create(Instance.CreateFontFace(fc, (uint)pList.Length, pList, 0, DWRITE_FONT_SIMULATIONS.DWRITE_FONT_SIMULATIONS_NONE)); + Assert.That(pFF.Item.GetType(), Is.EqualTo(fc)); + var ff = new IDWriteFontFile[pList.Length]; + var fflen = (uint)ff.Length; + Assert.That(() => pFF.Item.GetFiles(ref fflen, ff), Throws.Nothing); + ff.WriteValues(); + TestContext.WriteLine($"Index in font files: {pFF.Item.GetIndex()}"); + TestContext.WriteLine($"Simulations: {pFF.Item.GetSimulations()}"); + Assert.That(pFF.Item.IsSymbolFont(), Is.False); + Assert.That(() => { pFF.Item.GetMetrics(out var faceMetrics); faceMetrics.WriteValues(); }, Throws.Nothing); + var glCnt = (int)pFF.Item.GetGlyphCount(); + Assert.That(glCnt, Is.GreaterThan(0)); + glCnt = Math.Min(3, glCnt); + var glm = new DWRITE_GLYPH_METRICS[glCnt]; + var glidx = Enumerable.Range(0, glCnt).Select(i => (ushort)i).ToArray(); + Assert.That(() => pFF.Item.GetDesignGlyphMetrics(glidx, (uint)glCnt, glm), Throws.Nothing); + glm.WriteValues(); + Assert.That(() => + { + var tag = DWRITE_FONT_FEATURE_TAG.DWRITE_FONT_FEATURE_TAG_DEFAULT; + pFF.Item.TryGetFontTable((uint)tag, out var tableData, out var tableSize, out var tableCtx, out var tableExists); + TestContext.WriteLine($"Table: {tag} = Sz:{tableSize}, {tableExists}"); + pFF.Item.ReleaseFontTable(tableCtx); + }, Throws.Nothing); + var rParams = Instance.CreateRenderingParams(); + pFF.Item.GetRecommendedRenderingMode(9f, 72f, DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL, rParams).WriteValues(); + var hMon = User32.MonitorFromPoint(System.Drawing.Point.Empty, User32.MonitorFlags.MONITOR_DEFAULTTOPRIMARY); + rParams = Instance.CreateMonitorRenderingParams(hMon); + pFF.Item.GetRecommendedRenderingMode(9f, 72f, DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL, rParams).WriteValues(); + rParams = Instance.CreateCustomRenderingParams(2.2f, 1f, 1f, DWRITE_PIXEL_GEOMETRY.DWRITE_PIXEL_GEOMETRY_BGR, DWRITE_RENDERING_MODE.DWRITE_RENDERING_MODE_ALIASED); + pFF.Item.GetRecommendedRenderingMode(9f, 72f, DWRITE_MEASURING_MODE.DWRITE_MEASURING_MODE_NATURAL, rParams).WriteValues(); + pFF.Item.GetGdiCompatibleMetrics(9f, 72f).WriteValues(); + Assert.That(() => pFF.Item.GetGdiCompatibleGlyphMetrics(9f, 72f, default, true, glidx, (uint)glCnt, glm), Throws.Nothing); + glm.WriteValues(); + } + finally + { + foreach (var i in pList) + Marshal.ReleaseComObject(i); + } + } + + [Test] + public void CreateTextFormatTest() + { + using var pTF = ComReleaserFactory.Create(Instance.CreateTextFormat("Arial", default, DWRITE_FONT_WEIGHT.DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH.DWRITE_FONT_STRETCH_NORMAL, 11f, "en-us")); + Assert.That(pTF.Item.GetFontSize(), Is.GreaterThan(0f)); + Assert.That(() => pTF.Item.SetTextAlignment(DWRITE_TEXT_ALIGNMENT.DWRITE_TEXT_ALIGNMENT_CENTER), Throws.Nothing); + var sb = new StringBuilder(20); + Assert.That(() => pTF.Item.GetLocaleName(sb, (uint)sb.Capacity), Throws.Nothing); + Assert.That(sb.ToString(), Is.EqualTo("en-us")); + } + + [Test] + public void CreateTypographyTest() + { + using var pTyp = ComReleaserFactory.Create(Instance.CreateTypography()); + var cnt = pTyp.Item.GetFontFeatureCount(); + if (cnt > 0) + pTyp.Item.GetFontFeature(0).WriteValues(); + } + + [Test] + public void GetGdiInteropTest() + { + Assert.That(() => + { + using var p = ComReleaserFactory.Create(Instance.GetGdiInterop()); + }, Throws.Nothing); + } + + [Test] + public void FontFileLoaderTest() + { + var loader = new FileLoader(); + Assert.That(() => Instance.RegisterFontFileLoader(loader), Throws.Nothing); + try + { + + } + finally + { + Assert.That(() => Instance.UnregisterFontFileLoader(loader), Throws.Nothing); + } + } + + [ComVisible(true)] + public class FontLoader : IDWriteFontCollectionLoader + { + public HRESULT CreateEnumeratorFromKey([In] IDWriteFactory factory, IntPtr collectionKey, uint collectionKeySize, out IDWriteFontFileEnumerator fontFileEnumerator) + { + fontFileEnumerator = null; + if (factory is null || collectionKey == default) + return HRESULT.E_INVALIDARG; + + fontFileEnumerator = new FontEnumerator(factory, StringHelper.GetString(collectionKey, CharSet.Unicode, collectionKeySize)); + + return HRESULT.S_OK; + } + } + + [ComVisible(true)] + public class FileLoader : IDWriteFontFileLoader + { + public FileLoader() + { + + } + + public HRESULT CreateStreamFromKey([In] IntPtr fontFileReferenceKey, uint fontFileReferenceKeySize, out IDWriteFontFileStream fontFileStream) + { + fontFileStream = new FileStream(Directory.EnumerateFiles(fontDir).First()); + return default; + } + } + + [ComVisible(true)] + public class FileStream : IDWriteFontFileStream, IDisposable + { + FileInfo fi; + SafeHGlobalHandle mem; + + public FileStream(string path) + { + fi = new FileInfo(path); + mem = new SafeHGlobalHandle(File.ReadAllBytes(path)); + } + + public HRESULT ReadFileFragment(out IntPtr fragmentStart, ulong fileOffset, ulong fragmentSize, [Out] out IntPtr fragmentContext) + { + fragmentContext = default; + if (fileOffset + fragmentSize >= (ulong)fi.Length) + { + fragmentStart = default; + return HRESULT.E_FAIL; + } + fragmentStart = ((IntPtr)mem).Offset((long)fileOffset); + return default; + } + + public void ReleaseFileFragment([In] IntPtr fragmentContext) + { + } + + public HRESULT GetFileSize(out ulong fileSize) + { + fileSize = (ulong)fi.Length; + return default; + } + + public HRESULT GetLastWriteTime(out System.Runtime.InteropServices.ComTypes.FILETIME lastWriteTime) + { + lastWriteTime = fi.LastWriteTime.ToFileTimeStruct(); + return default; + } + + public void Dispose() => ((IDisposable)mem).Dispose(); + } + + [ComVisible(true)] + public class FontEnumerator : IDWriteFontFileEnumerator + { + private IEnumerator enumerator; + private IDWriteFactory factory; + + public FontEnumerator(IDWriteFactory fact, string path) + { + factory = fact; + enumerator = Directory.EnumerateFiles(path).GetEnumerator(); + } + + public HRESULT MoveNext([MarshalAs(UnmanagedType.Bool)] out bool hasCurrentFile) { hasCurrentFile = enumerator.MoveNext(); return HRESULT.S_OK; } + + public HRESULT GetCurrentFontFile(out IDWriteFontFile fontFile) + { + try { fontFile = factory.CreateFontFileReference(enumerator.Current); } + catch (COMException ex) { fontFile = null; return ex.HResult; } + return default; + } + } + } +} \ No newline at end of file diff --git a/UnitTests/PInvoke/Graphics/Graphics.csproj b/UnitTests/PInvoke/Graphics/Graphics.csproj new file mode 100644 index 00000000..6dadea57 --- /dev/null +++ b/UnitTests/PInvoke/Graphics/Graphics.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {AD003766-998F-4969-8632-A9CD0E3A21F8} + Library + Properties + UnitTest.PInvoke.DirectX + v4.7.2 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AnyCPU + true + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + x64 + + + + {241f73ee-9298-45c9-b869-a045dff94c03} + Vanara.Core + + + {faf09c42-66ca-4765-910a-2a9a2ef399d0} + Vanara.PInvoke.Graphics + + + {a5e519e9-feba-4fe3-93a5-b8269bef72f4} + Vanara.PInvoke.Shared + + + {a6771907-addc-49fc-8444-a97aa65e77e2} + Vanara.PInvoke.User32 + + + {a96cff10-0967-429a-8700-4a86c97c5603} + Shared + + + + + 3.12.0 + + + 3.15.1 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Vanara.sln b/Vanara.sln index b6aa7c54..401b9f8b 100644 --- a/Vanara.sln +++ b/Vanara.sln @@ -225,6 +225,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CldApi", "UnitTests\PInvoke EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.ProjectedFSLib", "PInvoke\ProjectedFSLib\Vanara.PInvoke.ProjectedFSLib.csproj", "{30F2727D-0B8E-4364-8F0E-9EEB4CD9CB0E}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.Graphics", "PInvoke\Graphics\Vanara.PInvoke.Graphics.csproj", "{FAF09C42-66CA-4765-910A-2A9A2EF399D0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graphics", "UnitTests\PInvoke\Graphics\Graphics.csproj", "{AD003766-998F-4969-8632-A9CD0E3A21F8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug (no Unit Tests)|Any CPU = Debug (no Unit Tests)|Any CPU @@ -721,6 +725,18 @@ Global {30F2727D-0B8E-4364-8F0E-9EEB4CD9CB0E}.Debug|Any CPU.Build.0 = Debug|Any CPU {30F2727D-0B8E-4364-8F0E-9EEB4CD9CB0E}.Release|Any CPU.ActiveCfg = Release|Any CPU {30F2727D-0B8E-4364-8F0E-9EEB4CD9CB0E}.Release|Any CPU.Build.0 = Release|Any CPU + {FAF09C42-66CA-4765-910A-2A9A2EF399D0}.Debug (no Unit Tests)|Any CPU.ActiveCfg = Debug|Any CPU + {FAF09C42-66CA-4765-910A-2A9A2EF399D0}.Debug (no Unit Tests)|Any CPU.Build.0 = Debug|Any CPU + {FAF09C42-66CA-4765-910A-2A9A2EF399D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAF09C42-66CA-4765-910A-2A9A2EF399D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAF09C42-66CA-4765-910A-2A9A2EF399D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAF09C42-66CA-4765-910A-2A9A2EF399D0}.Release|Any CPU.Build.0 = Release|Any CPU + {AD003766-998F-4969-8632-A9CD0E3A21F8}.Debug (no Unit Tests)|Any CPU.ActiveCfg = Debug|Any CPU + {AD003766-998F-4969-8632-A9CD0E3A21F8}.Debug (no Unit Tests)|Any CPU.Build.0 = Debug|Any CPU + {AD003766-998F-4969-8632-A9CD0E3A21F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD003766-998F-4969-8632-A9CD0E3A21F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD003766-998F-4969-8632-A9CD0E3A21F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD003766-998F-4969-8632-A9CD0E3A21F8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -816,6 +832,8 @@ Global {DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} {CCEE0CAA-27BF-43B3-8609-2279BEDA3F61} = {385CAD2D-0A5E-4F80-927B-D5499D126B90} {30F2727D-0B8E-4364-8F0E-9EEB4CD9CB0E} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} + {FAF09C42-66CA-4765-910A-2A9A2EF399D0} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} + {AD003766-998F-4969-8632-A9CD0E3A21F8} = {385CAD2D-0A5E-4F80-927B-D5499D126B90} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}