ExampleGallery.BurningTextExample.SetupText C# (CSharp) Méthode

SetupText() private méthode

Renders text into a command list and sets this as the input to the flame effect graph. The effect graph must already be created before calling this method.
private SetupText ( ICanvasResourceCreator resourceCreator ) : void
resourceCreator ICanvasResourceCreator
Résultat void
        private void SetupText(ICanvasResourceCreator resourceCreator)
        {
            textCommandList = new CanvasCommandList(resourceCreator);

            using (var ds = textCommandList.CreateDrawingSession())
            {
                ds.Clear(Colors.Transparent);

                ds.DrawText(
                    "Windows.UI.Composition",
                    0,
                    0,
                    Colors.White,
                    new Microsoft.Graphics.Canvas.Text.CanvasTextFormat
                    {
                        FontFamily = "Segoe UI",
                        FontSize = 20,
                        HorizontalAlignment = CanvasHorizontalAlignment.Center,
                        VerticalAlignment = CanvasVerticalAlignment.Top
                    });
            }

            // Hook up the command list to the inputs of the flame effect graph.
            morphology.Source = textCommandList;
            composite.Sources[1] = textCommandList;
        }