コード例 #1
0
 /// <unmanaged>HRESULT ID2D1CommandSink::DrawGlyphRun([In] D2D_POINT_2F baselineOrigin,[In] const DWRITE_GLYPH_RUN* glyphRun,[In, Optional] const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,[In] ID2D1Brush* foregroundBrush,[In] DWRITE_MEASURING_MODE measuringMode)</unmanaged>
 public void DrawGlyphRun(SharpDX.Vector2 baselineOrigin, SharpDX.DirectWrite.GlyphRun glyphRun, SharpDX.DirectWrite.GlyphRunDescription glyphRunDescription, SharpDX.Direct2D1.Brush foregroundBrush, SharpDX.Direct2D1.MeasuringMode measuringMode)
 {
     DrawGlyphRun_(baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode);
 }
コード例 #2
0
            private unsafe static int DrawGlyphRunImpl(IntPtr thisPtr, RawVector2 baselineOrigin, IntPtr glyphRunNative, IntPtr glyphRunDescriptionPtr, IntPtr foregroundBrush, SharpDX.Direct2D1.MeasuringMode measuringMode)
            {
                var glyphRun = new DirectWrite.GlyphRun();

                try
                {
                    var glyphRunDescription = new SharpDX.DirectWrite.GlyphRunDescription();
                    glyphRunDescription.__MarshalFrom(ref *(SharpDX.DirectWrite.GlyphRunDescription.__Native *)glyphRunDescriptionPtr);

                    glyphRun.__MarshalFrom(ref *(DirectWrite.GlyphRun.__Native *)glyphRunNative);

                    var shadow   = ToShadow <CommandSinkShadow>(thisPtr);
                    var callback = (CommandSink)shadow.Callback;
                    callback.DrawGlyphRun(baselineOrigin, glyphRun, glyphRunDescription, new Brush(foregroundBrush), measuringMode);
                }
                catch (Exception exception)
                {
                    return((int)SharpDX.Result.GetResultFromException(exception));
                }
                finally
                {
                    glyphRun.__MarshalFree(ref *(DirectWrite.GlyphRun.__Native *)glyphRunNative);
                }
                return(Result.Ok.Code);
            }
コード例 #3
0
ファイル: Factory2.cs プロジェクト: zmtzawqlp/SharpDX
 /// <summary>
 /// <p>This method is called on a glyph run to translate it in to multiple color glyph runs.</p>
 /// </summary>
 /// <param name = "baselineOriginX"><dd>  <p>The horizontal baseline origin of the original glyph run.</p> </dd></param>
 /// <param name = "baselineOriginY"><dd>  <p>The vertical baseline origin of the original glyph run.</p> </dd></param>
 /// <param name = "glyphRun"><dd>  <p>Original glyph run containing monochrome glyph IDs.</p> </dd></param>
 /// <param name = "glyphRunDescription"><dd>  <p>Optional glyph run description.</p> </dd></param>
 /// <param name = "measuringMode"><dd>  <p>Measuring mode used to compute glyph positions if the run contains color glyphs.</p> </dd></param>
 /// <param name = "worldToDeviceTransform"><dd>  <p> World transform multiplied by any DPI scaling. This is needed to compute glyph positions if the run contains color glyphs and the  measuring mode is not <strong>DWRITE_MEASURING_MODE_NATURAL</strong>.  If this parameter is <strong><c>null</c></strong>, and identity transform is assumed. </p> </dd></param>
 /// <param name = "colorPaletteIndex"><dd>  <p> Zero-based index of the color palette to use. Valid indices are less than the number of palettes in the font, as  returned by <strong>IDWriteFontFace2::GetColorPaletteCount</strong>. </p> </dd></param>
 /// <returns><dd>  <p> If the original glyph run contains color glyphs, this parameter receives a reference to  an <strong><see cref = "SharpDX.DirectWrite.ColorGlyphRunEnumerator"/></strong> interface.  The client uses the returned interface to get information about glyph runs and associated colors to render instead of the original glyph run.  If the original glyph run does not contain color glyphs, this method returns <strong>DWRITE_E_NOCOLOR</strong> and the output reference is <strong><c>null</c></strong>. </p> </dd></returns>
 /// <remarks>
 /// <p> If the code calls this method with a glyph run that contains no color information, the method returns <strong>DWRITE_E_NOCOLOR</strong> to  let the application know that it can just draw the original glyph run. If the glyph run contains color information, the function returns an object that can be enumerated through to expose runs and associated colors. The application then  calls <strong>DrawGlyphRun</strong> with each of the returned glyph runs and foreground colors. </p>
 /// </remarks>
 /// <msdn-id>dn280451</msdn-id>
 /// <unmanaged>HRESULT IDWriteFactory2::TranslateColorGlyphRun([In] float baselineOriginX,[In] float baselineOriginY,[In] const DWRITE_GLYPH_RUN* glyphRun,[In, Optional] const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,[In] DWRITE_MEASURING_MODE measuringMode,[In, Optional] const DWRITE_MATRIX* worldToDeviceTransform,[In] unsigned int colorPaletteIndex,[Out] IDWriteColorGlyphRunEnumerator** colorLayers)</unmanaged>
 /// <unmanaged-short>IDWriteFactory2::TranslateColorGlyphRun</unmanaged-short>
 public SharpDX.DirectWrite.ColorGlyphRunEnumerator TranslateColorGlyphRun(System.Single baselineOriginX, System.Single baselineOriginY, SharpDX.DirectWrite.GlyphRun glyphRun, SharpDX.DirectWrite.GlyphRunDescription glyphRunDescription, SharpDX.Direct2D1.MeasuringMode measuringMode, SharpDX.Mathematics.Interop.RawMatrix3x2?worldToDeviceTransform, System.Int32 colorPaletteIndex)
 {
     SharpDX.DirectWrite.ColorGlyphRunEnumerator colorLayers;
     TranslateColorGlyphRun(baselineOriginX, baselineOriginY, glyphRun, glyphRunDescription, measuringMode, worldToDeviceTransform, colorPaletteIndex, out colorLayers);
     return(colorLayers);
 }