Note that there are some C++ methods of IDCompositionVisual are renamed to avoid conflicts.
-- v2: include: Add dcomp.idl. include: Add dcomptypes.idl. include: Add DirectComposition error codes.
From: Zhiyi Zhang zzhang@codeweavers.com
--- include/winerror.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/winerror.h b/include/winerror.h index fb44eaacbed..ccb58199101 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -4023,6 +4023,10 @@ static inline HRESULT HRESULT_FROM_WIN32(unsigned int x) #define DXGI_ERROR_HW_PROTECTION_OUTOFMEMORY _HRESULT_TYPEDEF_(0x887a0030) #define DXGI_ERROR_MODE_CHANGE_IN_PROGRESS _HRESULT_TYPEDEF_(0x887a0025)
+#define DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED _HRESULT_TYPEDEF_(0x88980800) +#define DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED _HRESULT_TYPEDEF_(0x88980801) +#define DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED _HRESULT_TYPEDEF_(0x88980802) + #define ERROR_AUDITING_DISABLED _HRESULT_TYPEDEF_(0xC0090001) #define ERROR_ALL_SIDS_FILTERED _HRESULT_TYPEDEF_(0xC0090002)
From: Zhiyi Zhang zzhang@codeweavers.com
--- include/Makefile.in | 1 + include/dcomptypes.idl | 77 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 include/dcomptypes.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 49b5f7c4b01..07917b4923d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -182,6 +182,7 @@ SOURCES = \ dciddi.h \ dciman.h \ dcommon.idl \ + dcomptypes.idl \ dde.h \ dde.rh \ ddeml.h \ diff --git a/include/dcomptypes.idl b/include/dcomptypes.idl new file mode 100644 index 00000000000..2ee6b17cde3 --- /dev/null +++ b/include/dcomptypes.idl @@ -0,0 +1,77 @@ +/* + * Copyright 2023 Zhiyi Zhang for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "dxgitype.idl"; +import "dxgi1_5.idl"; + +enum DCOMPOSITION_BITMAP_INTERPOLATION_MODE +{ + DCOMPOSITION_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + DCOMPOSITION_BITMAP_INTERPOLATION_MODE_LINEAR = 1, + DCOMPOSITION_BITMAP_INTERPOLATION_MODE_INHERIT = 0xffffffff +}; + +enum DCOMPOSITION_BORDER_MODE +{ + DCOMPOSITION_BORDER_MODE_SOFT = 0, + DCOMPOSITION_BORDER_MODE_HARD = 1, + DCOMPOSITION_BORDER_MODE_INHERIT = 0xffffffff +}; + +enum DCOMPOSITION_COMPOSITE_MODE +{ + DCOMPOSITION_COMPOSITE_MODE_SOURCE_OVER = 0, + DCOMPOSITION_COMPOSITE_MODE_DESTINATION_INVERT = 1, + DCOMPOSITION_COMPOSITE_MODE_MIN_BLEND = 2, + DCOMPOSITION_COMPOSITE_MODE_INHERIT = 0xffffffff +}; + +enum DCOMPOSITION_BACKFACE_VISIBILITY +{ + DCOMPOSITION_BACKFACE_VISIBILITY_VISIBLE = 0, + DCOMPOSITION_BACKFACE_VISIBILITY_HIDDEN = 1, + DCOMPOSITION_BACKFACE_VISIBILITY_INHERIT = 0xffffffff +}; + +enum DCOMPOSITION_OPACITY_MODE +{ + DCOMPOSITION_OPACITY_MODE_LAYER = 0, + DCOMPOSITION_OPACITY_MODE_MULTIPLY = 1, + DCOMPOSITION_OPACITY_MODE_INHERIT = 0xffffffff +}; + +enum DCOMPOSITION_DEPTH_MODE +{ + DCOMPOSITION_DEPTH_MODE_TREE = 0, + DCOMPOSITION_DEPTH_MODE_SPATIAL = 1, + DCOMPOSITION_DEPTH_MODE_SORTED = 3, + DCOMPOSITION_DEPTH_MODE_INHERIT = 0xffffffff +}; + +typedef struct +{ + LARGE_INTEGER lastFrameTime; + DXGI_RATIONAL currentCompositionRate; + LARGE_INTEGER currentTime; + LARGE_INTEGER timeFrequency; + LARGE_INTEGER nextEstimatedFrameTime; +} DCOMPOSITION_FRAME_STATISTICS; + +cpp_quote("#define COMPOSITIONOBJECT_READ 0x0001L") +cpp_quote("#define COMPOSITIONOBJECT_WRITE 0x0002L") +cpp_quote("#define COMPOSITIONOBJECT_ALL_ACCESS (COMPOSITIONOBJECT_READ | COMPOSITIONOBJECT_WRITE)")
From: Zhiyi Zhang zzhang@codeweavers.com
Note that there are some C++ methods of IDCompositionVisual are renamed to avoid conflicts. --- include/Makefile.in | 1 + include/dcomp.idl | 230 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100644 include/dcomp.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 07917b4923d..610c488f10a 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -182,6 +182,7 @@ SOURCES = \ dciddi.h \ dciman.h \ dcommon.idl \ + dcomp.idl \ dcomptypes.idl \ dde.h \ dde.rh \ diff --git a/include/dcomp.idl b/include/dcomp.idl new file mode 100644 index 00000000000..f64d3d3a280 --- /dev/null +++ b/include/dcomp.idl @@ -0,0 +1,230 @@ +/* + * Copyright 2023 Zhiyi Zhang for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "dcommon.idl"; +import "dcomptypes.idl"; +import "unknwn.idl"; +import "d2dbasetypes.h"; + +cpp_quote("#ifndef D3DMATRIX_DEFINED") +cpp_quote("#include <d3d9types.h>") +cpp_quote("#endif") + +interface IDCompositionAffineTransform2DEffect; +interface IDCompositionAnimation; +interface IDCompositionArithmeticCompositeEffect; +interface IDCompositionBlendEffect; +interface IDCompositionBrightnessEffect; +interface IDCompositionClip; +interface IDCompositionColorMatrixEffect; +interface IDCompositionCompositeEffect; +interface IDCompositionDevice; +interface IDCompositionEffect; +interface IDCompositionEffectGroup; +interface IDCompositionFilterEffect; +interface IDCompositionGaussianBlurEffect; +interface IDCompositionHueRotationEffect; +interface IDCompositionLinearTransferEffect; +interface IDCompositionMatrixTransform; +interface IDCompositionMatrixTransform3D; +interface IDCompositionRectangleClip; +interface IDCompositionRotateTransform; +interface IDCompositionRotateTransform3D; +interface IDCompositionSaturationEffect; +interface IDCompositionScaleTransform; +interface IDCompositionScaleTransform3D; +interface IDCompositionShadowEffect; +interface IDCompositionSkewTransform; +interface IDCompositionSurface; +interface IDCompositionTableTransferEffect; +interface IDCompositionTarget; +interface IDCompositionTransform; +interface IDCompositionTransform3D; +interface IDCompositionTranslateTransform; +interface IDCompositionTranslateTransform3D; +interface IDCompositionTurbulenceEffect; +interface IDCompositionVirtualSurface; +interface IDCompositionVisual; +interface IDCompositionDesktopDevice; +interface IDCompositionDevice2; +interface IDCompositionDeviceDebug; +interface IDCompositionSurfaceFactory; +interface IDCompositionVisual2; +interface IDCompositionVisualDebug; +interface IDCompositionDevice3; +interface IDCompositionVisual3; + +[ + object, + uuid(c37ea93a-e7aa-450d-b16f-9746cb0407f3), + local, + pointer_default(unique) +] +interface IDCompositionDevice : IUnknown +{ + HRESULT Commit(); + HRESULT WaitForCommitCompletion(); + HRESULT GetFrameStatistics([out] DCOMPOSITION_FRAME_STATISTICS *statistics); + HRESULT CreateTargetForHwnd([in] HWND hwnd, [in] BOOL topmost, [out] IDCompositionTarget **target); + HRESULT CreateVisual([out] IDCompositionVisual **visual); + HRESULT CreateSurface([in] UINT width, [in] UINT height, [in] DXGI_FORMAT pixel_format, [in] DXGI_ALPHA_MODE alpha_mode, [out] IDCompositionSurface **surface); + HRESULT CreateVirtualSurface([in] UINT width, [in] UINT height, [in] DXGI_FORMAT pixel_format, [in] DXGI_ALPHA_MODE alpha_mode, [out] IDCompositionVirtualSurface **surface); + HRESULT CreateSurfaceFromHandle([in] HANDLE handle, [out] IUnknown **surface); + HRESULT CreateSurfaceFromHwnd([in] HWND hwnd, [out] IUnknown **surface); + HRESULT CreateTranslateTransform([out] IDCompositionTranslateTransform **transform); + HRESULT CreateScaleTransform([out] IDCompositionScaleTransform **transform); + HRESULT CreateRotateTransform([out] IDCompositionRotateTransform **transform); + HRESULT CreateSkewTransform([out] IDCompositionSkewTransform **transform); + HRESULT CreateMatrixTransform([out] IDCompositionMatrixTransform **transform); + HRESULT CreateTransformGroup([in, size_is(elements)] IDCompositionTransform **transforms, [in] UINT elements, [out] IDCompositionTransform **transform_group); + HRESULT CreateTranslateTransform3D([out] IDCompositionTranslateTransform3D **transform_3d); + HRESULT CreateScaleTransform3D([out] IDCompositionScaleTransform3D **transform_3d); + HRESULT CreateRotateTransform3D([out] IDCompositionRotateTransform3D **transform_3d); + HRESULT CreateMatrixTransform3D([out] IDCompositionMatrixTransform3D **transform_3d); + HRESULT CreateTransform3DGroup([in, size_is(elements)] IDCompositionTransform3D **transforms_3d, [in] UINT elements, [out] IDCompositionTransform3D **transform_3d_group); + HRESULT CreateEffectGroup([out] IDCompositionEffectGroup **effect_group); + HRESULT CreateRectangleClip([out] IDCompositionRectangleClip **clip); + HRESULT CreateAnimation([out] IDCompositionAnimation **animation); + HRESULT CheckDeviceState([out] BOOL *valid); +} + +[ + object, + uuid(75f6468d-1b8e-447c-9bc6-75fea80b5b25), + local, + pointer_default(unique) +] +interface IDCompositionDevice2 : IUnknown +{ + HRESULT Commit(); + HRESULT WaitForCommitCompletion(); + HRESULT GetFrameStatistics([out] DCOMPOSITION_FRAME_STATISTICS *statistics); + HRESULT CreateVisual([out] IDCompositionVisual2 **visual); + HRESULT CreateSurfaceFactory([in] IUnknown *rendering_device, [out] IDCompositionSurfaceFactory **surface_factory); + HRESULT CreateSurface([in] UINT width, [in] UINT height, [in] DXGI_FORMAT pixel_format, [in] DXGI_ALPHA_MODE alpha_mode, [out] IDCompositionSurface **surface); + HRESULT CreateVirtualSurface([in] UINT width, [in] UINT height, [in] DXGI_FORMAT pixel_format, [in] DXGI_ALPHA_MODE alpha_mode, [out] IDCompositionVirtualSurface **surface); + HRESULT CreateTranslateTransform([out] IDCompositionTranslateTransform **transform); + HRESULT CreateScaleTransform([out] IDCompositionScaleTransform **transform); + HRESULT CreateRotateTransform([out] IDCompositionRotateTransform **transform); + HRESULT CreateSkewTransform([out] IDCompositionSkewTransform **transform); + HRESULT CreateMatrixTransform([out] IDCompositionMatrixTransform **transform); + HRESULT CreateTransformGroup([in, size_is(elements)] IDCompositionTransform **transforms, [in] UINT elements, [out] IDCompositionTransform **transform_group); + HRESULT CreateTranslateTransform3D([out] IDCompositionTranslateTransform3D **transform_3d); + HRESULT CreateScaleTransform3D([out] IDCompositionScaleTransform3D **transform_3d); + HRESULT CreateRotateTransform3D([out] IDCompositionRotateTransform3D **transform_3d); + HRESULT CreateMatrixTransform3D([out] IDCompositionMatrixTransform3D **transform_3d); + HRESULT CreateTransform3DGroup([in, size_is(elements)] IDCompositionTransform3D **transforms_3d, [in] UINT elements, [out] IDCompositionTransform3D **transform_3d_group); + HRESULT CreateEffectGroup([out] IDCompositionEffectGroup **effect_group); + HRESULT CreateRectangleClip([out] IDCompositionRectangleClip **clip); + HRESULT CreateAnimation([out] IDCompositionAnimation **animation); +} + +[ + object, + uuid(0987cb06-f916-48bf-8d35-ce7641781bd9), + local, + pointer_default(unique) +] +interface IDCompositionDevice3 : IDCompositionDevice2 +{ + HRESULT CreateGaussianBlurEffect([out] IDCompositionGaussianBlurEffect **effect); + HRESULT CreateBrightnessEffect([out] IDCompositionBrightnessEffect **effect); + HRESULT CreateColorMatrixEffect([out] IDCompositionColorMatrixEffect **effect); + HRESULT CreateShadowEffect([out] IDCompositionShadowEffect **effect); + HRESULT CreateHueRotationEffect([out] IDCompositionHueRotationEffect **effect); + HRESULT CreateSaturationEffect([out] IDCompositionSaturationEffect **effect); + HRESULT CreateTurbulenceEffect([out] IDCompositionTurbulenceEffect **effect); + HRESULT CreateLinearTransferEffect([out] IDCompositionLinearTransferEffect **effect); + HRESULT CreateTableTransferEffect([out] IDCompositionTableTransferEffect **effect); + HRESULT CreateCompositeEffect([out] IDCompositionCompositeEffect **effect); + HRESULT CreateBlendEffect([out] IDCompositionBlendEffect **effect); + HRESULT CreateArithmeticCompositeEffect([out] IDCompositionArithmeticCompositeEffect **effect); + HRESULT CreateAffineTransform2DEffect([out] IDCompositionAffineTransform2DEffect **effect); +} + +[ + object, + uuid(5f4633fe-1e08-4cb8-8c75-ce24333f5602), + local, + pointer_default(unique) +] +interface IDCompositionDesktopDevice : IDCompositionDevice2 +{ + HRESULT CreateTargetForHwnd([in] HWND hwnd, [in] BOOL topmost, [out] IDCompositionTarget **target); + HRESULT CreateSurfaceFromHandle([in] HANDLE handle, [out] IUnknown **surface); + HRESULT CreateSurfaceFromHwnd([in] HWND hwnd, [out] IUnknown **surface); +} + +[ + object, + uuid(eacdd04c-117e-4e17-88f4-d1b12b0e3d89), + local, + pointer_default(unique) +] +interface IDCompositionTarget : IUnknown +{ + HRESULT SetRoot([in] IDCompositionVisual *visual); +} + +[ + object, + uuid(4d93059d-097b-4651-9a60-f0f25116e2f3), + local, + pointer_default(unique) +] +interface IDCompositionVisual : IUnknown +{ + HRESULT SetOffsetX([in] float offset_x); + /* C++ method: HRESULT SetOffsetX(IDCompositionAnimation *animation); Rename it to SetOffsetXAnimation */ + HRESULT SetOffsetXAnimation([in] IDCompositionAnimation *animation); + HRESULT SetOffsetY([in] float offset_y); + /* C++ method: HRESULT SetOffsetY(IDCompositionAnimation *animation); Rename it to SetOffsetYAnimation */ + HRESULT SetOffsetYAnimation([in] IDCompositionAnimation *animation); + /* C++ method: HRESULT SetTransform(const D2D_MATRIX_3X2_F &matrix); Use pointer instead of reference */ + HRESULT SetTransform([in] const D2D_MATRIX_3X2_F *matrix); + /* C++ method: HRESULT SetTransform(IDCompositionTransform *transform); Rename it to SetTransformObject */ + HRESULT SetTransformObject([in] IDCompositionTransform *transform); + HRESULT SetTransformParent([in] IDCompositionVisual *visual); + HRESULT SetEffect([in] IDCompositionEffect *effect); + HRESULT SetBitmapInterpolationMode([in] enum DCOMPOSITION_BITMAP_INTERPOLATION_MODE interpolation_mode); + HRESULT SetBorderMode([in] enum DCOMPOSITION_BORDER_MODE border_mode); + /* C++ method: HRESULT SetClip(const D2D_RECT_F &rect); Use pointer instead of reference */ + HRESULT SetClip([in] const D2D_RECT_F *rect); + /* C++ method: HRESULT SetClip(IDCompositionClip *clip); Rename it to SetClipObject */ + HRESULT SetClipObject([in] IDCompositionClip *clip); + HRESULT SetContent([in] IUnknown *content); + HRESULT AddVisual([in] IDCompositionVisual *visual, [in] BOOL insert_above, [in] IDCompositionVisual *reference_visual); + HRESULT RemoveVisual([in] IDCompositionVisual *visual); + HRESULT RemoveAllVisuals(); + HRESULT SetCompositeMode([in] enum DCOMPOSITION_COMPOSITE_MODE composite_mode); +} + +[ + object, + uuid(e8de1639-4331-4b26-bc5f-6a321d347a85), + local, + pointer_default(unique) +] +interface IDCompositionVisual2 : IDCompositionVisual +{ + HRESULT SetOpacityMode([in] enum DCOMPOSITION_OPACITY_MODE opacity_mode); + HRESULT SetBackFaceVisibility([in] enum DCOMPOSITION_BACKFACE_VISIBILITY visibility); +} + +cpp_quote("STDAPI DCompositionCreateDevice(IDXGIDevice *dxgi_device, REFIID iid, void **device);") +cpp_quote("STDAPI DCompositionCreateDevice2(IUnknown *rendering_device, REFIID iid, void **device);")
With the likes of IDCompositionScaleTransform3D, you don't have those interfaces defined.
Feel free to copy from https://github.com/alesliehughes/alesliehughes-wine-staging/blob/master/patc...