ConvertSolidColorBrush() public static method

Converts a Color into a SolidColorBrush.
public static ConvertSolidColorBrush ( SharpDX.Color color ) : SharpDX.Direct2D1.SolidColorBrush
color SharpDX.Color The Color.
return SharpDX.Direct2D1.SolidColorBrush
Beispiel #1
0
        /// <summary>
        /// Draws a string.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="rectangle">The Rectangle.</param>
        /// <param name="color">The Color.</param>
        public void DrawString(string text, Font font, Rectangle rectangle, Color color)
        {
            var dxFont = font.Instance as DirectXFont;

            if (dxFont == null)
            {
                throw new ArgumentException("DirectX11 expects a DirectXFont as resource.");
            }

            DirectXHelper.RenderTarget.DrawText(text, dxFont.GetFont(),
                                                new RectangleF(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height),
                                                DirectXHelper.ConvertSolidColorBrush(color));
        }
Beispiel #2
0
        /// <summary>
        /// Draws a string.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="position">The Position.</param>
        /// <param name="color">The Color.</param>
        public void DrawString(string text, Font font, Vector2 position, Color color)
        {
            var dxFont = font.Instance as DirectXFont;

            if (dxFont == null)
            {
                throw new ArgumentException("DirectX11 expects a DirectXFont as resource.");
            }

            DirectXHelper.RenderTarget.DrawText(text, dxFont.GetFont(),
                                                new RectangleF(position.X, position.Y, 9999, 9999), DirectXHelper.ConvertSolidColorBrush(color));
        }