Environment.GetTextOutlinedImage Method
The following code demonstrates how to efficiently draw an outlined text on screen
private TextureBase texture1; private bool firstTime = false; protected override void DrawOverlay(DrawSceneParams data) { base.DrawOverlay(data); if (!firstTime) { firstTime = true; Font font = new Font("Tahoma", 50, FontStyle.Italic); Image image1 = GetTextOutlinedImage("My Text", font, Color.Red, Color.Black, RotateFlipType.RotateNoneFlipY, 1); texture1 = renderContext.CreateTexture2D(image1, textureFilteringFunctionType.Nearest, textureFilteringFunctionType.Nearest, true, true); image1.Dispose(); font.Dispose(); } DrawTexture(texture1, 100, 100, ContentAlignment.BottomLeft); // Remember to Dispose the texture when it is no more needed, or before quitting the application }
This language is not supported or no code example is available.
Private texture1 As TextureBase Private firstTime As Boolean = False Protected Overrides Sub DrawOverlay(data As DrawSceneParams) MyBase.DrawOverlay(data) If Not firstTime Then firstTime = True Dim font As New Font("Tahoma", 50, FontStyle.Italic) Dim image1 As Image = GetTextOutlinedImage("My Text", font, Color.Red, Color.Black, RotateFlipType.RotateNoneFlipY, 1) texture1 = renderContext.CreateTexture2D(image1, textureFilteringFunctionType.Nearest, textureFilteringFunctionType.Nearest, True, True) image1.Dispose() font.Dispose() End If DrawTexture(texture1, 100, 100, ContentAlignment.BottomLeft) ' Remember to Dispose the texture when it is no more needed, or before quitting the application End Sub
This language is not supported or no code example is available.