Added conditional compilation and the necessary classes to compile OpenTK without referencing System.Drawing.dll. To build without System.Drawing, add "MINIMAL" to the conditional compilation symbols. Note that this is an experimental feature that will result in a source- and binary-incompatible dll.
This commit is contained in:
parent
02bfac7d59
commit
7bcbfc7072
22 changed files with 2194 additions and 37 deletions
|
@ -28,7 +28,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
|
|
|
@ -10,7 +10,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
|
|
|
@ -29,7 +29,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Threading;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
|
@ -99,7 +102,7 @@ namespace OpenTK.Graphics
|
|||
/// </summary>
|
||||
/// <param name="color">The System.Drawing.Color containing the component values.</param>
|
||||
[Obsolete("Use new Color4(r, g, b, a) instead.")]
|
||||
public Color4(System.Drawing.Color color)
|
||||
public Color4(Color color)
|
||||
: this(color.R, color.G, color.B, color.A)
|
||||
{ }
|
||||
|
||||
|
@ -150,7 +153,7 @@ namespace OpenTK.Graphics
|
|||
/// </summary>
|
||||
/// <param name="color">The System.Drawing.Color to convert.</param>
|
||||
/// <returns>A new Color4 structure containing the converted components.</returns>
|
||||
public static implicit operator Color4(System.Drawing.Color color)
|
||||
public static implicit operator Color4(Color color)
|
||||
{
|
||||
return new Color4(color.R, color.G, color.B, color.A);
|
||||
}
|
||||
|
@ -160,9 +163,9 @@ namespace OpenTK.Graphics
|
|||
/// </summary>
|
||||
/// <param name="color">The Color4 to convert.</param>
|
||||
/// <returns>A new System.Drawing.Color structure containing the converted components.</returns>
|
||||
public static explicit operator System.Drawing.Color(Color4 color)
|
||||
public static explicit operator Color(Color4 color)
|
||||
{
|
||||
return System.Drawing.Color.FromArgb(
|
||||
return Color.FromArgb(
|
||||
(int)(color.A * Byte.MaxValue),
|
||||
(int)(color.R * Byte.MaxValue),
|
||||
(int)(color.G * Byte.MaxValue),
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Graphics.ES20
|
||||
|
@ -63,7 +66,7 @@ namespace OpenTK.Graphics.ES20
|
|||
|
||||
#region public static void ClearColor() overloads
|
||||
|
||||
public static void ClearColor(System.Drawing.Color color)
|
||||
public static void ClearColor(Color color)
|
||||
{
|
||||
GL.ClearColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
|
||||
}
|
||||
|
@ -77,7 +80,7 @@ namespace OpenTK.Graphics.ES20
|
|||
|
||||
#region public static void BlendColor() overloads
|
||||
|
||||
public static void BlendColor(System.Drawing.Color color)
|
||||
public static void BlendColor(Color color)
|
||||
{
|
||||
GL.BlendColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
|
||||
}
|
||||
|
@ -399,17 +402,17 @@ namespace OpenTK.Graphics.ES20
|
|||
|
||||
#region Viewport
|
||||
|
||||
public static void Viewport(System.Drawing.Size size)
|
||||
public static void Viewport(Size size)
|
||||
{
|
||||
GL.Viewport(0, 0, size.Width, size.Height);
|
||||
}
|
||||
|
||||
public static void Viewport(System.Drawing.Point location, System.Drawing.Size size)
|
||||
public static void Viewport(Point location, Size size)
|
||||
{
|
||||
GL.Viewport(location.X, location.Y, size.Width, size.Height);
|
||||
}
|
||||
|
||||
public static void Viewport(System.Drawing.Rectangle rectangle)
|
||||
public static void Viewport(Rectangle rectangle)
|
||||
{
|
||||
GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
@ -103,12 +106,12 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region public static void Color[34]() overloads
|
||||
|
||||
public static void Color3(System.Drawing.Color color)
|
||||
public static void Color3(Color color)
|
||||
{
|
||||
GL.Color3(color.R, color.G, color.B);
|
||||
}
|
||||
|
||||
public static void Color4(System.Drawing.Color color)
|
||||
public static void Color4(Color color)
|
||||
{
|
||||
GL.Color4(color.R, color.G, color.B, color.A);
|
||||
}
|
||||
|
@ -132,7 +135,7 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region public static void ClearColor() overloads
|
||||
|
||||
public static void ClearColor(System.Drawing.Color color)
|
||||
public static void ClearColor(Color color)
|
||||
{
|
||||
GL.ClearColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
|
||||
}
|
||||
|
@ -146,7 +149,7 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region public static void BlendColor() overloads
|
||||
|
||||
public static void BlendColor(System.Drawing.Color color)
|
||||
public static void BlendColor(Color color)
|
||||
{
|
||||
GL.BlendColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
|
||||
}
|
||||
|
@ -720,24 +723,24 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region Rect
|
||||
|
||||
public static void Rect(System.Drawing.RectangleF rect)
|
||||
public static void Rect(RectangleF rect)
|
||||
{
|
||||
GL.Rect(rect.Left, rect.Top, rect.Right, rect.Bottom);
|
||||
}
|
||||
|
||||
public static void Rect(System.Drawing.Rectangle rect)
|
||||
public static void Rect(Rectangle rect)
|
||||
{
|
||||
GL.Rect(rect.Left, rect.Top, rect.Right, rect.Bottom);
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public static void Rect(ref System.Drawing.RectangleF rect)
|
||||
public static void Rect(ref RectangleF rect)
|
||||
{
|
||||
GL.Rect(rect.Left, rect.Top, rect.Right, rect.Bottom);
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public static void Rect(ref System.Drawing.Rectangle rect)
|
||||
public static void Rect(ref Rectangle rect)
|
||||
{
|
||||
GL.Rect(rect.Left, rect.Top, rect.Right, rect.Bottom);
|
||||
}
|
||||
|
@ -901,17 +904,17 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region Viewport
|
||||
|
||||
public static void Viewport(System.Drawing.Size size)
|
||||
public static void Viewport(Size size)
|
||||
{
|
||||
GL.Viewport(0, 0, size.Width, size.Height);
|
||||
}
|
||||
|
||||
public static void Viewport(System.Drawing.Point location, System.Drawing.Size size)
|
||||
public static void Viewport(Point location, Size size)
|
||||
{
|
||||
GL.Viewport(location.X, location.Y, size.Width, size.Height);
|
||||
}
|
||||
|
||||
public static void Viewport(System.Drawing.Rectangle rectangle)
|
||||
public static void Viewport(Rectangle rectangle)
|
||||
{
|
||||
GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
|
||||
}
|
||||
|
@ -930,7 +933,7 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region TexEnv
|
||||
|
||||
public static void TexEnv(TextureEnvTarget target, TextureEnvParameter pname, System.Drawing.Color color)
|
||||
public static void TexEnv(TextureEnvTarget target, TextureEnvParameter pname, Color color)
|
||||
{
|
||||
Color4 c = new Color4(color.R, color.G, color.B, color.A);
|
||||
unsafe
|
||||
|
|
|
@ -27,10 +27,12 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using OpenTK.Platform;
|
||||
using System.ComponentModel;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
using OpenTK.Platform;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,9 @@
|
|||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Platform;
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Graphics;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenTK.Platform
|
||||
{
|
||||
|
|
|
@ -31,7 +31,10 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
|
||||
using EventTime = System.Double;
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
|
@ -752,7 +754,11 @@ namespace OpenTK.Platform.MacOS
|
|||
int index;
|
||||
|
||||
bitmap = new Bitmap(128, 128);
|
||||
#if MINIMAL
|
||||
using (global::Graphics g = global::Graphics.FromImage(bitmap))
|
||||
#else
|
||||
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
|
||||
#endif
|
||||
{
|
||||
g.DrawImage(icon.ToBitmap(), 0, 0, 128, 128);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using OpenTK.Platform.MacOS.Carbon;
|
||||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
#region --- Using Directives ---
|
||||
|
||||
using System;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Security;
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ using OpenTK.Graphics;
|
|||
using OpenTK.Input;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
|
||||
namespace OpenTK.Platform.Windows
|
||||
{
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -594,15 +598,15 @@ namespace OpenTK.Platform.X11
|
|||
(byte)(argb & 0xFF));
|
||||
}
|
||||
}
|
||||
public static IntPtr CreatePixmapFromImage(Display display, System.Drawing.Bitmap image)
|
||||
public static IntPtr CreatePixmapFromImage(Display display, Bitmap image)
|
||||
{
|
||||
int width = image.Width;
|
||||
int height = image.Height;
|
||||
int size = width * height;
|
||||
|
||||
System.Drawing.Imaging.BitmapData data = image.LockBits(new System.Drawing.Rectangle(0, 0, width, height),
|
||||
System.Drawing.Imaging.ImageLockMode.ReadOnly,
|
||||
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
BitmapData data = image.LockBits(new Rectangle(0, 0, width, height),
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb);
|
||||
|
||||
IntPtr ximage = XCreateImage(display, CopyFromParent, 24, ImageFormat.ZPixmap,
|
||||
0, data.Scan0, (uint)width, (uint)height, 32, 0);
|
||||
|
@ -618,7 +622,7 @@ namespace OpenTK.Platform.X11
|
|||
return pixmap;
|
||||
}
|
||||
|
||||
public static IntPtr CreateMaskFromImage(Display display, System.Drawing.Bitmap image)
|
||||
public static IntPtr CreateMaskFromImage(Display display, Bitmap image)
|
||||
{
|
||||
int width = image.Width;
|
||||
int height = image.Height;
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Collections;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Platform.X11
|
||||
|
|
|
@ -29,12 +29,14 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenTK.Platform.X11
|
||||
{
|
||||
|
@ -1083,7 +1085,7 @@ namespace OpenTK.Platform.X11
|
|||
else
|
||||
{
|
||||
// Set _NET_WM_ICON
|
||||
System.Drawing.Bitmap bitmap = value.ToBitmap();
|
||||
Bitmap bitmap = value.ToBitmap();
|
||||
int size = bitmap.Width * bitmap.Height + 2;
|
||||
IntPtr[] data = new IntPtr[size];
|
||||
int index = 0;
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !MINIMAL
|
||||
using System.Drawing;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using OpenTK.Input;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenTK.Platform.X11
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue