Exemplo n.º 1
0
        public void Builder_BuildString_DrawtextFilter_Alt()
        {
            var str = FFMpegArguments
                      .FromInputFiles(true, "input.mp4")
                      .DrawText(DrawTextOptions
                                .Create("Stack Overflow", "/path/to/font.ttf", ("fontcolor", "white"), ("fontsize", "24")))
                      .OutputToFile("output.mp4").Arguments;

            Assert.AreEqual("-i \"input.mp4\" -vf drawtext=\"text='Stack Overflow':fontfile=/path/to/font.ttf:fontcolor=white:fontsize=24\" \"output.mp4\"", str);
        }
Exemplo n.º 2
0
 public CanvasText(string text, TextFormat textFormat, RectangleF layoutRect, Brush defaultForegroundBrush,
                   DrawTextOptions options, MeasuringMode measuringMode)
 {
     Text                   = text;
     TextFormat             = textFormat;
     LayoutRect             = layoutRect;
     DefaultForegroundBrush = defaultForegroundBrush;
     Options                = options;
     MeasuringMode          = measuringMode;
 }
Exemplo n.º 3
0
        public void Builder_BuildString_DrawtextFilter_Alt()
        {
            var str = FFMpegArguments
                      .FromFileInput("input.mp4")
                      .OutputToFile("output.mp4", false, opt => opt
                                    .WithVideoFilters(filterOptions => filterOptions
                                                      .DrawText(DrawTextOptions
                                                                .Create("Stack Overflow", "/path/to/font.ttf", ("fontcolor", "white"), ("fontsize", "24")))))
                      .Arguments;

            Assert.AreEqual(
                "-i \"input.mp4\" -vf \"drawtext=text='Stack Overflow':fontfile=/path/to/font.ttf:fontcolor=white:fontsize=24\" \"output.mp4\"",
                str);
        }
