示例#1
0
        /// <summary>
        /// Prints text using the specified color and layout options.
        /// </summary>
        /// <param name="text">The System.String to print.</param>
        /// <param name="font">The System.Drawing.Font that will be used to print text.</param>
        /// <param name="color">The System.Drawing.Color that will be used to print text.</param>
        /// <param name="rect">The System.Drawing.Rectangle that defines the bounds for text layout.</param>
        /// <param name="options">The OpenTK.Graphics.TextPrinterOptions that will be used to print text.</param>
        /// <param name="alignment">The OpenTK.Graphics.TextAlignment that will be used to print text.</param>
        /// <param name="direction">The OpenTK.Graphics.TextDirection that will be used to print text.</param>
        public void Render(string text, Font font, Color color, RectangleF rect, TextPrinterOptions options, TextAlignment alignment, TextDirection direction)
        {
            Contract.Requires(!_disposed, new ObjectDisposedException(GetType().ToString()).Message);
            Contract.Requires(!string.IsNullOrEmpty(text));
            Contract.Requires(font != null);
            Contract.Requires((rect.Width >= 0) && (rect.Height >= 0));

            var block = new TextBlock(text, font, rect, options, alignment, direction);

            TextOutput.Render(ref block, color, Rasterizer);
        }