diff options
Diffstat (limited to 'Backends/CairoBackend/src/GLDevice.cs')
| -rw-r--r-- | Backends/CairoBackend/src/GLDevice.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Backends/CairoBackend/src/GLDevice.cs b/Backends/CairoBackend/src/GLDevice.cs index c7992b74..d90fe1a0 100644 --- a/Backends/CairoBackend/src/GLDevice.cs +++ b/Backends/CairoBackend/src/GLDevice.cs @@ -2,6 +2,9 @@ // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; +using Drawing2D; +using OpenGL; +using static OpenGL.Gl; namespace Crow.CairoBackend { @@ -11,6 +14,15 @@ namespace Crow.CairoBackend public void SetThreadAware (bool value) { NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0); } + public virtual ISurface CreateSurface(int width, int height) { + uint tex = GenTexture (); + BindTexture (TextureTarget.Texture2d, tex); + TexImage2D (TextureTarget.Texture2d, 0, InternalFormat.Rgb, width, height, + 0, PixelFormat.Rgb, PixelType.UnsignedByte, 0); + TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, NEAREST); + TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, NEAREST); + return new GLSurface (this, Content.ColorAlpha, tex, width, height); + } } } |