/// <summary>
        /// <p> Draws a run of glyphs to a bitmap target at the specified position.</p>
        /// </summary>
        /// <param name="baselineOriginX"><dd>  <p> The horizontal position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB.</p> </dd></param>
        /// <param name="baselineOriginY"><dd>  <p> The vertical position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB.</p> </dd></param>
        /// <param name="measuringMode"><dd>  <p> The measuring method for glyphs in the run, used with the other properties to determine the rendering mode.</p> </dd></param>
        /// <param name="glyphRun"><dd>  <p> The structure containing the properties of the glyph run.</p> </dd></param>
        /// <param name="renderingParams"><dd>  <p> The object that controls rendering behavior.</p> </dd></param>
        /// <param name="textColor"><dd>  <p> The foreground color of the text.</p> </dd></param>
        /// <param name="blackBoxRect"><dd>  <p> 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.</p> </dd></param>
        /// <returns><p>If this method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
        /// <remarks>
        /// <p>You can use the <strong><see cref="SharpDX.DirectWrite.BitmapRenderTarget.DrawGlyphRun"/></strong> to render to a bitmap from a custom text renderer that you implement.  The custom text renderer should call this method from within the <strong><see cref="SharpDX.DirectWrite.TextRenderer.DrawGlyphRun"/></strong> callback method as shown in the following code.</p><pre>STDMETHODIMP GdiTextRenderer::DrawGlyphRun( __maybenull void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, <see cref="SharpDX.Direct2D1.MeasuringMode"/> measuringMode, __in <see cref="SharpDX.DirectWrite.GlyphRun"/> const* glyphRun, __in <see cref="SharpDX.DirectWrite.GlyphRunDescription"/> const* glyphRunDescription, <see cref="SharpDX.ComObject"/>* clientDrawingEffect )
        /// { <see cref="SharpDX.Result"/> hr = <see cref="SharpDX.Result.Ok"/>; // Pass on the drawing call to the render target to do the real work. <see cref="SharpDX.Mathematics.Interop.RawRectangle"/> dirtyRect = {0}; hr = pRenderTarget_-&gt;DrawGlyphRun( baselineOriginX, baselineOriginY, measuringMode, glyphRun, pRenderingParams_, RGB(0,200,255), &amp;dirtyRect ); return hr;
        /// }
        /// </pre><p>The <em>baselineOriginX</em>, <em>baslineOriginY</em>, <em>measuringMethod</em>, and <em>glyphRun</em> parameters are provided (as arguments) when the callback method is invoked.  The <em>renderingParams</em>, <em>textColor</em> and <em>blackBoxRect</em> are not.</p><p>Default rendering params can be retrieved by using the <strong><see cref="SharpDX.DirectWrite.Factory.CreateMonitorRenderingParams"/></strong> method.</p><p></p>
        /// </remarks>
        /// <include file='Documentation\CodeComments.xml' path="/comments/comment[@id='IDWriteBitmapRenderTarget::DrawGlyphRun']/*"/>
        /// <msdn-id>dd368167</msdn-id>
        /// <unmanaged>HRESULT IDWriteBitmapRenderTarget::DrawGlyphRun([In] float baselineOriginX,[In] float baselineOriginY,[In] DWRITE_MEASURING_MODE measuringMode,[In] const DWRITE_GLYPH_RUN* glyphRun,[In] IDWriteRenderingParams* renderingParams,[In] int textColor,[Out, Optional] RECT* blackBoxRect)</unmanaged>
        /// <unmanaged-short>IDWriteBitmapRenderTarget::DrawGlyphRun</unmanaged-short>
        public void DrawGlyphRun(float baselineOriginX,
                                 float baselineOriginY,
                                 SharpDX.Direct2D1.MeasuringMode measuringMode,
                                 SharpDX.DirectWrite.GlyphRun glyphRun,
                                 SharpDX.DirectWrite.RenderingParams renderingParams,
                                 RawColorBGRA textColor,
                                 out SharpDX.Mathematics.Interop.RawRectangle blackBoxRect)
        {
            int colorRgb = (textColor.R) | (textColor.G << 8) | (textColor.B << 16);

            DrawGlyphRun(baselineOriginX, baselineOriginY, measuringMode, glyphRun, renderingParams, colorRgb, out blackBoxRect);
        }
Beispiel #2
0
 /// <summary>
 /// Creates an <see cref="SharpDX.Direct2D1.DrawingStateBlock"/> that can be used with the {{SaveDrawingState}} and {{RestoreDrawingState}} methods of a render target.
 /// </summary>
 /// <param name="factory">an instance of <see cref = "SharpDX.Direct2D1.Factory" /></param>
 /// <param name="drawingStateDescription">A structure that contains antialiasing, transform, and tags  information.</param>
 /// <param name="textRenderingParams">Optional text parameters that indicate how text should be rendered.  </param>
 public DrawingStateBlock(Factory factory, SharpDX.Direct2D1.DrawingStateDescription?drawingStateDescription, SharpDX.DirectWrite.RenderingParams textRenderingParams)
     : base(IntPtr.Zero)
 {
     factory.CreateDrawingStateBlock(drawingStateDescription, textRenderingParams, this);
 }
Beispiel #3
0
 /// <summary>
 /// Creates an <see cref="SharpDX.Direct2D1.DrawingStateBlock"/> that can be used with the {{SaveDrawingState}} and {{RestoreDrawingState}} methods of a render target.
 /// </summary>
 /// <param name="factory">an instance of <see cref = "SharpDX.Direct2D1.Factory" /></param>
 /// <param name="textRenderingParams">Optional text parameters that indicate how text should be rendered.  </param>
 public DrawingStateBlock(Factory factory, SharpDX.DirectWrite.RenderingParams textRenderingParams)
     : this(factory, null, textRenderingParams)
 {
 }
 /// <summary>
 /// Creates an <see cref="SharpDX.Direct2D1.DrawingStateBlock1"/> that can be used with the {{SaveDrawingState}} and {{RestoreDrawingState}} methods of a render target.
 /// </summary>
 /// <param name="factory">an instance of <see cref = "SharpDX.Direct2D1.Factory1" /></param>
 /// <param name="textRenderingParams">Optional text parameters that indicate how text should be rendered.  </param>
 public DrawingStateBlock1(Factory1 factory, SharpDX.DirectWrite.RenderingParams textRenderingParams) : base(IntPtr.Zero)
 {
     factory.CreateDrawingStateBlock(null, textRenderingParams, this);
 }