diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-26 13:18:02 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-26 13:18:02 +0100 |
| commit | a3d4977a3cb6d7e4ce4f9627842398e6ab25d9a8 (patch) | |
| tree | 7a8e786c3f7e0990196b8fef34bcc3fefe4bf29b /Backends/CairoBackend/src | |
| parent | 4cc76903d5556886f39dc35400f7ba5e9f732eb7 (diff) | |
skia backend wip, glfw win created in backends if null, wip
Diffstat (limited to 'Backends/CairoBackend/src')
| -rw-r--r-- | Backends/CairoBackend/src/CairoBackendBase.cs | 7 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/Context.cs | 116 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/DefaultBackend.cs | 4 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/EglBackend.cs | 24 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/GLSurface.cs | 2 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/ImageBackend.cs | 18 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/ImageSurface.cs | 12 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/PSSurface.cs | 8 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/Pattern.cs | 3 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/PdfSurface.cs | 2 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/Surface.cs | 15 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/SurfacePattern.cs | 2 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/SvgSurface.cs | 2 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/XcbSurface.cs | 2 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/XlibSurface.cs | 18 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/rsvg/SvgHandle.cs | 4 |
16 files changed, 103 insertions, 136 deletions
diff --git a/Backends/CairoBackend/src/CairoBackendBase.cs b/Backends/CairoBackend/src/CairoBackendBase.cs index 535bb31d..1e1b2e82 100644 --- a/Backends/CairoBackend/src/CairoBackendBase.cs +++ b/Backends/CairoBackend/src/CairoBackendBase.cs @@ -6,7 +6,8 @@ using Glfw; namespace Crow.CairoBackend { public abstract class CairoBackendBase : IBackend { - protected ISurface surf; + protected IntPtr hWin; + protected Surface surf; /// <summary> Global font rendering settings for Cairo </summary> FontOptions FontRenderingOptions; /// <summary> Global font rendering settings for Cairo </summary> @@ -29,7 +30,7 @@ namespace Crow.CairoBackend public IRegion CreateRegion () => new Region (); public IContext CreateContext (ISurface surf) { - Context gr = new Context (surf); + Context gr = new Context (surf as Surface); gr.FontOptions = FontRenderingOptions; gr.Antialias = Antialias; return gr; @@ -102,7 +103,7 @@ namespace Crow.CairoBackend IContext ctx = existingContext; if (ctx == null) { disposeContextOnFlush = true; - ctx = new Context (MainSurface); + ctx = new Context (surf); } else disposeContextOnFlush = false; return ctx; diff --git a/Backends/CairoBackend/src/Context.cs b/Backends/CairoBackend/src/Context.cs index a4eac7a2..c15ecaa3 100644 --- a/Backends/CairoBackend/src/Context.cs +++ b/Backends/CairoBackend/src/Context.cs @@ -43,7 +43,7 @@ namespace Crow.CairoBackend { public class Context : IContext { - IntPtr handle = IntPtr.Zero; + internal IntPtr handle = IntPtr.Zero; static int native_glyph_size, c_compiler_long_size; @@ -75,12 +75,12 @@ namespace Crow.CairoBackend } } - public Context (ISurface surface) : this (NativeMethods.cairo_create (surface.Handle), true) + internal Context (Surface surface) : this (NativeMethods.cairo_create (surface.handle), true) { } - public Context (IntPtr handle, bool owner) + internal Context (IntPtr handle, bool owner) { this.handle = handle; if (!owner) @@ -90,7 +90,7 @@ namespace Crow.CairoBackend } [Obsolete] - public Context (IntPtr state) : this (state, true) + internal Context (IntPtr state) : this (state, true) { } @@ -144,8 +144,6 @@ namespace Crow.CairoBackend } } - public IntPtr Handle => handle; - public Operator Operator { set => NativeMethods.cairo_set_operator (handle, value); get => NativeMethods.cairo_get_operator (handle); @@ -163,71 +161,29 @@ namespace Crow.CairoBackend get => NativeMethods.cairo_get_line_width (handle); } public LineCap LineCap { - set { - NativeMethods.cairo_set_line_cap (handle, value); - } - - get { - return NativeMethods.cairo_get_line_cap (handle); - } + set => NativeMethods.cairo_set_line_cap (handle, value); + get => NativeMethods.cairo_get_line_cap (handle); } - public LineJoin LineJoin { - set { - NativeMethods.cairo_set_line_join (handle, value); - } - - get { - return NativeMethods.cairo_get_line_join (handle); - } + set => NativeMethods.cairo_set_line_join (handle, value); + get => NativeMethods.cairo_get_line_join (handle); } - - public void SetDash (double [] dashes, double offset = 0) - { - NativeMethods.cairo_set_dash (handle, dashes, dashes.Length, offset); - } - - [Obsolete("Use GetSource/SetSource")] - public Pattern Pattern { - set { - SetSource (value); - } - get { - return GetSource (); - } + public double MiterLimit { + set => NativeMethods.cairo_set_miter_limit (handle, value); + get => NativeMethods.cairo_get_miter_limit (handle); } - //This is obsolete because it wasn't obvious it needed to be disposed - [Obsolete("Use GetSource/SetSource")] - public Pattern Source { - set { - SetSource (value); - } - get { - return GetSource (); - } - } + public void SetDash (double [] dashes, double offset = 0) + => NativeMethods.cairo_set_dash (handle, dashes, dashes.Length, offset); public void SetSource (Pattern source) - { - NativeMethods.cairo_set_source (handle, source.handle); - } - + => NativeMethods.cairo_set_source (handle, source.handle); public Pattern GetSource () { var ptr = NativeMethods.cairo_get_source (handle); return Pattern.Lookup (ptr, false); } - public double MiterLimit { - set { - NativeMethods.cairo_set_miter_limit (handle, value); - } - - get { - return NativeMethods.cairo_get_miter_limit (handle); - } - } public PointD CurrentPoint { get { @@ -237,17 +193,13 @@ namespace Crow.CairoBackend } } - public bool HasCurrentPoint { - get { - return NativeMethods.cairo_has_current_point (handle); - } - } + public bool HasCurrentPoint => NativeMethods.cairo_has_current_point (handle); public Surface GetTarget () => Surface.Lookup (NativeMethods.cairo_get_target (handle), false); public void SetTarget (Surface target) { if (handle != IntPtr.Zero) NativeMethods.cairo_destroy (handle); - handle = NativeMethods.cairo_create (target.Handle); + handle = NativeMethods.cairo_create (target.handle); } public ScaledFont GetScaledFont () => new ScaledFont (NativeMethods.cairo_get_scaled_font (handle), false); @@ -269,17 +221,17 @@ namespace Crow.CairoBackend //[Obsolete ("Use SetSource method (with double parameters)")] public void SetSource (Surface source, int x = 0, int y = 0) { - NativeMethods.cairo_set_source_surface (handle, source.Handle, x, y); + NativeMethods.cairo_set_source_surface (handle, source.handle, x, y); } public void SetSource (Surface source, double x, double y) { - NativeMethods.cairo_set_source_surface (handle, source.Handle, x, y); + NativeMethods.cairo_set_source_surface (handle, source.handle, x, y); } public void SetSource (Surface source) { - NativeMethods.cairo_set_source_surface (handle, source.Handle, 0, 0); + NativeMethods.cairo_set_source_surface (handle, source.handle, 0, 0); } #region Path methods @@ -327,7 +279,7 @@ namespace Crow.CairoBackend public void PaintWithAlpha (double alpha) => NativeMethods.cairo_paint_with_alpha (handle, alpha); public void Mask (Pattern pattern) => NativeMethods.cairo_mask (handle, pattern.handle); public void MaskSurface (Surface surface, double surface_x, double surface_y) - => NativeMethods.cairo_mask_surface (handle, surface.Handle, surface_x, surface_y); + => NativeMethods.cairo_mask_surface (handle, surface.handle, surface_x, surface_y); public void Stroke () => NativeMethods.cairo_stroke (handle); public void StrokePreserve () => NativeMethods.cairo_stroke_preserve (handle); public Rectangle StrokeExtents () @@ -564,21 +516,11 @@ namespace Crow.CairoBackend } public void ShowText(string str) - { - NativeMethods.cairo_show_text (handle, TerminateUtf8 (str)); - } - - + => NativeMethods.cairo_show_text (handle, TerminateUtf8 (str)); public void TextPath(string str) - { - NativeMethods.cairo_text_path (handle, TerminateUtf8(str)); - } - + => NativeMethods.cairo_text_path (handle, TerminateUtf8(str)); public void TextPath(byte[] utf8) - { - NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8)); - } - + => NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8)); public TextExtents TextExtents(string s) { TextExtents extents; @@ -625,7 +567,7 @@ namespace Crow.CairoBackend public void Flush() { - throw new NotImplementedException(); + //throw new NotImplementedException(); } public void Clear() @@ -711,17 +653,15 @@ namespace Crow.CairoBackend { throw new NotImplementedException(); } - public void RenderSvg(IntPtr svgNativeHandle, string subId = null) - { - throw new NotImplementedException(); - } + public void RenderSvg(ISvgHandle svg, string subId = null) + => svg.Render (this, subId); Matrix savedMat; public void SaveTransformations() => NativeMethods.cairo_get_matrix (handle, out savedMat); public void RestoreTransformations() => NativeMethods.cairo_set_matrix (handle, ref savedMat); - public void SetSource(IPattern pat) => NativeMethods.cairo_set_source (handle, pat.Handle); + public void SetSource(IPattern pat) => NativeMethods.cairo_set_source (handle, (pat as Pattern).handle); public void SetSource(ISurface surf, double x = 0, double y = 0) - => NativeMethods.cairo_set_source_surface (handle, surf.Handle, x, y); + => NativeMethods.cairo_set_source_surface (handle, (surf as Surface).handle, x, y); } } diff --git a/Backends/CairoBackend/src/DefaultBackend.cs b/Backends/CairoBackend/src/DefaultBackend.cs index 2adb70a2..7f805063 100644 --- a/Backends/CairoBackend/src/DefaultBackend.cs +++ b/Backends/CairoBackend/src/DefaultBackend.cs @@ -9,8 +9,8 @@ namespace Crow.Backends /// </summary> /// <param name="width">backend surface width</param> /// <param name="height">backend surface height</param> - public DefaultBackend (IntPtr nativeWindoPointer, int width, int height) - : base (nativeWindoPointer, width, height) { } + public DefaultBackend (ref IntPtr nativeWindoPointer, out bool ownGlfwWinHandle, int width, int height) + : base (ref nativeWindoPointer, out ownGlfwWinHandle, width, height) { } public DefaultBackend (int width, int height) : base (width, height) { } diff --git a/Backends/CairoBackend/src/EglBackend.cs b/Backends/CairoBackend/src/EglBackend.cs index 51318a39..38f13a2e 100644 --- a/Backends/CairoBackend/src/EglBackend.cs +++ b/Backends/CairoBackend/src/EglBackend.cs @@ -6,15 +6,33 @@ using Glfw; namespace Crow.CairoBackend { public class EglBackend : CairoBackendBase { - IntPtr hWin; EGLDevice device; /// <summary> /// Create a new generic backend bound to the application surface /// </summary> /// <param name="width">backend surface width</param> /// <param name="height">backend surface height</param> - public EglBackend (IntPtr nativeWindoPointer, int width, int height) : base () { - hWin = nativeWindoPointer; + public EglBackend (ref IntPtr nativeWindoPointer, out bool ownGlfwWinHandle, int width, int height) : base () { + if (nativeWindoPointer == IntPtr.Zero) { + Glfw3.Init (); + Glfw3.WindowHint (WindowAttribute.ClientApi, Constants.OpenglEsApi); + Glfw3.WindowHint (WindowAttribute.ContextVersionMajor, 3); + Glfw3.WindowHint (WindowAttribute.ContextVersionMinor, 2); + Glfw3.WindowHint (WindowAttribute.ContextCreationApi, Constants.EglContextApi); + Glfw3.WindowHint (WindowAttribute.Resizable, 1); + Glfw3.WindowHint (WindowAttribute.Decorated, 1); + + hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero); + if (hWin == IntPtr.Zero) + throw new Exception ("[GLFW3] Unable to create Window"); + + nativeWindoPointer = hWin; + ownGlfwWinHandle = true; + } else { + hWin = nativeWindoPointer; + ownGlfwWinHandle = false; + } + Glfw3.MakeContextCurrent (hWin); Glfw3.SwapInterval (0); diff --git a/Backends/CairoBackend/src/GLSurface.cs b/Backends/CairoBackend/src/GLSurface.cs index 20d5b525..4fa262cc 100644 --- a/Backends/CairoBackend/src/GLSurface.cs +++ b/Backends/CairoBackend/src/GLSurface.cs @@ -89,7 +89,7 @@ namespace Crow.CairoBackend { => NativeMethods.cairo_gl_surface_set_size(handle, width, height); public void SwapBuffers(){ - NativeMethods.cairo_gl_surface_swapbuffers (this.Handle); + NativeMethods.cairo_gl_surface_swapbuffers (this.handle); } } } diff --git a/Backends/CairoBackend/src/ImageBackend.cs b/Backends/CairoBackend/src/ImageBackend.cs index fa9b009e..0181451a 100644 --- a/Backends/CairoBackend/src/ImageBackend.cs +++ b/Backends/CairoBackend/src/ImageBackend.cs @@ -11,7 +11,23 @@ namespace Crow.CairoBackend /// </summary> /// <param name="width">backend surface width</param> /// <param name="height">backend surface height</param> - public ImageBackend (IntPtr nativeWindoPointer, int width, int height) : base () { + public ImageBackend (ref IntPtr nativeWindoPointer, out bool ownGlfwWinHandle, int width, int height) : base () { + if (nativeWindoPointer == IntPtr.Zero) { + Glfw3.Init (); + Glfw3.WindowHint (WindowAttribute.ClientApi, 0); + Glfw3.WindowHint (WindowAttribute.Resizable, 1); + Glfw3.WindowHint (WindowAttribute.Decorated, 1); + + hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero); + if (hWin == IntPtr.Zero) + throw new Exception ("[GLFW3] Unable to create Window"); + + nativeWindoPointer = hWin; + ownGlfwWinHandle = true; + } else { + hWin = nativeWindoPointer; + ownGlfwWinHandle = false; + } switch (Environment.OSVersion.Platform) { case PlatformID.Unix: diff --git a/Backends/CairoBackend/src/ImageSurface.cs b/Backends/CairoBackend/src/ImageSurface.cs index c2e5dec9..2cfec61c 100644 --- a/Backends/CairoBackend/src/ImageSurface.cs +++ b/Backends/CairoBackend/src/ImageSurface.cs @@ -70,12 +70,12 @@ namespace Crow.CairoBackend { { } - public override int Width => NativeMethods.cairo_image_surface_get_width (Handle); - public override int Height => NativeMethods.cairo_image_surface_get_height (Handle); + public override int Width => NativeMethods.cairo_image_surface_get_width (handle); + public override int Height => NativeMethods.cairo_image_surface_get_height (handle); public byte[] Data { get { - IntPtr ptr = NativeMethods.cairo_image_surface_get_data (Handle); + IntPtr ptr = NativeMethods.cairo_image_surface_get_data (handle); int length = Height * Stride; byte[] data = new byte[length]; Marshal.Copy (ptr, data, 0, length); @@ -85,16 +85,16 @@ namespace Crow.CairoBackend { public IntPtr DataPtr { get { - return NativeMethods.cairo_image_surface_get_data (Handle); + return NativeMethods.cairo_image_surface_get_data (handle); } } public Format Format { - get { return NativeMethods.cairo_image_surface_get_format (Handle); } + get { return NativeMethods.cairo_image_surface_get_format (handle); } } public int Stride { - get { return NativeMethods.cairo_image_surface_get_stride (Handle); } + get { return NativeMethods.cairo_image_surface_get_stride (handle); } } } } diff --git a/Backends/CairoBackend/src/PSSurface.cs b/Backends/CairoBackend/src/PSSurface.cs index fadb1b2e..695b05de 100644 --- a/Backends/CairoBackend/src/PSSurface.cs +++ b/Backends/CairoBackend/src/PSSurface.cs @@ -43,22 +43,22 @@ namespace Crow.CairoBackend { public void BeginPageSetup () { - NativeMethods.cairo_ps_surface_dsc_begin_page_setup (Handle); + NativeMethods.cairo_ps_surface_dsc_begin_page_setup (handle); } public void BeginSetup () { - NativeMethods.cairo_ps_surface_dsc_begin_setup (Handle); + NativeMethods.cairo_ps_surface_dsc_begin_setup (handle); } public void DscComment (string comment) { - NativeMethods.cairo_ps_surface_dsc_comment (Handle, comment); + NativeMethods.cairo_ps_surface_dsc_comment (handle, comment); } public void SetSize (double width, double height) { - NativeMethods.cairo_ps_surface_set_size (Handle, width, height); + NativeMethods.cairo_ps_surface_set_size (handle, width, height); } } } diff --git a/Backends/CairoBackend/src/Pattern.cs b/Backends/CairoBackend/src/Pattern.cs index 137f67fe..3de491ec 100644 --- a/Backends/CairoBackend/src/Pattern.cs +++ b/Backends/CairoBackend/src/Pattern.cs @@ -35,7 +35,6 @@ namespace Crow.CairoBackend public class Pattern : IPattern { internal IntPtr handle; - public IntPtr Handle => handle; public static Pattern Lookup (IntPtr pattern, bool owner) { if (pattern == IntPtr.Zero) @@ -67,7 +66,7 @@ namespace Crow.CairoBackend [Obsolete ("Use the SurfacePattern constructor")] public Pattern (Surface surface) - : this ( NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true) + : this ( NativeMethods.cairo_pattern_create_for_surface (surface.handle), true) { } diff --git a/Backends/CairoBackend/src/PdfSurface.cs b/Backends/CairoBackend/src/PdfSurface.cs index 676b596b..061eaa4f 100644 --- a/Backends/CairoBackend/src/PdfSurface.cs +++ b/Backends/CairoBackend/src/PdfSurface.cs @@ -43,7 +43,7 @@ namespace Crow.CairoBackend { public void SetSize (double width, double height) { - NativeMethods.cairo_pdf_surface_set_size (Handle, width, height); + NativeMethods.cairo_pdf_surface_set_size (handle, width, height); } } } diff --git a/Backends/CairoBackend/src/Surface.cs b/Backends/CairoBackend/src/Surface.cs index b09ff5e9..80435b5e 100644 --- a/Backends/CairoBackend/src/Surface.cs +++ b/Backends/CairoBackend/src/Surface.cs @@ -40,7 +40,7 @@ namespace Crow.CairoBackend { public class Surface : ISurface { - protected IntPtr handle = IntPtr.Zero; + internal IntPtr handle = IntPtr.Zero; protected Surface() { @@ -112,7 +112,7 @@ namespace Crow.CairoBackend { public ISurface CreateSimilar (int width, int height) { IntPtr p = NativeMethods.cairo_surface_create_similar ( - this.Handle, Content.ColorAlpha, width, height); + this.handle, Content.ColorAlpha, width, height); return Surface.Lookup(p, true); } @@ -156,22 +156,15 @@ namespace Crow.CairoBackend { public void MarkDirty () { - NativeMethods.cairo_surface_mark_dirty (Handle); + NativeMethods.cairo_surface_mark_dirty (handle); } public void MarkDirty (Rectangle rectangle) { - NativeMethods.cairo_surface_mark_dirty_rectangle (Handle, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); + NativeMethods.cairo_surface_mark_dirty_rectangle (handle, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } 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 { - return handle; - } - } - public PointD DeviceOffset { get { double x, y; diff --git a/Backends/CairoBackend/src/SurfacePattern.cs b/Backends/CairoBackend/src/SurfacePattern.cs index 83b98a8c..85a31348 100644 --- a/Backends/CairoBackend/src/SurfacePattern.cs +++ b/Backends/CairoBackend/src/SurfacePattern.cs @@ -39,7 +39,7 @@ namespace Crow.CairoBackend { } public SurfacePattern (Surface surface) - : base (NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true) + : base (NativeMethods.cairo_pattern_create_for_surface (surface.handle), true) { } diff --git a/Backends/CairoBackend/src/SvgSurface.cs b/Backends/CairoBackend/src/SvgSurface.cs index 3eca6682..d6d53c33 100644 --- a/Backends/CairoBackend/src/SvgSurface.cs +++ b/Backends/CairoBackend/src/SvgSurface.cs @@ -43,7 +43,7 @@ namespace Crow.CairoBackend { public void RestrictToVersion (SvgVersion version) { - NativeMethods.cairo_svg_surface_restrict_to_version (Handle, version); + NativeMethods.cairo_svg_surface_restrict_to_version (handle, version); } } } diff --git a/Backends/CairoBackend/src/XcbSurface.cs b/Backends/CairoBackend/src/XcbSurface.cs index bb198a71..ed557d0c 100644 --- a/Backends/CairoBackend/src/XcbSurface.cs +++ b/Backends/CairoBackend/src/XcbSurface.cs @@ -47,7 +47,7 @@ namespace Crow.CairoBackend { } public override void Resize (int width, int height) { - NativeMethods.cairo_xcb_surface_set_size (Handle, width, height); + NativeMethods.cairo_xcb_surface_set_size (handle, width, height); } } } diff --git a/Backends/CairoBackend/src/XlibSurface.cs b/Backends/CairoBackend/src/XlibSurface.cs index df4b2619..6aea448b 100644 --- a/Backends/CairoBackend/src/XlibSurface.cs +++ b/Backends/CairoBackend/src/XlibSurface.cs @@ -57,21 +57,21 @@ namespace Crow.CairoBackend { public void SetDrawable (IntPtr drawable, int width, int height) { - NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height); + NativeMethods.cairo_xlib_surface_set_drawable (handle, drawable, width, height); } public override void Resize (int width, int height) { - NativeMethods.cairo_xlib_surface_set_size (Handle, width, height); + NativeMethods.cairo_xlib_surface_set_size (handle, width, height); } - public int Depth => NativeMethods.cairo_xlib_surface_get_depth (Handle); - public IntPtr Display => NativeMethods.cairo_xlib_surface_get_display (Handle); - public IntPtr Drawable => NativeMethods.cairo_xlib_surface_get_drawable (Handle); - public override int Width => NativeMethods.cairo_xlib_surface_get_width (Handle); - public override int Height => NativeMethods.cairo_xlib_surface_get_height (Handle); + public int Depth => NativeMethods.cairo_xlib_surface_get_depth (handle); + public IntPtr Display => NativeMethods.cairo_xlib_surface_get_display (handle); + public IntPtr Drawable => NativeMethods.cairo_xlib_surface_get_drawable (handle); + public override int Width => NativeMethods.cairo_xlib_surface_get_width (handle); + public override int Height => NativeMethods.cairo_xlib_surface_get_height (handle); - public IntPtr Screen => NativeMethods.cairo_xlib_surface_get_screen (Handle); - public IntPtr Visual=> NativeMethods.cairo_xlib_surface_get_visual (Handle); + public IntPtr Screen => NativeMethods.cairo_xlib_surface_get_screen (handle); + public IntPtr Visual=> NativeMethods.cairo_xlib_surface_get_visual (handle); } } diff --git a/Backends/CairoBackend/src/rsvg/SvgHandle.cs b/Backends/CairoBackend/src/rsvg/SvgHandle.cs index 6db657fd..e767ce3a 100644 --- a/Backends/CairoBackend/src/rsvg/SvgHandle.cs +++ b/Backends/CairoBackend/src/rsvg/SvgHandle.cs @@ -59,10 +59,10 @@ namespace Crow.CairoBackend { public void Render(IContext cr) => - rsvg_handle_render_cairo (Raw, cr == null ? IntPtr.Zero : cr.Handle); + rsvg_handle_render_cairo (Raw, cr == null ? IntPtr.Zero : (cr as Context).handle); public void Render (IContext cr, string id) => - rsvg_handle_render_cairo_sub (Raw, cr == null ? IntPtr.Zero : cr.Handle, id); + rsvg_handle_render_cairo_sub (Raw, cr == null ? IntPtr.Zero : (cr as Context).handle, id); [StructLayout(LayoutKind.Sequential)] struct DimensionData { |