Exemplo n.º 1
0
        public Result DrawGlyphRun(object clientDrawingContext, float baselineOriginX, float baselineOriginY, MeasuringMode measuringMode, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, ComObject clientDrawingEffect)
        {
            using (var pathGeometry = new PathGeometry(_d2DFactory))
            {
                using (var geometrySink = pathGeometry.Open())
                {
                    using (var fontFace = glyphRun.FontFace)
                    {
                        if (glyphRun.Indices.Length > 0)
                        {
                            fontFace.GetGlyphRunOutline(glyphRun.FontSize, glyphRun.Indices, glyphRun.Advances, glyphRun.Offsets,
                                                        glyphRun.Indices.Length, glyphRun.IsSideways, glyphRun.BidiLevel % 2 != 0, geometrySink);
                        }
                    }
                    geometrySink.Close();
                }


                var matrix = new Matrix3x2()
                {
                    M11 = 1,
                    M12 = 0,
                    M21 = 0,
                    M22 = 1,
                    M31 = baselineOriginX,
                    M32 = baselineOriginY
                };

                using (var transformedGeometry = new TransformedGeometry(_d2DFactory, pathGeometry, matrix))
                {
                    _dc.DrawGeometry(transformedGeometry, _outlineBrush);
                    _dc.FillGeometry(transformedGeometry, _fillBrush);
                }
            }
            return(SharpDX.Result.Ok);
        }
Exemplo n.º 2
0
 public void DrawGeometry(Graphics.Drawing.Geometry geometry, Brush brush, float strokeThickness = 1.0f)
 {
     deviceContext.DrawGeometry(geometry, brush, strokeThickness);
 }