From bca0eef6d4ea5faca1463fb5e7165d867441b923 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 3 Nov 2008 23:55:53 +0000 Subject: [PATCH] Implemented X11GdiPlusInternals. Added missing license headers. --- Source/OpenTK/Platform/IGdiPlusInternals.cs | 10 ++++- .../Platform/Windows/WinGdiPlusInternals.cs | 10 ++++- .../Platform/X11/X11GdiPlusInternals.cs | 38 +++++++++++++++---- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/Source/OpenTK/Platform/IGdiPlusInternals.cs b/Source/OpenTK/Platform/IGdiPlusInternals.cs index 3304d10b..27b9bfd0 100644 --- a/Source/OpenTK/Platform/IGdiPlusInternals.cs +++ b/Source/OpenTK/Platform/IGdiPlusInternals.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing detailed licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; diff --git a/Source/OpenTK/Platform/Windows/WinGdiPlusInternals.cs b/Source/OpenTK/Platform/Windows/WinGdiPlusInternals.cs index 8016732e..4f5643fa 100644 --- a/Source/OpenTK/Platform/Windows/WinGdiPlusInternals.cs +++ b/Source/OpenTK/Platform/Windows/WinGdiPlusInternals.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing detailed licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; using System.Drawing; diff --git a/Source/OpenTK/Platform/X11/X11GdiPlusInternals.cs b/Source/OpenTK/Platform/X11/X11GdiPlusInternals.cs index 6459cd15..b197517a 100644 --- a/Source/OpenTK/Platform/X11/X11GdiPlusInternals.cs +++ b/Source/OpenTK/Platform/X11/X11GdiPlusInternals.cs @@ -1,26 +1,50 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing detailed licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; +using System.Drawing; +using System.Reflection; namespace OpenTK.Platform.X11 { class X11GdiPlusInternals : IGdiPlusInternals { - #region IGdiPlusInternals Members + static readonly PropertyInfo native_graphics_property, native_font_property, native_string_format_property; + + static X11GdiPlusInternals() + { + native_graphics_property = + typeof(System.Drawing.Graphics).GetProperty("NativeObject", BindingFlags.Instance | BindingFlags.NonPublic); + + native_font_property = + typeof(System.Drawing.Font).GetProperty("NativeObject", BindingFlags.Instance | BindingFlags.NonPublic); + + native_string_format_property = + typeof(System.Drawing.StringFormat).GetProperty("NativeObject", BindingFlags.Instance | BindingFlags.NonPublic); + } + + #region --- IGdiPlusInternals Members --- public IntPtr GetNativeGraphics(System.Drawing.Graphics graphics) { - throw new NotImplementedException(); + return (IntPtr)native_graphics_property.GetValue(graphics, null); } - public IntPtr GetNativeFont(System.Drawing.Font font) + public IntPtr GetNativeFont(Font font) { - throw new NotImplementedException(); + return (IntPtr)native_font_property.GetValue(font, null); } - public IntPtr GetNativeStringFormat(System.Drawing.StringFormat format) + public IntPtr GetNativeStringFormat(StringFormat format) { - throw new NotImplementedException(); + return (IntPtr)native_string_format_property.GetValue(format, null); } #endregion