コード例 #1
0
        public D2D1DrawingStateBlock CreateDrawingStateBlock(DWriteRenderingParams textRenderingParams)
        {
            ID2D1DrawingStateBlock drawingStateBlock;

            this.factory.CreateDrawingStateBlock(IntPtr.Zero, textRenderingParams == null ? null : (IDWriteRenderingParams)textRenderingParams.Handle, out drawingStateBlock);
            return(new D2D1DrawingStateBlock(drawingStateBlock));
        }
コード例 #2
0
        public D2D1DrawingStateBlock CreateDrawingStateBlock(D2D1DrawingStateDescription drawingStateDescription, DWriteRenderingParams textRenderingParams)
        {
            ID2D1DrawingStateBlock drawingStateBlock;

            GCHandle drawingStateDescriptionHandle = GCHandle.Alloc(drawingStateDescription, GCHandleType.Pinned);

            try
            {
                this.factory.CreateDrawingStateBlock(drawingStateDescriptionHandle.AddrOfPinnedObject(), textRenderingParams == null ? null : (IDWriteRenderingParams)textRenderingParams.Handle, out drawingStateBlock);
            }
            finally
            {
                drawingStateDescriptionHandle.Free();
            }

            return(new D2D1DrawingStateBlock(drawingStateBlock));
        }