Exemplo n.º 4
0
        public void Builder_BuildString_DrawtextFilter()
        {
            var str = FFMpegArguments
                      .FromInputFiles(true, "input.mp4")
                      .DrawText(DrawTextOptions
                                .Create("Stack Overflow", "/path/to/font.ttf")
                                .WithParameter("fontcolor", "white")
                                .WithParameter("fontsize", "24")
                                .WithParameter("box", "1")
                                .WithParameter("boxcolor", "[email protected]")
                                .WithParameter("boxborderw", "5")
                                .WithParameter("x", "(w-text_w)/2")
                                .WithParameter("y", "(h-text_h)/2"))
                      .OutputToFile("output.mp4").Arguments;

            Assert.AreEqual("-i \"input.mp4\" -vf drawtext=\"text='Stack Overflow':fontfile=/path/to/font.ttf:fontcolor=white:fontsize=24:box=1:[email protected]:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2\" \"output.mp4\"", str);
        }
 public static void DrawTextLayout(
     RenderTarget renderTarget,
     Vector2 origin,
     TextLayout textLayout,
     Brush defaultForegroundBrush,
     DrawTextOptions options = DrawTextOptions.None)
 {
     if (options.HasFlag(DrawTextOptions.Clip))
     {
         renderTarget.PushAxisAlignedClip(new global::SharpDX.RectangleF(origin.X, origin.Y, textLayout.MaxWidth, textLayout.MaxHeight), renderTarget.AntialiasMode);
         using (var renderer = new CustomBrushTextRenderer(renderTarget, defaultForegroundBrush, options.HasFlag(DrawTextOptions.NoSnap)))
             textLayout.Draw(renderer, origin.X, origin.Y);
         renderTarget.PopAxisAlignedClip();
     }
     else
     {
         using (var renderer = new CustomBrushTextRenderer(renderTarget, defaultForegroundBrush, options.HasFlag(DrawTextOptions.NoSnap)))
             textLayout.Draw(renderer, origin.X, origin.Y);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Draws the given text on the screen.
        /// </summary>
        /// <param name="textToDraw">The text to draw.</param>
        /// <param name="textFormat">The TextFormat to be used.</param>
        /// <param name="targetRectangle">The target rectangle.</param>
        /// <param name="brush">The brush.</param>
        /// <param name="drawOptions">Some draw options to be passed to Direct2D.</param>
        /// <param name="measuringMode">Sets the measuring mode to be passed to Direct2D.</param>
        public void DrawText(
            string textToDraw, TextFormatResource textFormat, RectangleF targetRectangle, BrushResource brush,
            DrawTextOptions drawOptions = DrawTextOptions.None,
            MeasuringMode measuringMode = MeasuringMode.Natural)
        {
            if (_renderTarget == null)
            {
                return;
            }

            textToDraw.EnsureNotNull(nameof(textToDraw));
            targetRectangle.EnsureNotEmpty(nameof(targetRectangle));
            brush.EnsureNotNull(nameof(brush));

            _renderTarget.DrawText(
                textToDraw,
                textFormat.GetTextFormat(this.Device),
                targetRectangle,
                brush.GetBrush(this.Device),
                (D2D.DrawTextOptions)drawOptions, (Vortice.DCommon.MeasuringMode)measuringMode);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Draws the given text on the screen.
        /// </summary>
        /// <param name="textToDraw">The text to draw.</param>
        /// <param name="textFormat">The TextFormat to be used.</param>
        /// <param name="targetRectangle">The target rectangle.</param>
        /// <param name="brush">The brush.</param>
        /// <param name="drawOptions">Some draw options to be passed to Direct2D.</param>
        /// <param name="measuringMode">Sets the measuring mode to be passed to Direct2D.</param>
        public void DrawText(
            string textToDraw, TextFormatResource textFormat, RectangleF targetRectangle, BrushResource brush,
            DrawTextOptions drawOptions = DrawTextOptions.None,
            MeasuringMode measuringMode = MeasuringMode.Natural)
        {
            if (m_renderTarget == null)
            {
                return;
            }

            textToDraw.EnsureNotNull(nameof(textToDraw));
            targetRectangle.EnsureNotEmpty(nameof(targetRectangle));
            brush.EnsureNotNull(nameof(brush));

            D2D.DrawTextOptions drawOptionsD2D   = (D2D.DrawTextOptions)drawOptions;
            D2D.MeasuringMode   measuringModeD2D = (D2D.MeasuringMode)measuringMode;

            m_renderTarget.DrawText(
                textToDraw,
                textFormat.GetTextFormat(m_device),
                targetRectangle.ToDXRectangle(),
                brush.GetBrush(m_device),
                drawOptionsD2D);
        }
Exemplo n.º 8
0
 public CanvasTextLayout(Vector2 origin, TextLayout textLayout, Brush defaultForegroundBrush, DrawTextOptions options)
 {
     this.Origin                 = origin;
     this.TextLayout             = textLayout;
     this.DefaultForegroundBrush = defaultForegroundBrush;
     this.Options                = options;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Draws a <see cref="TextLayout"/> object to a render target at X/Y Coordinates.
        /// </summary>
        /// <param name="renderTarget">The render target.</param>
        /// <param name="textLayout">The text to render.</param>
        /// <param name="brush">The foreground brush.</param>
        /// <param name="x">X position</param>
        /// <param name="y">Y Position</param>
        /// <param name="brushBackground">The background brush, null for no background.</param>
        /// <param name="centerX">Center the text on the X axis</param>
        /// <param name="centerY">Center the text on the y axis</param>
        public static void DrawTextAtPoint(this SharpDX.Direct2D1.RenderTarget renderTarget, TextLayout textLayout, Brush brush, float x, float y, Brush brushBackground = null, bool centerX = false, bool centerY = false, DrawTextOptions options = DrawTextOptions.None)
        {
            float width  = textLayout.Metrics.Width;
            float height = textLayout.Metrics.Height;

            if (centerX)
            {
                x -= width / 2;
            }
            if (centerY)
            {
                y -= height / 2;
            }

            if (brushBackground != null)
            {
                renderTarget.FillRectangle(new RawRectangleF(x, y, x + width, y + height), brushBackground);
            }

            renderTarget.DrawTextLayout(new RawVector2 {
                X = x, Y = y
            }, textLayout, brush, options);
        }
Exemplo n.º 10
0
 public void DrawText(string text, int stringLength, TextFormat textFormat, RawRectangleF layoutRect, Brush defaultFillBrush, DrawTextOptions options, MeasuringMode measuringMode) => _renderTarget?.DrawText(text, stringLength, textFormat, layoutRect, defaultFillBrush, options, measuringMode);
Exemplo n.º 11
0
        public void DrawText(string text, IDWriteTextFormat textFormat, Rect layoutRect, ID2D1Brush defaultFillBrush, DrawTextOptions options = DrawTextOptions.None, MeasuringMode measuringMode = MeasuringMode.Natural)
        {
            Guard.NotNullOrEmpty(text, nameof(text));

            DrawText(text, text.Length, textFormat, layoutRect, defaultFillBrush, options, measuringMode);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Draws the specified text using the format information provided by an <see cref="T:SharpDX.DirectWrite.TextFormat" /> object.
 /// </summary>
 /// <remarks>
 /// To create an <see cref="T:SharpDX.DirectWrite.TextFormat" /> object, create an <see cref="T:SharpDX.DirectWrite.Factory" /> and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the <see cref="M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@)" /> or <see cref="M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@)" /> methods.
 /// </remarks>
 /// <param name="text">A reference to an array of Unicode characters to draw.  </param>
 /// <param name="textFormat">An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.   </param>
 /// <param name="layoutRect">The size and position of the area in which the text is drawn.  </param>
 /// <param name="defaultForegroundBrush">The brush used to paint the text. </param>
 /// <param name="options">A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is <see cref="F:SharpDX.Direct2D1.DrawTextOptions.None" />, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle. </param>
 /// <param name="measuringMode">A value that indicates how glyph metrics are used to measure text when it is formatted.  The default value is DWRITE_MEASURING_MODE_NATURAL.  </param>
 /// <unmanaged>void ID2D1RenderTarget::DrawTextA([In, Buffer] const wchar_t* string,[None] int stringLength,[In] IDWriteTextFormat* textFormat,[In] const D2D1_RECT_F* layoutRect,[In] ID2D1Brush* defaultForegroundBrush,[None] D2D1_DRAW_TEXT_OPTIONS options,[None] DWRITE_MEASURING_MODE measuringMode)</unmanaged>
 public void DrawText(string text, TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode)
 {
     DrawText(text, text.Length, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode);
 }
Exemplo n.º 13
0
 /// <summary>	
 /// Draws the specified text using the format information provided by an <see cref="T:SharpDX.DirectWrite.TextFormat" /> object. 	
 /// </summary>	
 /// <remarks>	
 /// To create an <see cref="T:SharpDX.DirectWrite.TextFormat" /> object, create an <see cref="T:SharpDX.DirectWrite.Factory" /> and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the <see cref="M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@)" /> or <see cref="M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@)" /> methods.  	
 /// </remarks>	
 /// <param name="text">A reference to an array of Unicode characters to draw.  </param>
 /// <param name="textFormat">An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.   </param>
 /// <param name="layoutRect">The size and position of the area in which the text is drawn.  </param>
 /// <param name="defaultForegroundBrush">The brush used to paint the text. </param>
 /// <param name="options">A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is <see cref="F:SharpDX.Direct2D1.DrawTextOptions.None" />, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle. </param>
 /// <param name="measuringMode">A value that indicates how glyph metrics are used to measure text when it is formatted.  The default value is DWRITE_MEASURING_MODE_NATURAL.  </param>
 /// <unmanaged>void ID2D1RenderTarget::DrawTextA([In, Buffer] const wchar_t* string,[None] int stringLength,[In] IDWriteTextFormat* textFormat,[In] const D2D1_RECT_F* layoutRect,[In] ID2D1Brush* defaultForegroundBrush,[None] D2D1_DRAW_TEXT_OPTIONS options,[None] DWRITE_MEASURING_MODE measuringMode)</unmanaged>
 public void DrawText(string text, TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode)
 {
     DrawText(text, text.Length, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode);
 }
Exemplo n.º 14
0
 public void DrawText(string text, TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options) => _renderTarget?.DrawText(text, textFormat, layoutRect, defaultForegroundBrush, options);
Exemplo n.º 15
0
        public void TestDraw()
        {
            d2d1DC.BeginDraw();
            d2d1DC.Clear(Color.Black);
            //=============================

            SolidColorBrush brush       = new SolidColorBrush(d2d1DC, Color.Yellow);
            SolidColorBrush brush2      = new SolidColorBrush(d2d1DC, Color.YellowGreen);
            TextFormat      textFormat  = new TextFormat(DirectXFactory.DWFactory, PreferFont, FontSize);
            TextFormat      textFormat2 = new TextFormat(DirectXFactory.DWFactory, PreferFont, FontSize);

            String msg = "正";

            TextLayout textLayout = new TextLayout(DirectXFactory.DWFactory, msg, textFormat, textFormat.FontSize * 1.5f, textFormat.FontSize);
            Size2F     s          = new Size2F(textLayout.Metrics.Width, textLayout.Metrics.Height);

            float      d    = s.Width / 2.0f;
            RectangleF rect = new RectangleF(0, 0, d, s.Height);


            textFormat.TextAlignment  = SharpDX.DirectWrite.TextAlignment.Leading;
            textFormat2.TextAlignment = SharpDX.DirectWrite.TextAlignment.Trailing;

            textFormat.WordWrapping = WordWrapping.NoWrap; //遇到邊界時別下移
            DrawTextOptions op = DrawTextOptions.Clip;     //遇到邊界時裁切

            float oy = (textLayout.Metrics.Height - textFormat.FontSize) / 2.0f;

            RectangleF rect1 = new RectangleF(0, oy, textLayout.Metrics.Width / 2.0f, textFormat.FontSize);
            RectangleF rect2 = new RectangleF(0, oy + textFormat.FontSize, textLayout.Metrics.Width / 2.0f, textFormat.FontSize);

            d2d1DC.FillRectangle(rect1, new SolidColorBrush(d2d1DC, Color.White));

            d2d1DC.FillRectangle(rect2, new SolidColorBrush(d2d1DC, Color.Blue));

            d2d1DC.DrawText("你", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("你", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("怎", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("怎", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("不", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("不", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("問", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("問", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("問", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("問", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("神", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("神", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("奇", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("奇", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("海", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("海", textFormat2, rect, brush2, op);
            rect.X += d;
            d2d1DC.DrawText("螺", textFormat, rect, brush, op);
            rect.X += d;
            d2d1DC.DrawText("螺", textFormat2, rect, brush2, op);

            //=============================
            d2d1DC.EndDraw();
            swapChain.Present(1, PresentFlags.None);
        }
Exemplo n.º 16
0
        private void DrawPTT(ScreenBuffer Buffer)
        {
            lock (d2d1DC)
            {
                LeftFormat  = new TextFormat(DirectXFactory.DWFactory, PreferFont, FontSize);
                RightFormat = new TextFormat(DirectXFactory.DWFactory, PreferFont, FontSize);

                LeftFormat.TextAlignment  = SharpDX.DirectWrite.TextAlignment.Leading;
                RightFormat.TextAlignment = SharpDX.DirectWrite.TextAlignment.Trailing;

                LeftFormat.WordWrapping  = WordWrapping.NoWrap; //遇到邊界時別下移
                RightFormat.WordWrapping = WordWrapping.NoWrap;
                DrawTextOptions option = DrawTextOptions.Clip;  //遇到邊界時裁切

                TextLayout textLayout = new TextLayout(DirectXFactory.DWFactory, "遇", LeftFormat, LeftFormat.FontSize, LeftFormat.FontSize);

                float dw     = textLayout.MaxWidth / 2.0f;
                float dh     = textLayout.MaxHeight + 0;
                float deltaX = -0.7f;
                float deltaY = -0.6f;
                float dx     = dw + deltaX;
                float dy     = dh + deltaY;

                Vector2 origin = new Vector2((float)((this.ActualWidth - dx * Buffer.Width) / 2.0), 0.0f);

                float      oy             = 1.0f + (textLayout.Metrics.Height - LeftFormat.FontSize) / 2.0f;
                RectangleF layoutRect     = new RectangleF(origin.X, origin.Y, dw, textLayout.Metrics.Height);
                RectangleF backLayoutRect = new RectangleF(origin.X, origin.Y + oy, dw, dh);

                d2d1DC.BeginDraw();
                d2d1DC.Clear(Color.Black);

                if (Colorful) //無彩限的幻影世界
                {
                    //先畫背景
                    for (int i = 0; i < Buffer.Height; i++)
                    {
                        for (int j = 0; j < Buffer.Width; j++)
                        {
                            if (Buffer[i][j].Content < 0x7F) //ascii
                            {
                                SolidColorBrush Backbrush = new SolidColorBrush(d2d1DC, Buffer[i][j].GetBackgroundColor());
                                d2d1DC.FillRectangle(backLayoutRect, Backbrush);
                                backLayoutRect.X += dx;
                            }
                            else
                            {
                                SolidColorBrush Backbrush = new SolidColorBrush(d2d1DC, Buffer[i][j].GetBackgroundColor());

                                if (j + 1 >= Buffer.Width)
                                {
                                    break;
                                }

                                d2d1DC.FillRectangle(backLayoutRect, Backbrush);
                                backLayoutRect.X += dx;

                                Backbrush = new SolidColorBrush(d2d1DC, Buffer[i][++j].GetBackgroundColor());
                                d2d1DC.FillRectangle(backLayoutRect, Backbrush);
                                backLayoutRect.X += dx;
                            }
                        }
                        backLayoutRect.X  = origin.X;
                        backLayoutRect.Y += dy;
                    }

                    //再畫文字
                    for (int i = 0; i < Buffer.Height; i++)
                    {
                        for (int j = 0; j < Buffer.Width; j++)
                        {
                            if (Buffer[i][j].Content < 0x7F) //ascii
                            {
                                SolidColorBrush Forebrush = new SolidColorBrush(d2d1DC, Buffer[i][j].GetForegroundColor());
                                d2d1DC.DrawText(Convert.ToString((char)Buffer[i][j].Content), LeftFormat, layoutRect, Forebrush, option);
                                layoutRect.X += dx;
                            }
                            else
                            {
                                SolidColorBrush Forebrush = new SolidColorBrush(d2d1DC, Buffer[i][j].GetForegroundColor());

                                if (j + 1 >= Buffer.Width)
                                {
                                    break;
                                }

                                string word = PTTEncoding.GetEncoding().GetString(new byte[] { Buffer[i][j].Content, Buffer[i][++j].Content });
                                d2d1DC.DrawText(word, LeftFormat, layoutRect, Forebrush, option);
                                layoutRect.X += dx;

                                Forebrush = new SolidColorBrush(d2d1DC, Buffer[i][j].GetForegroundColor());
                                d2d1DC.DrawText(word, RightFormat, layoutRect, Forebrush, option);
                                layoutRect.X += dx;
                            }
                        }
                        layoutRect.X  = origin.X;
                        layoutRect.Y += dy;
                    }
                }
                else //沒有色彩的世界
                {
                    SolidColorBrush brush = new SolidColorBrush(d2d1DC, new Color(0xbb, 0xbb, 0xbb));
                    Vector2         o     = Vector2.Zero;

                    for (int i = 0; i < Buffer.Height; i++)
                    {
                        List <byte> sb = new List <byte>();

                        for (int j = 0; j < Buffer.Width; j++)
                        {
                            if (Buffer[i][j].Content != 0)
                            {
                                sb.Add(Buffer[i][j].Content);
                            }
                            else
                            {
                                sb.Add((byte)' ');
                            }
                        }
                        String     msg = PTTEncoding.GetEncoding().GetString(sb.ToArray());
                        TextLayout tl  = new TextLayout(DirectXFactory.DWFactory, msg, LeftFormat, (float)this.ActualWidth, LeftFormat.FontSize);

                        RectangleF rect = new RectangleF(o.X, o.Y, tl.MaxWidth, tl.MaxHeight);
                        d2d1DC.DrawText(msg, LeftFormat, rect, brush);
                        o = o + new Vector2(0, LeftFormat.FontSize);
                    }
                }

                d2d1DC.EndDraw();

                swapChain.Present(1, PresentFlags.None);
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// Draws the specified text using the format information provided by an <see cref="T:SharpDX.DirectWrite.TextFormat" /> object.
 /// </summary>
 /// <remarks>
 /// To create an <see cref="IDWriteTextFormat"/> object, create an <see cref="IDWriteFactory"/> and call its CreateTextFormat method.
 /// </remarks>
 /// <param name="text">A reference to an array of Unicode characters to draw.  </param>
 /// <param name="textFormat">An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.   </param>
 /// <param name="layoutRect">The size and position of the area in which the text is drawn.  </param>
 /// <param name="defaultForegroundBrush">The brush used to paint the text. </param>
 /// <param name="options">A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is <see cref="F:SharpDX.Direct2D1.DrawTextOptions.None" />, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle. </param>
 /// <param name="measuringMode">A value that indicates how glyph metrics are used to measure text when it is formatted.  The default value is DWRITE_MEASURING_MODE_NATURAL.  </param>
 public void DrawText(string text, IDWriteTextFormat textFormat, RectF layoutRect, ID2D1Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode)
 {
     DrawText(text, text.Length, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode);
 }
Exemplo n.º 18
0
 public void DrawText(string text, ITextFormat textFormat, RectFloat layoutRect, IBrush defaultForegroundBrush, DrawTextOptions options, TextMeasuringMode measuringMode)
 {
     base.innerRefT.DrawText(text, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode);
 }
Exemplo n.º 19
0
        /// <summary>
        /// Draws the specified text using the format information provided by an <see cref="T:SharpDX.DirectWrite.TextFormat" /> object.
        /// </summary>
        /// <remarks>
        /// To create an <see cref="IDWriteTextFormat"/> object, create an <see cref="IDWriteFactory"/> and call its CreateTextFormat method.
        /// </remarks>
        /// <param name="text">A reference to an array of Unicode characters to draw.  </param>
        /// <param name="textFormat">An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.   </param>
        /// <param name="layoutRect">The size and position of the area in which the text is drawn.  </param>
        /// <param name="defaultForegroundBrush">The brush used to paint the text. </param>
        /// <param name="options">A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is <see cref="F:SharpDX.Direct2D1.DrawTextOptions.None" />, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle. </param>
        /// <param name="measuringMode">A value that indicates how glyph metrics are used to measure text when it is formatted.  The default value is DWRITE_MEASURING_MODE_NATURAL.  </param>
        public void DrawText(string text, IDWriteTextFormat textFormat, RawRectangleF layoutRect, ID2D1Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode)
        {
            Guard.NotNullOrEmpty(text, nameof(text));

            DrawText(text, text.Length, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode);
        }
Exemplo n.º 20
0
 public void DrawTextLayout(RawVector2 origin, TextLayout textLayout, Brush defaultFillBrush, DrawTextOptions options) => _renderTarget?.DrawTextLayout(origin, textLayout, defaultFillBrush, options);
Exemplo n.º 21
0
 public void DrawText(string text, TextFormat textFormat, RectangleF layoutRect, Brush foregroundBrush,
                      DrawTextOptions textOptions = DrawTextOptions.None)
 {
     deviceContext.DrawText(text, textFormat, Convert(layoutRect), foregroundBrush, textOptions);
 }
Exemplo n.º 22
0
 public void DrawTextLayout(PointFloat origin, ITextLayout textLayout, IBrush defaultForegroundBrush, DrawTextOptions options)
 {
     base.innerRefT.DrawTextLayout(origin, textLayout, defaultForegroundBrush, options);
 }
Exemplo n.º 23
0
 public FFMpegArgumentOptions DrawText(DrawTextOptions drawTextOptions) => WithArgument(new DrawTextArgument(drawTextOptions));