Ejemplo n.º 1
0
        public static T QueryInterface <T>(this IUnknown self) where T : ComPtr, new()
        {
            var p = new T();

            if (self.QueryInterface(ref p.GetIID(), out p.PtrForNew).Failed())
            {
                return(null);
            }
            return(p);
        }
Ejemplo n.º 2
0
        public virtual int Connect(
            IUnknown pUnkServer
            )
        {
            var fp = GetFunctionPointer(3);

            if (m_ConnectFunc == null)
            {
                m_ConnectFunc = (ConnectFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(ConnectFunc));
            }

            return(m_ConnectFunc(m_ptr, pUnkServer != null ? pUnkServer.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 3
0
        public virtual int TakeOwnership(
            IUnknown pDevice,
            int Exclusive
            )
        {
            var fp = GetFunctionPointer(11);

            if (m_TakeOwnershipFunc == null)
            {
                m_TakeOwnershipFunc = (TakeOwnershipFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(TakeOwnershipFunc));
            }

            return(m_TakeOwnershipFunc(m_ptr, pDevice != null ? pDevice.Ptr : IntPtr.Zero, Exclusive));
        }
Ejemplo n.º 4
0
        public virtual int SetDrawingEffect(
            IUnknown drawingEffect,
            DWRITE_TEXT_RANGE textRange
            )
        {
            var fp = GetFunctionPointer(38);

            if (m_SetDrawingEffectFunc == null)
            {
                m_SetDrawingEffectFunc = (SetDrawingEffectFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(SetDrawingEffectFunc));
            }

            return(m_SetDrawingEffectFunc(m_ptr, drawingEffect != null ? drawingEffect.Ptr : IntPtr.Zero, textRange));
        }
Ejemplo n.º 5
0
        public virtual int SetPrivateDataInterface(
            ref Guid guid,
            IUnknown pData
            )
        {
            var fp = GetFunctionPointer(6);

            if (m_SetPrivateDataInterfaceFunc == null)
            {
                m_SetPrivateDataInterfaceFunc = (SetPrivateDataInterfaceFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(SetPrivateDataInterfaceFunc));
            }

            return(m_SetPrivateDataInterfaceFunc(m_ptr, ref guid, pData != null ? pData.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 6
0
        public virtual int SetPrivateDataInterface(
            ref Guid Name,
            IUnknown pUnknown
            )
        {
            var fp = GetFunctionPointer(4);

            if (m_SetPrivateDataInterfaceFunc == null)
            {
                m_SetPrivateDataInterfaceFunc = (SetPrivateDataInterfaceFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(SetPrivateDataInterfaceFunc));
            }

            return(m_SetPrivateDataInterfaceFunc(m_ptr, ref Name, pUnknown != null ? pUnknown.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 7
0
        public virtual int DuplicateOutput(
            IUnknown pDevice,
            out IDXGIOutputDuplication ppOutputDuplication
            )
        {
            var fp = GetFunctionPointer(22);

            if (m_DuplicateOutputFunc == null)
            {
                m_DuplicateOutputFunc = (DuplicateOutputFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(DuplicateOutputFunc));
            }
            ppOutputDuplication = new IDXGIOutputDuplication();
            return(m_DuplicateOutputFunc(m_ptr, pDevice != null ? pDevice.Ptr : IntPtr.Zero, out ppOutputDuplication.PtrForNew));
        }
Ejemplo n.º 8
0
        public virtual int FindClosestMatchingMode1(
            ref DXGI_MODE_DESC1 pModeToMatch,
            out DXGI_MODE_DESC1 pClosestMatch,
            IUnknown pConcernedDevice
            )
        {
            var fp = GetFunctionPointer(20);

            if (m_FindClosestMatchingMode1Func == null)
            {
                m_FindClosestMatchingMode1Func = (FindClosestMatchingMode1Func)Marshal.GetDelegateForFunctionPointer(fp, typeof(FindClosestMatchingMode1Func));
            }

            return(m_FindClosestMatchingMode1Func(m_ptr, ref pModeToMatch, out pClosestMatch, pConcernedDevice != null ? pConcernedDevice.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 9
0
        public virtual int CheckOverlaySupport(
            DXGI_FORMAT EnumFormat,
            IUnknown pConcernedDevice,
            out uint pFlags
            )
        {
            var fp = GetFunctionPointer(24);

            if (m_CheckOverlaySupportFunc == null)
            {
                m_CheckOverlaySupportFunc = (CheckOverlaySupportFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CheckOverlaySupportFunc));
            }

            return(m_CheckOverlaySupportFunc(m_ptr, EnumFormat, pConcernedDevice != null ? pConcernedDevice.Ptr : IntPtr.Zero, out pFlags));
        }
Ejemplo n.º 10
0
        public virtual int CreateSwapChain(
            IUnknown pDevice,
            out DXGI_SWAP_CHAIN_DESC pDesc,
            out IDXGISwapChain ppSwapChain
            )
        {
            var fp = GetFunctionPointer(10);

            if (m_CreateSwapChainFunc == null)
            {
                m_CreateSwapChainFunc = (CreateSwapChainFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateSwapChainFunc));
            }
            ppSwapChain = new IDXGISwapChain();
            return(m_CreateSwapChainFunc(m_ptr, pDevice != null ? pDevice.Ptr : IntPtr.Zero, out pDesc, out ppSwapChain.PtrForNew));
        }
Ejemplo n.º 11
0
        public virtual int CreateInstance(
            IUnknown pUnkOuter,
            ref Guid riid,
            out IntPtr ppvObj
            )
        {
            var fp = GetFunctionPointer(16);

            if (m_CreateInstanceFunc == null)
            {
                m_CreateInstanceFunc = (CreateInstanceFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateInstanceFunc));
            }

            return(m_CreateInstanceFunc(m_ptr, pUnkOuter != null ? pUnkOuter.Ptr : IntPtr.Zero, ref riid, out ppvObj));
        }
Ejemplo n.º 12
0
        public virtual int CreateSwapChainForComposition(
            IUnknown pDevice,
            ref DXGI_SWAP_CHAIN_DESC1 pDesc,
            IDXGIOutput pRestrictToOutput,
            out IDXGISwapChain1 ppSwapChain
            )
        {
            var fp = GetFunctionPointer(24);

            if (m_CreateSwapChainForCompositionFunc == null)
            {
                m_CreateSwapChainForCompositionFunc = (CreateSwapChainForCompositionFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateSwapChainForCompositionFunc));
            }
            ppSwapChain = new IDXGISwapChain1();
            return(m_CreateSwapChainForCompositionFunc(m_ptr, pDevice != null ? pDevice.Ptr : IntPtr.Zero, ref pDesc, pRestrictToOutput != null ? pRestrictToOutput.Ptr : IntPtr.Zero, out ppSwapChain.PtrForNew));
        }
Ejemplo n.º 13
0
        public virtual int LoadObject(
            ref ushort pstrName,
            uint dwHint,
            IUnknown pUnkObject,
            IErrorLog pErrLog
            )
        {
            var fp = GetFunctionPointer(7);

            if (m_LoadObjectFunc == null)
            {
                m_LoadObjectFunc = (LoadObjectFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(LoadObjectFunc));
            }

            return(m_LoadObjectFunc(m_ptr, ref pstrName, dwHint, pUnkObject != null ? pUnkObject.Ptr : IntPtr.Zero, pErrLog != null ? pErrLog.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 14
0
        public virtual int CheckOverlayColorSpaceSupport(
            DXGI_FORMAT Format,
            DXGI_COLOR_SPACE_TYPE ColorSpace,
            IUnknown pConcernedDevice,
            out uint pFlags
            )
        {
            var fp = GetFunctionPointer(25);

            if (m_CheckOverlayColorSpaceSupportFunc == null)
            {
                m_CheckOverlayColorSpaceSupportFunc = (CheckOverlayColorSpaceSupportFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CheckOverlayColorSpaceSupportFunc));
            }

            return(m_CheckOverlayColorSpaceSupportFunc(m_ptr, Format, ColorSpace, pConcernedDevice != null ? pConcernedDevice.Ptr : IntPtr.Zero, out pFlags));
        }
Ejemplo n.º 15
0
        public virtual int DrawStrikethrough(
            IntPtr clientDrawingContext,
            float baselineOriginX,
            float baselineOriginY,
            ref DWRITE_STRIKETHROUGH strikethrough,
            IUnknown clientDrawingEffect
            )
        {
            var fp = GetFunctionPointer(8);

            if (m_DrawStrikethroughFunc == null)
            {
                m_DrawStrikethroughFunc = (DrawStrikethroughFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(DrawStrikethroughFunc));
            }

            return(m_DrawStrikethroughFunc(m_ptr, clientDrawingContext, baselineOriginX, baselineOriginY, ref strikethrough, clientDrawingEffect != null ? clientDrawingEffect.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 16
0
        public virtual int DrawUnderline(
            IntPtr clientDrawingContext,
            float baselineOriginX,
            float baselineOriginY,
            ref DWRITE_UNDERLINE underline,
            IUnknown clientDrawingEffect
            )
        {
            var fp = GetFunctionPointer(7);

            if (m_DrawUnderlineFunc == null)
            {
                m_DrawUnderlineFunc = (DrawUnderlineFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(DrawUnderlineFunc));
            }

            return(m_DrawUnderlineFunc(m_ptr, clientDrawingContext, baselineOriginX, baselineOriginY, ref underline, clientDrawingEffect != null ? clientDrawingEffect.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 17
0
        public virtual int CreateDecodeSwapChainForCompositionSurfaceHandle(
            IUnknown pDevice,
            IntPtr hSurface,
            out DXGI_DECODE_SWAP_CHAIN_DESC pDesc,
            IDXGIResource pYuvDecodeBuffers,
            IDXGIOutput pRestrictToOutput,
            out IDXGIDecodeSwapChain ppSwapChain
            )
        {
            var fp = GetFunctionPointer(4);

            if (m_CreateDecodeSwapChainForCompositionSurfaceHandleFunc == null)
            {
                m_CreateDecodeSwapChainForCompositionSurfaceHandleFunc = (CreateDecodeSwapChainForCompositionSurfaceHandleFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateDecodeSwapChainForCompositionSurfaceHandleFunc));
            }
            ppSwapChain = new IDXGIDecodeSwapChain();
            return(m_CreateDecodeSwapChainForCompositionSurfaceHandleFunc(m_ptr, pDevice != null ? pDevice.Ptr : IntPtr.Zero, hSurface, out pDesc, pYuvDecodeBuffers != null ? pYuvDecodeBuffers.Ptr : IntPtr.Zero, pRestrictToOutput != null ? pRestrictToOutput.Ptr : IntPtr.Zero, out ppSwapChain.PtrForNew));
        }
Ejemplo n.º 18
0
        public virtual int CreateSwapChainForHwnd(
            IUnknown pDevice,
            IntPtr hWnd,
            ref DXGI_SWAP_CHAIN_DESC1 pDesc,
            ref DXGI_SWAP_CHAIN_FULLSCREEN_DESC pFullscreenDesc,
            IDXGIOutput pRestrictToOutput,
            out IDXGISwapChain1 ppSwapChain
            )
        {
            var fp = GetFunctionPointer(15);

            if (m_CreateSwapChainForHwndFunc == null)
            {
                m_CreateSwapChainForHwndFunc = (CreateSwapChainForHwndFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateSwapChainForHwndFunc));
            }
            ppSwapChain = new IDXGISwapChain1();
            return(m_CreateSwapChainForHwndFunc(m_ptr, pDevice != null ? pDevice.Ptr : IntPtr.Zero, hWnd, ref pDesc, ref pFullscreenDesc, pRestrictToOutput != null ? pRestrictToOutput.Ptr : IntPtr.Zero, out ppSwapChain.PtrForNew));
        }
Ejemplo n.º 19
0
        public virtual int DrawGlyphRun(
            IntPtr clientDrawingContext,
            float baselineOriginX,
            float baselineOriginY,
            DWRITE_MEASURING_MODE measuringMode,
            ref DWRITE_GLYPH_RUN glyphRun,
            ref DWRITE_GLYPH_RUN_DESCRIPTION glyphRunDescription,
            IUnknown clientDrawingEffect
            )
        {
            var fp = GetFunctionPointer(6);

            if (m_DrawGlyphRunFunc == null)
            {
                m_DrawGlyphRunFunc = (DrawGlyphRunFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(DrawGlyphRunFunc));
            }

            return(m_DrawGlyphRunFunc(m_ptr, clientDrawingContext, baselineOriginX, baselineOriginY, measuringMode, ref glyphRun, ref glyphRunDescription, clientDrawingEffect != null ? clientDrawingEffect.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 20
0
        public virtual int Draw(
            IntPtr clientDrawingContext,
            IDWriteTextRenderer renderer,
            float originX,
            float originY,
            int isSideways,
            int isRightToLeft,
            IUnknown clientDrawingEffect
            )
        {
            var fp = GetFunctionPointer(3);

            if (m_DrawFunc == null)
            {
                m_DrawFunc = (DrawFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(DrawFunc));
            }

            return(m_DrawFunc(m_ptr, clientDrawingContext, renderer != null ? renderer.Ptr : IntPtr.Zero, originX, originY, isSideways, isRightToLeft, clientDrawingEffect != null ? clientDrawingEffect.Ptr : IntPtr.Zero));
        }
Ejemplo n.º 21
0
        public virtual int DrawInlineObject(
            IntPtr clientDrawingContext,
            float originX,
            float originY,
            IDWriteInlineObject inlineObject,
            int isSideways,
            int isRightToLeft,
            IUnknown clientDrawingEffect
            )
        {
            var fp = GetFunctionPointer(9);

            if (m_DrawInlineObjectFunc == null)
            {
                m_DrawInlineObjectFunc = (DrawInlineObjectFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(DrawInlineObjectFunc));
            }

            return(m_DrawInlineObjectFunc(m_ptr, clientDrawingContext, originX, originY, inlineObject != null ? inlineObject.Ptr : IntPtr.Zero, isSideways, isRightToLeft, clientDrawingEffect != null ? clientDrawingEffect.Ptr : IntPtr.Zero));
        }