return NativeMethods.cairo_status (handle);
}
}
+ public string StatusString {
+ get {
+ return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (Status));
+ }
+ }
public IntPtr Handle => handle;
public virtual ISurface CreateSurface(byte[] data, int width, int height)
=> new ImageSurface (data, Format.ARGB32, width, height, 4 * width);
- public ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
+ public virtual ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
switch (Environment.OSVersion.Platform) {
case PlatformID.Unix:
IntPtr disp = Glfw3.GetX11Display ();
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
+using Drawing2D;
namespace Crow.CairoBackend
{
public class EGLDevice : GLDevice
{
- public EGLDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
+ public EGLDevice (IntPtr dpy, IntPtr gl_ctx, bool threadAwayre = false) : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
{
+ SetThreadAware(threadAwayre);
}
+ public override ISurface CreateSurface(int width, int height)
+ => new ImageSurface (Format.ARGB32, width, height);
+ public override ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
+ return new GLSurface (this, Glfw.Glfw3.GetEGLSurface (nativeWindoPointer), width, height);
+ }
+
}
}
public GLSurface (WGLDevice device, IntPtr hdc, int width, int height)
: base (NativeMethods.cairo_gl_surface_create_for_dc (device.Handle, hdc, width, height), true)
{}
+ public override void Flush ()
+ {
+ base.Flush ();
+ SwapBuffers ();
+ }
+ public override int Width => NativeMethods.cairo_gl_surface_get_width (handle);
+ public override int Height => NativeMethods.cairo_gl_surface_get_height (handle);
public void SwapBuffers(){
NativeMethods.cairo_gl_surface_swapbuffers (this.Handle);
}
- public Surface CreateSimilar (
- Content content, int width, int height)
- {
+ public ISurface CreateSimilar (int width, int height) {
IntPtr p = NativeMethods.cairo_surface_create_similar (
- this.Handle, content, width, height);
-
+ this.Handle, Content.ColorAlpha, width, height);
return Surface.Lookup(p, true);
}
return Status;
}
- public void Flush ()
+ public virtual void Flush ()
{
NativeMethods.cairo_surface_flush (handle);
}
{
NativeMethods.cairo_surface_mark_dirty_rectangle (Handle, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
}
- public virtual int Width => -1;
- public virtual int Height => -1;
+ public virtual int Width => NativeMethods.cairo_image_surface_get_width (handle);
+ public virtual int Height => NativeMethods.cairo_image_surface_get_height (handle);
public IntPtr Handle {
get {
{
throw new NotImplementedException();
}
-
- public ISurface CreateSimilar(int width, int height)
- {
- throw new NotImplementedException();
- }
}
}