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 namespace OpenTK.Graphics
{ {
[Obsolete()]
class DisplayListTextHandle : TextHandle class DisplayListTextHandle : TextHandle
{ {
public DisplayListTextHandle(int handle) : base(handle) { } public DisplayListTextHandle(int handle) : base(handle) { }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,6 +17,7 @@ namespace OpenTK.Graphics
/// <summary> /// <summary>
/// Provides text printing through OpenGL 1.5 vertex buffer objects. /// Provides text printing through OpenGL 1.5 vertex buffer objects.
/// </summary> /// </summary>
[Obsolete]
class VboTextPrinter : ITextPrinterImplementation class VboTextPrinter : ITextPrinterImplementation
{ {
static int allocated_handles; static int allocated_handles;
@ -84,6 +85,7 @@ namespace OpenTK.Graphics
/// <summary> /// <summary>
/// Contains the necessary information to print text through the VboTextPrinter implementation. /// Contains the necessary information to print text through the VboTextPrinter implementation.
/// </summary> /// </summary>
[Obsolete]
class VboTextHandle : TextHandle class VboTextHandle : TextHandle
{ {
public VboTextHandle(int handle) : base(handle) { } 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);
TextExtents Measure(string text, Font font, TextPrinterOptions options); TextExtents Measure(string text, Font font, TextPrinterOptions options);
TextExtents Measure(string text, Font font, TextPrinterOptions options, RectangleF layoutRectangle); 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 #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 #endregion
#region Private Members #region Private Members