Obsoleted old implementation and added compatibility layer to the new ITextPrinter.

This commit is contained in:
the_fiddler 2008-11-25 18:17:30 +00:00
parent 4ca288bc87
commit 27c3f3b0ce
9 changed files with 52 additions and 4 deletions

View file

@ -11,6 +11,7 @@ using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics
{
[Obsolete()]
class DisplayListTextHandle : TextHandle
{
public DisplayListTextHandle(int handle) : base(handle) { }

View file

@ -16,6 +16,7 @@ namespace OpenTK.Graphics
/// <summary>
/// Provides text printing through OpenGL 1.1 Display Lists.
/// </summary>
[Obsolete()]
class DisplayListTextPrinter : ITextPrinterImplementation
{
#region IPrinter Members

View file

@ -16,6 +16,7 @@ namespace OpenTK.Graphics
/// <summary>
/// Represents a single character of a specific Font.
/// </summary>
[Obsolete]
struct Glyph : IPackable<Glyph>
{
char character;

View file

@ -15,6 +15,7 @@ namespace OpenTK.Graphics
/// <summary>
/// Defines the interface for TextPrinter implementations.
/// </summary>
[Obsolete("Use ITextOutputProvider instead")]
public interface ITextPrinterImplementation
{
/// <summary>

View file

@ -13,17 +13,27 @@ namespace OpenTK.Graphics
/// <summary>
/// Represents a handle to cached text.
/// </summary>
public abstract class TextHandle : IDisposable
[Obsolete("Use TextPrinter.Print instead")]
public class TextHandle : IDisposable
{
internal string Text;
internal System.Drawing.Font GdiPFont;
/// <summary>
/// Constructs a new TextHandle,
/// </summary>
/// <param name="handle"></param>
public TextHandle(int handle)
internal TextHandle(int handle)
{
Handle = handle;
}
internal TextHandle(string text, System.Drawing.Font font)
{
Text = text;
GdiPFont = font;
}
private int handle;
protected TextureFont font;
protected bool disposed;

View file

@ -21,11 +21,12 @@ namespace OpenTK.Graphics
{
using Graphics = System.Drawing.Graphics;
using PixelFormat = OpenTK.Graphics.PixelFormat;
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
[Obsolete("Use System.Drawing.Font instead")]
public class TextureFont : IFont
{
Font font;
internal Font font;
Dictionary<char, RectangleF> loaded_glyphs = new Dictionary<char, RectangleF>(64);
Bitmap bmp;

View file

@ -17,6 +17,7 @@ namespace OpenTK.Graphics
/// <summary>
/// Provides text printing through OpenGL 1.5 vertex buffer objects.
/// </summary>
[Obsolete]
class VboTextPrinter : ITextPrinterImplementation
{
static int allocated_handles;
@ -84,6 +85,7 @@ namespace OpenTK.Graphics
/// <summary>
/// Contains the necessary information to print text through the VboTextPrinter implementation.
/// </summary>
[Obsolete]
class VboTextHandle : TextHandle
{
public VboTextHandle(int handle) : base(handle) { }

View file

@ -25,5 +25,14 @@ namespace OpenTK.Graphics
TextExtents Measure(string text, Font font);
TextExtents Measure(string text, Font font, TextPrinterOptions options);
TextExtents Measure(string text, Font font, TextPrinterOptions options, RectangleF layoutRectangle);
[Obsolete("Use TextPrinter.Print instead")]
void Draw(TextHandle handle);
[Obsolete("Use TextPrinter.Print instead")]
void Draw(string text, TextureFont font);
[Obsolete("Use TextPrinter.Print instead")]
void Prepare(string text, TextureFont font, out TextHandle handle);
}
}

View file

@ -177,6 +177,28 @@ namespace OpenTK.Graphics
#endregion
#region Obsolete
[Obsolete("Use TextPrinter.Print instead")]
public void Draw(TextHandle handle)
{
Print(handle.Text, handle.GdiPFont);
}
[Obsolete("Use TextPrinter.Print instead")]
public void Draw(string text, TextureFont font)
{
Print(text, font.font);
}
[Obsolete("Use TextPrinter.Print instead")]
public void Prepare(string text, TextureFont font, out TextHandle handle)
{
handle = new TextHandle(text, font.font);
}
#endregion
#endregion
#region Private Members