--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="src\**\*.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\Drawing2D\Drawing2D.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+//
+// Cairo.cs - a simplistic binding of the Cairo API to C#.
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+// Copyright (C) 2006 Alp Toker
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing
+{
+ public static class CairoAPI {
+ static public int Version {
+ get {
+ return NativeMethods.cairo_version ();
+ }
+ }
+
+ static public string VersionString {
+ get {
+ IntPtr x = NativeMethods.cairo_version_string ();
+ return Marshal.PtrToStringAnsi (x);
+ }
+ }
+ }
+}
--- /dev/null
+//
+// CairoDebug.cs
+//
+// Author:
+// Michael Hutchinson (mhutch@xamarin.com)
+//
+// Copyright (C) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ static class CairoDebug
+ {
+ static System.Collections.Generic.Dictionary<IntPtr,string> traces;
+
+ public static readonly bool Enabled;
+
+ static CairoDebug ()
+ {
+ var dbg = Environment.GetEnvironmentVariable ("MONO_CAIRO_DEBUG_DISPOSE");
+ if (dbg == null)
+ return;
+ Enabled = true;
+ traces = new System.Collections.Generic.Dictionary<IntPtr,string> ();
+ }
+
+ public static void OnAllocated (IntPtr obj)
+ {
+ if (!Enabled)
+ throw new InvalidOperationException ();
+
+ traces[obj] = Environment.StackTrace;
+ }
+
+ public static void OnDisposed<T> (IntPtr obj, bool disposing)
+ {
+ if (disposing && !Enabled)
+ throw new InvalidOperationException ();
+
+ if (Environment.HasShutdownStarted)
+ return;
+
+ if (!disposing) {
+ System.Diagnostics.Debug.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
+ if (Enabled) {
+ string val;
+ if (traces.TryGetValue (obj, out val)) {
+ System.Diagnostics.Debug.WriteLine ("Allocated from:");
+ System.Diagnostics.Debug.WriteLine (val);
+ }
+ } else {
+ System.Diagnostics.Debug.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
+ }
+ }
+
+ if (Enabled)
+ traces.Remove (obj);
+ }
+ }
+
+}
--- /dev/null
+//
+// Mono.Cairo.Content.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+ //[Flags]
+ public enum Content
+ {
+ Color = 0x1000,
+ Alpha = 0x2000,
+ ColorAlpha = 0x3000,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using Drawing2D;
+
+namespace Crow.Drawing {
+
+ [Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")]
+ public class Graphics : Context {
+ public Graphics (IntPtr state) : base (state) {}
+ public Graphics (Surface surface) : base (surface) {}
+ }
+
+ public class Context : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
+ static int native_glyph_size, c_compiler_long_size;
+
+ static Context ()
+ {
+ //
+ // This is used to determine what kind of structure
+ // we should use to marshal Glyphs, as the public
+ // definition in Cairo uses `long', which can be
+ // 32 bits or 64 bits depending on the platform.
+ //
+ // We assume that sizeof(long) == sizeof(void*)
+ // except in the case of Win64 where sizeof(long)
+ // is 32 bits
+ //
+ int ptr_size = Marshal.SizeOf (typeof (IntPtr));
+
+ PlatformID platform = Environment.OSVersion.Platform;
+ if (platform == PlatformID.Win32NT ||
+ platform == PlatformID.Win32S ||
+ platform == PlatformID.Win32Windows ||
+ platform == PlatformID.WinCE ||
+ ptr_size == 4){
+ c_compiler_long_size = 4;
+ native_glyph_size = Marshal.SizeOf (typeof (NativeGlyph_4byte_longs));
+ } else {
+ c_compiler_long_size = 8;
+ native_glyph_size = Marshal.SizeOf (typeof (Glyph));
+ }
+ }
+
+ public Context (Surface surface) : this (NativeMethods.cairo_create (surface.Handle), true)
+ {
+ }
+
+
+ public Context (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ [Obsolete]
+ public Context (IntPtr state) : this (state, true)
+ {
+ }
+
+ ~Context ()
+ {
+ Dispose (false);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Context> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_destroy (handle);
+ handle = IntPtr.Zero;
+
+ }
+
+ public void Save ()
+ {
+ NativeMethods.cairo_save (handle);
+ }
+
+ public void Restore ()
+ {
+ NativeMethods.cairo_restore (handle);
+ }
+
+ public Antialias Antialias {
+ get { return NativeMethods.cairo_get_antialias (handle); }
+ set { NativeMethods.cairo_set_antialias (handle, value); }
+ }
+
+ public Status Status {
+ get {
+ return NativeMethods.cairo_status (handle);
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public Operator Operator {
+ set {
+ NativeMethods.cairo_set_operator (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_operator (handle);
+ }
+ }
+
+ public double Tolerance {
+ get {
+ return NativeMethods.cairo_get_tolerance (handle);
+ }
+
+ set {
+ NativeMethods.cairo_set_tolerance (handle, value);
+ }
+ }
+
+ public FillRule FillRule {
+ set {
+ NativeMethods.cairo_set_fill_rule (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_fill_rule (handle);
+ }
+ }
+
+ public double LineWidth {
+ set {
+ NativeMethods.cairo_set_line_width (handle, value);
+ }
+
+ get {
+ return 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);
+ }
+ }
+
+ public LineJoin LineJoin {
+ set {
+ NativeMethods.cairo_set_line_join (handle, value);
+ }
+
+ get {
+ return 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 ();
+ }
+ }
+
+ //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 SetSource (Pattern source)
+ {
+ 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 {
+ double x, y;
+ NativeMethods.cairo_get_current_point (handle, out x, out y);
+ return new PointD (x, y);
+ }
+ }
+
+ public bool HasCurrentPoint {
+ get {
+ return NativeMethods.cairo_has_current_point (handle);
+ }
+ }
+
+ [Obsolete ("Use GetTarget/SetTarget")]
+ public Surface Target {
+ set {
+ if (handle != IntPtr.Zero)
+ NativeMethods.cairo_destroy (handle);
+
+ handle = NativeMethods.cairo_create (value.Handle);
+ }
+
+ get {
+ return GetTarget ();
+ }
+ }
+
+ public Surface GetTarget ()
+ {
+ return 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);
+ }
+
+ [Obsolete("Use GetScaledFont/SetScaledFont")]
+ public ScaledFont ScaledFont {
+ set {
+ SetScaledFont (value);
+ }
+
+ get {
+ return GetScaledFont ();
+ }
+ }
+
+ public ScaledFont GetScaledFont ()
+ {
+ return new ScaledFont (NativeMethods.cairo_get_scaled_font (handle), false);
+ }
+
+ public void SetScaledFont (ScaledFont font)
+ {
+ NativeMethods.cairo_set_scaled_font (handle, font.Handle);
+ }
+
+ public uint ReferenceCount {
+ get { return NativeMethods.cairo_get_reference_count (handle); }
+ }
+
+ public void SetSource (Color color)
+ {
+ NativeMethods.cairo_set_source_rgba (handle, color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
+ }
+
+ public void SetSource (double r, double g, double b)
+ {
+ NativeMethods.cairo_set_source_rgb (handle, r, g, b);
+ }
+
+ public void SetSource (double r, double g, double b, double a)
+ {
+ NativeMethods.cairo_set_source_rgba (handle, r, g, b, a);
+ }
+
+ //[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);
+ }
+
+ public void SetSource (Surface source, double x, double 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);
+ }
+
+#region Path methods
+
+ public void NewPath ()
+ {
+ NativeMethods.cairo_new_path (handle);
+ }
+
+ public void NewSubPath ()
+ {
+ NativeMethods.cairo_new_sub_path (handle);
+ }
+
+ public void MoveTo (PointD p)
+ {
+ MoveTo (p.X, p.Y);
+ }
+
+ public void MoveTo (double x, double y)
+ {
+ NativeMethods.cairo_move_to (handle, x, y);
+ }
+
+ public void LineTo (PointD p)
+ {
+ LineTo (p.X, p.Y);
+ }
+
+ public void LineTo (double x, double y)
+ {
+ NativeMethods.cairo_line_to (handle, x, y);
+ }
+
+ public void CurveTo (PointD p1, PointD p2, PointD p3)
+ {
+ CurveTo (p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
+ }
+
+ public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
+ {
+ NativeMethods.cairo_curve_to (handle, x1, y1, x2, y2, x3, y3);
+ }
+
+ public void RelMoveTo (Distance d)
+ {
+ RelMoveTo (d.Dx, d.Dy);
+ }
+
+ public void RelMoveTo (double dx, double dy)
+ {
+ NativeMethods.cairo_rel_move_to (handle, dx, dy);
+ }
+
+ public void RelLineTo (Distance d)
+ {
+ RelLineTo (d.Dx, d.Dy);
+ }
+
+ public void RelLineTo (double dx, double dy)
+ {
+ NativeMethods.cairo_rel_line_to (handle, dx, dy);
+ }
+
+ public void RelCurveTo (Distance d1, Distance d2, Distance d3)
+ {
+ RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy);
+ }
+
+ public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+ {
+ NativeMethods.cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3);
+ }
+
+ public void Arc (double xc, double yc, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc (handle, xc, yc, radius, angle1, angle2);
+ }
+ public void Arc (PointD center, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc (handle, center.X, center.Y, radius, angle1, angle2);
+ }
+
+ public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc_negative (handle, xc, yc, radius, angle1, angle2);
+ }
+ public void ArcNegative (PointD center, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc_negative (handle, center.X, center.Y, radius, angle1, angle2);
+ }
+
+ public void Rectangle (Rectangle rectangle)
+ {
+ Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+ }
+ public void Rectangle (RectangleD rectangle)
+ {
+ Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+ }
+
+ public void Rectangle (PointD p, double width, double height)
+ {
+ Rectangle (p.X, p.Y, width, height);
+ }
+
+ public void Rectangle (double x, double y, double width, double height)
+ {
+ NativeMethods.cairo_rectangle (handle, x, y, width, height);
+ }
+
+ public void ClosePath ()
+ {
+ NativeMethods.cairo_close_path (handle);
+ }
+
+ public Path CopyPath ()
+ {
+ return new Path (NativeMethods.cairo_copy_path (handle));
+ }
+
+ public Path CopyPathFlat ()
+ {
+ return new Path (NativeMethods.cairo_copy_path_flat (handle));
+ }
+
+ public void AppendPath (Path path)
+ {
+ NativeMethods.cairo_append_path (handle, path.Handle);
+ }
+
+#endregion
+
+#region Painting Methods
+ public void Paint ()
+ {
+ NativeMethods.cairo_paint (handle);
+ }
+
+ 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);
+ }
+
+ public void Stroke ()
+ {
+ NativeMethods.cairo_stroke (handle);
+ }
+
+ public void StrokePreserve ()
+ {
+ NativeMethods.cairo_stroke_preserve (handle);
+ }
+
+ public Rectangle StrokeExtents ()
+ {
+ double x1, y1, x2, y2;
+ NativeMethods.cairo_stroke_extents (handle, out x1, out y1, out x2, out y2);
+ return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
+ }
+
+ public void Fill ()
+ {
+ NativeMethods.cairo_fill (handle);
+ }
+
+ public Rectangle FillExtents ()
+ {
+ double x1, y1, x2, y2;
+ NativeMethods.cairo_fill_extents (handle, out x1, out y1, out x2, out y2);
+ return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
+ }
+
+ public void FillPreserve ()
+ {
+ NativeMethods.cairo_fill_preserve (handle);
+ }
+
+#endregion
+
+ public void Clip ()
+ {
+ NativeMethods.cairo_clip (handle);
+ }
+
+ public void ClipPreserve ()
+ {
+ NativeMethods.cairo_clip_preserve (handle);
+ }
+
+ public void ResetClip ()
+ {
+ NativeMethods.cairo_reset_clip (handle);
+ }
+
+ public bool InClip (double x, double y)
+ {
+ return NativeMethods.cairo_in_clip (handle, x, y);
+ }
+ public RectangleList GetClipRectangles (){
+ return (RectangleList)Marshal.PtrToStructure (NativeMethods.cairo_copy_clip_rectangle_list (handle), typeof(RectangleList));
+ }
+ public void ClipExtendRectangle (){
+ double x1, y1, x2, y2;
+ NativeMethods.cairo_clip_extents (handle, out x1, out y1, out x2, out y2);
+ NativeMethods.cairo_rectangle (handle, x1, y1, x2 - x1, y2 - y1);
+ }
+ public bool InStroke (double x, double y)
+ {
+ return NativeMethods.cairo_in_stroke (handle, x, y);
+ }
+
+ public bool InFill (double x, double y)
+ {
+ return NativeMethods.cairo_in_fill (handle, x, y);
+ }
+
+ public Pattern PopGroup ()
+ {
+ return Pattern.Lookup (NativeMethods.cairo_pop_group (handle), true);
+ }
+
+ public void PopGroupToSource ()
+ {
+ NativeMethods.cairo_pop_group_to_source (handle);
+ }
+
+ public void PushGroup ()
+ {
+ NativeMethods.cairo_push_group (handle);
+ }
+
+ public void PushGroup (Content content)
+ {
+ NativeMethods.cairo_push_group_with_content (handle, content);
+ }
+
+ [Obsolete ("Use GetGroupTarget()")]
+ public Surface GroupTarget {
+ get {
+ return GetGroupTarget ();
+ }
+ }
+
+ public Surface GetGroupTarget ()
+ {
+ IntPtr surface = NativeMethods.cairo_get_group_target (handle);
+ return Surface.Lookup (surface, false);
+ }
+
+ public void Rotate (double angle)
+ {
+ NativeMethods.cairo_rotate (handle, angle);
+ }
+
+ public void Scale (double sx, double sy)
+ {
+ NativeMethods.cairo_scale (handle, sx, sy);
+ }
+
+ public void Translate (double tx, double ty)
+ {
+ NativeMethods.cairo_translate (handle, tx, ty);
+ }
+
+ public void Transform (Matrix m)
+ {
+ NativeMethods.cairo_transform (handle, m);
+ }
+
+ [Obsolete("Use UserToDevice instead")]
+ public void TransformPoint (ref double x, ref double y)
+ {
+ NativeMethods.cairo_user_to_device (handle, ref x, ref y);
+ }
+
+ [Obsolete("Use UserToDeviceDistance instead")]
+ public void TransformDistance (ref double dx, ref double dy)
+ {
+ NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
+ }
+
+ [Obsolete("Use InverseTransformPoint instead")]
+ public void InverseTransformPoint (ref double x, ref double y)
+ {
+ NativeMethods.cairo_device_to_user (handle, ref x, ref y);
+ }
+
+ [Obsolete("Use DeviceToUserDistance instead")]
+ public void InverseTransformDistance (ref double dx, ref double dy)
+ {
+ NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
+ }
+
+ public void UserToDevice (ref double x, ref double y)
+ {
+ NativeMethods.cairo_user_to_device (handle, ref x, ref y);
+ }
+
+ public void UserToDeviceDistance (ref double dx, ref double dy)
+ {
+ NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
+ }
+
+ public void DeviceToUser (ref double x, ref double y)
+ {
+ NativeMethods.cairo_device_to_user (handle, ref x, ref y);
+ }
+
+ public void DeviceToUserDistance (ref double dx, ref double dy)
+ {
+ NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
+ }
+
+ public Matrix Matrix {
+ set {
+ NativeMethods.cairo_set_matrix (handle, value);
+ }
+
+ get {
+ Matrix m = new Matrix();
+ NativeMethods.cairo_get_matrix (handle, m);
+ return m;
+ }
+ }
+
+ public void SetFontSize (double scale)
+ {
+ NativeMethods.cairo_set_font_size (handle, scale);
+ }
+
+ public void IdentityMatrix ()
+ {
+ NativeMethods.cairo_identity_matrix (handle);
+ }
+
+ [Obsolete ("Use SetFontSize() instead.")]
+ public void FontSetSize (double scale)
+ {
+ SetFontSize (scale);
+ }
+
+ [Obsolete ("Use SetFontSize() instead.")]
+ public double FontSize {
+ set { SetFontSize (value); }
+ }
+
+ public Matrix FontMatrix {
+ get {
+ Matrix m;
+ NativeMethods.cairo_get_font_matrix (handle, out m);
+ return m;
+ }
+ set { NativeMethods.cairo_set_font_matrix (handle, value); }
+ }
+
+ public FontOptions FontOptions {
+ get {
+ FontOptions options = new FontOptions ();
+ NativeMethods.cairo_get_font_options (handle, options.Handle);
+ return options;
+ }
+ set { NativeMethods.cairo_set_font_options (handle, value.Handle); }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NativeGlyph_4byte_longs {
+ public int index;
+ public double x;
+ public double y;
+
+ public NativeGlyph_4byte_longs (Glyph source)
+ {
+ index = (int) source.index;
+ x = source.x;
+ y = source.y;
+ }
+ }
+
+ static internal IntPtr FromGlyphToUnManagedMemory(Glyph [] glyphs)
+ {
+ IntPtr dest = Marshal.AllocHGlobal (native_glyph_size * glyphs.Length);
+ long pos = dest.ToInt64();
+
+ if (c_compiler_long_size == 8){
+ foreach (Glyph g in glyphs){
+ Marshal.StructureToPtr (g, (IntPtr)pos, false);
+ pos += native_glyph_size;
+ }
+ } else {
+ foreach (Glyph g in glyphs){
+ NativeGlyph_4byte_longs n = new NativeGlyph_4byte_longs (g);
+
+ Marshal.StructureToPtr (n, (IntPtr)pos, false);
+ pos += native_glyph_size;
+ }
+ }
+
+ return dest;
+ }
+
+ public void ShowGlyphs (Glyph[] glyphs)
+ {
+ IntPtr ptr;
+
+ ptr = FromGlyphToUnManagedMemory (glyphs);
+
+ NativeMethods.cairo_show_glyphs (handle, ptr, glyphs.Length);
+
+ Marshal.FreeHGlobal (ptr);
+ }
+
+ [Obsolete("The matrix argument was never used, use ShowGlyphs(Glyphs []) instead")]
+ public void ShowGlyphs (Matrix matrix, Glyph[] glyphs)
+ {
+ ShowGlyphs (glyphs);
+ }
+
+ [Obsolete("The matrix argument was never used, use GlyphPath(Glyphs []) instead")]
+ public void GlyphPath (Matrix matrix, Glyph[] glyphs)
+ {
+ GlyphPath (glyphs);
+ }
+
+ public void GlyphPath (Glyph[] glyphs)
+ {
+ IntPtr ptr;
+
+ ptr = FromGlyphToUnManagedMemory (glyphs);
+
+ NativeMethods.cairo_glyph_path (handle, ptr, glyphs.Length);
+
+ Marshal.FreeHGlobal (ptr);
+
+ }
+
+ public FontExtents FontExtents {
+ get {
+ FontExtents f_extents;
+ NativeMethods.cairo_font_extents (handle, out f_extents);
+ return f_extents;
+ }
+ }
+
+ public void CopyPage ()
+ {
+ NativeMethods.cairo_copy_page (handle);
+ }
+
+ [Obsolete ("Use SelectFontFace() instead.")]
+ public void FontFace (string family, FontSlant slant, FontWeight weight)
+ {
+ SelectFontFace (family, slant, weight);
+ }
+
+ public void SetContextFontFace (FontFace value)
+ {
+ NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
+ }
+
+ public void SelectFontFace (string family, FontSlant slant, FontWeight weight)
+ {
+ NativeMethods.cairo_select_font_face (handle, family, slant, weight);
+ }
+
+ public void ShowPage ()
+ {
+ NativeMethods.cairo_show_page (handle);
+ }
+
+ private static byte[] TerminateUtf8(byte[] utf8)
+ {
+ if (utf8.Length > 0 && utf8[utf8.Length - 1] == 0)
+ return utf8;
+ var termedArray = new byte[utf8.Length + 1];
+ Array.Copy(utf8, termedArray, utf8.Length);
+ termedArray[utf8.Length] = 0;
+ return termedArray;
+ }
+
+ private static byte[] TerminateUtf8(string s)
+ {
+ // compute the byte count including the trailing \0
+ var byteCount = Encoding.UTF8.GetMaxByteCount(s.Length + 1);
+ var bytes = new byte[byteCount];
+ Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
+ return bytes;
+ }
+
+ public void ShowText(string str)
+ {
+ NativeMethods.cairo_show_text (handle, TerminateUtf8 (str));
+ }
+
+
+ public void TextPath(string str)
+ {
+ NativeMethods.cairo_text_path (handle, TerminateUtf8(str));
+ }
+
+ public void TextPath(byte[] utf8)
+ {
+ NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8));
+ }
+
+ public TextExtents TextExtents(string s)
+ {
+ TextExtents extents;
+ NativeMethods.cairo_text_extents (handle, TerminateUtf8(s), out extents);
+ return extents;
+ }
+ public void ShowText (ReadOnlySpan<char> s, int tabSize) {
+ int size = s.Length * 4 + 1;
+ Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+ int encodedBytes = Text.Encoding.ToUtf8 (s, bytes, tabSize);
+ bytes[encodedBytes] = 0;
+ ShowText (bytes.Slice (0, encodedBytes + 1));
+ }
+ public TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize) {
+ TextExtents (s, tabSize, out TextExtents extents);
+ return extents;
+ }
+ public void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents) {
+ int size = s.Length * 4 + 1;
+ Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+ int encodedBytes = Text.Encoding.ToUtf8 (s, bytes, tabSize);
+ bytes[encodedBytes] = 0;
+ TextExtents (bytes.Slice (0, encodedBytes + 1), out extents);
+ }
+ public void ShowText (Span<byte> bytes) {
+ NativeMethods.cairo_show_text (handle, ref bytes.GetPinnableReference());
+ }
+ public void TextExtents (Span<byte> bytes, out TextExtents extents) {
+ NativeMethods.cairo_text_extents (handle, ref bytes.GetPinnableReference (), out extents);
+ }
+
+ public TextExtents GlyphExtents (Glyph[] glyphs)
+ {
+ IntPtr ptr = FromGlyphToUnManagedMemory (glyphs);
+
+ TextExtents extents;
+
+ NativeMethods.cairo_glyph_extents (handle, ptr, glyphs.Length, out extents);
+
+ Marshal.FreeHGlobal (ptr);
+
+ return extents;
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.Drawing
+{
+ public class DRMDevice : Device
+ {
+ public DRMDevice () : base (NativeMethods.cairo_drm_device_default (), true)
+ {
+ }
+ public DRMDevice (int fd) : base (NativeMethods.cairo_drm_device_get_for_fd (fd), true)
+ {
+ }
+ public DRMDevice (IntPtr udev_device) : base (NativeMethods.cairo_drm_device_get (udev_device), true)
+ {
+ }
+
+ public int FileDescriptor {
+ get { return NativeMethods.cairo_drm_device_get_fd (Handle); }
+ }
+
+ public void DeviceThrottle () { NativeMethods.cairo_drm_device_throttle (Handle);}
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.GLSurface.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class DRMSurface : Surface
+ {
+
+ public DRMSurface (IntPtr ptr, bool own) : base (ptr, own)
+ {}
+
+ public DRMSurface (DRMDevice device, Format format, int width, int height)
+ : base (NativeMethods.cairo_drm_surface_create (device.Handle, format, width, height), true)
+ {}
+
+ public DRMSurface (DRMDevice device, uint name, Format format, int width, int height, int stride)
+ : base (NativeMethods.cairo_drm_surface_create_for_name (device.Handle, name, format, width, height, stride), true)
+ {}
+
+ public DRMSurface (DRMDevice device, IntPtr imageSurface)
+ : base (NativeMethods.cairo_drm_surface_create_from_cacheable_image (device.Handle, imageSurface), true)
+ {}
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.Drawing
+{
+ public class Device : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
+ protected Device()
+ {
+ }
+
+ protected Device (IntPtr ptr) : this (ptr, true)
+ {
+ }
+
+ protected Device (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_device_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ ~Device ()
+ {
+ Dispose (false);
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+ public string Status {
+ get {
+ return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
+ }
+ }
+ public void SetThreadAware (bool value){
+ NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0);
+ }
+ public Status Acquire()
+ {
+ return NativeMethods.cairo_device_acquire (handle);
+ }
+ public void Release()
+ {
+ NativeMethods.cairo_device_release (handle);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Device> (handle, disposing);
+
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_device_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.DirectFBSurface.cs
+//
+// Authors:
+// Alp Toker
+//
+// (C) Alp Toker, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+ public class DirectFBSurface : Surface
+ {
+ internal DirectFBSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public DirectFBSurface (IntPtr dfb, IntPtr dfb_surface)
+ : base (NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface), true)
+ {
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Crow.Drawing {
+
+ public struct Distance
+ {
+ public Distance (double dx, double dy)
+ {
+ this.dx = dx;
+ this.dy = dy;
+ }
+
+ double dx, dy;
+ public double Dx {
+ get { return dx; }
+ set { dx = value; }
+ }
+
+ public double Dy {
+ get { return dy; }
+ set { dy = value; }
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.Drawing
+{
+ public class EGLDevice : Device
+ {
+ public EGLDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
+ {
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Extend.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum Extend
+ {
+ None,
+ Repeat,
+ Reflect,
+ Pad,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FillRule.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum FillRule
+ {
+ Winding,
+ EvenOdd
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Filter.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum Filter
+ {
+ Fast,
+ Good,
+ Best,
+ Nearest,
+ Bilinear,
+ Gaussian,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FontExtents.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+//
+// This is a simplistic binding of the Cairo API to C#. All functions
+// in cairo.h are transcribed into their C# equivelants
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing
+{
+ [StructLayout (LayoutKind.Sequential)]
+ public struct FontExtents
+ {
+ double ascent;
+ double descent;
+ double height;
+ double maxXAdvance;
+ double maxYAdvance;
+
+ public double Ascent {
+ get { return ascent; }
+ set { ascent = value; }
+ }
+
+ public double Descent {
+ get { return descent; }
+ set { descent = value; }
+ }
+
+ public double Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public double MaxXAdvance {
+ get { return maxXAdvance; }
+ set { maxXAdvance = value; }
+ }
+
+ public double MaxYAdvance {
+ get { return maxYAdvance; }
+ set { maxYAdvance = value; }
+ }
+
+ public FontExtents (double ascent, double descent, double height, double maxXAdvance, double maxYAdvance)
+ {
+ this.ascent = ascent;
+ this.descent = descent;
+ this.height = height;
+ this.maxXAdvance = maxXAdvance;
+ this.maxYAdvance = maxYAdvance;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is FontExtents)
+ return this == (FontExtents) obj;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) Ascent ^ (int) Descent ^ (int) Height ^ (int) MaxXAdvance ^ (int) MaxYAdvance;
+ }
+
+ public static bool operator == (FontExtents extents, FontExtents other)
+ {
+ return extents.Ascent == other.Ascent && extents.Descent == other.Descent && extents.Height == other.Height && extents.MaxXAdvance == other.MaxXAdvance && extents.MaxYAdvance == other.MaxYAdvance;
+ }
+
+ public static bool operator != (FontExtents extents, FontExtents other)
+ {
+ return !(extents == other);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FontFace.cs
+//
+// Author:
+// Alp Toker (alp@atoker.com)
+// Miguel de Icaza (miguel@novell.com)
+//
+// (C) Ximian Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.Drawing
+{
+ public class FontFace : IDisposable
+ {
+ IntPtr handle;
+
+ internal static FontFace Lookup (IntPtr handle, bool owner)
+ {
+ if (handle == IntPtr.Zero)
+ return null;
+ return new FontFace (handle, owner);
+ }
+
+ ~FontFace ()
+ {
+ Dispose (false);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<FontFace> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_font_face_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+
+ [Obsolete]
+ public FontFace (IntPtr handle) : this (handle, true)
+ {
+ }
+
+ public FontFace (IntPtr handle, bool owned)
+ {
+ this.handle = handle;
+ if (!owned)
+ NativeMethods.cairo_font_face_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public Status Status {
+ get {
+ return NativeMethods.cairo_font_face_status (handle);
+ }
+ }
+
+ public FontType FontType {
+ get {
+ return NativeMethods.cairo_font_face_get_type (handle);
+ }
+ }
+
+ public uint ReferenceCount {
+ get { return NativeMethods.cairo_font_face_get_reference_count (handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.FontOptions.cs
+//
+// Author:
+// John Luke (john.luke@gmail.com)
+//
+// (C) John Luke 2005.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+ public class FontOptions : IDisposable
+ {
+ IntPtr handle;
+
+ public FontOptions () : this (NativeMethods.cairo_font_options_create ())
+ {
+ }
+
+ ~FontOptions ()
+ {
+ Dispose (false);
+ }
+
+ internal FontOptions (IntPtr handle)
+ {
+ this.handle = handle;
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public FontOptions Copy ()
+ {
+ return new FontOptions (NativeMethods.cairo_font_options_copy (handle));
+ }
+
+ [Obsolete ("Use Dispose()")]
+ public void Destroy ()
+ {
+ Dispose ();
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<FontOptions> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_font_options_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+
+ public static bool operator == (FontOptions options, FontOptions other)
+ {
+ return Equals (options, other);
+ }
+
+ public static bool operator != (FontOptions options, FontOptions other)
+ {
+ return !(options == other);
+ }
+
+ public override bool Equals (object other)
+ {
+ return Equals (other as FontOptions);
+ }
+
+ bool Equals (FontOptions options)
+ {
+ return options != null && NativeMethods.cairo_font_options_equal (Handle, options.Handle);
+ }
+
+ public IntPtr Handle {
+ get { return handle; }
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) NativeMethods.cairo_font_options_hash (handle);
+ }
+
+ public void Merge (FontOptions other)
+ {
+ if (other == null)
+ throw new ArgumentNullException ("other");
+ NativeMethods.cairo_font_options_merge (handle, other.Handle);
+ }
+
+ public Antialias Antialias {
+ get { return NativeMethods.cairo_font_options_get_antialias (handle); }
+ set { NativeMethods.cairo_font_options_set_antialias (handle, value); }
+ }
+
+ public HintMetrics HintMetrics {
+ get { return NativeMethods.cairo_font_options_get_hint_metrics (handle);}
+ set { NativeMethods.cairo_font_options_set_hint_metrics (handle, value); }
+ }
+
+ public HintStyle HintStyle {
+ get { return NativeMethods.cairo_font_options_get_hint_style (handle);}
+ set { NativeMethods.cairo_font_options_set_hint_style (handle, value); }
+ }
+
+ public Status Status {
+ get { return NativeMethods.cairo_font_options_status (handle); }
+ }
+
+ public SubpixelOrder SubpixelOrder {
+ get { return NativeMethods.cairo_font_options_get_subpixel_order (handle);}
+ set { NativeMethods.cairo_font_options_set_subpixel_order (handle, value); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.FontSlant.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum FontSlant
+ {
+ Normal,
+ Italic,
+ Oblique
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FontType.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+
+ public enum FontType
+ {
+ Toy,
+ FreeType,
+ Win32,
+ Atsui,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FontWeight.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum FontWeight
+ {
+ Normal,
+ Bold,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.GLSurface.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class GLSurface : Surface
+ {
+ public GLSurface (IntPtr ptr, bool own) : base (ptr, own)
+ {}
+
+ public GLSurface (Device device, Content content, uint tex, int width, int height)
+ : base (NativeMethods.cairo_gl_surface_create_for_texture (device.Handle, (uint)content, tex, width, height), true)
+ {}
+
+ public GLSurface (EGLDevice device, IntPtr eglSurf, int width, int height)
+ : base (NativeMethods.cairo_gl_surface_create_for_egl (device.Handle, eglSurf, width, height), true)
+ {}
+
+ public GLSurface (GLXDevice device, IntPtr window, int width, int height)
+ : base (NativeMethods.cairo_gl_surface_create_for_window (device.Handle, window, width, height),true)
+ {}
+
+ 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 void SwapBuffers(){
+ NativeMethods.cairo_gl_surface_swapbuffers (this.Handle);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.Drawing
+{
+ public class GLXDevice : Device
+ {
+ public GLXDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_glx_device_create (dpy, gl_ctx), true)
+ {
+ }
+
+ public IntPtr Display {
+ get { return NativeMethods.cairo_glx_device_get_display (Handle); }
+ }
+
+ public IntPtr Context {
+ get { return NativeMethods.cairo_glx_device_get_context (Handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.GlitzSurface.cs
+//
+// Authors:
+// Alp Toker
+//
+// (C) Alp Toker, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+ public class GlitzSurface : Surface
+ {
+ internal GlitzSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public GlitzSurface (IntPtr glitz_surface)
+ : base (NativeMethods.cairo_glitz_surface_create (glitz_surface), true)
+ {
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Glyph.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Glyph
+ {
+ internal long index;
+ internal double x;
+ internal double y;
+
+ public Glyph (long index, double x, double y)
+ {
+ this.index = index;
+ this.x = x;
+ this.y = y;
+ }
+
+ public long Index {
+ get { return index; }
+ set { index = value; }
+ }
+
+ public double X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public double Y {
+ get { return y; }
+ set { y = value; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is Glyph)
+ return this == (Glyph)obj;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) Index ^ (int) X ^ (int) Y;
+ }
+
+ internal static IntPtr GlyphsToIntPtr (Glyph[] glyphs)
+ {
+ int size = Marshal.SizeOf (glyphs[0]);
+ IntPtr dest = Marshal.AllocHGlobal (size * glyphs.Length);
+ long pos = dest.ToInt64 ();
+ for (int i = 0; i < glyphs.Length; i++, pos += size)
+ Marshal.StructureToPtr (glyphs[i], (IntPtr) pos, false);
+ return dest;
+ }
+
+ public static bool operator == (Glyph glyph, Glyph other)
+ {
+ return glyph.Index == other.Index && glyph.X == other.X && glyph.Y == other.Y;
+ }
+
+ public static bool operator != (Glyph glyph, Glyph other)
+ {
+ return !(glyph == other);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Gradient.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Color = Crow.Color;
+namespace Crow.Drawing {
+
+ public class Gradient : Pattern
+ {
+ protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ public int ColorStopCount {
+ get {
+ int cnt;
+ NativeMethods.cairo_pattern_get_color_stop_count (Handle, out cnt);
+ return cnt;
+ }
+ }
+
+ public Status AddColorStop (double offset, Color c)
+ {
+ NativeMethods.cairo_pattern_add_color_stop_rgba (Handle, offset, c.R / 255.0, c.G / 255.0, c.B / 255.0, c.A / 255.0);
+ return Status;
+ }
+
+ public Status AddColorStopRgb (double offset, Color c)
+ {
+ NativeMethods.cairo_pattern_add_color_stop_rgb (Handle, offset, c.R / 255.0, c.G / 255.0 / 255.0, c.B / 255.0);
+ return Status;
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.HintMetrics.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum HintMetrics
+ {
+ Default,
+ Off,
+ On,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.HintStyle.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum HintStyle
+ {
+ Default,
+ None,
+ Slight,
+ Medium,
+ Full,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.ImageSurface.cs
+//
+// Authors:
+// Duncan Mak
+// Miguel de Icaza.
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell, Inc. 2003.
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing {
+
+ public class ImageSurface : Surface
+ {
+ internal ImageSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public ImageSurface (Format format, int width, int height)
+ : base (NativeMethods.cairo_image_surface_create (format, width, height), true)
+ {
+ }
+
+ [Obsolete ("Use ImageSurface (byte[] data, Cairo.Format format, int width, int height, int stride)")]
+ public ImageSurface (ref byte[] data, Format format, int width, int height, int stride)
+ : this (data, format, width, height, stride)
+ {
+ }
+
+ public ImageSurface (byte[] data, Format format, int width, int height, int stride)
+ : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
+ {
+ }
+
+ public ImageSurface (IntPtr data, Format format, int width, int height, int stride)
+ : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
+ {
+ }
+
+ public ImageSurface (string filename)
+ : base (NativeMethods.cairo_image_surface_create_from_png (filename), true)
+ {
+ }
+
+ 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);
+ int length = Height * Stride;
+ byte[] data = new byte[length];
+ Marshal.Copy (ptr, data, 0, length);
+ return data;
+ }
+ }
+
+ public IntPtr DataPtr {
+ get {
+ return NativeMethods.cairo_image_surface_get_data (Handle);
+ }
+ }
+
+ public Format Format {
+ get { return NativeMethods.cairo_image_surface_get_format (Handle); }
+ }
+
+ public int Stride {
+ get { return NativeMethods.cairo_image_surface_get_stride (Handle); }
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.LineCap.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum LineCap
+ {
+ Butt,
+ Round,
+ Square,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.LineJoin.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum LineJoin
+ {
+ Miter,
+ Round,
+ Bevel
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.LinearGradient.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.Drawing {
+
+ public class LinearGradient : Gradient
+ {
+ internal LinearGradient (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ public LinearGradient (double x0, double y0, double x1, double y1)
+ : base (NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1), true)
+ {
+ }
+
+ public PointD[] LinearPoints {
+ get {
+ double x0, y0, x1, y1;
+ PointD[] points = new PointD [2];
+
+ NativeMethods.cairo_pattern_get_linear_points (Handle, out x0, out y0, out x1, out y1);
+
+ points[0] = new PointD (x0, y0);
+ points[1] = new PointD (x1, y1);
+ return points;
+ }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Matrix.cs
+//
+// Author: Duncan Mak
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Idan Gazit (idan@fastmail.fm)
+//
+// (C) Ximian Inc, 2003 - 2005.
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing {
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class Matrix //: ICloneable
+ {
+ public double Xx;
+ public double Yx;
+ public double Xy;
+ public double Yy;
+ public double X0;
+ public double Y0;
+
+ public Matrix (double xx, double yx, double xy, double yy,
+ double x0, double y0)
+ {
+ this.Xx = xx; this.Yx = yx; this.Xy = xy;
+ this.Yy = yy; this.X0 = x0; this.Y0 = y0;
+ }
+
+ public Matrix ()
+ {
+ this.InitIdentity ();
+ }
+
+ public bool IsIdentity ()
+ {
+ return (this == new Matrix ());
+ }
+
+ public void InitIdentity ()
+ {
+ // this.Init(1,0,0,1,0,0);
+ NativeMethods.cairo_matrix_init_identity (this);
+ }
+
+ public void Init (double xx, double yx, double xy, double yy,
+ double x0, double y0)
+ {
+ this.Xx = xx; this.Yx = yx; this.Xy = xy;
+ this.Yy = yy; this.X0 = x0; this.Y0 = y0;
+ }
+
+ public void InitTranslate (double tx, double ty)
+ {
+ //this.Init (1, 0, 0, 1, tx, ty);
+ NativeMethods.cairo_matrix_init_translate (this, tx, ty);
+ }
+
+ public void Translate (double tx, double ty)
+ {
+ NativeMethods.cairo_matrix_translate (this, tx, ty);
+ }
+
+ public void InitScale (double sx, double sy)
+ {
+ //this.Init (sx, 0, 0, sy, 0, 0);
+ NativeMethods.cairo_matrix_init_scale (this, sx, sy);
+ }
+
+ public void Scale (double sx, double sy)
+ {
+ NativeMethods.cairo_matrix_scale (this, sx, sy);
+ }
+
+ public void InitRotate (double radians)
+ {
+ /*
+ double s, c;
+ s = Math.Sin (radians);
+ c = Math.Cos (radians);
+ this.Init (c, s, -s, c, 0, 0);
+ */
+ NativeMethods.cairo_matrix_init_rotate (this, radians);
+ }
+
+ public void Rotate (double radians)
+ {
+ NativeMethods.cairo_matrix_rotate (this, radians);
+ }
+
+ public Status Invert ()
+ {
+ return NativeMethods.cairo_matrix_invert (this);
+ }
+
+ public void Multiply (Matrix b)
+ {
+ Matrix a = (Matrix) this.Clone ();
+ NativeMethods.cairo_matrix_multiply (this, a, b);
+ }
+
+ public static Matrix Multiply (Matrix a, Matrix b) {
+ Matrix result = new Matrix ();
+ NativeMethods.cairo_matrix_multiply (result, a, b);
+ return result;
+ }
+
+
+ public void TransformDistance (ref double dx, ref double dy)
+ {
+ NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref dy);
+ }
+
+ public void TransformPoint (ref double x, ref double y)
+ {
+ NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
+ }
+
+ public override String ToString ()
+ {
+ String s = String.Format ("xx:{0:##0.0#} yx:{1:##0.0#} xy:{2:##0.0#} yy:{3:##0.0#} x0:{4:##0.0#} y0:{5:##0.0#}",
+ this.Xx, this.Yx, this.Xy, this.Yy, this.X0, this.Y0);
+ return s;
+ }
+
+ public static bool operator == (Matrix lhs, Matrix rhs)
+ {
+ return (lhs.Xx == rhs.Xx &&
+ lhs.Xy == rhs.Xy &&
+ lhs.Yx == rhs.Yx &&
+ lhs.Yy == rhs.Yy &&
+ lhs.X0 == rhs.X0 &&
+ lhs.Y0 == rhs.Y0 );
+ }
+
+ public static bool operator != (Matrix lhs, Matrix rhs)
+ {
+ return !(lhs==rhs);
+ }
+
+
+
+ public override bool Equals(object o)
+ {
+ if (! (o is Matrix))
+ return false;
+ else
+ return (this == (Matrix) o);
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)this.Xx ^ (int)this.Xx>>32 ^
+ (int)this.Xy ^ (int)this.Xy>>32 ^
+ (int)this.Yx ^ (int)this.Yx>>32 ^
+ (int)this.Yy ^ (int)this.Yy>>32 ^
+ (int)this.X0 ^ (int)this.X0>>32 ^
+ (int)this.Y0 ^ (int)this.Y0>>32;
+ }
+
+ public object Clone()
+ {
+ return this.MemberwiseClone ();
+ }
+
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.Drawing {
+
+ public class MeshPattern : Pattern
+ {
+ internal MeshPattern (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ public MeshPattern ()
+ : base (NativeMethods.cairo_pattern_create_mesh(), true)
+ {
+ }
+
+ //no idea why this is here, the base one is identical, but we can't remove it now
+ public new Extend Extend {
+ set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_extend (Handle); }
+ }
+
+ public Filter Filter {
+ set { NativeMethods.cairo_pattern_set_filter (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_filter (Handle); }
+ }
+
+ public void BeginPatch(){
+ NativeMethods.cairo_mesh_pattern_begin_patch (Handle);
+ }
+ public void EndPatch(){
+ NativeMethods.cairo_mesh_pattern_end_patch (Handle);
+ }
+ public void MoveTo(double x, double y){
+ NativeMethods.cairo_mesh_pattern_move_to (Handle, x, y);
+ }
+ public void MoveTo (PointD p) {
+ NativeMethods.cairo_mesh_pattern_move_to (Handle, p.X, p.Y);
+ }
+ public void LineTo(double x, double y){
+ NativeMethods.cairo_mesh_pattern_line_to (Handle, x, y);
+ }
+ public void LineTo (PointD p) {
+ NativeMethods.cairo_mesh_pattern_line_to (Handle, p.X, p.Y);
+ }
+ public void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
+ {
+ NativeMethods.cairo_mesh_pattern_curve_to (Handle, x1, y1, x2, y2, x3, y3);
+ }
+ public void SetControlPoint(uint point_num, double x, double y){
+ NativeMethods.cairo_mesh_pattern_set_control_point (Handle, point_num, x, y);
+ }
+ public void SetControlPoint (uint point_num, PointD p) {
+ NativeMethods.cairo_mesh_pattern_set_control_point (Handle, point_num, p.X, p.Y);
+ }
+ public void SetCornerColorRGB(uint corner_num, double r, double g, double b){
+ NativeMethods.cairo_mesh_pattern_set_corner_color_rgb (Handle, corner_num, r, g, b);
+ }
+ public void SetCornerColorRGBA(uint corner_num, double r, double g, double b, double a){
+ NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (Handle, corner_num, r, g, b, a);
+ }
+ public void SetCornerColor (uint corner_num, Color c) {
+ NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (Handle, corner_num, c.R, c.G, c.B, c.A);
+ }
+ public uint PatchCount {
+ get {
+ uint count = 0;
+ NativeMethods.cairo_mesh_pattern_get_patch_count(Handle, out count);
+ return count;
+ }
+ }
+ public Path GetPath(uint patch_num){
+ return new Path(NativeMethods.cairo_mesh_pattern_get_path(Handle, patch_num));
+ }
+ public PointD GetControlPoint(uint point_num, uint patch_num = 0) {
+ NativeMethods.cairo_mesh_pattern_get_control_point (Handle, patch_num, point_num, out double x, out double y);
+ return new PointD (x, y);
+ }
+ public void GetCornerColorRGBA(){
+
+ }
+ }
+}
+
--- /dev/null
+//
+// Cairo.cs - a simplistic binding of the Cairo API to C#.
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+// Copyright (C) 2006 Alp Toker
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Cairo
+{
+ // sort the functions like in the following page so it is easier to find what is missing
+ // http://cairographics.org/manual/index-all.html
+
+ public static class NativeMethods
+ {
+ #if MONOTOUCH
+ const string cairo = "__Internal";
+ #else
+ const string cairo = "libcairo-2.dll";
+ #endif
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern void cairo_append_path (IntPtr cr, Path path);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+ // [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ // public static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_clip (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_clip_preserve (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_close_path (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_copy_page (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_copy_path (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_copy_path_flat (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_create (IntPtr target);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_debug_reset_static_data ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_destroy (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_fill (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_fill_preserve (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
+
+ #region FontFace
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_face_destroy (IntPtr font_face);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern FontType cairo_font_face_get_type (IntPtr font_face);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern void cairo_font_face_get_user_data (IntPtr font_face);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern void cairo_font_face_set_user_data (IntPtr font_face);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_font_face_reference (IntPtr font_face);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_font_face_status (IntPtr font_face);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern uint cairo_font_face_get_reference_count (IntPtr surface);
+ #endregion
+
+ #region FontOptions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_font_options_copy (IntPtr original);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_font_options_create ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_options_destroy (IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Antialias cairo_font_options_get_antialias (IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern long cairo_font_options_hash (IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_font_options_status (IntPtr options);
+ #endregion
+
+ #region Freetype / FontConfig
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Antialias cairo_get_antialias (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern FillRule cairo_get_fill_rule (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_get_font_face (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_get_group_target (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern LineCap cairo_get_line_cap (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern LineJoin cairo_get_line_join (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern double cairo_get_line_width (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_get_matrix (IntPtr cr, Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern double cairo_get_miter_limit (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Operator cairo_get_operator (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern uint cairo_get_reference_count (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_get_source (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_get_target (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern double cairo_get_tolerance (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ [return: MarshalAs (UnmanagedType.U1)]
+ public static extern bool cairo_has_current_point (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_identity_matrix (IntPtr cr);
+
+ #region Image Surface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_image_surface_create (Cairo.Format format, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ public static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Cairo.Format format, int width, int height, int stride);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_image_surface_create_from_png (string filename);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern IntPtr cairo_image_surface_create_from_png_stream (string filename);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Format cairo_image_surface_get_format (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_image_surface_get_height (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_image_surface_get_stride (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_image_surface_get_width (IntPtr surface);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ [return: MarshalAs (UnmanagedType.U1)]
+ public static extern bool cairo_in_clip (IntPtr cr, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ [return: MarshalAs (UnmanagedType.U1)]
+ public static extern bool cairo_in_fill (IntPtr cr, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ [return: MarshalAs (UnmanagedType.U1)]
+ public static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_line_to (IntPtr cr, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_mask (IntPtr cr, IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+ #region Matrix
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_init_identity (Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_matrix_invert (Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_rotate (Matrix matrix, double radians);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_move_to (IntPtr cr, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_new_path (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_new_sub_path (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_paint (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_path_destroy (IntPtr path);
+
+ #region Pattern
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_destroy (IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Extend cairo_pattern_get_extend (IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Filter cairo_pattern_get_filter (IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern PatternType cairo_pattern_get_type (IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pattern_reference (IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_pattern_status (IntPtr pattern);
+ #endregion
+
+ #region PdfSurface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
+ #endregion
+
+ #region PostscriptSurface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_pop_group (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_pop_group_to_source (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_push_group (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_push_group_with_content (IntPtr cr, Content content);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_reference (IntPtr cr);
+
+ #region Regions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_region_copy (IntPtr original);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_region_create ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_region_create_rectangle (ref Crow.Rectangle rect);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_region_destroy (IntPtr region);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern bool cairo_region_equal (IntPtr a, IntPtr b);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_region_get_extents (IntPtr region, out Crow.Rectangle extents);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern bool cairo_region_is_empty (IntPtr region);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_region_num_rectangles (IntPtr region);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_region_reference (IntPtr region);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_status (IntPtr region);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_region_translate (IntPtr region, int dx, int dy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_union (IntPtr dst, IntPtr other);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_union_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_reset_clip (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_restore (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_rotate (IntPtr cr, double angle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_save (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_scale (IntPtr cr, double sx, double sy);
+
+ #region ScaledFont
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_scaled_font_status (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_get_scaled_font (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ public static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ public static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_get_dash_count (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_fill_rule (IntPtr cr, Cairo.FillRule fill_rule);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ public static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_font_size (IntPtr cr, double size);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_line_width (IntPtr cr, double width);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_matrix (IntPtr cr, Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_miter_limit (IntPtr cr, double limit);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_operator (IntPtr cr, Cairo.Operator op);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_show_page (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_show_text (IntPtr cr, string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_status (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_status_to_string (Status status);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_stroke (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_stroke_preserve (IntPtr cr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
+
+ #region Surface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_surface_create_similar (IntPtr surface, Cairo.Content content, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_destroy (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_finish (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_flush (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Content cairo_surface_get_content (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern uint cairo_surface_get_reference_count (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern SurfaceType cairo_surface_get_type (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_mark_dirty (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_surface_reference (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_surface_status (IntPtr surface);
+ #endregion
+
+ #region SVG surface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
+
+ //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ //public static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_text_extents (IntPtr cr, string txt, out TextExtents extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ public static extern void cairo_text_path (IntPtr ct, byte[] utf8);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_transform (IntPtr cr, Matrix matrix);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_translate (IntPtr cr, double tx, double ty);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_version ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_version_string ();
+
+ #region DirectFBSurface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
+ #endregion
+
+ #region win32 fonts
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
+ #endregion
+
+ #region win32 surface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
+ #endregion
+
+ #region XcbSurface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
+ #endregion
+
+ #region XlibSurface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_xlib_surface_get_depth (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_xlib_surface_get_height (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_xlib_surface_get_width (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
+ #endregion
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
+
+ #region GLSurface
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_gl_surface_get_width (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_gl_surface_get_height (IntPtr surface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
+ #endregion
+
+ #region GLX Functions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_glx_device_get_display (IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_glx_device_get_context (IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
+ #endregion
+
+ #region WGL Fucntions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
+ #endregion
+
+ #region EGL Functions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
+ #endregion
+
+ #region DRM Functions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_device_get_for_fd (int fd);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_device_default ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_drm_device_throttle (IntPtr cairo_device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format, int width, int height);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format, int width, int height, int stride);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_drm_surface_unmap (IntPtr drmSurface, IntPtr imageSurface);
+ #endregion
+
+ #region Device
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_device_acquire(IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_device_destroy (IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern IntPtr cairo_device_reference (IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void cairo_device_release(IntPtr device);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern Status cairo_device_status(IntPtr device);
+ #endregion
+
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+ public static extern void crow_cairo_region_clear(IntPtr ctx, IntPtr reg);
+
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// Cairo.cs - a simplistic binding of the Cairo API to C#.
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+// Copyright (C) 2006 Alp Toker
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.Drawing
+{
+ // sort the functions like in the following page so it is easier to find what is missing
+ // http://cairographics.org/manual/index-all.html
+
+ internal static class NativeMethods
+ {
+#if MONOTOUCH
+ const string cairo = "__Internal";
+#else
+ const string cairo = "cairo";
+#endif
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern void cairo_append_path (IntPtr cr, Path path);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_clip (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_clip_preserve (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_close_path (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_copy_page (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_copy_path (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_copy_path_flat (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_create (IntPtr target);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_debug_reset_static_data ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_destroy (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_fill (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_fill_preserve (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
+
+ #region FontFace
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_face_destroy (IntPtr font_face);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern FontType cairo_font_face_get_type (IntPtr font_face);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern void cairo_font_face_get_user_data (IntPtr font_face);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern void cairo_font_face_set_user_data (IntPtr font_face);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_font_face_reference (IntPtr font_face);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_font_face_status (IntPtr font_face);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern uint cairo_font_face_get_reference_count (IntPtr surface);
+ #endregion
+
+ #region FontOptions
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_font_options_copy (IntPtr original);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_font_options_create ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_options_destroy (IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ [return: MarshalAs (UnmanagedType.U1)]
+ internal static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Antialias cairo_font_options_get_antialias (IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern long cairo_font_options_hash (IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_font_options_status (IntPtr options);
+ #endregion
+
+ #region Freetype / FontConfig
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Antialias cairo_get_antialias (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern FillRule cairo_get_fill_rule (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_get_font_face (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_get_group_target (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern LineCap cairo_get_line_cap (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern LineJoin cairo_get_line_join (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern double cairo_get_line_width (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_get_matrix (IntPtr cr, Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern double cairo_get_miter_limit (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Operator cairo_get_operator (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern uint cairo_get_reference_count (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_get_source (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_get_target (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern double cairo_get_tolerance (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ [return: MarshalAs (UnmanagedType.U1)]
+ internal static extern bool cairo_has_current_point (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_identity_matrix (IntPtr cr);
+
+ #region Image Surface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_create (Format format, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Format format, int width, int height, int stride);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Format format, int width, int height, int stride);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_create_from_png (string filename);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern IntPtr cairo_image_surface_create_from_png_stream (string filename);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Format cairo_image_surface_get_format (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_image_surface_get_height (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_image_surface_get_stride (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_image_surface_get_width (IntPtr surface);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ [return: MarshalAs (UnmanagedType.U1)]
+ internal static extern bool cairo_in_clip (IntPtr cr, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ [return: MarshalAs (UnmanagedType.U1)]
+ internal static extern bool cairo_in_fill (IntPtr cr, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ [return: MarshalAs (UnmanagedType.U1)]
+ internal static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_line_to (IntPtr cr, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mask (IntPtr cr, IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+ #region Matrix
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_init_identity (Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_matrix_invert (Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_rotate (Matrix matrix, double radians);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_move_to (IntPtr cr, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_new_path (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_new_sub_path (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_paint (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_path_destroy (IntPtr path);
+
+ #region Pattern
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_destroy (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Extend cairo_pattern_get_extend (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Filter cairo_pattern_get_filter (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern PatternType cairo_pattern_get_type (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_reference (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_pattern_status (IntPtr pattern);
+
+ //mesh pattern
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pattern_create_mesh ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_begin_patch (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_end_patch (IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_move_to (IntPtr pattern, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_line_to (IntPtr pattern, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_curve_to (IntPtr pattern, double x1, double y1,
+ double x2, double y2, double x3, double y3);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_set_control_point (IntPtr pattern, uint point_num, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_set_corner_color_rgb (IntPtr pattern, uint corner_num,
+ double r, double g, double b);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_mesh_pattern_set_corner_color_rgba (IntPtr pattern, uint corner_num,
+ double r, double g, double b, double a);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_mesh_pattern_get_patch_count (IntPtr pattern, out uint count);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_mesh_pattern_get_path (IntPtr pattern, uint patch_num);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_mesh_pattern_get_control_point (IntPtr pattern,
+ uint patch_num, uint point_num, out double x, out double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_mesh_pattern_get_corner_color_rgba (IntPtr pattern,
+ uint patch_num, uint point_num, out double r, out double g, out double b, out double a);
+ #endregion
+
+ #region PdfSurface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
+ #endregion
+
+ #region PostscriptSurface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_pop_group (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_pop_group_to_source (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_push_group (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_push_group_with_content (IntPtr cr, Content content);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_reference (IntPtr cr);
+
+ #region Regions
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_copy (IntPtr original);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create_rectangle (ref Rectangle rect);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_destroy (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool cairo_region_equal (IntPtr a, IntPtr b);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_get_extents (IntPtr region, out Rectangle extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool cairo_region_is_empty (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_region_num_rectangles (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_reference (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_status (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_translate (IntPtr region, int dx, int dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_union (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_union_rectangle (IntPtr dst, ref Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Rectangle rectangle);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_reset_clip (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_restore (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_rotate (IntPtr cr, double angle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_save (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_scale (IntPtr cr, double sx, double sy);
+
+ #region ScaledFont
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_scaled_font_status (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_get_scaled_font (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_get_dash_count (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_fill_rule (IntPtr cr, FillRule fill_rule);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_font_size (IntPtr cr, double size);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_line_width (IntPtr cr, double width);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_matrix (IntPtr cr, Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_miter_limit (IntPtr cr, double limit);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_operator (IntPtr cr, Operator op);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_show_page (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_status (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_status_to_string (Status status);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_stroke (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_stroke_preserve (IntPtr cr);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
+
+ #region Surface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_surface_create_similar (IntPtr surface, Content content, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_destroy (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_finish (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_flush (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Content cairo_surface_get_content (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern SurfaceType cairo_surface_get_type (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_mark_dirty (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_surface_reference (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_surface_status (IntPtr surface);
+ #endregion
+
+ #region SVG surface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
+
+ //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ //internal static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
+ #endregion
+
+ [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void cairo_show_text (IntPtr cr, byte[] text);
+
+ [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void cairo_text_extents (IntPtr cr, byte[] utf8, out TextExtents extents);
+
+ [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void cairo_show_text (IntPtr cr, ref byte utf8);
+
+ [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void cairo_text_extents (IntPtr cr, ref byte utf8, out TextExtents extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_text_path (IntPtr ct, byte[] utf8);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_transform (IntPtr cr, Matrix matrix);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_translate (IntPtr cr, double tx, double ty);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_version ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_version_string ();
+
+ #region DirectFBSurface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
+ #endregion
+
+ #region win32 fonts
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
+ #endregion
+
+ #region win32 surface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
+ #endregion
+
+ #region XcbSurface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
+ #endregion
+
+ #region XlibSurface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_xlib_surface_get_depth (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_xlib_surface_get_height (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_xlib_surface_get_width (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
+ #endregion
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
+
+ #region GLSurface
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_gl_surface_get_width (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_gl_surface_get_height (IntPtr surface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
+ #endregion
+
+ #region GLX Functions
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_glx_device_get_display (IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_glx_device_get_context (IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
+ #endregion
+
+ #region WGL Fucntions
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
+ #endregion
+
+ #region EGL Functions
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
+ #endregion
+
+ #region DRM Functions
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_device_get_for_fd (int fd);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_device_default ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_drm_device_throttle (IntPtr cairo_device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format, int width, int height, int stride);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_drm_surface_unmap (IntPtr drmSurface, IntPtr imageSurface);
+ #endregion
+
+ #region Device
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_device_acquire(IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_device_destroy (IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_device_reference (IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_device_release(IntPtr device);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_device_status(IntPtr device);
+ #endregion
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// Mono.Cairo.PostscriptSurface.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class PSSurface : Surface
+ {
+ internal PSSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public PSSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_ps_surface_create (filename, width, height), true)
+ {
+ }
+
+ public void BeginPageSetup ()
+ {
+ NativeMethods.cairo_ps_surface_dsc_begin_page_setup (Handle);
+ }
+
+ public void BeginSetup ()
+ {
+ NativeMethods.cairo_ps_surface_dsc_begin_setup (Handle);
+ }
+
+ public void DscComment (string 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);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Miguel de Icaza (miguel@novell.com)
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+
+namespace Crow.Drawing {
+
+ public class Path : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
+ internal Path (IntPtr handle)
+ {
+ this.handle = handle;
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ ~Path ()
+ {
+ Dispose (false);
+ }
+
+ public IntPtr Handle { get { return handle; } }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Path> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_path_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+
+namespace Crow.Drawing {
+
+ public class Pattern : IDisposable
+ {
+ [Obsolete]
+ protected IntPtr pattern = IntPtr.Zero;
+
+ public static Pattern Lookup (IntPtr pattern, bool owner)
+ {
+ if (pattern == IntPtr.Zero)
+ return null;
+
+ PatternType pt = NativeMethods.cairo_pattern_get_type (pattern);
+ switch (pt) {
+ case PatternType.Solid:
+ return new SolidPattern (pattern, owner);
+ case PatternType.Surface:
+ return new SurfacePattern (pattern, owner);
+ case PatternType.Linear:
+ return new LinearGradient (pattern, owner);
+ case PatternType.Radial:
+ return new RadialGradient (pattern, owner);
+ default:
+ return new Pattern (pattern, owner);
+ }
+ }
+
+ [Obsolete]
+ protected Pattern ()
+ {
+ }
+
+ internal Pattern (IntPtr handle, bool owned)
+ {
+ Handle = handle;
+ if (!owned)
+ NativeMethods.cairo_pattern_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ ~Pattern ()
+ {
+ Dispose (false);
+ }
+
+ [Obsolete ("Use the SurfacePattern constructor")]
+ public Pattern (Surface surface)
+ : this ( NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
+ {
+ }
+
+ [Obsolete]
+ protected void Reference ()
+ {
+ NativeMethods.cairo_pattern_reference (pattern);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Pattern> (Handle, disposing);
+
+ if (!disposing|| Handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_pattern_destroy (Handle);
+ Handle = IntPtr.Zero;
+ }
+
+ [Obsolete ("Use Dispose()")]
+ public void Destroy ()
+ {
+ Dispose ();
+ }
+
+ public Status Status
+ {
+ get { return NativeMethods.cairo_pattern_status (Handle); }
+ }
+
+ public Extend Extend
+ {
+ get { return NativeMethods.cairo_pattern_get_extend (Handle); }
+ set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
+ }
+
+ public Matrix Matrix {
+ set {
+ NativeMethods.cairo_pattern_set_matrix (Handle, value);
+ }
+
+ get {
+ Matrix m = new Matrix ();
+ NativeMethods.cairo_pattern_get_matrix (Handle, m);
+ return m;
+ }
+ }
+
+#pragma warning disable 612
+ public IntPtr Handle {
+ get { return pattern; }
+ private set { pattern = value; }
+ }
+#pragma warning restore 612
+
+ [Obsolete]
+ public IntPtr Pointer {
+ get { return pattern; }
+ }
+
+ public PatternType PatternType {
+ get { return NativeMethods.cairo_pattern_get_type (Handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.PatternType.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+
+ public enum PatternType
+ {
+ Solid,
+ Surface,
+ Linear,
+ Radial,
+ Mesh,
+ RasterSource
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.PdfSurface.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class PdfSurface : Surface
+ {
+ internal PdfSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public PdfSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_pdf_surface_create (filename, width, height), true)
+ {
+ }
+
+ public void SetSize (double width, double height)
+ {
+ NativeMethods.cairo_pdf_surface_set_size (Handle, width, height);
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class RadialGradient : Gradient
+ {
+ internal RadialGradient (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ public RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
+ : base (NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1), true)
+ {
+ }
+ }
+}
+
--- /dev/null
+// Copyright (C) 2011 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.Drawing
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RectangleList {
+ public Status Status;
+ public IntPtr Rectangles;
+ public int NumRectangles;
+ }
+
+ public enum RegionOverlap {
+ In,
+ Out,
+ Part,
+ }
+
+ public class Region : IDisposable {
+
+ IntPtr handle;
+ public IntPtr Handle {
+ get { return handle; }
+ }
+
+ [Obsolete]
+ public Region (IntPtr handle) : this (handle, false) {}
+
+ public Region (IntPtr handle, bool owned)
+ {
+ this.handle = handle;
+ if (!owned)
+ NativeMethods.cairo_region_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public Region () : this (NativeMethods.cairo_region_create () , true)
+ {
+ }
+
+ public Region (Rectangle rect)
+ {
+ handle = NativeMethods.cairo_region_create_rectangle (ref rect);
+ }
+
+ public Region (RectangleList rects)
+ {
+ handle = NativeMethods.cairo_region_create_rectangles (rects.Rectangles, rects.NumRectangles);
+ }
+
+ public Region Copy ()
+ {
+ return new Region (NativeMethods.cairo_region_copy (Handle), true);
+ }
+
+ #region IDisposable
+ ~Region ()
+ {
+ Dispose (false);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Region> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_region_destroy (Handle);
+ handle = IntPtr.Zero;
+ }
+ #endregion
+
+ public override bool Equals (object obj)
+ {
+ return (obj is Region) && NativeMethods.cairo_region_equal (Handle, (obj as Region).Handle);
+ }
+
+ public override int GetHashCode ()
+ {
+ return Handle.GetHashCode ();
+ }
+
+ public Status Status {
+ get { return NativeMethods.cairo_region_status (Handle); }
+ }
+
+ public Rectangle Extents {
+ get {
+ Rectangle result;
+ NativeMethods.cairo_region_get_extents (Handle, out result);
+ return result;
+ }
+ }
+
+ public int NumRectangles {
+ get { return NativeMethods.cairo_region_num_rectangles (Handle); }
+ }
+
+ public Rectangle GetRectangle (int nth)
+ {
+ Rectangle val;
+ NativeMethods.cairo_region_get_rectangle (Handle, nth, out val);
+ return val;
+ }
+
+ public bool IsEmpty {
+ get { return NativeMethods.cairo_region_is_empty (Handle); }
+ }
+
+ public RegionOverlap Contains (Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle);
+ }
+
+ public bool Contains (int x, int y)
+ {
+ return NativeMethods.cairo_region_contains_point (Handle, x, y);
+ }
+
+ public void Translate (int dx, int dy)
+ {
+ NativeMethods.cairo_region_translate (Handle, dx, dy);
+ }
+
+ public Status Subtract (Region other)
+ {
+ return NativeMethods.cairo_region_subtract (Handle, other.Handle);
+ }
+
+ public Status SubtractRectangle (Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_subtract_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Intersect (Region other)
+ {
+ return NativeMethods.cairo_region_intersect (Handle, other.Handle);
+ }
+
+ public Status IntersectRectangle (Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_intersect_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Union (Region other)
+ {
+ return NativeMethods.cairo_region_union (Handle, other.Handle);
+ }
+
+ public Status UnionRectangle (Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_union_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Xor (Region other)
+ {
+ return NativeMethods.cairo_region_xor (Handle, other.Handle);
+ }
+
+ public Status XorRectangle (Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_xor_rectangle (Handle, ref rectangle);
+ }
+ public void Reset () {
+ if (IsEmpty)
+ return;
+ NativeMethods.cairo_region_destroy (Handle);
+ handle = NativeMethods.cairo_region_create ();
+ }
+ public bool OverlapOut (Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out;
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.ScaledFont.cs
+//
+// (c) 2008 Jordi Mas i Hernandez (jordimash@gmail.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing {
+
+ public class ScaledFont : IDisposable
+ {
+ protected IntPtr handle = IntPtr.Zero;
+
+ internal ScaledFont (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_scaled_font_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public ScaledFont (FontFace fontFace, Matrix matrix, Matrix ctm, FontOptions options)
+ : this (NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle), true)
+ {
+ }
+
+ ~ScaledFont ()
+ {
+ Dispose (false);
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public FontExtents FontExtents {
+ get {
+ FontExtents extents;
+ NativeMethods.cairo_scaled_font_extents (handle, out extents);
+ return extents;
+ }
+ }
+
+ public Matrix FontMatrix {
+ get {
+ Matrix m;
+ NativeMethods.cairo_scaled_font_get_font_matrix (handle, out m);
+ return m;
+ }
+ }
+
+ public FontType FontType {
+ get {
+ return NativeMethods.cairo_scaled_font_get_type (handle);
+ }
+ }
+
+ public TextExtents GlyphExtents (Glyph[] glyphs)
+ {
+ IntPtr ptr = Context.FromGlyphToUnManagedMemory (glyphs);
+ TextExtents extents;
+
+ NativeMethods.cairo_scaled_font_glyph_extents (handle, ptr, glyphs.Length, out extents);
+
+ Marshal.FreeHGlobal (ptr);
+ return extents;
+ }
+
+ public Status Status
+ {
+ get { return NativeMethods.cairo_scaled_font_status (handle); }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<ScaledFont> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_scaled_font_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+
+ [Obsolete]
+ protected void Reference ()
+ {
+ NativeMethods.cairo_scaled_font_reference (handle);
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Color = Crow.Color;
+namespace Crow.Drawing {
+
+ public class SolidPattern : Pattern
+ {
+ internal SolidPattern (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ public SolidPattern (Color color)
+ : base (NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A), true)
+ {
+ }
+
+ public SolidPattern (double r, double g, double b)
+ : base (NativeMethods.cairo_pattern_create_rgb (r, g, b), true)
+ {
+ }
+
+ public SolidPattern (double r, double g, double b, double a)
+ : base (NativeMethods.cairo_pattern_create_rgba (r, g, b, a), true)
+ {
+ }
+
+ public SolidPattern (Color color, bool solid)
+ : base (solid
+ ? NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B)
+ : NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A),
+ true)
+ {
+ }
+
+ public Color Color {
+ get {
+ double red, green, blue, alpha;
+ NativeMethods.cairo_pattern_get_rgba (Handle, out red, out green, out blue, out alpha);
+ return new Color (red, green, blue, alpha);
+ }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Status.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum Status
+ {
+ Success = 0,
+ NoMemory,
+ InvalidRestore,
+ InvalidPopGroup,
+ NoCurrentPoint,
+ InvalidMatrix,
+ InvalidStatus,
+ NullPointer,
+ InvalidString,
+ InvalidPathData,
+ ReadError,
+ WriteError,
+ SurfaceFinished,
+ SurfaceTypeMismatch,
+ PatternTypeMismatch,
+ InvalidContent,
+ InvalidFormat,
+ InvalidVisual,
+ FileNotFound,
+ InvalidDash,
+ InvalidDscComment,
+ InvalidIndex,
+ ClipNotRepresentable,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Cairo.cs
+//
+// Authors:
+// John Luke (john.luke@gmail.com)
+//
+// Copyright (C) John Luke 2005
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing
+{
+
+ public enum SubpixelOrder
+ {
+ Default,
+ Rgb,
+ Bgr,
+ Vrgb,
+ Vbgr,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Surface.cs
+//
+// Authors:
+// Duncan Mak
+// Miguel de Icaza.
+// Alp Toker
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell, Inc. 2003.
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using Drawing2D;
+
+namespace Crow.Drawing {
+
+ public class Surface : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
+ [Obsolete]
+ protected Surface()
+ {
+ }
+
+ [Obsolete]
+ protected Surface (IntPtr ptr) : this (ptr, true)
+ {
+ }
+
+ protected Surface (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_surface_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public static Surface Lookup (IntPtr surface, bool owned)
+ {
+ SurfaceType st = NativeMethods.cairo_surface_get_type (surface);
+ switch (st) {
+ case SurfaceType.Image:
+ return new ImageSurface (surface, owned);
+ case SurfaceType.Xlib:
+ return new XlibSurface (surface, owned);
+ case SurfaceType.Xcb:
+ return new XcbSurface (surface, owned);
+ case SurfaceType.Glitz:
+ return new GlitzSurface (surface, owned);
+ case SurfaceType.Win32:
+ return new Win32Surface (surface, owned);
+ case SurfaceType.Pdf:
+ return new PdfSurface (surface, owned);
+ case SurfaceType.PS:
+ return new PSSurface (surface, owned);
+ case SurfaceType.DirectFB:
+ return new DirectFBSurface (surface, owned);
+ case SurfaceType.Svg:
+ return new SvgSurface (surface, owned);
+ case SurfaceType.GL:
+ return new GLSurface (surface, owned);
+ default:
+ return new Surface (surface, owned);
+ }
+ }
+
+ [Obsolete ("Use an ImageSurface constructor instead.")]
+ public static Surface CreateForImage (
+ ref byte[] data, Format format, int width, int height, int stride)
+ {
+ IntPtr p = NativeMethods.cairo_image_surface_create_for_data (
+ data, format, width, height, stride);
+
+ return new Surface (p, true);
+ }
+
+ [Obsolete ("Use an ImageSurface constructor instead.")]
+ public static Surface CreateForImage (
+ Format format, int width, int height)
+ {
+ IntPtr p = NativeMethods.cairo_image_surface_create (
+ format, width, height);
+
+ return new Surface (p, true);
+ }
+
+
+ public Surface CreateSimilar (
+ Content content, int width, int height)
+ {
+ IntPtr p = NativeMethods.cairo_surface_create_similar (
+ this.Handle, content, width, height);
+
+ return Surface.Lookup(p, true);
+ }
+
+ ~Surface ()
+ {
+ Dispose (false);
+ }
+
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Surface> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_surface_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ public virtual void SetSize (int width, int height) {
+ }
+
+ public Status Finish ()
+ {
+ NativeMethods.cairo_surface_finish (handle);
+ return Status;
+ }
+
+ public void Flush ()
+ {
+ NativeMethods.cairo_surface_flush (handle);
+ }
+
+ public void MarkDirty ()
+ {
+ 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);
+ }
+ public virtual int Width => -1;
+ public virtual int Height => -1;
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public PointD DeviceOffset {
+ get {
+ double x, y;
+ NativeMethods.cairo_surface_get_device_offset (handle, out x, out y);
+ return new PointD (x, y);
+ }
+
+ set {
+ NativeMethods.cairo_surface_set_device_offset (handle, value.X, value.Y);
+ }
+ }
+
+ [Obsolete ("Use Dispose()")]
+ public void Destroy()
+ {
+ Dispose ();
+ }
+
+ public void SetFallbackResolution (double x, double y)
+ {
+ NativeMethods.cairo_surface_set_fallback_resolution (handle, x, y);
+ }
+
+ public void WriteToPng (string filename)
+ {
+ NativeMethods.cairo_surface_write_to_png (handle, filename);
+ }
+
+ [Obsolete ("Use Handle instead.")]
+ public IntPtr Pointer {
+ get {
+ return handle;
+ }
+ }
+
+ public Status Status {
+ get { return NativeMethods.cairo_surface_status (handle); }
+ }
+
+ public Content Content {
+ get { return NativeMethods.cairo_surface_get_content (handle); }
+ }
+
+ public SurfaceType SurfaceType {
+ get { return NativeMethods.cairo_surface_get_type (handle); }
+ }
+
+ public uint ReferenceCount {
+ get { return NativeMethods.cairo_surface_get_reference_count (handle); }
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class SurfacePattern : Pattern
+ {
+ internal SurfacePattern (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ public SurfacePattern (Surface surface)
+ : base (NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
+ {
+ }
+
+ //no idea why this is here, the base one is identical, but we can't remove it now
+ public new Extend Extend {
+ set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_extend (Handle); }
+ }
+
+ public Filter Filter {
+ set { NativeMethods.cairo_pattern_set_filter (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_filter (Handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.SurfaceType.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+
+ public enum SurfaceType
+ {
+ Image,
+ Pdf,
+ PS,
+ Xlib,
+ Xcb,
+ Glitz,
+ Quartz,
+ Win32,
+ BeOS,
+ DirectFB,
+ Svg,
+ OS2,
+ Win32Printing,
+ QuartzImage,
+ Script,
+ Qt,
+ Recording,
+ VG,
+ GL,
+ Drm,
+ Tee,
+ Xml,
+ Skia,
+ SubSurface
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.SvgSurface.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class SvgSurface : Surface
+ {
+ internal SvgSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public SvgSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_svg_surface_create (filename, width, height), true)
+ {
+ }
+
+ public void RestrictToVersion (SvgVersion version)
+ {
+ NativeMethods.cairo_svg_surface_restrict_to_version (Handle, version);
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.SvgVersion.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+
+ public enum SvgVersion
+ {
+ // FIXME: yuck
+ OnePointOne = 0,
+ OnePointTwo,
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.TextExtents.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing
+{
+ [StructLayout (LayoutKind.Sequential)]
+ public struct TextExtents
+ {
+ double xbearing;
+ double ybearing;
+ double width;
+ double height;
+ double xadvance;
+ double yadvance;
+
+ public double XBearing {
+ get { return xbearing; }
+ set { xbearing = value; }
+ }
+
+ public double YBearing {
+ get { return ybearing; }
+ set { ybearing = value; }
+ }
+
+ public double Width {
+ get { return width; }
+ set { width = value; }
+ }
+
+ public double Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public double XAdvance {
+ get { return xadvance; }
+ set { xadvance = value; }
+ }
+
+ public double YAdvance {
+ get { return yadvance; }
+ set { yadvance = value; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is TextExtents)
+ return this == (TextExtents)obj;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)XBearing ^ (int)YBearing ^ (int)Width ^ (int)Height ^ (int)XAdvance ^ (int)YAdvance;
+ }
+
+ public static bool operator == (TextExtents extents, TextExtents other)
+ {
+ return extents.XBearing == other.XBearing && extents.YBearing == other.YBearing && extents.Width == other.Width && extents.Height == other.Height && extents.XAdvance == other.XAdvance && extents.YAdvance == other.YAdvance;
+ }
+
+ public static bool operator != (TextExtents extents, TextExtents other)
+ {
+ return !(extents == other);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+// JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.Drawing
+{
+ public class WGLDevice : Device
+ {
+ public WGLDevice (IntPtr hglrc) : base (NativeMethods.cairo_wgl_device_create (hglrc), true)
+ {
+ }
+
+ public IntPtr Context {
+ get { return NativeMethods.cairo_wgl_device_get_context (Handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Win32Surface.cs
+//
+// Authors:
+// John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class Win32Surface : Surface
+ {
+ internal Win32Surface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public Win32Surface (IntPtr hdc)
+ : base (NativeMethods.cairo_win32_surface_create (hdc), true)
+ {
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.XcbSurface.cs
+//
+// Authors:
+// Alp Toker
+//
+// (C) Alp Toker, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+ public class XcbSurface : Surface
+ {
+ internal XcbSurface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
+ : base (NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height), true)
+ {
+ }
+
+ public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
+ {
+ IntPtr ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
+ return new XcbSurface (ptr, true);
+ }
+ public override void SetSize (int width, int height)
+ {
+ NativeMethods.cairo_xcb_surface_set_size (Handle, width, height);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.XlibSurface.cs
+//
+// Authors:
+// Duncan Mak
+// Miguel de Icaza.
+// JP Bruyère
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell, Inc. 2003.
+// (C) JP Bruyère 2021
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.Drawing {
+
+ public class XlibSurface : Surface
+ {
+ public XlibSurface (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
+ : base (NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height), true)
+ {
+ }
+
+ public XlibSurface (IntPtr ptr, bool own) : base (ptr, own)
+ {
+ }
+
+ public static XlibSurface FromBitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
+ {
+ IntPtr ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
+ return new XlibSurface(ptr, true);
+ }
+
+ public void SetDrawable (IntPtr drawable, int width, int height)
+ {
+ NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height);
+ }
+
+ public override void SetSize (int width, int 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 IntPtr Screen => NativeMethods.cairo_xlib_surface_get_screen (Handle);
+ public IntPtr Visual=> NativeMethods.cairo_xlib_surface_get_visual (Handle);
+ }
+}
--- /dev/null
+//Copyright GPL2
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.Drawing {
+
+
+ public sealed class SvgHandle : IDisposable {
+ const string lib = "rsvg-2.40";
+
+ public IntPtr Raw;
+
+ [DllImport (lib)]
+ static extern IntPtr rsvg_handle_new();
+ [DllImport (lib)]
+ static extern IntPtr rsvg_handle_new_from_data (byte[] data, UIntPtr n_data, out IntPtr error);
+ [DllImport (lib)]
+ static extern IntPtr rsvg_handle_new_from_file (string file_name, out IntPtr error);
+ [DllImport (lib)]
+ static extern IntPtr rsvg_handle_get_base_uri (IntPtr raw);
+ [DllImport (lib)]
+ static extern void rsvg_handle_set_dpi (IntPtr raw, double dpi);
+ [DllImport (lib)]
+ static extern void rsvg_handle_set_dpi_x_y (IntPtr raw, double dpi_x, double dpi_y);
+
+ [DllImport (lib)]
+ static extern void rsvg_handle_render_cairo (IntPtr raw, IntPtr cr);
+ [DllImport (lib)]
+ static extern void rsvg_handle_render_cairo_sub (IntPtr raw, IntPtr cr, string id);
+
+ [DllImport (lib)]
+ static extern void rsvg_handle_get_dimensions (IntPtr raw, IntPtr dimension_data);
+ [DllImport (lib)]
+ static extern bool rsvg_handle_close (IntPtr raw, out IntPtr error);
+ [DllImport (lib)]
+ static extern IntPtr rsvg_handle_get_title (IntPtr raw);
+ [DllImport (lib)]
+ static extern IntPtr rsvg_handle_get_metadata (IntPtr raw);
+
+ public SvgHandle ()
+ {
+ Raw = rsvg_handle_new();
+ }
+ public SvgHandle (byte[] data)
+ {
+ Raw = rsvg_handle_new_from_data(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)), out IntPtr error);
+ if (error != IntPtr.Zero) throw new Exception (error.ToString());
+ }
+ public SvgHandle (string file_name)
+ {
+ Raw = rsvg_handle_new_from_file(file_name, out IntPtr error);
+ if (error != IntPtr.Zero) throw new Exception (error.ToString());
+ }
+
+
+ public double Dpi { set => rsvg_handle_set_dpi (Raw, value); }
+ public void SetDpiXY (double dpi_x, double dpi_y) => rsvg_handle_set_dpi_x_y (Raw, dpi_x, dpi_y);
+
+
+ public void Render(Context cr) =>
+ rsvg_handle_render_cairo (Raw, cr == null ? IntPtr.Zero : cr.Handle);
+
+ public void Render (Context cr, string id) =>
+ rsvg_handle_render_cairo_sub (Raw, cr == null ? IntPtr.Zero : cr.Handle, id);
+
+ [StructLayout(LayoutKind.Sequential)]
+ struct DimensionData {
+
+ public int Width;
+ public int Height;
+ public double Em;
+ public double Ex;
+
+ public static DimensionData Zero = new DimensionData ();
+
+ public static DimensionData New(IntPtr raw) {
+ if (raw == IntPtr.Zero)
+ return DimensionData.Zero;
+ return (DimensionData) Marshal.PtrToStructure (raw, typeof (DimensionData));
+ }
+ }
+ public Size Dimensions {
+ get {
+ DimensionData dimension_data;
+ IntPtr native_dimension_data = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (DimensionData)));
+ rsvg_handle_get_dimensions(Raw, native_dimension_data);
+ dimension_data = DimensionData.New (native_dimension_data);
+ Marshal.FreeHGlobal (native_dimension_data);
+ return new Size (dimension_data.Width, dimension_data.Height);
+ }
+ }
+
+ public void Dispose() {
+ bool raw_ret = rsvg_handle_close(Raw, out IntPtr error);
+ if (error != IntPtr.Zero) throw new Exception (error.ToString());
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="src\**\*.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\Drawing2D\Drawing2D.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using System.Text;
+using System.Linq;
+using Crow;
+
+namespace Crow.Drawing
+{
+ public class Context : IDisposable
+ {
+
+ IntPtr handle = IntPtr.Zero;
+
+ public Context(Surface surf)
+ {
+ handle = NativeMethods.vkvg_create(surf.Handle);
+ this.FillRule = FillRule.NonZero;
+ }
+ ~Context()
+ {
+ Dispose(false);
+ }
+
+ public IntPtr Handle => handle;
+
+ public void AddReference()
+ {
+ NativeMethods.vkvg_reference(handle);
+ }
+ public uint References() => NativeMethods.vkvg_get_reference_count(handle);
+
+ public double LineWidth
+ {
+ get => NativeMethods.vkvg_get_line_width(handle);
+ set { NativeMethods.vkvg_set_line_width(handle, (float)value); }
+ }
+ public LineJoin LineJoin
+ {
+ get => NativeMethods.vkvg_get_line_join(handle);
+ set { NativeMethods.vkvg_set_line_join(handle, value); }
+ }
+ public LineCap LineCap
+ {
+ get => NativeMethods.vkvg_get_line_cap(handle);
+ set { NativeMethods.vkvg_set_line_cap(handle, value); }
+ }
+ public uint FontSize
+ {
+ set { NativeMethods.vkvg_set_font_size(handle, value); }
+ }
+ public string FontFace
+ {
+ set { NativeMethods.vkvg_select_font_face(handle, value); }
+ }
+ public Operator Operator
+ {
+ set { NativeMethods.vkvg_set_operator(handle, value); }
+ get { return NativeMethods.vkvg_get_operator(handle); }
+ }
+ public FillRule FillRule
+ {
+ set { NativeMethods.vkvg_set_fill_rule(handle, value); }
+ get { return NativeMethods.vkvg_get_fill_rule(handle); }
+ }
+ public FontExtents FontExtents
+ {
+ get
+ {
+ FontExtents f_extents;
+ NativeMethods.vkvg_font_extents(handle, out f_extents);
+ return f_extents;
+ }
+ }
+ public Antialias Antialias {
+ set;
+ get;
+ }
+ public TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize = 4) {
+ TextExtents (s, tabSize, out TextExtents extents);
+ return extents;
+ }
+ public void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents) {
+ if (s.Length == 0) {
+ extents = default;
+ return;
+ }
+ int size = s.Length * 4 + 1;
+ Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+ int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
+ bytes[encodedBytes] = 0;
+ TextExtents (bytes.Slice (0, encodedBytes + 1), out extents);
+ }
+ public void TextExtents (Span<byte> bytes, out TextExtents extents) {
+ NativeMethods.vkvg_text_extents (handle, ref bytes.GetPinnableReference (), out extents);
+ }
+ public Matrix Matrix
+ {
+ get
+ {
+ Matrix m;
+ NativeMethods.vkvg_get_matrix(handle, out m);
+ return m;
+ }
+ set
+ {
+ NativeMethods.vkvg_set_matrix(handle, ref value);
+ }
+ }
+ public void ShowText (string text) => ShowText (text.AsSpan());
+ public void ShowText (ReadOnlySpan<char> s, int tabSize = 4) {
+ int size = s.Length * 4 + 1;
+ Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+ int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
+ bytes[encodedBytes] = 0;
+ ShowText (bytes.Slice (0, encodedBytes + 1));
+ }
+ public void ShowText (Span<byte> bytes) {
+ NativeMethods.vkvg_show_text (handle, ref bytes.GetPinnableReference());
+ }
+
+ public void ShowText(TextRun textRun)
+ {
+ NativeMethods.vkvg_show_text_run(handle, textRun.Handle);
+ }
+ public void Save()
+ {
+ NativeMethods.vkvg_save(handle);
+ }
+ public void Restore()
+ {
+ NativeMethods.vkvg_restore(handle);
+ }
+ public void Flush()
+ {
+ NativeMethods.vkvg_flush(handle);
+ }
+ public void Clear()
+ {
+ NativeMethods.vkvg_clear(handle);
+ }
+ public void Paint()
+ {
+ NativeMethods.vkvg_paint(handle);
+ }
+ public void PaintWithAlpha (double alpha) => Paint();
+ public void Arc(float xc, float yc, float radius, float a1, float a2)
+ {
+ NativeMethods.vkvg_arc(handle, xc, yc, radius, a1, a2);
+ }
+ public void Arc(double xc, double yc, double radius, double a1, double a2)
+ {
+ NativeMethods.vkvg_arc(handle, (float)xc, (float)yc, (float)radius, (float)a1, (float)a2);
+ }
+ public void Arc (PointD center, double radius, double angle1, double angle2)
+ {
+ NativeMethods.vkvg_arc (handle, (float)center.X, (float)center.Y, (float)radius, (float)angle1, (float)angle2);
+ }
+
+ public void ArcNegative (PointD center, double radius, double angle1, double angle2)
+ {
+ NativeMethods.vkvg_arc_negative (handle, (float)center.X, (float)center.Y, (float)radius, (float)angle1, (float)angle2);
+ }
+ public void ArcNegative(float xc, float yc, float radius, float a1, float a2)
+ {
+ NativeMethods.vkvg_arc_negative(handle, xc, yc, radius, a1, a2);
+ }
+ public void Rectangle(float x, float y, float width, float height)
+ {
+ NativeMethods.vkvg_rectangle(handle, x, y, width, height);
+ }
+ public void Scale(float sx, float sy)
+ {
+ NativeMethods.vkvg_scale(handle, sx, sy);
+ }
+ public void Translate(float dx, float dy)
+ {
+ NativeMethods.vkvg_translate(handle, dx, dy);
+ }
+ public void Rotate(float alpha)
+ {
+ NativeMethods.vkvg_rotate(handle, alpha);
+ }
+ public void ArcNegative(double xc, double yc, double radius, double a1, double a2)
+ {
+ NativeMethods.vkvg_arc_negative(handle, (float)xc, (float)yc, (float)radius, (float)a1, (float)a2);
+ }
+ public void Rectangle(double x, double y, double width, double height)
+ {
+ NativeMethods.vkvg_rectangle(handle, (float)x, (float)y, (float)width, (float)height);
+ }
+ public void Scale(double sx, double sy)
+ {
+ NativeMethods.vkvg_scale(handle, (float)sx, (float)sy);
+ }
+ public void Translate(double dx, double dy)
+ {
+ NativeMethods.vkvg_translate(handle, (float)dx, (float)dy);
+ }
+ public void Translate(PointD p)
+ {
+ NativeMethods.vkvg_translate(handle, (float)p.X, (float)p.Y);
+ }
+ public void Rotate(double alpha)
+ {
+ NativeMethods.vkvg_rotate(handle, (float)alpha);
+ }
+
+ public void Fill()
+ {
+ NativeMethods.vkvg_fill(handle);
+ }
+ public void FillPreserve()
+ {
+ NativeMethods.vkvg_fill_preserve(handle);
+ }
+ public void Stroke()
+ {
+ NativeMethods.vkvg_stroke(handle);
+ }
+ public void StrokePreserve()
+ {
+ NativeMethods.vkvg_stroke_preserve(handle);
+ }
+ public void Clip()
+ {
+ NativeMethods.vkvg_clip(handle);
+ }
+ public void ClipPreserve()
+ {
+ NativeMethods.vkvg_clip_preserve(handle);
+ }
+ public void ResetClip()
+ {
+ NativeMethods.vkvg_reset_clip(handle);
+ }
+ public void NewPath()
+ {
+ NativeMethods.vkvg_new_path(handle);
+ }
+ public void NewSubPath()
+ {
+ NativeMethods.vkvg_new_sub_path(handle);
+ }
+ public void ClosePath()
+ {
+ NativeMethods.vkvg_close_path(handle);
+ }
+ public void MoveTo(PointD p)
+ {
+ NativeMethods.vkvg_move_to(handle, (float)p.X, (float)p.Y);
+ }
+ public void MoveTo(Point p)
+ {
+ NativeMethods.vkvg_move_to(handle, p.X, p.Y);
+ }
+ public void MoveTo(float x, float y)
+ {
+ NativeMethods.vkvg_move_to(handle, x, y);
+ }
+ public void RelMoveTo(float x, float y)
+ {
+ NativeMethods.vkvg_rel_move_to(handle, x, y);
+ }
+ public void LineTo(float x, float y)
+ {
+ NativeMethods.vkvg_line_to(handle, x, y);
+ }
+ public void LineTo(Point p)
+ {
+ NativeMethods.vkvg_line_to(handle, p.X, p.Y);
+ }
+ public void LineTo(PointD p)
+ {
+ NativeMethods.vkvg_line_to(handle, (float)p.X, (float)p.Y);
+ }
+ public void RelLineTo(float x, float y)
+ {
+ NativeMethods.vkvg_rel_line_to(handle, x, y);
+ }
+ public void CurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
+ {
+ NativeMethods.vkvg_curve_to(handle, x1, y1, x2, y2, x3, y3);
+ }
+ public void RelCurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
+ {
+ NativeMethods.vkvg_rel_curve_to(handle, x1, y1, x2, y2, x3, y3);
+ }
+
+ public void MoveTo(double x, double y)
+ {
+ NativeMethods.vkvg_move_to(handle, (float)x, (float)y);
+ }
+ public void RelMoveTo(double x, double y)
+ {
+ NativeMethods.vkvg_rel_move_to(handle, (float)x, (float)y);
+ }
+ public void LineTo(double x, double y)
+ {
+ NativeMethods.vkvg_line_to(handle, (float)x, (float)y);
+ }
+ public void RelLineTo(double x, double y)
+ {
+ NativeMethods.vkvg_rel_line_to(handle, (float)x, (float)y);
+ }
+ public void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
+ {
+ NativeMethods.vkvg_curve_to(handle, (float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3);
+ }
+ public void RelCurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
+ {
+ NativeMethods.vkvg_rel_curve_to(handle, (float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3);
+ }
+
+ public void SetSource(Pattern pat)
+ {
+ NativeMethods.vkvg_set_source(handle, pat.Handle);
+ }
+ public void SetSource (Color color)
+ {
+ NativeMethods.vkvg_set_source_rgba (handle, (float)(color.R / 255.0), (float)(color.G / 255.0), (float)(color.B / 255.0), (float)(color.A / 255.0));
+ }
+ public void SetSource(float r, float g, float b, float a = 1f)
+ {
+ NativeMethods.vkvg_set_source_rgba(handle, r, g, b, a);
+ }
+ public void SetSource(double r, double g, double b, double a = 1.0)
+ {
+ NativeMethods.vkvg_set_source_rgba(handle, (float)r, (float)g, (float)b, (float)a);
+ }
+ public void SetSource(Surface surf, float x = 0f, float y = 0f)
+ {
+ NativeMethods.vkvg_set_source_surface(handle, surf.Handle, x, y);
+ }
+ public void SetSourceSurface(Surface surf, float x = 0f, float y = 0f)
+ {
+ NativeMethods.vkvg_set_source_surface(handle, surf.Handle, x, y);
+ }
+ public void RenderSvg(IntPtr nsvgImage, string subId = null)
+ {
+ NativeMethods.vkvg_render_svg(handle, nsvgImage, subId);
+ }
+ public Crow.Rectangle StrokeExtents () => default;
+ internal static byte[] TerminateUtf8(string s)
+ {
+ // compute the byte count including the trailing \0
+ var byteCount = Encoding.UTF8.GetMaxByteCount(s.Length + 1);
+ var bytes = new byte[byteCount];
+ Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
+ return bytes;
+ }
+ public void SetDash (double [] dashes, double offset = 0) {
+ if (dashes == null)
+ NativeMethods.vkvg_set_dash(handle, null, 0, 0);
+ else {
+ float[] floats = dashes.Cast<float> ().ToArray ();
+ NativeMethods.vkvg_set_dash(handle, floats, (uint)dashes.Length, (float)offset);
+ }
+ }
+ public float[] Dashes
+ {
+ set
+ {
+ if (value == null)
+ NativeMethods.vkvg_set_dash(handle, null, 0, 0);
+ else
+ NativeMethods.vkvg_set_dash(handle, value, (uint)value.Length, 0);
+ }
+ }
+
+
+ public void PushGroup () {
+
+ }
+ public void PopGroupToSource () {
+
+ }
+
+ #region IDisposable implementation
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.vkvg_destroy(handle);
+ handle = IntPtr.Zero;
+ }
+ #endregion
+ }
+}
+
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Crow.Drawing
+{
+ public class Device: IDisposable
+ {
+
+ IntPtr handle = IntPtr.Zero;
+
+ #region CTORS & DTOR
+ public Device (IntPtr instance, IntPtr phy, IntPtr dev, uint qFamIdx, SampleCount samples = SampleCount.Sample_1, uint qIndex = 0)
+ {
+ handle = NativeMethods.vkvg_device_create_multisample (instance, phy, dev, qFamIdx, qIndex, samples, false);
+ }
+ ~Device ()
+ {
+ Dispose (false);
+ }
+ #endregion
+
+ public void GetDpy (out int hdpy, out int vdpy) => NativeMethods.vkvg_device_get_dpy (handle, out hdpy, out vdpy);
+ public void SetDpy (int hdpy, int vdpy) => NativeMethods.vkvg_device_set_dpy (handle, hdpy, vdpy);
+ public void AddReference () => NativeMethods.vkvg_device_reference (handle);
+ public uint References () => NativeMethods.vkvg_device_get_reference_count (handle);
+
+ public IntPtr Handle => handle;
+
+ #region IDisposable implementation
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.vkvg_device_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ #endregion
+ }
+}
+
--- /dev/null
+// Copyright (c) 2018-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+namespace Crow.Drawing
+{
+ public class Gradient : Pattern
+ {
+ protected Gradient(IntPtr handle) : base (handle) { }
+ public void AddColorStop (double offset, Crow.Color c)
+ => NativeMethods.vkvg_pattern_add_color_stop(handle, (float)offset, c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f);
+ public void AddColorStop(float offset, float r, float g, float b, float a = 1f)
+ => NativeMethods.vkvg_pattern_add_color_stop(handle, offset, r, g, b, a);
+ }
+ public class LinearGradient : Gradient {
+ public LinearGradient (float x0, float y0, float x1, float y1)
+ : base (NativeMethods.vkvg_pattern_create_linear(x0, y0, x1, y1)) {
+
+ }
+ }
+ public class RadialGradient : Gradient {
+ public RadialGradient ( float cx0, float cy0, float radius0,
+ float cx1, float cy1, float radius1)
+ : base (NativeMethods.vkvg_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1)) {
+
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+namespace Crow.Drawing {
+ public struct Matrix {
+ float xx; float yx;
+ float xy; float yy;
+ float x0; float y0;
+
+ public float XX { get { return xx; } set { xx = value; } }
+ public float YX { get { return yx; } set { yx = value; } }
+ public float XY { get { return xy; } set { xy = value; } }
+ public float YY { get { return yy; } set { yy = value; } }
+ public float X0 { get { return x0; } set { x0 = value; } }
+ public float Y0 { get { return y0; } set { y0 = value; } }
+
+ public static Matrix Create (float xx, float yx, float xy, float yy, float x0, float y0) {
+ Matrix tmp;
+ NativeMethods.vkvg_matrix_init (out tmp, xx, yx, xy, yy, x0, y0);
+ return tmp;
+ }
+ public static Matrix CreateTranslation (float tx, float ty) {
+ Matrix tmp;
+ NativeMethods.vkvg_matrix_init_translate (out tmp, tx, ty);
+ return tmp;
+ }
+ public static Matrix CreateRotation (float radian) {
+ Matrix tmp;
+ NativeMethods.vkvg_matrix_init_rotate (out tmp, radian);
+ return tmp;
+ }
+ public static Matrix CreateScale (float sx, float sy) {
+ Matrix tmp;
+ NativeMethods.vkvg_matrix_init_scale (out tmp, sx, sy);
+ return tmp;
+ }
+ public static Matrix Identity {
+ get {
+ Matrix tmp;
+ NativeMethods.vkvg_matrix_init_identity (out tmp);
+ return tmp;
+ }
+ }
+
+ public void Translate (float tx, float ty) {
+ Matrix tmp = this;
+ NativeMethods.vkvg_matrix_translate (ref tmp, tx, ty);
+ xx = tmp.xx; yx = tmp.yx;
+ xy = tmp.xy; yy = tmp.yy;
+ x0 = tmp.x0; y0 = tmp.y0;
+ }
+ public void Rotate (float radian) {
+ Matrix tmp = this;
+ NativeMethods.vkvg_matrix_rotate (ref tmp, radian);
+ xx = tmp.xx; yx = tmp.yx;
+ xy = tmp.xy; yy = tmp.yy;
+ x0 = tmp.x0; y0 = tmp.y0;
+ }
+ public void Scale (float sx, float sy) {
+ Matrix tmp = this;
+ NativeMethods.vkvg_matrix_scale (ref tmp, sx, sy);
+ xx = tmp.xx; yx = tmp.yx;
+ xy = tmp.xy; yy = tmp.yy;
+ x0 = tmp.x0; y0 = tmp.y0;
+ }
+ public void Invert () {
+ Matrix tmp = this;
+ NativeMethods.vkvg_matrix_invert (ref tmp);
+ xx = tmp.xx; yx = tmp.yx;
+ xy = tmp.xy; yy = tmp.yy;
+ x0 = tmp.x0; y0 = tmp.y0;
+ }
+ public void TransformDistance (ref float dx, ref float dy) {
+ NativeMethods.vkvg_matrix_transform_distance (ref this, ref dx, ref dy);
+ }
+ public void TransformPoint (ref float px, ref float py) {
+ NativeMethods.vkvg_matrix_transform_distance (ref this, ref px, ref py);
+ }
+
+ public static Matrix operator *(Matrix a, Matrix b) {
+ Matrix tmp;
+ NativeMethods.vkvg_matrix_multiply (out tmp, ref a, ref b);
+ return tmp;
+ }
+
+ public override string ToString () {
+ return string.Format ($"({xx};{yx};{xy};{yy};{x0};{y0})");
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.Drawing
+{
+ internal static class NativeMethods
+ {
+ const string libvkvg = "vkvg";
+
+ #region Device
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_device_create(IntPtr instance, IntPtr phy, IntPtr dev, uint qFamIdx, uint qIndex);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_device_destroy(IntPtr device);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_device_create_multisample(IntPtr inst, IntPtr phy, IntPtr vkdev, uint qFamIdx, uint qIndex, SampleCount samples, bool deferredResolve);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_device_reference(IntPtr dev);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern uint vkvg_device_get_reference_count(IntPtr dev);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_device_set_dpy(IntPtr dev, int hdpy, int vdpy);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_device_get_dpy(IntPtr dev, out int hdpy, out int vdpy);
+ #endregion
+
+ #region Context
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_create(IntPtr surface);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_destroy(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_flush(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_new_path(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_new_sub_path(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_close_path(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_line_to(IntPtr ctx, float x, float y);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_rel_line_to(IntPtr ctx, float x, float y);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_move_to(IntPtr ctx, float x, float y);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_rel_move_to(IntPtr ctx, float x, float y);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_arc(IntPtr ctx, float xc, float yc, float radius, float a1, float a2);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_arc_negative(IntPtr ctx, float xc, float yc, float radius, float a1, float a2);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_curve_to(IntPtr ctx, float x1, float y1, float x2, float y2, float x3, float y3);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_rel_curve_to(IntPtr ctx, float x1, float y1, float x2, float y2, float x3, float y3);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_rectangle(IntPtr ctx, float x, float y, float width, float height);
+
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_scale(IntPtr ctx, float sx, float sy);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_translate(IntPtr ctx, float dx, float dy);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_rotate(IntPtr ctx, float alpha);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_transform(IntPtr ctx, ref Matrix matrix);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_matrix(IntPtr ctx, ref Matrix matrix);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_get_matrix(IntPtr ctx, out Matrix matrix);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_identity_matrix(IntPtr ctx);
+
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_stroke(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_stroke_preserve(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_clip(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_clip_preserve(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_reset_clip(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_fill(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_fill_preserve(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_paint(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_source_rgba(IntPtr ctx, float r, float g, float b, float a);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_line_width(IntPtr ctx, float width);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_line_cap(IntPtr ctx, LineCap cap);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_line_join(IntPtr ctx, LineJoin join);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_operator(IntPtr ctx, Operator op);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern FillRule vkvg_get_fill_rule(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_fill_rule(IntPtr ctx, FillRule fr);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern Operator vkvg_get_operator(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_source_surface(IntPtr ctx, IntPtr surf, float x, float y);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_source(IntPtr ctx, IntPtr pattern);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_font_extents(IntPtr ctx, out FontExtents extents);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_text_extents(IntPtr ctx, byte[] utf8, out TextExtents extents);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_text_extents(IntPtr cr, ref byte utf8, out TextExtents extents);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_select_font_face(IntPtr ctx, string name);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_font_size(IntPtr ctx, uint size);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_show_text(IntPtr ctx, byte [] utf8);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_show_text(IntPtr cr, ref byte utf8);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_save(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_restore(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_clear(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern float vkvg_get_line_width(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern LineCap vkvg_get_line_cap(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern LineJoin vkvg_get_line_join(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_get_source(IntPtr ctx);
+
+ [DllImport (libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_set_dash (IntPtr ctx, float[] dashes, uint dashCount, float offset);
+
+ //void vkvg_set_dash (VkvgContext ctx, const float* dashes, uint32_t num_dashes, float offset);
+ //void vkvg_get_dash (VkvgContext ctx, const float* dashes, uint32_t* num_dashes, float* offset
+
+ [DllImport (libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_reference(IntPtr ctx);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern uint vkvg_get_reference_count(IntPtr ctx);
+ #endregion
+
+ #region TextRun
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_text_run_create(IntPtr ctx, byte[] utf8);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_text_run_destroy(IntPtr textRun);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_show_text_run(IntPtr ctx, IntPtr textRun);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_text_run_get_extents(IntPtr textRun, out TextExtents extents);
+ #endregion
+
+ #region Pattern
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_create();
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_reference(IntPtr pat);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern uint vkvg_pattern_get_reference_count(IntPtr pat);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_create_rgba(float r, float g, float b, float a);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_create_rgb(float r, float g, float b);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_create_for_surface(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_create_linear(float x0, float y0, float x1, float y1);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_pattern_create_radial(float cx0, float cy0, float radius0,
+ float cx1, float cy1, float radius1);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_pattern_destroy(IntPtr pat);
+
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_pattern_add_color_stop(IntPtr pat, float offset, float r, float g, float b, float a);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_pattern_set_extend(IntPtr pat, Extend extend);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_pattern_set_filter(IntPtr pat, Filter filter);
+
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern Extend vkvg_pattern_get_extend(IntPtr pat);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern Filter vkvg_pattern_get_filter(IntPtr pat);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern PatternType vkvg_pattern_get_type(IntPtr pat);
+ #endregion
+
+ #region Matrices
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_init_identity(out Matrix matrix);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_init(out Matrix matrix,
+ float xx, float yx,
+ float xy, float yy,
+ float x0, float y0);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_init_translate(out Matrix matrix, float tx, float ty);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_init_scale(out Matrix matrix, float sx, float sy);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_init_rotate(out Matrix matrix, float radians);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_translate(ref Matrix matrix, float tx, float ty);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_scale(ref Matrix matrix, float sx, float sy);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_rotate(ref Matrix matrix, float radians);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_multiply(out Matrix result, ref Matrix a, ref Matrix b);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_transform_distance(ref Matrix matrix, ref float dx, ref float dy);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_transform_point(ref Matrix matrix, ref float x, ref float y);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_matrix_invert(ref Matrix matrix);
+ #endregion
+
+ #region Surface
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_create(IntPtr device, uint width, uint height);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_create_from_image(IntPtr dev, string filePath);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_create_from_svg(IntPtr dev, string filePath);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_create_from_svg_fragment(IntPtr dev, byte[] filePath);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_create_from_bitmap(IntPtr dev, ref byte data, uint width, uint height);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_surface_destroy(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_get_vk_image(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int vkvg_surface_get_width(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int vkvg_surface_get_height(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_surface_clear(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr vkvg_surface_reference(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern uint vkvg_surface_get_reference_count(IntPtr surf);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_surface_write_to_png(IntPtr surf, [MarshalAs(UnmanagedType.LPStr)]string path);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_surface_write_to_memory(IntPtr surf, IntPtr pBitmap);
+ #endregion
+
+ #region NSVG
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr nsvg_load_file(IntPtr dev, string filePath);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern IntPtr nsvg_load(IntPtr dev, ref byte fragment);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void nsvg_destroy(IntPtr nsvgImage);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void nsvg_get_size(IntPtr nsvgImage, out int width, out int height);
+ [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void vkvg_render_svg(IntPtr ctx, IntPtr nsvgImage, string subId);
+ #endregion
+ }
+}
+
--- /dev/null
+// Copyright (c) 2018-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+namespace Crow.Drawing
+{
+ public class Pattern : IDisposable
+ {
+ protected IntPtr handle = IntPtr.Zero;
+
+ #region CTORS & DTOR
+ protected Pattern(IntPtr handle)
+ {
+ this.handle = handle;
+ }
+ public Pattern(float r, float g, float b)
+ {
+ handle = NativeMethods.vkvg_pattern_create_rgb(r, g, b);
+ }
+ public Pattern(float r, float g, float b, float a)
+ {
+ handle = NativeMethods.vkvg_pattern_create_rgba(r, g, b, a);
+ }
+ public Pattern(Surface surf)
+ {
+ handle = NativeMethods.vkvg_pattern_create_for_surface(surf.Handle);
+ }
+
+ ~Pattern()
+ {
+ Dispose(false);
+ }
+ #endregion
+
+ public void AddReference()
+ {
+ NativeMethods.vkvg_pattern_reference(handle);
+ }
+ public uint References() => NativeMethods.vkvg_pattern_get_reference_count(handle);
+
+ public IntPtr Handle => handle;
+
+ public Extend Extend
+ {
+ set { NativeMethods.vkvg_pattern_set_extend(handle, value); }
+ get { return NativeMethods.vkvg_pattern_get_extend(handle); }
+ }
+ public Filter Filter
+ {
+ set { NativeMethods.vkvg_pattern_set_filter(handle, value); }
+ get { return NativeMethods.vkvg_pattern_get_filter(handle); }
+ }
+
+ #region IDisposable implementation
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.vkvg_pattern_destroy(handle);
+ handle = IntPtr.Zero;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Crow.Drawing
+{
+ public class Surface: IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+ Device vkvgDev;
+
+ public Surface (Device device, int width, int height)
+ {
+ vkvgDev = device;
+ if (width <= 0 || height <= 0)
+ handle = NativeMethods.vkvg_surface_create (device.Handle, 1, 1);
+ else
+ handle = NativeMethods.vkvg_surface_create (device.Handle, (uint)width, (uint)height);
+ }
+ public Surface (Device device, Span<byte> data, int width, int heigth)
+ {
+ vkvgDev = device;
+ handle = NativeMethods.vkvg_surface_create_from_bitmap (device.Handle, ref data.GetPinnableReference(), (uint)width, (uint)heigth);
+ }
+ public Surface (Device device, string imgPath) {
+ vkvgDev = device;
+ handle = NativeMethods.vkvg_surface_create_from_image (device.Handle, imgPath);
+ }
+ public Surface (Device device, IntPtr surfHandle) {
+ vkvgDev = device;
+ handle = surfHandle;
+ AddReference ();
+ }
+
+ Surface (IntPtr devHandle, int width, int heigth)
+ {
+ handle = NativeMethods.vkvg_surface_create (devHandle, (uint)width, (uint)heigth);
+ }
+ ~Surface ()
+ {
+ Dispose (false);
+ }
+
+ public IntPtr Handle => handle;
+ public IntPtr VkImage => NativeMethods.vkvg_surface_get_vk_image (handle);
+ public int Width => NativeMethods.vkvg_surface_get_width (handle);
+ public int Height => NativeMethods.vkvg_surface_get_height (handle);
+
+ public void AddReference () => NativeMethods.vkvg_surface_reference (handle);
+ public uint References () => NativeMethods.vkvg_surface_get_reference_count (handle);
+
+// public Surface CreateSimilar (uint width, uint height) {
+// return new Surface (handle, width, height);
+// }
+// public Surface CreateSimilar (int width, int height) {
+// return new Surface (handle, (uint)width, (uint)height);
+// }
+
+ public void Flush () {
+ //throw new NotImplementedException ();
+ }
+
+ public void WriteToPng (string path) {
+ NativeMethods.vkvg_surface_write_to_png (handle, path);
+ }
+ public void WriteTo (IntPtr bitmap) {
+ NativeMethods.vkvg_surface_write_to_memory (handle, bitmap);
+ }
+ public void Clear () {
+ NativeMethods.vkvg_surface_clear (handle);
+ }
+
+ #region IDisposable implementation
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.vkvg_surface_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ #endregion
+ }
+}
+
--- /dev/null
+//Copyright GPL2
+using System;
+
+namespace Crow.Drawing {
+
+
+ public sealed class SvgHandle : IDisposable {
+
+ public IntPtr Raw;
+
+ public SvgHandle (Device dev, Span<byte> bytes)
+ {
+ /*int size = svgFragment.Length * 4 + 1;
+ Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+ int encodedBytes = Crow.Text.Encoding.ToUtf8 (svgFragment, bytes);
+ bytes[encodedBytes] = 0;*/
+ Raw = NativeMethods.nsvg_load (dev.Handle, ref bytes.GetPinnableReference());
+ }
+ public SvgHandle (Device dev, string file_name)
+ {
+ Raw = NativeMethods.nsvg_load_file (dev.Handle, file_name);
+ }
+
+ public void Render(Context cr) =>
+ cr.RenderSvg (Raw);
+
+ public void Render (Context cr, string id) =>
+ cr.RenderSvg (Raw, id);
+
+ public Size Dimensions {
+ get {
+ NativeMethods.nsvg_get_size (Raw, out int w, out int h);
+ return new Size (w, h);
+ }
+ }
+
+ public void Dispose() {
+ NativeMethods.nsvg_destroy (Raw);
+ }
+
+ }
+}
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+namespace Crow.Drawing {
+ public class TextRun : IDisposable {
+
+ IntPtr handle = IntPtr.Zero;
+
+ #region CTORS & DTOR
+ protected TextRun(IntPtr handle) {
+ this.handle = handle;
+ }
+ public TextRun(string text) {
+ handle = NativeMethods.vkvg_text_run_create (handle, Context.TerminateUtf8(text));
+ }
+
+ ~TextRun() {
+ Dispose (false);
+ }
+ #endregion
+
+ //public void AddReference () {
+ // NativeMethods.vkvg_pattern_reference (handle);
+ //}
+ //public uint References () => NativeMethods.vkvg_pattern_get_reference_count (handle);
+
+ public IntPtr Handle { get { return handle; } }
+
+ public TextExtents Extents {
+ get {
+ TextExtents extents;
+ NativeMethods.vkvg_text_run_get_extents (handle, out extents);
+ return extents;
+ }
+ }
+
+ #region IDisposable implementation
+ public void Dispose () {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing) {
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.vkvg_text_run_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2019-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.InteropServices;
+using Glfw;
+using vke;
+using Vulkan;
+using static Vulkan.Vk;
+using Device = vke.Device;
+
+namespace Crow.Drawing {
+ /// <summary>
+ /// Base class for offscreen vulkan context without swapchain
+ /// </summary>
+ public abstract class VulkanContextBase : IDisposable {
+ protected Interface iface;
+ public uint width { get; protected set; }
+ public uint height { get; protected set; }
+
+ protected Instance instance;
+ protected PhysicalDevice phy;
+ protected vke.Device dev;
+ protected Queue graphicQueue;//for vkvg, we must have at least a graphic queue
+ public Crow.Drawing.Device VkvgDevice { get; protected set; }
+
+ public void WaitIdle() => dev.WaitIdle ();
+
+ public VulkanContextBase (Interface iface) {
+ this.iface = iface;
+ }
+
+
+ protected void createVkvgDevice () => VkvgDevice =
+ new Crow.Drawing.Device (instance.Handle, phy.Handle, dev.VkDev.Handle, graphicQueue.qFamIndex, SampleCount.Sample_8);
+
+ public abstract void CreateSurface (int width, int height, ref Surface surf);
+ public abstract bool render ();
+
+ #region IDisposable Support
+ protected bool isDisposed;
+ protected virtual void Dispose (bool disposing) {
+ if (!isDisposed) {
+ dev.WaitIdle ();
+
+ VkvgDevice.Dispose ();
+
+ if (disposing) {
+ dev.Dispose ();
+ instance.Dispose ();
+ } else
+ Debug.WriteLine ("a VulkanContext has not been correctly disposed");
+
+ isDisposed = true;
+ }
+ }
+ ~VulkanContextBase () {
+ Dispose (false);
+ }
+ public void Dispose () {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+ #endregion
+ }
+ //vulkan context rendering to preallocated bitmap
+ public class OffscreenVulkanContext : VulkanContextBase {
+ public IntPtr bitmap { get; private set; }
+ Surface surface;
+ /// <summary>
+ /// Preallocated Pointer to output bitmap
+ /// </summary>
+ /// <param name="pBitmap"></param>
+ public OffscreenVulkanContext (Interface iface) : base (iface) {
+#if DEBUG
+ instance = new Instance (Ext.I.VK_EXT_debug_utils);
+#else
+ instance = new Instance ();
+#endif
+ phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault ();
+ VkPhysicalDeviceFeatures enabledFeatures = default;
+ dev = new vke.Device (phy);
+ graphicQueue = new Queue (dev, VkQueueFlags.Graphics);
+ dev.Activate (enabledFeatures);
+
+ createVkvgDevice ();
+ }
+ public override void CreateSurface (int width, int height, ref Surface surf) {
+ surf?.Dispose ();
+ surface = new Surface (VkvgDevice, width, height);
+ surf = surface;
+
+ this.width = (uint)width;
+ this.height = (uint)height;
+
+ if (bitmap != IntPtr.Zero)
+ Marshal.FreeHGlobal (bitmap);
+ bitmap = Marshal.AllocHGlobal (height * width * 4);
+ Console.WriteLine($"vkCtx.CreateOffscreenSurface: w:{width} h:{height}");
+ }
+ public override bool render () {
+ surface.WriteTo (bitmap);
+ Console.WriteLine($"vkCtx.Render(WriteTo): w:{width} h:{height}");
+ return true;
+ }
+ protected override void Dispose (bool disposing) {
+ if (!isDisposed) {
+ dev.WaitIdle ();
+
+ surface?.Dispose ();
+ if (bitmap != IntPtr.Zero)
+ Marshal.FreeHGlobal (bitmap);
+
+ base.Dispose (disposing);
+ }
+ }
+ }
+ /// <summary>
+ /// Base class to build vulkan application.
+ /// Provide default swapchain with its command pool and buffers per image and the main present queue
+ /// </summary>
+ public class VulkanContext : VulkanContextBase {
+ IntPtr hWin;/** GLFW window native pointer. */
+ /**Vulkan Surface */
+ protected VkSurfaceKHR hSurf;
+ protected SwapChain swapChain;
+ protected CommandPool cmdPool;
+ protected PrimaryCommandBuffer[] cmds;
+ protected VkSemaphore[] drawComplete;
+ protected Fence drawFence;
+
+ protected uint fps { get; private set; }
+ protected bool updateViewRequested = true;
+
+ /// <summary>readonly GLFW window handle</summary>
+ public IntPtr WindowHandle => hWin;
+
+ uint frameCount;
+ Stopwatch frameChrono;
+
+ public VulkanContext (Interface iface, IntPtr hWin, uint _width, uint _height, bool vsync = false) : base (iface) {
+ this.hWin = hWin;
+
+ SwapChain.IMAGES_USAGE = VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransferDst;
+ SwapChain.PREFERED_FORMAT = VkFormat.B8g8r8a8Unorm;
+
+ //Instance.VALIDATION = true;
+ //Instance.RENDER_DOC_CAPTURE = true;
+ List<string> instExts = new List<string> (Glfw3.GetRequiredInstanceExtensions ());
+#if DEBUG
+ instExts.Add (Ext.I.VK_EXT_debug_utils);
+#endif
+
+ instance = new Instance (instExts.ToArray());
+ hSurf = instance.CreateSurface (hWin);
+
+ phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault (p => p.HasSwapChainSupport);
+
+ VkPhysicalDeviceFeatures enabledFeatures = default;
+
+ //First create the c# device class
+ dev = new vke.Device (phy);
+
+ graphicQueue = new PresentQueue (dev, VkQueueFlags.Graphics, hSurf);
+
+ //activate the device to have effective queues created accordingly to what's available
+ dev.Activate (enabledFeatures, Ext.D.VK_KHR_swapchain);
+
+ swapChain = new SwapChain (graphicQueue as PresentQueue, _width, _height, SwapChain.PREFERED_FORMAT,
+ vsync ? VkPresentModeKHR.FifoKHR : VkPresentModeKHR.ImmediateKHR);
+ swapChain.Activate ();
+
+ width = swapChain.Width;
+ height = swapChain.Height;
+
+ cmdPool = new CommandPool (dev, graphicQueue.qFamIndex, VkCommandPoolCreateFlags.ResetCommandBuffer);
+ cmds = cmdPool.AllocateCommandBuffer (swapChain.ImageCount);
+
+ drawComplete = new VkSemaphore[swapChain.ImageCount];
+ drawFence = new Fence (dev, true, "draw fence");
+
+ for (int i = 0; i < swapChain.ImageCount; i++) {
+ drawComplete[i] = dev.CreateSemaphore ();
+ drawComplete[i].SetDebugMarkerName (dev, "Semaphore DrawComplete" + i);
+ }
+
+ cmdPool.SetName ("main CmdPool");
+
+ createVkvgDevice ();
+ }
+
+ public override void CreateSurface (int width, int height, ref Surface surf) {
+ WaitIdle();
+
+ blitSource?.Dispose ();
+ surf?.Dispose ();
+ surf = new Surface (VkvgDevice, width, height);
+ buildBlitCommand (surf);
+
+ WaitIdle();
+ }
+
+ internal vke.Image blitSource;
+
+ void buildBlitCommand (Crow.Drawing.Surface surf) {
+ //Console.WriteLine ($"build blit w:{width} h:{height}");
+ cmdPool.Reset();
+
+ blitSource = new vke.Image (dev, new VkImage((ulong)surf.VkImage.ToInt64()), Vulkan.VkFormat.B8g8r8a8Unorm,
+ Vulkan.VkImageUsageFlags.TransferSrc | Vulkan.VkImageUsageFlags.TransferDst | Vulkan.VkImageUsageFlags.ColorAttachment,
+ width, height);
+
+ for (int i = 0; i < swapChain.ImageCount; i++) {
+ vke.Image blitDest = swapChain.images[i];
+ vke.PrimaryCommandBuffer cmd = cmds[i];
+ cmd.Start();
+
+ blitDest.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
+ VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
+
+ blitSource.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
+ VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
+
+ blitSource.BlitTo (cmd, blitDest, VkFilter.Nearest);
+
+ blitDest.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.TransferDstOptimal, VkImageLayout.PresentSrcKHR,
+ VkPipelineStageFlags.Transfer, VkPipelineStageFlags.BottomOfPipe);
+
+ blitSource.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal,
+ VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ColorAttachmentOutput);
+
+ cmd.End ();
+ }
+ }
+ /// <summary>
+ /// Main render method called each frame. get next swapchain image, process resize if needed, submit and present to the presentQueue.
+ /// Wait QueueIdle after presenting.
+ /// </summary>
+ public override bool render () {
+ WaitIdle();
+
+ int idx = swapChain.GetNextImage ();
+ if (idx < 0) {
+ width = swapChain.Width;
+ height = swapChain.Height;
+ //Console.WriteLine ($"get next image failed w:{width} h:{height}");
+ return false;
+ }
+
+ if (cmds[idx] == null)
+ return false;
+
+ drawFence.Wait ();
+ drawFence.Reset ();
+
+ graphicQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx], drawFence);
+ (graphicQueue as PresentQueue).Present (swapChain, drawComplete[idx]);
+
+ WaitIdle();
+ iface.IsDirty = false;
+ return true;
+ }
+ protected override void Dispose (bool disposing) {
+ if (!isDisposed) {
+ dev.WaitIdle ();
+
+ for (int i = 0; i < swapChain.ImageCount; i++) {
+ dev.DestroySemaphore (drawComplete[i]);
+ cmds[i].Free ();
+ }
+ drawFence.Dispose ();
+ swapChain.Dispose ();
+
+ vkDestroySurfaceKHR (instance.Handle, hSurf, IntPtr.Zero);
+
+ if (disposing)
+ cmdPool.Dispose ();
+
+ base.Dispose (disposing);
+ }
+ }
+ }
+}
--- /dev/null
+//from Mono.Cairo
+//fake FontOptions
+
+using System;
+
+namespace Crow.Drawing
+{
+ public enum SubpixelOrder
+ {
+ Default,
+ Rgb,
+ Bgr,
+ Vrgb,
+ Vbgr,
+ }
+ public enum HintMetrics
+ {
+ Default,
+ Off,
+ On,
+ }
+ public enum HintStyle
+ {
+ Default,
+ None,
+ Slight,
+ Medium,
+ Full,
+ }
+ public class FontOptions : IDisposable
+ {
+ public FontOptions () { }
+
+
+ public FontOptions Copy () => default;
+
+
+ public IntPtr Handle {
+ get ;
+ }
+
+
+ public void Merge (FontOptions other)
+ {
+ }
+
+ public void Dispose() {}
+
+ public Antialias Antialias {
+ get ;
+ set ;
+ }
+
+ public HintMetrics HintMetrics {
+ get ;
+ set ;
+ }
+
+ public HintStyle HintStyle {
+ get ;
+ set ;
+ }
+
+ public Status Status {
+ get ;
+ }
+
+ public SubpixelOrder SubpixelOrder {
+ get ;
+ set ;
+ }
+ }
+}
+
--- /dev/null
+// Copyright (c) 2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System.Collections.Generic;
+using System;
+
+
+namespace Crow {
+ public enum RegionOverlap {
+ In,
+ Out,
+ Part,
+ }
+ public class Region : IDisposable
+ {
+ public List<Rectangle> list = new List<Rectangle>();
+ public int count => list.Count;
+ public int NumRectangles => list.Count;
+ public bool IsEmpty => list.Count == 0;
+ public Rectangle GetRectangle(int i) => list[i];
+
+ public void AddRectangle(Rectangle r)
+ {
+ if (r == default)
+ return;
+ if (DoesNotContains (r)) {
+ list.Add (r);
+ boundsUpToDate = false;
+ }
+ }
+ public void Reset()
+ {
+ list = new List<Rectangle>();
+ _bounds = default;
+ boundsUpToDate = true;
+ }
+ public bool DoesNotContains(Rectangle r)
+ {
+ foreach (Rectangle rInList in list)
+ if (rInList.ContainsOrIsEqual(r))
+ return false;
+ return true;
+ }
+ public bool OverlapOut (Rectangle r) {
+ foreach (Rectangle rInList in list)
+ if (rInList.Intersect(r))
+ return false;
+ return true;
+ }
+
+ public bool intersect(Rectangle r)
+ {
+ foreach (Rectangle rInList in list)
+ if (rInList.Intersect(r))
+ return true;
+ return false;
+ }
+ public void stroke(Context ctx, Color c)
+ {
+ foreach (Rectangle r in list)
+ ctx.Rectangle(r);
+
+ ctx.SetSource(c);
+
+ ctx.LineWidth = 2;
+ ctx.Stroke ();
+ }
+ public void clearAndClip(Context ctx)
+ {
+ if (list.Count == 0)
+ return;
+ foreach (Rectangle r in list)
+ ctx.Rectangle(r);
+
+ ctx.ClipPreserve();
+ ctx.Operator = Operator.Clear;
+ ctx.Fill();
+ ctx.Operator = Operator.Over;
+ }
+
+ public void clip(Context ctx)
+ {
+ foreach (Rectangle r in list)
+ ctx.Rectangle(r);
+
+ ctx.Clip();
+ }
+ public void UnionRectangle (Rectangle r) {
+ /*if (r == default)
+ System.Diagnostics.Debugger.Break ();*/
+ AddRectangle (r);
+ }
+ Rectangle _bounds;
+ bool boundsUpToDate = true;
+ public Rectangle Bounds {
+ get {
+ if (!boundsUpToDate) {
+ if (list.Count > 0) {
+ _bounds = list [0];
+ for (int i = 1; i < list.Count; i++) {
+ _bounds += list [i];
+ }
+ } else
+ _bounds = default;
+ boundsUpToDate = true;
+ }
+ return _bounds;
+ }
+ }
+ public void clear(Context ctx)
+ {
+ foreach (Rectangle r in list)
+ ctx.Rectangle(r);
+ ctx.Operator = Operator.Clear;
+ ctx.Fill();
+ ctx.Operator = Operator.Over;
+ }
+ public override string ToString ()
+ {
+ string tmp = "";
+ foreach (Rectangle r in list) {
+ tmp += r.ToString ();
+ }
+ return tmp;
+ }
+
+ public void Dispose()
+ {
+
+ }
+ }
+}
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTests", "Samples\PerfTests\PerfTests.csproj", "{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drawing2D", "Drawing2D\Drawing2D.csproj", "{B9E665AC-92A5-4F53-A021-7B27A8014BC3}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Backends", "Backends", "{451F5727-2A2E-4361-A41B-089429ADE8F9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CairoBackend", "Backends\CairoBackend\CairoBackend.csproj", "{E06441A9-0CFD-45BB-9478-99D28CEB327F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
{F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
{56329D48-D382-4850-93DE-59C453894E8A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
+ {E06441A9-0CFD-45BB-9478-99D28CEB327F} = {451F5727-2A2E-4361-A41B-089429ADE8F9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {00D4E149-7131-49F4-BAAD-559AA961A78E}
<PackageReference Include="StbImageSharp" Version="2.22.4" />
</ItemGroup>
- <PropertyGroup Condition=" '$(CrowDebugLogEnabled)' == 'true'" >
+ <PropertyGroup Condition=" '$(CrowDebugLogEnabled)' == 'true'">
<DefineConstants>$(DefineConstants);DEBUG_LOG</DefineConstants>
</PropertyGroup>
- <PropertyGroup Condition=" '$(CrowDebugStatsEnabled)' == 'true'" >
+ <PropertyGroup Condition=" '$(CrowDebugStatsEnabled)' == 'true'">
<DefineConstants>$(DefineConstants);DEBUG_STATS</DefineConstants>
</PropertyGroup>
- <PropertyGroup Condition=" '$(CrowDesignModeEnabled)' == 'true'" >
+ <PropertyGroup Condition=" '$(CrowDesignModeEnabled)' == 'true'">
<DefineConstants>$(DefineConstants);DESIGN_MODE</DefineConstants>
</PropertyGroup>
<!--<ItemGroup>
</ItemGroup>
<ItemGroup Condition=" '$(CrowVkvgBackend)' != 'true'">
- <Compile Include="src\GraphicBackends\Mono.Cairo\**\*.*"
- Exclude="src\GraphicBackends\Mono.Cairo\NativeMethods-internal.cs" />
+ <Compile Include="src\GraphicBackends\Mono.Cairo\**\*.*" Exclude="src\GraphicBackends\Mono.Cairo\NativeMethods-internal.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Remove="src\Widgets\ColorPicker2.cs" />
</ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Drawing2D\Drawing2D.csproj" />
+ </ItemGroup>
</Project>
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Crow
-{
- public struct Point : IEquatable<Point>, IEquatable<int>
- {
- public int X, Y;
-
- #region CTOR
- public Point (int x, int y) {
- X = x;
- Y = y;
- }
- public Point (int pos) {
- X = pos;
- Y = pos;
- }
- #endregion
-
- public int Length => (int)Math.Sqrt (Math.Pow (X, 2) + Math.Pow (Y, 2));
- public double LengthD => Math.Sqrt (Math.Pow (X, 2) + Math.Pow (Y, 2));
- public Point Normalized {
- get {
- int l = Length;
- return new Point (X / l, Y / l);
- }
- }
- public static implicit operator PointD (Point p) => new PointD (p.X, p.Y);
- public static implicit operator Point (int i) => new Point (i, i);
-
- public static Point operator + (Point p1, Point p2) => new Point (p1.X + p2.X, p1.Y + p2.Y);
- public static Point operator + (Point p, int i) => new Point (p.X + i, p.Y + i);
- public static Point operator - (Point p1, Point p2) => new Point (p1.X - p2.X, p1.Y - p2.Y);
- public static Point operator - (Point p, int i) => new Point (p.X - i, p.Y - i);
- public static Point operator * (Point p1, Point p2) => new Point (p1.X * p2.X, p1.Y * p2.Y);
- public static Point operator * (Point p, int d) => new Point (p.X * d, p.Y * d);
- public static Point operator / (Point p1, Point p2) => new Point (p1.X / p2.X, p1.Y / p2.Y);
- public static Point operator / (Point p, int d) => new Point (p.X / d, p.Y / d);
-
- public static bool operator == (Point s1, Point s2) => s1.Equals (s2);
- public static bool operator != (Point s1, Point s2) => !s1.Equals (s2);
- public static bool operator == (Point s, int i) => s.Equals(i);
- public static bool operator != (Point s, int i) => !s.Equals (i);
- public static bool operator > (Point p1, Point p2) => p1.X > p2.X && p1.Y > p2.Y;
- public static bool operator > (Point s, int i) => s.X > i && s.Y > i;
- public static bool operator < (Point p1, Point p2) => p1.X < p2.X && p1.Y < p2.Y;
- public static bool operator < (Point s, int i) => s.X < i && s.Y < i;
- public static bool operator >= (Point p1, Point p2) => p1.X >= p2.X && p1.Y >= p2.Y;
- public static bool operator >= (Point s, int i) => s.X >= i && s.Y >= i;
- public static bool operator <= (Point p1, Point p2) => p1.X <= p2.X && p1.Y <= p2.Y;
- public static bool operator <= (Point s, int i) => s.X <= i && s.Y <= i;
-
- public bool Equals (Point other) => X == other.X && Y == other.Y;
- public bool Equals (int other) => X == other && Y == other;
-
-
- public override int GetHashCode () => HashCode.Combine (X, Y);
- public override bool Equals (object obj) => obj is Point s ? Equals (s) : false;
- public override string ToString () => $"{X},{Y}";
- public static Point Parse (string s) {
- ReadOnlySpan<char> tmp = s.AsSpan ();
- if (tmp.Length == 0)
- return default (Point);
- int ioc = tmp.IndexOf (',');
- return ioc < 0 ? new Point (int.Parse (tmp)) : new Point (
- int.Parse (tmp.Slice (0, ioc)),
- int.Parse (tmp.Slice (ioc + 1)));
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace Crow {
- public struct PointD {
- public double X;
- public double Y;
- public PointD (double x, double y)
- {
- X = x;
- Y = y;
- }
-
- public double Length => Math.Sqrt (Math.Pow (X, 2) + Math.Pow (Y, 2));
- public PointD Normalized {
- get {
- double l = Length;
- return new PointD (X / l, Y / l);
- }
- }
- public static implicit operator Point (PointD p) => new Point ((int)Math.Round (p.X), (int)Math.Round (p.Y));
- public static implicit operator PointD (double i) => new PointD (i, i);
-
- public static PointD operator + (PointD p1, PointD p2) => new PointD (p1.X + p2.X, p1.Y + p2.Y);
- public static PointD operator + (PointD p, double i) => new PointD (p.X + i, p.Y + i);
- public static PointD operator - (PointD p1, PointD p2) => new PointD (p1.X - p2.X, p1.Y - p2.Y);
- public static PointD operator - (PointD p, double i) => new PointD (p.X - i, p.Y - i);
- public static PointD operator * (PointD p1, PointD p2) => new PointD (p1.X * p2.X, p1.Y * p2.Y);
- public static PointD operator * (PointD p, double d) => new PointD (p.X * d, p.Y * d);
- public static PointD operator / (PointD p1, PointD p2) => new PointD (p1.X / p2.X, p1.Y / p2.Y);
- public static PointD operator / (PointD p, double d) => new PointD (p.X / d, p.Y / d);
-
- public static bool operator == (PointD s1, PointD s2) => s1.X == s2.X && s1.Y == s2.Y;
- public static bool operator == (PointD s, double i) => s.X == i && s.Y == i;
- public static bool operator != (PointD s1, PointD s2) => !(s1.X == s2.X && s1.Y == s2.Y);
- public static bool operator != (PointD s, double i) => !(s.X == i && s.Y == i);
- public static bool operator > (PointD p1, PointD p2) => p1.X > p2.X && p1.Y > p2.Y;
- public static bool operator > (PointD s, double i) => s.X > i && s.Y > i;
- public static bool operator < (PointD p1, PointD p2) => p1.X < p2.X && p1.Y < p2.Y;
- public static bool operator < (PointD s, double i) => s.X < i && s.Y < i;
- public static bool operator >= (PointD p1, PointD p2) => p1.X >= p2.X && p1.Y >= p2.Y;
- public static bool operator >= (PointD s, double i) => s.X >= i && s.Y >= i;
- public static bool operator <= (PointD p1, PointD p2) => p1.X <= p2.X && p1.Y <= p2.Y;
- public static bool operator <= (PointD s, double i) => s.X <= i && s.Y <= i;
-
- public override string ToString () => string.Format ("{0},{1}", X, Y);
- public override bool Equals (object obj) => obj is PointD ? this == (PointD)obj :
- obj is Point && (Point)this == (Point)obj;
- public static PointD Parse (string s)
- {
- if (string.IsNullOrEmpty (s))
- return default (PointD);
- string [] d = s.Trim ().Split (',');
- if (d.Length == 2)
- return new PointD (double.Parse (d [0]), double.Parse (d [1]));
- else if (d.Length == 1) {
- double tmp = double.Parse (d [0]);
- return new PointD (tmp, tmp);
- }
- throw new Exception ("Crow.PointD Parsing Error: " + s);
- }
-
- public override int GetHashCode ()
- {
-#pragma warning disable RECS0025 // Champ autre qu’en lecture seule référencé dans « GetHashCode() »
- unchecked {
- var hashCode = 1861411795;
- hashCode = hashCode * -1521134295 + X.GetHashCode ();
-
- hashCode = hashCode * -1521134295 + Y.GetHashCode ();
- return hashCode;
- }
-#pragma warning restore RECS0025 // Champ autre qu’en lecture seule référencé dans « GetHashCode() » }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow {
- [StructLayout(LayoutKind.Sequential)]
- public struct Rectangle
- {
- public static readonly Rectangle Zero = new Rectangle (0, 0, 0, 0);
-
- public int X, Y, Width, Height;
-
- #region ctor
- public Rectangle(Point p, Size s): this (p.X, p.Y, s.Width, s.Height) { }
- public Rectangle(Size s) : this (0, 0, s.Width, s.Height) { }
- public Rectangle(int x, int y, int width, int height) {
- X = x;
- Y = y;
- Width = width;
- Height = height;
- }
- #endregion
-
- #region PROPERTIES
- [XmlIgnore]public int Left{
- get => X;
- set { X = value; }
- }
- [XmlIgnore]public int Top{
- get => Y;
- set { Y = value; }
- }
- [XmlIgnore] public int Right => X + Width;
- [XmlIgnore]public int Bottom => Y + Height;
- [XmlIgnore]public Size Size{
- get => new Size (Width, Height);
- set {
- Width = value.Width;
- Height = value.Height;
- }
- }
- [XmlIgnore]
- public SizeD SizeD => new SizeD (Width, Height);
- [XmlIgnore]public Point Position{
- get => new Point (X, Y);
- set {
- X = value.X;
- Y = value.Y;
- }
- }
- [XmlIgnore]public Point TopLeft{
- get => new Point (X, Y);
- set {
- X = value.X;
- Y = value.Y;
- }
- }
- [XmlIgnore] public Point TopRight => new Point (Right, Y);
- [XmlIgnore] public Point BottomLeft => new Point (X, Bottom);
- [XmlIgnore] public Point BottomRight => new Point (Right, Bottom);
- [XmlIgnore] public Point Center => new Point (Left + Width / 2, Top + Height / 2);
- [XmlIgnore] public Point CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0);
-
- #endregion
-
- #region FUNCTIONS
- public void Inflate(int xDelta, int yDelta)
- {
- this.X -= xDelta;
- this.Width += 2 * xDelta;
- this.Y -= yDelta;
- this.Height += 2 * yDelta;
- }
- public void Inflate(int delta)
- {
- Inflate (delta, delta);
- }
- public Rectangle Inflated (int delta) => Inflated (delta, delta);
- public Rectangle Inflated (int deltaX, int deltaY) {
- Rectangle r = this;
- r.Inflate (deltaX, deltaY);
- return r;
- }
- public void Scale (double factor) {
- X = (int)Math.Round(factor * X);
- Y = (int)Math.Round(factor * Y);
- Width = (int)Math.Round(factor * Width);
- Height = (int)Math.Round(factor * Height);
- }
- public Rectangle Scaled (double factor) {
- return new Rectangle (
- (int)Math.Round(factor * X),
- (int)Math.Round(factor * Y),
- (int)Math.Round(factor * Width),
- (int)Math.Round(factor * Height));
- }
- public RectangleD ScaledD (double factor) {
- return new RectangleD (
- factor * X,
- factor * Y,
- factor * Width,
- factor * Height);
- }
- public bool ContainsOrIsEqual (Point p) => (p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height);
- public bool ContainsOrIsEqual (Rectangle r) => r.TopLeft >= this.TopLeft && r.BottomRight <= this.BottomRight;
- public bool Intersect(Rectangle r)
- {
- int maxLeft = Math.Max(this.Left, r.Left);
- int minRight = Math.Min(this.Right, r.Right);
- int maxTop = Math.Max(this.Top, r.Top);
- int minBottom = Math.Min(this.Bottom, r.Bottom);
-
- return (maxLeft < minRight) && (maxTop < minBottom);
- }
- public Rectangle Intersection(Rectangle r)
- {
- Rectangle result = new Rectangle();
-
- if (r.Left >= Left)
- result.Left = r.Left;
- else
- result.TopLeft = TopLeft;
-
- if (r.Right >= Right)
- result.Width = Right - result.Left;
- else
- result.Width = r.Right - result.Left;
-
- if (r.Top >= Top)
- result.Top = r.Top;
- else
- result.Top = Top;
-
- if (r.Bottom >= Bottom)
- result.Height = Bottom - result.Top;
- else
- result.Height = r.Bottom - result.Top;
-
- return result;
- }
- #endregion
-
- #region operators
- public static Rectangle operator +(Rectangle r1, Rectangle r2)
- {
- int x = Math.Min(r1.X, r2.X);
- int y = Math.Min(r1.Y, r2.Y);
- int x2 = Math.Max(r1.Right, r2.Right);
- int y2 = Math.Max(r1.Bottom, r2.Bottom);
- return new Rectangle(x, y, x2 - x, y2 - y);
- }
- public static Rectangle operator + (Rectangle r, Point p) => new Rectangle (r.X + p.X, r.Y + p.Y, r.Width, r.Height);
- public static Rectangle operator - (Rectangle r, Point p) => new Rectangle (r.X - p.X, r.Y - p.Y, r.Width, r.Height);
- public static bool operator == (Rectangle r1, Rectangle r2) => r1.TopLeft == r2.TopLeft && r1.Size == r2.Size;
- public static bool operator != (Rectangle r1, Rectangle r2) => !(r1.TopLeft == r2.TopLeft && r1.Size == r2.Size);
-
- public static implicit operator Rectangle (RectangleD r) => new Rectangle ((int)Math.Round(r.X), (int)Math.Round (r.Y),
- (int)Math.Round (r.Width), (int)Math.Round (r.Height));
- #endregion
-
- public override string ToString () => $"{X},{Y},{Width},{Height}";
- public static Rectangle Parse(string s)
- {
- string[] d = s.Split(new char[] { ',' });
- return new Rectangle(
- int.Parse(d[0]),
- int.Parse(d[1]),
- int.Parse(d[2]),
- int.Parse(d[3]));
- }
- public override int GetHashCode ()
- {
- unchecked // Overflow is fine, just wrap
- {
- int hash = 17;
- // Suitable nullity checks etc, of course :)
- hash = hash * 23 + X.GetHashCode();
- hash = hash * 23 + Y.GetHashCode();
- hash = hash * 23 + Width.GetHashCode();
- hash = hash * 23 + Height.GetHashCode();
- return hash;
- }
- }
- public override bool Equals (object obj) => (obj == null || obj.GetType () != typeof (Rectangle)) ?
- false : this == (Rectangle)obj;
- }
-}
+++ /dev/null
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow {
- [StructLayout(LayoutKind.Sequential)]
- public struct RectangleD
- {
- public static readonly RectangleD Zero = new RectangleD (0, 0, 0, 0);
-
- public double X, Y, Width, Height;
-
- #region ctor
- public RectangleD(PointD p, Size s): this (p.X, p.Y, s.Width, s.Height) { }
- public RectangleD(SizeD s) : this (0, 0, s.Width, s.Height) { }
- public RectangleD(double x, double y, double width, double height) {
- X = x;
- Y = y;
- Width = width;
- Height = height;
- }
- #endregion
-
- #region PROPERTIES
- [XmlIgnore]public double Left{
- get => X;
- set { X = value; }
- }
- [XmlIgnore]public double Top{
- get => Y;
- set { Y = value; }
- }
- [XmlIgnore] public double Right => X + Width;
- [XmlIgnore]public double Bottom => Y + Height;
- [XmlIgnore]public SizeD Size{
- get => new SizeD (Width, Height);
- set {
- Width = value.Width;
- Height = value.Height;
- }
- }
- [XmlIgnore]public PointD Position{
- get => new PointD (X, Y);
- set {
- X = value.X;
- Y = value.Y;
- }
- }
- [XmlIgnore]public PointD TopLeft{
- get => new PointD (X, Y);
- set {
- X = value.X;
- Y = value.Y;
- }
- }
- [XmlIgnore] public PointD TopRight => new PointD (Right, Y);
- [XmlIgnore] public PointD BottomLeft => new PointD (X, Bottom);
- [XmlIgnore] public PointD BottomRight => new PointD (Right, Bottom);
- [XmlIgnore] public PointD Center => new PointD (Left + Width / 2, Top + Height / 2);
- [XmlIgnore] public PointD CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0);
-
- #endregion
-
- #region FUNCTIONS
- public void Inflate(double xDelta, double yDelta)
- {
- this.X -= xDelta;
- this.Width += 2 * xDelta;
- this.Y -= yDelta;
- this.Height += 2 * yDelta;
- }
- public void Inflate(double delta)
- {
- Inflate (delta, delta);
- }
- public RectangleD Inflated (double delta) => Inflated (delta, delta);
- public RectangleD Inflated (double deltaX, double deltaY) {
- RectangleD r = this;
- r.Inflate (deltaX, deltaY);
- return r;
- }
- public bool ContainsOrIsEqual (PointD p) => (p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height);
- public bool ContainsOrIsEqual (RectangleD r) => r.TopLeft >= this.TopLeft && r.BottomRight <= this.BottomRight;
- public bool Intersect(RectangleD r)
- {
- double maxLeft = Math.Max(this.Left, r.Left);
- double minRight = Math.Min(this.Right, r.Right);
- double maxTop = Math.Max(this.Top, r.Top);
- double minBottom = Math.Min(this.Bottom, r.Bottom);
-
- return (maxLeft < minRight) && (maxTop < minBottom);
- }
- public RectangleD Intersection(RectangleD r)
- {
- RectangleD result = new RectangleD();
-
- if (r.Left >= Left)
- result.Left = r.Left;
- else
- result.TopLeft = TopLeft;
-
- if (r.Right >= Right)
- result.Width = Right - result.Left;
- else
- result.Width = r.Right - result.Left;
-
- if (r.Top >= Top)
- result.Top = r.Top;
- else
- result.Top = Top;
-
- if (r.Bottom >= Bottom)
- result.Height = Bottom - result.Top;
- else
- result.Height = r.Bottom - result.Top;
-
- return result;
- }
- #endregion
-
- #region operators
- public static RectangleD operator +(RectangleD r1, RectangleD r2)
- {
- double x = Math.Min(r1.X, r2.X);
- double y = Math.Min(r1.Y, r2.Y);
- double x2 = Math.Max(r1.Right, r2.Right);
- double y2 = Math.Max(r1.Bottom, r2.Bottom);
- return new RectangleD(x, y, x2 - x, y2 - y);
- }
- public static RectangleD operator + (RectangleD r, PointD p) => new RectangleD (r.X + p.X, r.Y + p.Y, r.Width, r.Height);
- public static RectangleD operator - (RectangleD r, PointD p) => new RectangleD (r.X - p.X, r.Y - p.Y, r.Width, r.Height);
- public static bool operator == (RectangleD r1, RectangleD r2) => r1.TopLeft == r2.TopLeft && r1.Size == r2.Size;
- public static bool operator != (RectangleD r1, RectangleD r2) => !(r1.TopLeft == r2.TopLeft && r1.Size == r2.Size);
-
- public static implicit operator RectangleD(Rectangle r) => new RectangleD(r.X,r.Y,r.Width,r.Height);
- #endregion
-
- public override string ToString () => $"{X},{Y},{Width},{Height}";
- public static RectangleD Parse(string s)
- {
- string[] d = s.Split(new char[] { ',' });
- return new RectangleD(
- double.Parse(d[0]),
- double.Parse(d[1]),
- double.Parse(d[2]),
- double.Parse(d[3]));
- }
- public override int GetHashCode ()
- {
- unchecked // Overflow is fine, just wrap
- {
- int hash = 17;
- // Suitable nullity checks etc, of course :)
- hash = hash * 23 + X.GetHashCode();
- hash = hash * 23 + Y.GetHashCode();
- hash = hash * 23 + Width.GetHashCode();
- hash = hash * 23 + Height.GetHashCode();
- return hash;
- }
- }
- public override bool Equals (object obj) => (obj == null || obj.GetType () != typeof (RectangleD)) ?
- false : this == (RectangleD)obj;
- }
-}
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace Crow
-{
- public struct Size : IEquatable<Size>, IEquatable<int>
- {
- public int Width, Height;
-
- #region CTOR
- public Size (int width, int height)
- {
- Width = width;
- Height = height;
- }
- public Size (int size)
- {
- Width = size;
- Height = size;
- }
- #endregion
-
- #region operators
- public static implicit operator Rectangle(Size s)=> new Rectangle (s);
- public static implicit operator Size(int i)=> new Size(i, i);
- public static implicit operator string(Size s)=> s.ToString ();
- public static implicit operator Size(string s)=> Parse (s);
-
- public static bool operator == (Size s1, Size s2) => s1.Equals(s2);
- public static bool operator != (Size s1, Size s2) => !s1.Equals (s2);
- public static bool operator > (Size s1, Size s2) => (s1.Width > s2.Width && s1.Height > s2.Height);
- public static bool operator >= (Size s1, Size s2) => (s1.Width >= s2.Width && s1.Height >= s2.Height);
- public static bool operator < (Size s1, Size s2) => (s1.Width < s2.Width) ? s1.Height <= s2.Height :
- (s1.Width == s2.Width && s1.Height < s2.Height);
- public static bool operator < (Size s, int i) => s.Width < i && s.Height < i;
- public static bool operator <= (Size s, int i) => s.Width <= i && s.Height <= i;
- public static bool operator > (Size s, int i) => s.Width > i && s.Height > i;
- public static bool operator >= (Size s, int i) => s.Width >= i && s.Height >= i;
- public static bool operator <= (Size s1, Size s2) => (s1.Width <= s2.Width && s1.Height <= s2.Height);
- /*public static bool operator == (Size s, int i) => (s.Width == i && s.Height == i);
- public static bool operator != (Size s, int i) => (s.Width != i || s.Height != i);*/
- public static Size operator + (Size s1, Size s2) => new Size (s1.Width + s2.Width, s1.Height + s2.Height);
- public static Size operator + (Size s, int i) => new Size (s.Width + i, s.Height + i);
- public static Size operator * (Size s, int i) => new Size (s.Width * i, s.Height * i);
- public static Size operator / (Size s, int i) => new Size (s.Width / i, s.Height / i);
-
- public static Size operator * (Size s, double i) => new Size ((int)(s.Width * i), (int)(s.Height * i));
- #endregion
-
-
- public bool Equals (Size other) => Width == other.Width && Height == other.Height;
- public bool Equals (int other) => Width == other && Height == other;
-
- public override int GetHashCode () => HashCode.Combine (Width, Height);
- public override bool Equals (object obj) => obj is Size s ? Equals(s) : false;
- public override string ToString () => $"{Width},{Height}";
- public static Size Parse(string s)
- {
- ReadOnlySpan<char> tmp = s.AsSpan ();
- if (tmp.Length == 0)
- return default (Size);
- int ioc = tmp.IndexOf (',');
- return ioc < 0 ? new Size (int.Parse (tmp)) : new Size (
- int.Parse (tmp.Slice (0, ioc)),
- int.Parse (tmp.Slice (ioc + 1)));
- }
-
- }
-}
+++ /dev/null
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-namespace Crow
-{
- public struct SizeD {
- public static SizeD Zero => new SizeD (0, 0);
-
- public double Width, Height;
-
- #region CTOR
- public SizeD (double width, double height)
- {
- Width = width;
- Height = height;
- }
- public SizeD (double size)
- {
- Width = size;
- Height = size;
- }
- #endregion
-
- #region operators
- public static implicit operator RectangleD (SizeD s) => new RectangleD (s);
- public static implicit operator SizeD (double i) => new SizeD (i, i);
- public static implicit operator string (SizeD s) => s.ToString ();
- public static implicit operator SizeD (string s) => string.IsNullOrEmpty (s) ? Zero : Parse (s);
-
- public static bool operator == (SizeD s1, SizeD s2) => (s1.Width == s2.Width && s1.Height == s2.Height);
- public static bool operator != (SizeD s1, SizeD s2) => (s1.Width == s2.Width && s1.Height == s2.Height);
- public static bool operator > (SizeD s1, SizeD s2) => (s1.Width > s2.Width && s1.Height > s2.Height);
- public static bool operator >= (SizeD s1, SizeD s2) => (s1.Width >= s2.Width && s1.Height >= s2.Height);
- public static bool operator < (SizeD s1, SizeD s2) => (s1.Width < s2.Width) ? s1.Height <= s2.Height :
- (s1.Width == s2.Width && s1.Height < s2.Height);
- public static bool operator < (SizeD s, double i) => s.Width < i && s.Height < i;
- public static bool operator <= (SizeD s, double i) => s.Width <= i && s.Height <= i;
- public static bool operator > (SizeD s, double i) => s.Width > i && s.Height > i;
- public static bool operator >= (SizeD s, double i) => s.Width >= i && s.Height >= i;
- public static bool operator <= (SizeD s1, SizeD s2) => (s1.Width <= s2.Width && s1.Height <= s2.Height);
- public static bool operator == (SizeD s, double i) => (s.Width == i && s.Height == i);
- public static bool operator != (SizeD s, double i) => (s.Width == i && s.Height == i);
- public static SizeD operator + (SizeD s1, SizeD s2) => new SizeD (s1.Width + s2.Width, s1.Height + s2.Height);
- public static SizeD operator + (SizeD s, double i) => new SizeD (s.Width + i, s.Height + i);
- public static SizeD operator * (SizeD s, double i) => new SizeD (s.Width * i, s.Height * i);
- public static SizeD operator / (SizeD s, double i) => new SizeD (s.Width / i, s.Height / i);
- #endregion
-
- public override int GetHashCode ()
- {
- unchecked // Overflow is fine, just wrap
- {
- int hash = 17;
- // Suitable nullity checks etc, of course :)
- hash = hash * 23 + Width.GetHashCode ();
- hash = hash * 23 + Height.GetHashCode ();
- return hash;
- }
- }
- public override bool Equals (object obj) => (obj == null || obj.GetType () != typeof (SizeD)) ? false : this == (SizeD)obj;
- public override string ToString () => $"{Width},{Height}";
- public static SizeD Parse (string s)
- {
- string [] d = s.Split (new char [] { ',' });
- return d.Length == 1 ? new SizeD (double.Parse (d [0])) : new SizeD (
- double.Parse (d [0]),
- double.Parse (d [1]));
- }
- }
-}
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
-using Crow.Drawing;
+using Drawing2D;
namespace Crow
{
public static class CairoHelpers
- {
+ {
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>
{
if (val.CompareTo(min) < 0) return min;
return arr[minp];
}
- public static void CairoRectangle(Context gr, RectangleD r, double radius, double stroke = 0.0)
+ public static void CairoRectangle(IContext gr, RectangleD r, double radius, double stroke = 0.0)
{
if (radius > 0)
DrawRoundedRectangle (gr, r, radius, stroke);
else
gr.Rectangle (r, stroke);
}
- public static void CairoCircle(Context gr, RectangleD r)
+ public static void CairoCircle(IContext gr, RectangleD r)
{
gr.Arc(r.X + r.Width/2.0, r.Y + r.Height/2.0, Math.Min(r.Width,r.Height)/2.0, 0, 2.0*Math.PI);
}
- public static void DrawRoundedRectangle(Context gr, RectangleD r, double radius, double stroke = 0.0)
+ public static void DrawRoundedRectangle(IContext gr, RectangleD r, double radius, double stroke = 0.0)
{
if (stroke>0.0) {
gr.LineWidth = stroke;
}else
DrawRoundedRectangle(gr, r.X, r.Y, r.Width, r.Height, radius);
}
- public static void DrawRoundedRectangle(Context gr, double x, double y, double width, double height, double radius)
+ public static void DrawRoundedRectangle(IContext gr, double x, double y, double width, double height, double radius)
{
//gr.Save();
gr.ClosePath();
//gr.Restore();
}
- public static void StrokeRaisedRectangle(Context gr, Rectangle r, double width = 1)
+ public static void StrokeRaisedRectangle(IContext gr, Rectangle r, double width = 1)
{
//gr.Save();
r.Inflate((int)-width / 2, (int)-width / 2);
//gr.Restore();
}
- public static void StrokeLoweredRectangle(Context gr, Rectangle r, double width = 1)
+ public static void StrokeLoweredRectangle(IContext gr, Rectangle r, double width = 1)
{
//gr.Save();
r.Inflate((int)-width / 2, (int)-width / 2);
+++ /dev/null
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-//using FastEnumUtility;
-
-namespace Crow
-{
- public enum Colors : UInt32
- {
- AliceBlue = 0xF0F8FFFF,
- AntiqueWhite = 0xFAEBD7FF,
- //Aqua = 0x00FFFFFF,
- Aquamarine = 0x7FFFD4FF,
- Azure = 0xF0FFFFFF,
- Beige = 0xF5F5DCFF,
- Bisque = 0xFFE4C4FF,
- Black = 0x000000FF,
- BlanchedAlmond = 0xFFEBCDFF,
- Blue = 0x0000FFFF,
- BlueViolet = 0x8A2BE2FF,
- Brown = 0xA52A2AFF,
- BurlyWood = 0xDEB887FF,
- CadetBlue = 0x5F9EA0FF,
- Chartreuse = 0x7FFF00FF,
- Chocolate = 0xD2691EFF,
- Coral = 0xFF7F50FF,
- CornflowerBlue = 0x6495EDFF,
- Cornsilk = 0xFFF8DCFF,
- Crimson = 0xDC143CFF,
- Cyan = 0x00FFFFFF,
- DarkBlue = 0x00008BFF,
- DarkCyan = 0x008B8BFF,
- DarkGoldenRod = 0xB8860BFF,
- DarkGrey = 0x202020FF,
- DarkGreen = 0x006400FF,
- DarkKhaki = 0xBDB76BFF,
- DarkMagenta = 0x8B008BFF,
- DarkOliveGreen = 0x556B2FFF,
- DarkOrange = 0xFF8C00FF,
- DarkOrchid = 0x9932CCFF,
- DarkRed = 0x8B0000FF,
- DarkSalmon = 0xE9967AFF,
- DarkSeaGreen = 0x8FBC8FFF,
- DarkSlateBlue = 0x483D8BFF,
- DarkSlateGrey = 0x2F4F4FFF,
- DarkTurquoise = 0x00CED1FF,
- DarkViolet = 0x9400D3FF,
- DeepPink = 0xFF1493FF,
- DeepSkyBlue = 0x00BFFFFF,
- DimGrey = 0x696969FF,
- DodgerBlue = 0x1E90FFFF,
- FireBrick = 0xB22222FF,
- FloralWhite = 0xFFFAF0FF,
- ForestGreen = 0x228B22FF,
- Fuchsia = 0xFF00FFFF,
- Gainsboro = 0xDCDCDCFF,
- GhostWhite = 0xF8F8FFFF,
- Gold = 0xFFD700FF,
- GoldenRod = 0xDAA520FF,
- Grey = 0x808080FF,
- Green = 0x008000FF,
- GreenYellow = 0xADFF2FFF,
- HoneyDew = 0xF0FFF0FF,
- HotPink = 0xFF69B4FF,
- IndianRed = 0xCD5C5CFF,
- Indigo = 0x4B0082FF,
- Ivory = 0xFFFFF0FF,
- Jet = 0x343434FF,
- Khaki = 0xF0E68CFF,
- Lavender = 0xE6E6FAFF,
- LavenderBlush = 0xFFF0F5FF,
- LawnGreen = 0x7CFC00FF,
- LemonChiffon = 0xFFFACDFF,
- LightBlue = 0xADD8E6FF,
- LightCoral = 0xF08080FF,
- LightCyan = 0xE0FFFFFF,
- LightGoldenRodYellow = 0xFAFAD2FF,
- LightGrey = 0xD3D3D3FF,
- LightGreen = 0x90EE90FF,
- LightPink = 0xFFB6C1FF,
- LightSalmon = 0xFFA07AFF,
- LightSeaGreen = 0x20B2AAFF,
- LightSkyBlue = 0x87CEFAFF,
- LightSlateGrey = 0x778899FF,
- LightSteelBlue = 0xB0C4DEFF,
- LightYellow = 0xFFFFE0FF,
- Lime = 0x00FF00FF,
- LimeGreen = 0x32CD32FF,
- Linen = 0xFAF0E6FF,
- Magenta = 0xFF00FFFF,
- Maroon = 0x800000FF,
- MediumAquaMarine = 0x66CDAAFF,
- MediumBlue = 0x0000CDFF,
- MediumOrchid = 0xBA55D3FF,
- MediumPurple = 0x9370DBFF,
- MediumSeaGreen = 0x3CB371FF,
- MediumSlateBlue = 0x7B68EEFF,
- MediumSpringGreen = 0x00FA9AFF,
- MediumTurquoise = 0x48D1CCFF,
- MediumVioletRed = 0xC71585FF,
- MidnightBlue = 0x191970FF,
- MintCream = 0xF5FFFAFF,
- MistyRose = 0xFFE4E1FF,
- Moccasin = 0xFFE4B5FF,
- NavajoWhite = 0xFFDEADFF,
- Navy = 0x000080FF,
- OldLace = 0xFDF5E6FF,
- Olive = 0x808000FF,
- OliveDrab = 0x6B8E23FF,
- Onyx = 0x353839FF,
- Orange = 0xFFA500FF,
- OrangeRed = 0xFF4500FF,
- Orchid = 0xDA70D6FF,
- PaleGoldenRod = 0xEEE8AAFF,
- PaleGreen = 0x98FB98FF,
- PaleTurquoise = 0xAFEEEEFF,
- PaleVioletRed = 0xDB7093FF,
- PapayaWhip = 0xFFEFD5FF,
- PeachPuff = 0xFFDAB9FF,
- Peru = 0xCD853FFF,
- Pink = 0xFFC0CBFF,
- Plum = 0xDDA0DDFF,
- PowderBlue = 0xB0E0E6FF,
- Purple = 0x800080FF,
- RebeccaPurple = 0x663399FF,
- Red = 0xFF0000FF,
- RosyBrown = 0xBC8F8FFF,
- RoyalBlue = 0x4169E1FF,
- SaddleBrown = 0x8B4513FF,
- Salmon = 0xFA8072FF,
- SandyBrown = 0xF4A460FF,
- SeaGreen = 0x2E8B57FF,
- SeaShell = 0xFFF5EEFF,
- Sienna = 0xA0522DFF,
- Silver = 0xC0C0C0FF,
- SkyBlue = 0x87CEEBFF,
- SlateBlue = 0x6A5ACDFF,
- SlateGrey = 0x708090FF,
- Snow = 0xFFFAFAFF,
- SpringGreen = 0x00FF7FFF,
- SteelBlue = 0x4682B4FF,
- Tan = 0xD2B48CFF,
- Teal = 0x008080FF,
- Thistle = 0xD8BFD8FF,
- Tomato = 0xFF6347FF,
- Turquoise = 0x40E0D0FF,
- Violet = 0xEE82EEFF,
- Wheat = 0xF5DEB3FF,
- White = 0xFFFFFFFF,
- WhiteSmoke = 0xF5F5F5FF,
- Yellow = 0xFFFF00FF,
- YellowGreen = 0x9ACD32FF,
-
- Transparent = 0x00,
- Clear = 0x01
- }
-
- /// <summary>
- /// Universal Color structure
- /// </summary>
- public struct Color : IEquatable<Color>
- {
- #region CTOR
- public Color (int r, int g, int b, int a) :
- this ((uint)r, (uint)g, (uint)b, (uint)a) { }
-
- public Color(uint r, uint g, uint b, uint a)
- {
- value =
- ((r & 0xFF) << 24) +
- ((g & 0xFF) << 16) +
- ((b & 0xFF) << 8) +
- ((a & 0xFF));
- }
- public Color (byte r, byte g, byte b, byte a)
- {
- value = ((uint)r << 24) + ((uint)g << 16) + ((uint)b << 8) + a;
- }
- public Color (double r, double g, double b, double a)
- {
- value =
- (((uint)Math.Round (r * 255.0)) << 24) +
- (((uint)Math.Round (g * 255.0)) << 16) +
- (((uint)Math.Round (b * 255.0)) << 8) +
- (((uint)Math.Round (a * 255.0)));
- }
- public Color (ReadOnlySpan<double> rgba) {
- value =
- (((uint)Math.Round (rgba[0] * 255.0)) << 24) +
- (((uint)Math.Round (rgba[1] * 255.0)) << 16) +
- (((uint)Math.Round (rgba[2] * 255.0)) << 8) +
- (((uint)Math.Round (rgba[3] * 255.0)));
- }
- public Color (UInt32 rgba)
- {
- this.value = rgba;
- }
- public Color (Colors color)
- {
- this.value = (UInt32)color;
- }
- #endregion
- //rgba
- UInt32 value;
-
- public uint R {
- get => (value & 0xFF000000) >> 24;
- set => this.value = (value & 0x000000FF) << 24;
- }
- public uint G {
- get => (value & 0x00FF0000) >> 16;
- set => this.value = (value & 0x000000FF) << 16;
- }
- public uint B {
- get => (value & 0x0000FF00) >> 8;
- set => this.value = (value & 0x000000FF) << 8;
- }
- public uint A {
- get => (value & 0x000000FF);
- set => this.value = (value & 0x000000FF);
- }
-
-
-
-
- /*public string Name;
- public string htmlCode;
- internal bool predefinied;*/
-
- #region Operators
- /*public static implicit operator string(Color c) => c.ToString();
-
- public static implicit operator UInt32 (Color c) => c.value;*/
-
- /*public static implicit operator Color(string s)
- {
- }*/
-
- public static implicit operator Color (Colors c) => new Color ((UInt32)c);
- public static implicit operator Colors (Color c) => (Colors)c.value;
- public static bool operator ==(Color a, Color b) => a.Equals (b);
- public static bool operator != (Color a, Color b) => !a.Equals (b);
-
- public static Color operator *(Color c, Double f) => new Color(c.R,c.G,c.B,c.A * f);
- public static Color operator +(Color c1, Color c2) => new Color(c1.R + c2.R,c1.G + c2.G,c1.B + c2.B,c1.A + c2.A);
- public static Color operator -(Color c1, Color c2) =>new Color(c1.R - c2.R,c1.G - c2.G,c1.B - c2.B,c1.A - c2.A);
- #endregion
-
- /// <summary>
- /// compute the hue of the color
- /// </summary>
- public uint Hue {
- get {
- double r = R / 255.0;
- double g = G / 255.0;
- double b = B / 255.0;
- double min = Math.Min (r, Math.Min (g, b)); //Min. value of RGB
- double max = Math.Max (r, Math.Max (g, b)); //Max. value of RGB
- double diff = max - min; //Delta RGB value
-
- if ( diff == 0 )//This is a grey, no chroma...
- return 0;
-
- double h = 0.0, s = diff / max;
-
- double diffR = (((max - r) / 6.0) + (diff / 2.0)) / diff;
- double diffG = (((max - g) / 6.0) + (diff / 2.0)) / diff;
- double diffB = (((max - b) / 6.0) + (diff / 2.0)) / diff;
-
- if (r == max)
- h = diffB - diffG;
- else if (g == max)
- h = (1.0 / 3.0) + diffR - diffB;
- else if (b == max)
- h = (2.0 / 3.0) + diffG - diffR;
-
- if (h < 0)
- h += 1;
- if (h > 1)
- h -= 1;
-
- return (uint)(h*255);
- }
- }
- /// <summary>
- /// compute the saturation of the color
- /// </summary>
- public uint Saturation {
- get {
- uint min = Math.Min (R, Math.Min (G, B)); //Min. value of RGB
- uint max = Math.Max (R, Math.Max (G, B)); //Max. value of RGB
- uint diff = max - min; //Delta RGB value
- return diff == 0 ? 0 : (uint)(255.0 * diff / max);
- }
- }
- /// <summary>
- /// compute the RGB intensity of the color
- /// </summary>
- /// <value>The value.</value>
- public uint Value => Math.Max (R, Math.Max (G, B)); //Max. value of RGB
-
- public string HtmlCode {
- get {
- string tmp = $"#{R:X2}{G:X2}{B:X2}";
- return A == 0xFF ? tmp : $"{tmp}{A:X2}";
- }
- }
- public float[] floatArray => new float[]{ R / 255f, G / 255f, B / 255f, A / 255f };
- /// <summary>
- /// return a copy of the color with the alpha component modified
- /// </summary>
- /// <returns>new modified color</returns>
- /// <param name="_A">normalized alpha component</param>
- public Color AdjustAlpha(double _A)
- {
- float[] tmp = floatArray;
- return new Color (tmp[0], tmp[1], tmp[2], _A);
- }
-
- public override bool Equals (object obj)
- => obj is Color c && Equals(c);
- /*public bool Equals (Colors other)
- => value == (UInt32)other;*/
-
- public bool Equals (Color other)
- => value == other.value;
- public override int GetHashCode ()
- => value.GetHashCode ();
-
- public override string ToString()
- => EnumsNET.Enums.IsValid<Colors> ((Colors)value) ? EnumsNET.Enums.GetName((Colors)value) : HtmlCode;
-
- public static Color FromIml (string iml)
- {
- Span<double> components = stackalloc double[4];
- components[3] = 1;//init alpha to 1 so that it can be ommitted
- ReadOnlySpan<char> c = iml.AsSpan ();
- int i = 0;
- int ioc = c.IndexOf (',');
-
- while (ioc >= 0) {
- components[i++] = double.Parse (c.Slice (0, ioc));
- c = c.Slice (ioc + 1);
- ioc = c.IndexOf (',');
- }
- components[i++] = double.Parse (c);
- return new Color (components);
- }
-
- public static Color Parse(string s)
- => string.IsNullOrEmpty (s) ? new Color (Colors.White) :
- s[0] == '#' ? s.Length < 8 ?
- new Color (0xff + (UInt32.Parse (s.AsSpan ().Slice (1), System.Globalization.NumberStyles.HexNumber)<<8))
- : new Color (UInt32.Parse (s.AsSpan().Slice (1), System.Globalization.NumberStyles.HexNumber)) :
- char.IsDigit(s[0]) ? FromIml (s) :
- EnumsNET.Enums.TryParse<Colors> (s, out Colors cc) ? new Color(cc) :
- throw new Exception ("Unknown color name: " + s);
-
- public static Color FromHSV (double _h, double _v = 0xff, double _s = 0xff, double _alpha = 0xff) {
- _h /= 255.0;
- _v /= 255.0;
- _s /= 255.0;
-
- double H = _h * 360;
- double C = _v * _s;
- //X = C × (1 - | (H / 60°) mod 2 - 1 |)
- double X = C * (1 - Math.Abs ((H / 60.0) % 2 - 1));
- double m = _v - C;
-
- if (H >= 300)
- return new Color (C + m, m, X + m, _alpha / 255.0);
- else if (H >= 240)
- return new Color (X + m, m, C + m, _alpha / 255.0);
- else if (H >= 180)
- return new Color (m, X + m, C + m, _alpha / 255.0);
- else if (H >= 120)
- return new Color ( m, C + m, X + m, _alpha / 255.0);
- else if (H >= 60)
- return new Color (X + m, C + m, m, _alpha / 255.0);
- return new Color (C + m, X + m, m, _alpha / 255.0);
- }
- }
-}
using System;
using System.Collections.Generic;
using System.Threading;
+using Drawing2D;
namespace Crow.DebugLogger
{
// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Threading;
+using Drawing2D;
namespace Crow.DebugLogger
{
public class DbgLayoutEvent : DbgWidgetEvent
return Colors.Orange;
}
}
- }
+ }
}
}
\ No newline at end of file
// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Threading;
+using Drawing2D;
namespace Crow.DebugLogger
{
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.Linq.Expressions;
using System.Reflection;
-using Crow.Drawing;
+using Drawing2D;
namespace Crow
{
{
#region Cairo extensions
- public static void Rectangle(this Context ctx, Rectangle r, double stroke = 0.0)
+ public static void Rectangle(this IContext ctx, Rectangle r, double stroke = 0.0)
{
if (stroke > 0.0) {
ctx.LineWidth = stroke;
public static PointD Multiply(this PointD p1, double v){
return new PointD(p1.X * v, p1.Y * v);
}
- public static void DrawCote(this Context ctx, PointD p1, PointD p2,
+ public static void DrawCote(this IContext ctx, PointD p1, PointD p2,
double stroke = 1.0, bool fill = false, double arrowWidth = 3.0, double arrowLength = 7.0)
{
PointD vDir = p2.Substract(p1);
ctx.LineWidth = stroke;
ctx.Stroke ();
}
- public static void DrawCoteInverse(this Context ctx, PointD p1, PointD p2,
+ public static void DrawCoteInverse(this IContext ctx, PointD p1, PointD p2,
double stroke = 1.0, bool fill = false, double arrowWidth = 3.0, double arrowLength = 7.0)
{
PointD vDir = p2.Substract(p1);
ctx.LineWidth = stroke;
ctx.Stroke ();
}
- public static void DrawCoteFixed(this Context ctx, PointD p1, PointD p2,
+ public static void DrawCoteFixed(this IContext ctx, PointD p1, PointD p2,
double stroke = 1.0, double coteWidth = 3.0)
{
PointD vDir = p2.Substract(p1);
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.IO;
using System.Runtime.InteropServices;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
image = new byte[bitmapSize];
System.Runtime.InteropServices.Marshal.Copy (data.Scan0, image, 0, bitmapSize);
- bitmap.UnlockBits (data);
+ bitmap.UnlockBits (data);
}*/
#region implemented abstract members of Fill
public override bool IsLoaded => image != null;
- public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle))
+ public override void SetAsSource (Interface iFace, IContext ctx, Rectangle bounds = default(Rectangle))
{
if (image == null)
load (iFace);
#else
using (Surface tmp = new ImageSurface (Format.Argb32, bounds.Width, bounds.Height)) {
#endif
- using (Context gr = new Context (tmp)) {
+ using (IContext gr = new Context (tmp)) {
gr.Translate (bounds.Left, bounds.Top);
gr.Scale (widthRatio, heightRatio);
gr.Translate ((bounds.Width/widthRatio - Dimensions.Width)/2, (bounds.Height/heightRatio - Dimensions.Height)/2);
#if VKVG
- using (Surface imgSurf = new Surface (iFace.vkvgDevice, image, Dimensions.Width, Dimensions.Height))
+ using (Surface imgSurf = new Surface (iFace.vkvgDevice, image, Dimensions.Width, Dimensions.Height))
#else
- using (Surface imgSurf = new ImageSurface (image, Format.Argb32, Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width))
+ using (Surface imgSurf = new ImageSurface (image, Format.Argb32, Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width))
#endif
{
gr.SetSource (imgSurf, 0,0);
}
}
ctx.SetSource (tmp);
- }
+ }
}
#endregion
/// <param name="gr">drawing Backend context</param>
/// <param name="rect">bounds of the target surface to paint</param>
/// <param name="subPart">used for svg only</param>
- public override void Paint (Interface iFace, Context gr, Rectangle rect, string subPart = "")
+ public override void Paint (Interface iFace, IContext gr, Rectangle rect, string subPart = "")
{
if (image == null)
load (iFace);
gr.Translate ((rect.Width/widthRatio - Dimensions.Width)/2, (rect.Height/heightRatio - Dimensions.Height)/2);
#if VKVG
- using (Surface imgSurf = new Surface (iFace.vkvgDevice, image, Dimensions.Width, Dimensions.Height))
+ using (Surface imgSurf = new Surface (iFace.vkvgDevice, image, Dimensions.Width, Dimensions.Height))
#else
- using (Surface imgSurf = new ImageSurface (image, Format.Argb32, Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width))
-#endif
- {
+ using (Surface imgSurf = new ImageSurface (image, Format.Argb32, Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width))
+#endif
+ {
gr.SetSource (imgSurf, 0,0);
gr.Paint ();
}
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
/// </summary>
/// <param name="ctx">backend context</param>
/// <param name="bounds">paint operation bounding box, unused for SolidColor</param>
- public abstract void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle));
+ public abstract void SetAsSource (Interface iFace, IContext ctx, Rectangle bounds = default(Rectangle));
public static Fill Parse (string s){
ReadOnlySpan<char> tmp = s.AsSpan ();
if (tmp.Length == 0)
return null;
if (tmp.Length > 8 && tmp.Slice (1, 8).SequenceEqual ("gradient"))
- return (Fill)Gradient.Parse (s);
+ return (Fill)Gradient.Parse (s);
if (tmp.EndsWith (".svg", StringComparison.OrdinalIgnoreCase) ||
tmp.EndsWith (".png", StringComparison.OrdinalIgnoreCase) ||
tmp.EndsWith (".jpg", StringComparison.OrdinalIgnoreCase) ||
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
#region implemented abstract members of Fill
- public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle))
+ public override void SetAsSource (Interface iFace, IContext ctx, Rectangle bounds = default(Rectangle))
{
Crow.Drawing.Gradient grad = null;
switch (GradientType) {
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.IO;
using System.Collections.Generic;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
}
/// <summary>
/// virtual class for loading and drawing picture in the interface
- ///
+ ///
/// Every loaded resources are stored in a dictonary with their path as key and shared
/// among interface elements
/// </summary>
/// <param name="gr">drawing Backend context</param>
/// <param name="rect">bounds of the target surface to paint</param>
/// <param name="subPart">used for svg only</param>
- public abstract void Paint(Interface iFace, Context ctx, Rectangle rect, string subPart = "");
+ public abstract void Paint(Interface iFace, IContext ctx, Rectangle rect, string subPart = "");
public abstract bool IsLoaded { get; }
public abstract void load (Interface iface);
#region Operators
{
if (string.IsNullOrEmpty (path))
return null;
-
+
Picture _pic = null;
- if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
+ if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
_pic = new SvgPicture (path);
- else
+ else
_pic = new BmpPicture (path);
return _pic;
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.Reflection;
using System.Diagnostics;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
#endregion
#region implemented abstract members of Fill
- public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default)
+ public override void SetAsSource (Interface iFace, IContext ctx, Rectangle bounds = default)
{
ctx.SetSource (color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
}
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.IO;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
#region implemented abstract members of Fill
public override bool IsLoaded => hSVG != null;
- public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle))
+ public override void SetAsSource (Interface iFace, IContext ctx, Rectangle bounds = default(Rectangle))
{
if (hSVG == null)
load (iFace);
#else
using (Surface tmp = new ImageSurface (Format.Argb32, bounds.Width, bounds.Height)) {
#endif
- using (Context gr = new Context (tmp)) {
+ using (IContext gr = new Context (tmp)) {
gr.Translate (bounds.Left, bounds.Top);
gr.Scale (widthRatio, heightRatio);
gr.Translate ((bounds.Width/widthRatio - Dimensions.Width)/2, (bounds.Height/heightRatio - Dimensions.Height)/2);
/// <param name="gr">drawing Backend context</param>
/// <param name="rect">bounds of the target surface to paint</param>
/// <param name="subPart">limit rendering to this coma separated list of svg part identified with their svg 'id' attribute.</param>
- public override void Paint (Interface iFace, Context gr, Rectangle rect, string subPart = "")
+ public override void Paint (Interface iFace, IContext gr, Rectangle rect, string subPart = "")
{
if (hSVG == null)
load (iFace);
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
-using Crow.Drawing;
+
namespace Crow
{
}
public FontSlant Slant {
- get{
+ get{
switch (Style) {
case FontStyle.Italic:
return FontSlant.Italic;
}
}
public FontWeight Wheight {
- get{
+ get{
switch (Style) {
case FontStyle.Bold:
return FontWeight.Bold;
default:
return FontWeight.Normal;
- }
+ }
}
}
#region Operators
public static implicit operator string(Font c) => c.ToString();
-
+
public static implicit operator Font(string s) => (Font)Parse(s);
#endregion
f.Style = EnumsNET.Enums.Parse<FontStyle> (tmp.Slice (ioc + 1).ToString (), true);
}
}
- return f;
+ return f;
}
}
}
+++ /dev/null
-//
-// Mono.Cairo.Antialias.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum Antialias
- {
- Default,
- None,
- Grey,
- Subpixel,
- }
-}
+++ /dev/null
-//
-// Cairo.cs - a simplistic binding of the Cairo API to C#.
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// John Luke (john.luke@gmail.com)
-// Alp Toker (alp@atoker.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-// Copyright (C) 2006 Alp Toker
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- public static class CairoAPI {
- static public int Version {
- get {
- return NativeMethods.cairo_version ();
- }
- }
-
- static public string VersionString {
- get {
- IntPtr x = NativeMethods.cairo_version_string ();
- return Marshal.PtrToStringAnsi (x);
- }
- }
- }
-}
+++ /dev/null
-//
-// CairoDebug.cs
-//
-// Author:
-// Michael Hutchinson (mhutch@xamarin.com)
-//
-// Copyright (C) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- static class CairoDebug
- {
- static System.Collections.Generic.Dictionary<IntPtr,string> traces;
-
- public static readonly bool Enabled;
-
- static CairoDebug ()
- {
- var dbg = Environment.GetEnvironmentVariable ("MONO_CAIRO_DEBUG_DISPOSE");
- if (dbg == null)
- return;
- Enabled = true;
- traces = new System.Collections.Generic.Dictionary<IntPtr,string> ();
- }
-
- public static void OnAllocated (IntPtr obj)
- {
- if (!Enabled)
- throw new InvalidOperationException ();
-
- traces[obj] = Environment.StackTrace;
- }
-
- public static void OnDisposed<T> (IntPtr obj, bool disposing)
- {
- if (disposing && !Enabled)
- throw new InvalidOperationException ();
-
- if (Environment.HasShutdownStarted)
- return;
-
- if (!disposing) {
- System.Diagnostics.Debug.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
- if (Enabled) {
- string val;
- if (traces.TryGetValue (obj, out val)) {
- System.Diagnostics.Debug.WriteLine ("Allocated from:");
- System.Diagnostics.Debug.WriteLine (val);
- }
- } else {
- System.Diagnostics.Debug.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
- }
- }
-
- if (Enabled)
- traces.Remove (obj);
- }
- }
-
-}
+++ /dev/null
-//
-// Mono.Cairo.Content.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
- //[Flags]
-
- public enum Content
- {
- Color = 0x1000,
- Alpha = 0x2000,
- ColorAlpha = 0x3000,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Context.cs
-//
-// Author:
-// Duncan Mak (duncan@ximian.com)
-// Miguel de Icaza (miguel@novell.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// Alp Toker (alp@atoker.com)
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Crow.Drawing {
-
- [Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")]
- public class Graphics : Context {
- public Graphics (IntPtr state) : base (state) {}
- public Graphics (Surface surface) : base (surface) {}
- }
-
- public class Context : IDisposable
- {
- IntPtr handle = IntPtr.Zero;
-
- static int native_glyph_size, c_compiler_long_size;
-
- static Context ()
- {
- //
- // This is used to determine what kind of structure
- // we should use to marshal Glyphs, as the public
- // definition in Cairo uses `long', which can be
- // 32 bits or 64 bits depending on the platform.
- //
- // We assume that sizeof(long) == sizeof(void*)
- // except in the case of Win64 where sizeof(long)
- // is 32 bits
- //
- int ptr_size = Marshal.SizeOf (typeof (IntPtr));
-
- PlatformID platform = Environment.OSVersion.Platform;
- if (platform == PlatformID.Win32NT ||
- platform == PlatformID.Win32S ||
- platform == PlatformID.Win32Windows ||
- platform == PlatformID.WinCE ||
- ptr_size == 4){
- c_compiler_long_size = 4;
- native_glyph_size = Marshal.SizeOf (typeof (NativeGlyph_4byte_longs));
- } else {
- c_compiler_long_size = 8;
- native_glyph_size = Marshal.SizeOf (typeof (Glyph));
- }
- }
-
- public Context (Surface surface) : this (NativeMethods.cairo_create (surface.Handle), true)
- {
- }
-
-
- public Context (IntPtr handle, bool owner)
- {
- this.handle = handle;
- if (!owner)
- NativeMethods.cairo_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- [Obsolete]
- public Context (IntPtr state) : this (state, true)
- {
- }
-
- ~Context ()
- {
- Dispose (false);
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<Context> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_destroy (handle);
- handle = IntPtr.Zero;
-
- }
-
- public void Save ()
- {
- NativeMethods.cairo_save (handle);
- }
-
- public void Restore ()
- {
- NativeMethods.cairo_restore (handle);
- }
-
- public Antialias Antialias {
- get { return NativeMethods.cairo_get_antialias (handle); }
- set { NativeMethods.cairo_set_antialias (handle, value); }
- }
-
- public Status Status {
- get {
- return NativeMethods.cairo_status (handle);
- }
- }
-
- public IntPtr Handle {
- get {
- return handle;
- }
- }
-
- public Operator Operator {
- set {
- NativeMethods.cairo_set_operator (handle, value);
- }
-
- get {
- return NativeMethods.cairo_get_operator (handle);
- }
- }
-
- public double Tolerance {
- get {
- return NativeMethods.cairo_get_tolerance (handle);
- }
-
- set {
- NativeMethods.cairo_set_tolerance (handle, value);
- }
- }
-
- public FillRule FillRule {
- set {
- NativeMethods.cairo_set_fill_rule (handle, value);
- }
-
- get {
- return NativeMethods.cairo_get_fill_rule (handle);
- }
- }
-
- public double LineWidth {
- set {
- NativeMethods.cairo_set_line_width (handle, value);
- }
-
- get {
- return 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);
- }
- }
-
- public LineJoin LineJoin {
- set {
- NativeMethods.cairo_set_line_join (handle, value);
- }
-
- get {
- return 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 ();
- }
- }
-
- //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 SetSource (Pattern source)
- {
- 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 {
- double x, y;
- NativeMethods.cairo_get_current_point (handle, out x, out y);
- return new PointD (x, y);
- }
- }
-
- public bool HasCurrentPoint {
- get {
- return NativeMethods.cairo_has_current_point (handle);
- }
- }
-
- [Obsolete ("Use GetTarget/SetTarget")]
- public Surface Target {
- set {
- if (handle != IntPtr.Zero)
- NativeMethods.cairo_destroy (handle);
-
- handle = NativeMethods.cairo_create (value.Handle);
- }
-
- get {
- return GetTarget ();
- }
- }
-
- public Surface GetTarget ()
- {
- return 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);
- }
-
- [Obsolete("Use GetScaledFont/SetScaledFont")]
- public ScaledFont ScaledFont {
- set {
- SetScaledFont (value);
- }
-
- get {
- return GetScaledFont ();
- }
- }
-
- public ScaledFont GetScaledFont ()
- {
- return new ScaledFont (NativeMethods.cairo_get_scaled_font (handle), false);
- }
-
- public void SetScaledFont (ScaledFont font)
- {
- NativeMethods.cairo_set_scaled_font (handle, font.Handle);
- }
-
- public uint ReferenceCount {
- get { return NativeMethods.cairo_get_reference_count (handle); }
- }
-
- public void SetSource (Color color)
- {
- NativeMethods.cairo_set_source_rgba (handle, color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
- }
-
- public void SetSource (double r, double g, double b)
- {
- NativeMethods.cairo_set_source_rgb (handle, r, g, b);
- }
-
- public void SetSource (double r, double g, double b, double a)
- {
- NativeMethods.cairo_set_source_rgba (handle, r, g, b, a);
- }
-
- //[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);
- }
-
- public void SetSource (Surface source, double x, double 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);
- }
-
-#region Path methods
-
- public void NewPath ()
- {
- NativeMethods.cairo_new_path (handle);
- }
-
- public void NewSubPath ()
- {
- NativeMethods.cairo_new_sub_path (handle);
- }
-
- public void MoveTo (PointD p)
- {
- MoveTo (p.X, p.Y);
- }
-
- public void MoveTo (double x, double y)
- {
- NativeMethods.cairo_move_to (handle, x, y);
- }
-
- public void LineTo (PointD p)
- {
- LineTo (p.X, p.Y);
- }
-
- public void LineTo (double x, double y)
- {
- NativeMethods.cairo_line_to (handle, x, y);
- }
-
- public void CurveTo (PointD p1, PointD p2, PointD p3)
- {
- CurveTo (p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
- }
-
- public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
- {
- NativeMethods.cairo_curve_to (handle, x1, y1, x2, y2, x3, y3);
- }
-
- public void RelMoveTo (Distance d)
- {
- RelMoveTo (d.Dx, d.Dy);
- }
-
- public void RelMoveTo (double dx, double dy)
- {
- NativeMethods.cairo_rel_move_to (handle, dx, dy);
- }
-
- public void RelLineTo (Distance d)
- {
- RelLineTo (d.Dx, d.Dy);
- }
-
- public void RelLineTo (double dx, double dy)
- {
- NativeMethods.cairo_rel_line_to (handle, dx, dy);
- }
-
- public void RelCurveTo (Distance d1, Distance d2, Distance d3)
- {
- RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy);
- }
-
- public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
- {
- NativeMethods.cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3);
- }
-
- public void Arc (double xc, double yc, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc (handle, xc, yc, radius, angle1, angle2);
- }
- public void Arc (PointD center, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc (handle, center.X, center.Y, radius, angle1, angle2);
- }
-
- public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc_negative (handle, xc, yc, radius, angle1, angle2);
- }
- public void ArcNegative (PointD center, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc_negative (handle, center.X, center.Y, radius, angle1, angle2);
- }
-
- public void Rectangle (Crow.Rectangle rectangle)
- {
- Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
- }
- public void Rectangle (Crow.RectangleD rectangle)
- {
- Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
- }
-
- public void Rectangle (PointD p, double width, double height)
- {
- Rectangle (p.X, p.Y, width, height);
- }
-
- public void Rectangle (double x, double y, double width, double height)
- {
- NativeMethods.cairo_rectangle (handle, x, y, width, height);
- }
-
- public void ClosePath ()
- {
- NativeMethods.cairo_close_path (handle);
- }
-
- public Path CopyPath ()
- {
- return new Path (NativeMethods.cairo_copy_path (handle));
- }
-
- public Path CopyPathFlat ()
- {
- return new Path (NativeMethods.cairo_copy_path_flat (handle));
- }
-
- public void AppendPath (Path path)
- {
- NativeMethods.cairo_append_path (handle, path.Handle);
- }
-
-#endregion
-
-#region Painting Methods
- public void Paint ()
- {
- NativeMethods.cairo_paint (handle);
- }
-
- 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);
- }
-
- public void Stroke ()
- {
- NativeMethods.cairo_stroke (handle);
- }
-
- public void StrokePreserve ()
- {
- NativeMethods.cairo_stroke_preserve (handle);
- }
-
- public Crow.Rectangle StrokeExtents ()
- {
- double x1, y1, x2, y2;
- NativeMethods.cairo_stroke_extents (handle, out x1, out y1, out x2, out y2);
- return new Crow.Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
- }
-
- public void Fill ()
- {
- NativeMethods.cairo_fill (handle);
- }
-
- public Crow.Rectangle FillExtents ()
- {
- double x1, y1, x2, y2;
- NativeMethods.cairo_fill_extents (handle, out x1, out y1, out x2, out y2);
- return new Crow.Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
- }
-
- public void FillPreserve ()
- {
- NativeMethods.cairo_fill_preserve (handle);
- }
-
-#endregion
-
- public void Clip ()
- {
- NativeMethods.cairo_clip (handle);
- }
-
- public void ClipPreserve ()
- {
- NativeMethods.cairo_clip_preserve (handle);
- }
-
- public void ResetClip ()
- {
- NativeMethods.cairo_reset_clip (handle);
- }
-
- public bool InClip (double x, double y)
- {
- return NativeMethods.cairo_in_clip (handle, x, y);
- }
- public RectangleList GetClipRectangles (){
- return (RectangleList)Marshal.PtrToStructure (NativeMethods.cairo_copy_clip_rectangle_list (handle), typeof(RectangleList));
- }
- public void ClipExtendRectangle (){
- double x1, y1, x2, y2;
- NativeMethods.cairo_clip_extents (handle, out x1, out y1, out x2, out y2);
- NativeMethods.cairo_rectangle (handle, x1, y1, x2 - x1, y2 - y1);
- }
- public bool InStroke (double x, double y)
- {
- return NativeMethods.cairo_in_stroke (handle, x, y);
- }
-
- public bool InFill (double x, double y)
- {
- return NativeMethods.cairo_in_fill (handle, x, y);
- }
-
- public Pattern PopGroup ()
- {
- return Pattern.Lookup (NativeMethods.cairo_pop_group (handle), true);
- }
-
- public void PopGroupToSource ()
- {
- NativeMethods.cairo_pop_group_to_source (handle);
- }
-
- public void PushGroup ()
- {
- NativeMethods.cairo_push_group (handle);
- }
-
- public void PushGroup (Content content)
- {
- NativeMethods.cairo_push_group_with_content (handle, content);
- }
-
- [Obsolete ("Use GetGroupTarget()")]
- public Surface GroupTarget {
- get {
- return GetGroupTarget ();
- }
- }
-
- public Surface GetGroupTarget ()
- {
- IntPtr surface = NativeMethods.cairo_get_group_target (handle);
- return Surface.Lookup (surface, false);
- }
-
- public void Rotate (double angle)
- {
- NativeMethods.cairo_rotate (handle, angle);
- }
-
- public void Scale (double sx, double sy)
- {
- NativeMethods.cairo_scale (handle, sx, sy);
- }
-
- public void Translate (double tx, double ty)
- {
- NativeMethods.cairo_translate (handle, tx, ty);
- }
-
- public void Transform (Matrix m)
- {
- NativeMethods.cairo_transform (handle, m);
- }
-
- [Obsolete("Use UserToDevice instead")]
- public void TransformPoint (ref double x, ref double y)
- {
- NativeMethods.cairo_user_to_device (handle, ref x, ref y);
- }
-
- [Obsolete("Use UserToDeviceDistance instead")]
- public void TransformDistance (ref double dx, ref double dy)
- {
- NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
- }
-
- [Obsolete("Use InverseTransformPoint instead")]
- public void InverseTransformPoint (ref double x, ref double y)
- {
- NativeMethods.cairo_device_to_user (handle, ref x, ref y);
- }
-
- [Obsolete("Use DeviceToUserDistance instead")]
- public void InverseTransformDistance (ref double dx, ref double dy)
- {
- NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
- }
-
- public void UserToDevice (ref double x, ref double y)
- {
- NativeMethods.cairo_user_to_device (handle, ref x, ref y);
- }
-
- public void UserToDeviceDistance (ref double dx, ref double dy)
- {
- NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
- }
-
- public void DeviceToUser (ref double x, ref double y)
- {
- NativeMethods.cairo_device_to_user (handle, ref x, ref y);
- }
-
- public void DeviceToUserDistance (ref double dx, ref double dy)
- {
- NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
- }
-
- public Matrix Matrix {
- set {
- NativeMethods.cairo_set_matrix (handle, value);
- }
-
- get {
- Matrix m = new Matrix();
- NativeMethods.cairo_get_matrix (handle, m);
- return m;
- }
- }
-
- public void SetFontSize (double scale)
- {
- NativeMethods.cairo_set_font_size (handle, scale);
- }
-
- public void IdentityMatrix ()
- {
- NativeMethods.cairo_identity_matrix (handle);
- }
-
- [Obsolete ("Use SetFontSize() instead.")]
- public void FontSetSize (double scale)
- {
- SetFontSize (scale);
- }
-
- [Obsolete ("Use SetFontSize() instead.")]
- public double FontSize {
- set { SetFontSize (value); }
- }
-
- public Matrix FontMatrix {
- get {
- Matrix m;
- NativeMethods.cairo_get_font_matrix (handle, out m);
- return m;
- }
- set { NativeMethods.cairo_set_font_matrix (handle, value); }
- }
-
- public FontOptions FontOptions {
- get {
- FontOptions options = new FontOptions ();
- NativeMethods.cairo_get_font_options (handle, options.Handle);
- return options;
- }
- set { NativeMethods.cairo_set_font_options (handle, value.Handle); }
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct NativeGlyph_4byte_longs {
- public int index;
- public double x;
- public double y;
-
- public NativeGlyph_4byte_longs (Glyph source)
- {
- index = (int) source.index;
- x = source.x;
- y = source.y;
- }
- }
-
- static internal IntPtr FromGlyphToUnManagedMemory(Glyph [] glyphs)
- {
- IntPtr dest = Marshal.AllocHGlobal (native_glyph_size * glyphs.Length);
- long pos = dest.ToInt64();
-
- if (c_compiler_long_size == 8){
- foreach (Glyph g in glyphs){
- Marshal.StructureToPtr (g, (IntPtr)pos, false);
- pos += native_glyph_size;
- }
- } else {
- foreach (Glyph g in glyphs){
- NativeGlyph_4byte_longs n = new NativeGlyph_4byte_longs (g);
-
- Marshal.StructureToPtr (n, (IntPtr)pos, false);
- pos += native_glyph_size;
- }
- }
-
- return dest;
- }
-
- public void ShowGlyphs (Glyph[] glyphs)
- {
- IntPtr ptr;
-
- ptr = FromGlyphToUnManagedMemory (glyphs);
-
- NativeMethods.cairo_show_glyphs (handle, ptr, glyphs.Length);
-
- Marshal.FreeHGlobal (ptr);
- }
-
- [Obsolete("The matrix argument was never used, use ShowGlyphs(Glyphs []) instead")]
- public void ShowGlyphs (Matrix matrix, Glyph[] glyphs)
- {
- ShowGlyphs (glyphs);
- }
-
- [Obsolete("The matrix argument was never used, use GlyphPath(Glyphs []) instead")]
- public void GlyphPath (Matrix matrix, Glyph[] glyphs)
- {
- GlyphPath (glyphs);
- }
-
- public void GlyphPath (Glyph[] glyphs)
- {
- IntPtr ptr;
-
- ptr = FromGlyphToUnManagedMemory (glyphs);
-
- NativeMethods.cairo_glyph_path (handle, ptr, glyphs.Length);
-
- Marshal.FreeHGlobal (ptr);
-
- }
-
- public FontExtents FontExtents {
- get {
- FontExtents f_extents;
- NativeMethods.cairo_font_extents (handle, out f_extents);
- return f_extents;
- }
- }
-
- public void CopyPage ()
- {
- NativeMethods.cairo_copy_page (handle);
- }
-
- [Obsolete ("Use SelectFontFace() instead.")]
- public void FontFace (string family, FontSlant slant, FontWeight weight)
- {
- SelectFontFace (family, slant, weight);
- }
-
- public void SetContextFontFace (FontFace value)
- {
- NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
- }
-
- public void SelectFontFace (string family, FontSlant slant, FontWeight weight)
- {
- NativeMethods.cairo_select_font_face (handle, family, slant, weight);
- }
-
- public void ShowPage ()
- {
- NativeMethods.cairo_show_page (handle);
- }
-
- private static byte[] TerminateUtf8(byte[] utf8)
- {
- if (utf8.Length > 0 && utf8[utf8.Length - 1] == 0)
- return utf8;
- var termedArray = new byte[utf8.Length + 1];
- Array.Copy(utf8, termedArray, utf8.Length);
- termedArray[utf8.Length] = 0;
- return termedArray;
- }
-
- private static byte[] TerminateUtf8(string s)
- {
- // compute the byte count including the trailing \0
- var byteCount = Encoding.UTF8.GetMaxByteCount(s.Length + 1);
- var bytes = new byte[byteCount];
- Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
- return bytes;
- }
-
- public void ShowText(string str)
- {
- NativeMethods.cairo_show_text (handle, TerminateUtf8 (str));
- }
-
-
- public void TextPath(string str)
- {
- NativeMethods.cairo_text_path (handle, TerminateUtf8(str));
- }
-
- public void TextPath(byte[] utf8)
- {
- NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8));
- }
-
- public TextExtents TextExtents(string s)
- {
- TextExtents extents;
- NativeMethods.cairo_text_extents (handle, TerminateUtf8(s), out extents);
- return extents;
- }
- public void ShowText (ReadOnlySpan<char> s, int tabSize) {
- int size = s.Length * 4 + 1;
- Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
- bytes[encodedBytes] = 0;
- ShowText (bytes.Slice (0, encodedBytes + 1));
- }
- public TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize) {
- TextExtents (s, tabSize, out TextExtents extents);
- return extents;
- }
- public void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents) {
- int size = s.Length * 4 + 1;
- Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
- bytes[encodedBytes] = 0;
- TextExtents (bytes.Slice (0, encodedBytes + 1), out extents);
- }
- public void ShowText (Span<byte> bytes) {
- NativeMethods.cairo_show_text (handle, ref bytes.GetPinnableReference());
- }
- public void TextExtents (Span<byte> bytes, out TextExtents extents) {
- NativeMethods.cairo_text_extents (handle, ref bytes.GetPinnableReference (), out extents);
- }
-
- public TextExtents GlyphExtents (Glyph[] glyphs)
- {
- IntPtr ptr = FromGlyphToUnManagedMemory (glyphs);
-
- TextExtents extents;
-
- NativeMethods.cairo_glyph_extents (handle, ptr, glyphs.Length, out extents);
-
- Marshal.FreeHGlobal (ptr);
-
- return extents;
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.Drawing
-{
- public class DRMDevice : Device
- {
- public DRMDevice () : base (NativeMethods.cairo_drm_device_default (), true)
- {
- }
- public DRMDevice (int fd) : base (NativeMethods.cairo_drm_device_get_for_fd (fd), true)
- {
- }
- public DRMDevice (IntPtr udev_device) : base (NativeMethods.cairo_drm_device_get (udev_device), true)
- {
- }
-
- public int FileDescriptor {
- get { return NativeMethods.cairo_drm_device_get_fd (Handle); }
- }
-
- public void DeviceThrottle () { NativeMethods.cairo_drm_device_throttle (Handle);}
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.GLSurface.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class DRMSurface : Surface
- {
-
- public DRMSurface (IntPtr ptr, bool own) : base (ptr, own)
- {}
-
- public DRMSurface (DRMDevice device, Format format, int width, int height)
- : base (NativeMethods.cairo_drm_surface_create (device.Handle, format, width, height), true)
- {}
-
- public DRMSurface (DRMDevice device, uint name, Format format, int width, int height, int stride)
- : base (NativeMethods.cairo_drm_surface_create_for_name (device.Handle, name, format, width, height, stride), true)
- {}
-
- public DRMSurface (DRMDevice device, IntPtr imageSurface)
- : base (NativeMethods.cairo_drm_surface_create_from_cacheable_image (device.Handle, imageSurface), true)
- {}
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.Drawing
-{
- public class Device : IDisposable
- {
- IntPtr handle = IntPtr.Zero;
-
- protected Device()
- {
- }
-
- protected Device (IntPtr ptr) : this (ptr, true)
- {
- }
-
- protected Device (IntPtr handle, bool owner)
- {
- this.handle = handle;
- if (!owner)
- NativeMethods.cairo_device_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- ~Device ()
- {
- Dispose (false);
- }
-
- public IntPtr Handle {
- get {
- return handle;
- }
- }
- public string Status {
- get {
- return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
- }
- }
- public void SetThreadAware (bool value){
- NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0);
- }
- public Status Acquire()
- {
- return NativeMethods.cairo_device_acquire (handle);
- }
- public void Release()
- {
- NativeMethods.cairo_device_release (handle);
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<Device> (handle, disposing);
-
- if (!disposing || handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_device_destroy (handle);
- handle = IntPtr.Zero;
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.DirectFBSurface.cs
-//
-// Authors:
-// Alp Toker
-//
-// (C) Alp Toker, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
- public class DirectFBSurface : Surface
- {
- internal DirectFBSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public DirectFBSurface (IntPtr dfb, IntPtr dfb_surface)
- : base (NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface), true)
- {
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Context.cs
-//
-// Author:
-// Duncan Mak (duncan@ximian.com)
-// Miguel de Icaza (miguel@novell.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// Alp Toker (alp@atoker.com)
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace Crow.Drawing {
-
- public struct Distance
- {
- public Distance (double dx, double dy)
- {
- this.dx = dx;
- this.dy = dy;
- }
-
- double dx, dy;
- public double Dx {
- get { return dx; }
- set { dx = value; }
- }
-
- public double Dy {
- get { return dy; }
- set { dy = value; }
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.Drawing
-{
- public class EGLDevice : Device
- {
- public EGLDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
- {
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.Extend.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// John Luke (john.luke@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum Extend
- {
- None,
- Repeat,
- Reflect,
- Pad,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.FillRule.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum FillRule
- {
- Winding,
- EvenOdd
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Filter.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum Filter
- {
- Fast,
- Good,
- Best,
- Nearest,
- Bilinear,
- Gaussian,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.FontExtents.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-//
-// This is a simplistic binding of the Cairo API to C#. All functions
-// in cairo.h are transcribed into their C# equivelants
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- [StructLayout (LayoutKind.Sequential)]
- public struct FontExtents
- {
- double ascent;
- double descent;
- double height;
- double maxXAdvance;
- double maxYAdvance;
-
- public double Ascent {
- get { return ascent; }
- set { ascent = value; }
- }
-
- public double Descent {
- get { return descent; }
- set { descent = value; }
- }
-
- public double Height {
- get { return height; }
- set { height = value; }
- }
-
- public double MaxXAdvance {
- get { return maxXAdvance; }
- set { maxXAdvance = value; }
- }
-
- public double MaxYAdvance {
- get { return maxYAdvance; }
- set { maxYAdvance = value; }
- }
-
- public FontExtents (double ascent, double descent, double height, double maxXAdvance, double maxYAdvance)
- {
- this.ascent = ascent;
- this.descent = descent;
- this.height = height;
- this.maxXAdvance = maxXAdvance;
- this.maxYAdvance = maxYAdvance;
- }
-
- public override bool Equals (object obj)
- {
- if (obj is FontExtents)
- return this == (FontExtents) obj;
- return false;
- }
-
- public override int GetHashCode ()
- {
- return (int) Ascent ^ (int) Descent ^ (int) Height ^ (int) MaxXAdvance ^ (int) MaxYAdvance;
- }
-
- public static bool operator == (FontExtents extents, FontExtents other)
- {
- return extents.Ascent == other.Ascent && extents.Descent == other.Descent && extents.Height == other.Height && extents.MaxXAdvance == other.MaxXAdvance && extents.MaxYAdvance == other.MaxYAdvance;
- }
-
- public static bool operator != (FontExtents extents, FontExtents other)
- {
- return !(extents == other);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.FontFace.cs
-//
-// Author:
-// Alp Toker (alp@atoker.com)
-// Miguel de Icaza (miguel@novell.com)
-//
-// (C) Ximian Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.Drawing
-{
- public class FontFace : IDisposable
- {
- IntPtr handle;
-
- internal static FontFace Lookup (IntPtr handle, bool owner)
- {
- if (handle == IntPtr.Zero)
- return null;
- return new FontFace (handle, owner);
- }
-
- ~FontFace ()
- {
- Dispose (false);
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<FontFace> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_font_face_destroy (handle);
- handle = IntPtr.Zero;
- }
-
- [Obsolete]
- public FontFace (IntPtr handle) : this (handle, true)
- {
- }
-
- public FontFace (IntPtr handle, bool owned)
- {
- this.handle = handle;
- if (!owned)
- NativeMethods.cairo_font_face_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- public IntPtr Handle {
- get {
- return handle;
- }
- }
-
- public Status Status {
- get {
- return NativeMethods.cairo_font_face_status (handle);
- }
- }
-
- public FontType FontType {
- get {
- return NativeMethods.cairo_font_face_get_type (handle);
- }
- }
-
- public uint ReferenceCount {
- get { return NativeMethods.cairo_font_face_get_reference_count (handle); }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.FontOptions.cs
-//
-// Author:
-// John Luke (john.luke@gmail.com)
-//
-// (C) John Luke 2005.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
- public class FontOptions : IDisposable
- {
- IntPtr handle;
-
- public FontOptions () : this (NativeMethods.cairo_font_options_create ())
- {
- }
-
- ~FontOptions ()
- {
- Dispose (false);
- }
-
- internal FontOptions (IntPtr handle)
- {
- this.handle = handle;
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- public FontOptions Copy ()
- {
- return new FontOptions (NativeMethods.cairo_font_options_copy (handle));
- }
-
- [Obsolete ("Use Dispose()")]
- public void Destroy ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<FontOptions> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_font_options_destroy (handle);
- handle = IntPtr.Zero;
- }
-
- public static bool operator == (FontOptions options, FontOptions other)
- {
- return Equals (options, other);
- }
-
- public static bool operator != (FontOptions options, FontOptions other)
- {
- return !(options == other);
- }
-
- public override bool Equals (object other)
- {
- return Equals (other as FontOptions);
- }
-
- bool Equals (FontOptions options)
- {
- return options != null && NativeMethods.cairo_font_options_equal (Handle, options.Handle);
- }
-
- public IntPtr Handle {
- get { return handle; }
- }
-
- public override int GetHashCode ()
- {
- return (int) NativeMethods.cairo_font_options_hash (handle);
- }
-
- public void Merge (FontOptions other)
- {
- if (other == null)
- throw new ArgumentNullException ("other");
- NativeMethods.cairo_font_options_merge (handle, other.Handle);
- }
-
- public Antialias Antialias {
- get { return NativeMethods.cairo_font_options_get_antialias (handle); }
- set { NativeMethods.cairo_font_options_set_antialias (handle, value); }
- }
-
- public HintMetrics HintMetrics {
- get { return NativeMethods.cairo_font_options_get_hint_metrics (handle);}
- set { NativeMethods.cairo_font_options_set_hint_metrics (handle, value); }
- }
-
- public HintStyle HintStyle {
- get { return NativeMethods.cairo_font_options_get_hint_style (handle);}
- set { NativeMethods.cairo_font_options_set_hint_style (handle, value); }
- }
-
- public Status Status {
- get { return NativeMethods.cairo_font_options_status (handle); }
- }
-
- public SubpixelOrder SubpixelOrder {
- get { return NativeMethods.cairo_font_options_get_subpixel_order (handle);}
- set { NativeMethods.cairo_font_options_set_subpixel_order (handle, value); }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.FontSlant.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum FontSlant
- {
- Normal,
- Italic,
- Oblique
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.FontType.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
-
- public enum FontType
- {
- Toy,
- FreeType,
- Win32,
- Atsui,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.FontWeight.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum FontWeight
- {
- Normal,
- Bold,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Format.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum Format
- {
- Argb32 = 0,
- Rgb24 = 1,
- A8 = 2,
- A1 = 3,
- Rgb16565 = 4,
-
- //[Obsolete ("Use Argb32")]
- ARGB32 = Argb32,
- //[Obsolete ("Use Rgb24")]
- RGB24 = Rgb24,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.GLSurface.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class GLSurface : Surface
- {
- public GLSurface (IntPtr ptr, bool own) : base (ptr, own)
- {}
-
- public GLSurface (Device device, Content content, uint tex, int width, int height)
- : base (NativeMethods.cairo_gl_surface_create_for_texture (device.Handle, (uint)content, tex, width, height), true)
- {}
-
- public GLSurface (EGLDevice device, IntPtr eglSurf, int width, int height)
- : base (NativeMethods.cairo_gl_surface_create_for_egl (device.Handle, eglSurf, width, height), true)
- {}
-
- public GLSurface (GLXDevice device, IntPtr window, int width, int height)
- : base (NativeMethods.cairo_gl_surface_create_for_window (device.Handle, window, width, height),true)
- {}
-
- 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 void SwapBuffers(){
- NativeMethods.cairo_gl_surface_swapbuffers (this.Handle);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.Drawing
-{
- public class GLXDevice : Device
- {
- public GLXDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_glx_device_create (dpy, gl_ctx), true)
- {
- }
-
- public IntPtr Display {
- get { return NativeMethods.cairo_glx_device_get_display (Handle); }
- }
-
- public IntPtr Context {
- get { return NativeMethods.cairo_glx_device_get_context (Handle); }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.GlitzSurface.cs
-//
-// Authors:
-// Alp Toker
-//
-// (C) Alp Toker, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
- public class GlitzSurface : Surface
- {
- internal GlitzSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public GlitzSurface (IntPtr glitz_surface)
- : base (NativeMethods.cairo_glitz_surface_create (glitz_surface), true)
- {
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Glyph.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct Glyph
- {
- internal long index;
- internal double x;
- internal double y;
-
- public Glyph (long index, double x, double y)
- {
- this.index = index;
- this.x = x;
- this.y = y;
- }
-
- public long Index {
- get { return index; }
- set { index = value; }
- }
-
- public double X {
- get { return x; }
- set { x = value; }
- }
-
- public double Y {
- get { return y; }
- set { y = value; }
- }
-
- public override bool Equals (object obj)
- {
- if (obj is Glyph)
- return this == (Glyph)obj;
- return false;
- }
-
- public override int GetHashCode ()
- {
- return (int) Index ^ (int) X ^ (int) Y;
- }
-
- internal static IntPtr GlyphsToIntPtr (Glyph[] glyphs)
- {
- int size = Marshal.SizeOf (glyphs[0]);
- IntPtr dest = Marshal.AllocHGlobal (size * glyphs.Length);
- long pos = dest.ToInt64 ();
- for (int i = 0; i < glyphs.Length; i++, pos += size)
- Marshal.StructureToPtr (glyphs[i], (IntPtr) pos, false);
- return dest;
- }
-
- public static bool operator == (Glyph glyph, Glyph other)
- {
- return glyph.Index == other.Index && glyph.X == other.X && glyph.Y == other.Y;
- }
-
- public static bool operator != (Glyph glyph, Glyph other)
- {
- return !(glyph == other);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Gradient.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Color = Crow.Color;
-namespace Crow.Drawing {
-
- public class Gradient : Pattern
- {
- protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
- {
- }
-
- public int ColorStopCount {
- get {
- int cnt;
- NativeMethods.cairo_pattern_get_color_stop_count (Handle, out cnt);
- return cnt;
- }
- }
-
- public Status AddColorStop (double offset, Color c)
- {
- NativeMethods.cairo_pattern_add_color_stop_rgba (Handle, offset, c.R / 255.0, c.G / 255.0, c.B / 255.0, c.A / 255.0);
- return Status;
- }
-
- public Status AddColorStopRgb (double offset, Color c)
- {
- NativeMethods.cairo_pattern_add_color_stop_rgb (Handle, offset, c.R / 255.0, c.G / 255.0 / 255.0, c.B / 255.0);
- return Status;
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.HintMetrics.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum HintMetrics
- {
- Default,
- Off,
- On,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.HintStyle.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum HintStyle
- {
- Default,
- None,
- Slight,
- Medium,
- Full,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.ImageSurface.cs
-//
-// Authors:
-// Duncan Mak
-// Miguel de Icaza.
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell, Inc. 2003.
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing {
-
- public class ImageSurface : Surface
- {
- internal ImageSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public ImageSurface (Format format, int width, int height)
- : base (NativeMethods.cairo_image_surface_create (format, width, height), true)
- {
- }
-
- [Obsolete ("Use ImageSurface (byte[] data, Cairo.Format format, int width, int height, int stride)")]
- public ImageSurface (ref byte[] data, Format format, int width, int height, int stride)
- : this (data, format, width, height, stride)
- {
- }
-
- public ImageSurface (byte[] data, Format format, int width, int height, int stride)
- : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
- {
- }
-
- public ImageSurface (IntPtr data, Format format, int width, int height, int stride)
- : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
- {
- }
-
- public ImageSurface (string filename)
- : base (NativeMethods.cairo_image_surface_create_from_png (filename), true)
- {
- }
-
- 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);
- int length = Height * Stride;
- byte[] data = new byte[length];
- Marshal.Copy (ptr, data, 0, length);
- return data;
- }
- }
-
- public IntPtr DataPtr {
- get {
- return NativeMethods.cairo_image_surface_get_data (Handle);
- }
- }
-
- public Format Format {
- get { return NativeMethods.cairo_image_surface_get_format (Handle); }
- }
-
- public int Stride {
- get { return NativeMethods.cairo_image_surface_get_stride (Handle); }
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.LineCap.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum LineCap
- {
- Butt,
- Round,
- Square,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.LineJoin.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum LineJoin
- {
- Miter,
- Round,
- Bevel
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.LinearGradient.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class LinearGradient : Gradient
- {
- internal LinearGradient (IntPtr handle, bool owned) : base (handle, owned)
- {
- }
-
- public LinearGradient (double x0, double y0, double x1, double y1)
- : base (NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1), true)
- {
- }
-
- public PointD[] LinearPoints {
- get {
- double x0, y0, x1, y1;
- PointD[] points = new PointD [2];
-
- NativeMethods.cairo_pattern_get_linear_points (Handle, out x0, out y0, out x1, out y1);
-
- points[0] = new PointD (x0, y0);
- points[1] = new PointD (x1, y1);
- return points;
- }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.Matrix.cs
-//
-// Author: Duncan Mak
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// Idan Gazit (idan@fastmail.fm)
-//
-// (C) Ximian Inc, 2003 - 2005.
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing {
-
- [StructLayout(LayoutKind.Sequential)]
- public class Matrix //: ICloneable
- {
- public double Xx;
- public double Yx;
- public double Xy;
- public double Yy;
- public double X0;
- public double Y0;
-
- public Matrix (double xx, double yx, double xy, double yy,
- double x0, double y0)
- {
- this.Xx = xx; this.Yx = yx; this.Xy = xy;
- this.Yy = yy; this.X0 = x0; this.Y0 = y0;
- }
-
- public Matrix ()
- {
- this.InitIdentity ();
- }
-
- public bool IsIdentity ()
- {
- return (this == new Matrix ());
- }
-
- public void InitIdentity ()
- {
- // this.Init(1,0,0,1,0,0);
- NativeMethods.cairo_matrix_init_identity (this);
- }
-
- public void Init (double xx, double yx, double xy, double yy,
- double x0, double y0)
- {
- this.Xx = xx; this.Yx = yx; this.Xy = xy;
- this.Yy = yy; this.X0 = x0; this.Y0 = y0;
- }
-
- public void InitTranslate (double tx, double ty)
- {
- //this.Init (1, 0, 0, 1, tx, ty);
- NativeMethods.cairo_matrix_init_translate (this, tx, ty);
- }
-
- public void Translate (double tx, double ty)
- {
- NativeMethods.cairo_matrix_translate (this, tx, ty);
- }
-
- public void InitScale (double sx, double sy)
- {
- //this.Init (sx, 0, 0, sy, 0, 0);
- NativeMethods.cairo_matrix_init_scale (this, sx, sy);
- }
-
- public void Scale (double sx, double sy)
- {
- NativeMethods.cairo_matrix_scale (this, sx, sy);
- }
-
- public void InitRotate (double radians)
- {
- /*
- double s, c;
- s = Math.Sin (radians);
- c = Math.Cos (radians);
- this.Init (c, s, -s, c, 0, 0);
- */
- NativeMethods.cairo_matrix_init_rotate (this, radians);
- }
-
- public void Rotate (double radians)
- {
- NativeMethods.cairo_matrix_rotate (this, radians);
- }
-
- public Status Invert ()
- {
- return NativeMethods.cairo_matrix_invert (this);
- }
-
- public void Multiply (Matrix b)
- {
- Matrix a = (Matrix) this.Clone ();
- NativeMethods.cairo_matrix_multiply (this, a, b);
- }
-
- public static Matrix Multiply (Matrix a, Matrix b) {
- Matrix result = new Matrix ();
- NativeMethods.cairo_matrix_multiply (result, a, b);
- return result;
- }
-
-
- public void TransformDistance (ref double dx, ref double dy)
- {
- NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref dy);
- }
-
- public void TransformPoint (ref double x, ref double y)
- {
- NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
- }
-
- public override String ToString ()
- {
- String s = String.Format ("xx:{0:##0.0#} yx:{1:##0.0#} xy:{2:##0.0#} yy:{3:##0.0#} x0:{4:##0.0#} y0:{5:##0.0#}",
- this.Xx, this.Yx, this.Xy, this.Yy, this.X0, this.Y0);
- return s;
- }
-
- public static bool operator == (Matrix lhs, Matrix rhs)
- {
- return (lhs.Xx == rhs.Xx &&
- lhs.Xy == rhs.Xy &&
- lhs.Yx == rhs.Yx &&
- lhs.Yy == rhs.Yy &&
- lhs.X0 == rhs.X0 &&
- lhs.Y0 == rhs.Y0 );
- }
-
- public static bool operator != (Matrix lhs, Matrix rhs)
- {
- return !(lhs==rhs);
- }
-
-
-
- public override bool Equals(object o)
- {
- if (! (o is Matrix))
- return false;
- else
- return (this == (Matrix) o);
- }
-
- public override int GetHashCode()
- {
- return (int)this.Xx ^ (int)this.Xx>>32 ^
- (int)this.Xy ^ (int)this.Xy>>32 ^
- (int)this.Yx ^ (int)this.Yx>>32 ^
- (int)this.Yy ^ (int)this.Yy>>32 ^
- (int)this.X0 ^ (int)this.X0>>32 ^
- (int)this.Y0 ^ (int)this.Y0>>32;
- }
-
- public object Clone()
- {
- return this.MemberwiseClone ();
- }
-
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class MeshPattern : Pattern
- {
- internal MeshPattern (IntPtr handle, bool owned) : base (handle, owned)
- {
- }
-
- public MeshPattern ()
- : base (NativeMethods.cairo_pattern_create_mesh(), true)
- {
- }
-
- //no idea why this is here, the base one is identical, but we can't remove it now
- public new Extend Extend {
- set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
- get { return NativeMethods.cairo_pattern_get_extend (Handle); }
- }
-
- public Filter Filter {
- set { NativeMethods.cairo_pattern_set_filter (Handle, value); }
- get { return NativeMethods.cairo_pattern_get_filter (Handle); }
- }
-
- public void BeginPatch(){
- NativeMethods.cairo_mesh_pattern_begin_patch (Handle);
- }
- public void EndPatch(){
- NativeMethods.cairo_mesh_pattern_end_patch (Handle);
- }
- public void MoveTo(double x, double y){
- NativeMethods.cairo_mesh_pattern_move_to (Handle, x, y);
- }
- public void MoveTo (PointD p) {
- NativeMethods.cairo_mesh_pattern_move_to (Handle, p.X, p.Y);
- }
- public void LineTo(double x, double y){
- NativeMethods.cairo_mesh_pattern_line_to (Handle, x, y);
- }
- public void LineTo (PointD p) {
- NativeMethods.cairo_mesh_pattern_line_to (Handle, p.X, p.Y);
- }
- public void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
- {
- NativeMethods.cairo_mesh_pattern_curve_to (Handle, x1, y1, x2, y2, x3, y3);
- }
- public void SetControlPoint(uint point_num, double x, double y){
- NativeMethods.cairo_mesh_pattern_set_control_point (Handle, point_num, x, y);
- }
- public void SetControlPoint (uint point_num, PointD p) {
- NativeMethods.cairo_mesh_pattern_set_control_point (Handle, point_num, p.X, p.Y);
- }
- public void SetCornerColorRGB(uint corner_num, double r, double g, double b){
- NativeMethods.cairo_mesh_pattern_set_corner_color_rgb (Handle, corner_num, r, g, b);
- }
- public void SetCornerColorRGBA(uint corner_num, double r, double g, double b, double a){
- NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (Handle, corner_num, r, g, b, a);
- }
- public void SetCornerColor (uint corner_num, Color c) {
- NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (Handle, corner_num, c.R, c.G, c.B, c.A);
- }
- public uint PatchCount {
- get {
- uint count = 0;
- NativeMethods.cairo_mesh_pattern_get_patch_count(Handle, out count);
- return count;
- }
- }
- public Path GetPath(uint patch_num){
- return new Path(NativeMethods.cairo_mesh_pattern_get_path(Handle, patch_num));
- }
- public PointD GetControlPoint(uint point_num, uint patch_num = 0) {
- NativeMethods.cairo_mesh_pattern_get_control_point (Handle, patch_num, point_num, out double x, out double y);
- return new PointD (x, y);
- }
- public void GetCornerColorRGBA(){
-
- }
- }
-}
-
+++ /dev/null
-//
-// Cairo.cs - a simplistic binding of the Cairo API to C#.
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// John Luke (john.luke@gmail.com)
-// Alp Toker (alp@atoker.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-// Copyright (C) 2006 Alp Toker
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-
-namespace Cairo
-{
- // sort the functions like in the following page so it is easier to find what is missing
- // http://cairographics.org/manual/index-all.html
-
- public static class NativeMethods
- {
- #if MONOTOUCH
- const string cairo = "__Internal";
- #else
- const string cairo = "libcairo-2.dll";
- #endif
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern void cairo_append_path (IntPtr cr, Path path);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
- // [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- // public static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_clip (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_clip_preserve (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_close_path (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_copy_page (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_copy_path (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_copy_path_flat (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_create (IntPtr target);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_debug_reset_static_data ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_destroy (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_fill (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_fill_preserve (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
-
- #region FontFace
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_face_destroy (IntPtr font_face);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern FontType cairo_font_face_get_type (IntPtr font_face);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern void cairo_font_face_get_user_data (IntPtr font_face);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern void cairo_font_face_set_user_data (IntPtr font_face);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_font_face_reference (IntPtr font_face);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_font_face_status (IntPtr font_face);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern uint cairo_font_face_get_reference_count (IntPtr surface);
- #endregion
-
- #region FontOptions
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_font_options_copy (IntPtr original);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_font_options_create ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_options_destroy (IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Antialias cairo_font_options_get_antialias (IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern long cairo_font_options_hash (IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_font_options_status (IntPtr options);
- #endregion
-
- #region Freetype / FontConfig
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Antialias cairo_get_antialias (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern FillRule cairo_get_fill_rule (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_get_font_face (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_get_group_target (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern LineCap cairo_get_line_cap (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern LineJoin cairo_get_line_join (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern double cairo_get_line_width (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_get_matrix (IntPtr cr, Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern double cairo_get_miter_limit (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Operator cairo_get_operator (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern uint cairo_get_reference_count (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_get_source (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_get_target (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern double cairo_get_tolerance (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- [return: MarshalAs (UnmanagedType.U1)]
- public static extern bool cairo_has_current_point (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_identity_matrix (IntPtr cr);
-
- #region Image Surface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_image_surface_create (Cairo.Format format, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- public static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Cairo.Format format, int width, int height, int stride);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_image_surface_create_from_png (string filename);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern IntPtr cairo_image_surface_create_from_png_stream (string filename);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Format cairo_image_surface_get_format (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_image_surface_get_height (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_image_surface_get_stride (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_image_surface_get_width (IntPtr surface);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- [return: MarshalAs (UnmanagedType.U1)]
- public static extern bool cairo_in_clip (IntPtr cr, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- [return: MarshalAs (UnmanagedType.U1)]
- public static extern bool cairo_in_fill (IntPtr cr, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- [return: MarshalAs (UnmanagedType.U1)]
- public static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_line_to (IntPtr cr, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_mask (IntPtr cr, IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
-
- #region Matrix
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_init_identity (Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_matrix_invert (Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_rotate (Matrix matrix, double radians);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_move_to (IntPtr cr, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_new_path (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_new_sub_path (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_paint (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_path_destroy (IntPtr path);
-
- #region Pattern
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_destroy (IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Extend cairo_pattern_get_extend (IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Filter cairo_pattern_get_filter (IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern PatternType cairo_pattern_get_type (IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pattern_reference (IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_pattern_status (IntPtr pattern);
- #endregion
-
- #region PdfSurface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
- #endregion
-
- #region PostscriptSurface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_pop_group (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_pop_group_to_source (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_push_group (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_push_group_with_content (IntPtr cr, Content content);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_reference (IntPtr cr);
-
- #region Regions
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_region_copy (IntPtr original);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_region_create ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_region_create_rectangle (ref Crow.Rectangle rect);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_region_destroy (IntPtr region);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern bool cairo_region_equal (IntPtr a, IntPtr b);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_region_get_extents (IntPtr region, out Crow.Rectangle extents);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern bool cairo_region_is_empty (IntPtr region);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_region_num_rectangles (IntPtr region);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_region_reference (IntPtr region);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_status (IntPtr region);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_region_translate (IntPtr region, int dx, int dy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_union (IntPtr dst, IntPtr other);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_union_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_reset_clip (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_restore (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_rotate (IntPtr cr, double angle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_save (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_scale (IntPtr cr, double sx, double sy);
-
- #region ScaledFont
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_scaled_font_status (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_get_scaled_font (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- public static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- public static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_get_dash_count (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_fill_rule (IntPtr cr, Cairo.FillRule fill_rule);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- public static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_font_size (IntPtr cr, double size);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_line_width (IntPtr cr, double width);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_matrix (IntPtr cr, Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_miter_limit (IntPtr cr, double limit);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_operator (IntPtr cr, Cairo.Operator op);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_show_page (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_show_text (IntPtr cr, string str);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_status (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_status_to_string (Status status);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_stroke (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_stroke_preserve (IntPtr cr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
-
- #region Surface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_surface_create_similar (IntPtr surface, Cairo.Content content, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_destroy (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_finish (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_flush (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Content cairo_surface_get_content (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern uint cairo_surface_get_reference_count (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern SurfaceType cairo_surface_get_type (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_mark_dirty (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_surface_reference (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_surface_status (IntPtr surface);
- #endregion
-
- #region SVG surface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
-
- //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- //public static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_text_extents (IntPtr cr, string txt, out TextExtents extents);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- public static extern void cairo_text_path (IntPtr ct, byte[] utf8);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_transform (IntPtr cr, Matrix matrix);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_translate (IntPtr cr, double tx, double ty);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_version ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_version_string ();
-
- #region DirectFBSurface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
- #endregion
-
- #region win32 fonts
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
- #endregion
-
- #region win32 surface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
- #endregion
-
- #region XcbSurface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
- #endregion
-
- #region XlibSurface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_xlib_surface_get_depth (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_xlib_surface_get_height (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_xlib_surface_get_width (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
- #endregion
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
-
- #region GLSurface
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_gl_surface_get_width (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_gl_surface_get_height (IntPtr surface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
- #endregion
-
- #region GLX Functions
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_glx_device_get_display (IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_glx_device_get_context (IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
- #endregion
-
- #region WGL Fucntions
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
- #endregion
-
- #region EGL Functions
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
- #endregion
-
- #region DRM Functions
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_device_get_for_fd (int fd);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_device_default ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_drm_device_throttle (IntPtr cairo_device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format, int width, int height);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format, int width, int height, int stride);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_drm_surface_unmap (IntPtr drmSurface, IntPtr imageSurface);
- #endregion
-
- #region Device
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_device_acquire(IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_device_destroy (IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern IntPtr cairo_device_reference (IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void cairo_device_release(IntPtr device);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern Status cairo_device_status(IntPtr device);
- #endregion
-
-
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static extern void crow_cairo_region_clear(IntPtr ctx, IntPtr reg);
-
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// Cairo.cs - a simplistic binding of the Cairo API to C#.
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// John Luke (john.luke@gmail.com)
-// Alp Toker (alp@atoker.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-// Copyright (C) 2006 Alp Toker
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- // sort the functions like in the following page so it is easier to find what is missing
- // http://cairographics.org/manual/index-all.html
-
- internal static class NativeMethods
- {
-#if MONOTOUCH
- const string cairo = "__Internal";
-#else
- const string cairo = "cairo";
-#endif
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern void cairo_append_path (IntPtr cr, Path path);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_clip (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_clip_preserve (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_close_path (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_copy_page (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_copy_path (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_copy_path_flat (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_create (IntPtr target);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_debug_reset_static_data ();
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_destroy (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_fill (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_fill_preserve (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
-
- #region FontFace
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_face_destroy (IntPtr font_face);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern FontType cairo_font_face_get_type (IntPtr font_face);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern void cairo_font_face_get_user_data (IntPtr font_face);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern void cairo_font_face_set_user_data (IntPtr font_face);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_font_face_reference (IntPtr font_face);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_font_face_status (IntPtr font_face);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_font_face_get_reference_count (IntPtr surface);
- #endregion
-
- #region FontOptions
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_font_options_copy (IntPtr original);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_font_options_create ();
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_options_destroy (IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- [return: MarshalAs (UnmanagedType.U1)]
- internal static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Antialias cairo_font_options_get_antialias (IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern long cairo_font_options_hash (IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_font_options_status (IntPtr options);
- #endregion
-
- #region Freetype / FontConfig
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Antialias cairo_get_antialias (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern FillRule cairo_get_fill_rule (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_get_font_face (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_get_group_target (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern LineCap cairo_get_line_cap (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern LineJoin cairo_get_line_join (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern double cairo_get_line_width (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_get_matrix (IntPtr cr, Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern double cairo_get_miter_limit (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Operator cairo_get_operator (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_get_reference_count (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_get_source (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_get_target (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern double cairo_get_tolerance (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- [return: MarshalAs (UnmanagedType.U1)]
- internal static extern bool cairo_has_current_point (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_identity_matrix (IntPtr cr);
-
- #region Image Surface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_image_surface_create (Format format, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Format format, int width, int height, int stride);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Format format, int width, int height, int stride);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_image_surface_create_from_png (string filename);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern IntPtr cairo_image_surface_create_from_png_stream (string filename);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Format cairo_image_surface_get_format (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_image_surface_get_height (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_image_surface_get_stride (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_image_surface_get_width (IntPtr surface);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- [return: MarshalAs (UnmanagedType.U1)]
- internal static extern bool cairo_in_clip (IntPtr cr, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- [return: MarshalAs (UnmanagedType.U1)]
- internal static extern bool cairo_in_fill (IntPtr cr, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- [return: MarshalAs (UnmanagedType.U1)]
- internal static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_line_to (IntPtr cr, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mask (IntPtr cr, IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
-
- #region Matrix
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_init_identity (Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_matrix_invert (Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_rotate (Matrix matrix, double radians);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_move_to (IntPtr cr, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_new_path (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_new_sub_path (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_paint (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_path_destroy (IntPtr path);
-
- #region Pattern
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_destroy (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Extend cairo_pattern_get_extend (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Filter cairo_pattern_get_filter (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern PatternType cairo_pattern_get_type (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_reference (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_pattern_status (IntPtr pattern);
-
- //mesh pattern
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pattern_create_mesh ();
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_begin_patch (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_end_patch (IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_move_to (IntPtr pattern, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_line_to (IntPtr pattern, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_curve_to (IntPtr pattern, double x1, double y1,
- double x2, double y2, double x3, double y3);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_set_control_point (IntPtr pattern, uint point_num, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_set_corner_color_rgb (IntPtr pattern, uint corner_num,
- double r, double g, double b);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_mesh_pattern_set_corner_color_rgba (IntPtr pattern, uint corner_num,
- double r, double g, double b, double a);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_mesh_pattern_get_patch_count (IntPtr pattern, out uint count);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_mesh_pattern_get_path (IntPtr pattern, uint patch_num);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_mesh_pattern_get_control_point (IntPtr pattern,
- uint patch_num, uint point_num, out double x, out double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_mesh_pattern_get_corner_color_rgba (IntPtr pattern,
- uint patch_num, uint point_num, out double r, out double g, out double b, out double a);
- #endregion
-
- #region PdfSurface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
- #endregion
-
- #region PostscriptSurface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_pop_group (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_pop_group_to_source (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_push_group (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_push_group_with_content (IntPtr cr, Content content);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_reference (IntPtr cr);
-
- #region Regions
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_region_copy (IntPtr original);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_region_create ();
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_region_create_rectangle (ref Crow.Rectangle rect);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_region_destroy (IntPtr region);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool cairo_region_equal (IntPtr a, IntPtr b);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_region_get_extents (IntPtr region, out Crow.Rectangle extents);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool cairo_region_is_empty (IntPtr region);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_region_num_rectangles (IntPtr region);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_region_reference (IntPtr region);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_status (IntPtr region);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_region_translate (IntPtr region, int dx, int dy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_union (IntPtr dst, IntPtr other);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_union_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_reset_clip (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_restore (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_rotate (IntPtr cr, double angle);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_save (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_scale (IntPtr cr, double sx, double sy);
-
- #region ScaledFont
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_scaled_font_status (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_get_scaled_font (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_get_dash_count (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_fill_rule (IntPtr cr, FillRule fill_rule);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_font_size (IntPtr cr, double size);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_line_width (IntPtr cr, double width);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_matrix (IntPtr cr, Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_miter_limit (IntPtr cr, double limit);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_operator (IntPtr cr, Operator op);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_show_page (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_status (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_status_to_string (Status status);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_stroke (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_stroke_preserve (IntPtr cr);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
-
- #region Surface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_surface_create_similar (IntPtr surface, Content content, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_destroy (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_finish (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_flush (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Content cairo_surface_get_content (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern SurfaceType cairo_surface_get_type (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_mark_dirty (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_surface_reference (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_surface_status (IntPtr surface);
- #endregion
-
- #region SVG surface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
-
- //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- //internal static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
- #endregion
-
- [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void cairo_show_text (IntPtr cr, byte[] text);
-
- [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void cairo_text_extents (IntPtr cr, byte[] utf8, out TextExtents extents);
-
- [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void cairo_show_text (IntPtr cr, ref byte utf8);
-
- [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void cairo_text_extents (IntPtr cr, ref byte utf8, out TextExtents extents);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_text_path (IntPtr ct, byte[] utf8);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_transform (IntPtr cr, Matrix matrix);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_translate (IntPtr cr, double tx, double ty);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_version ();
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_version_string ();
-
- #region DirectFBSurface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
- #endregion
-
- #region win32 fonts
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
- #endregion
-
- #region win32 surface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
- #endregion
-
- #region XcbSurface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
- #endregion
-
- #region XlibSurface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_xlib_surface_get_depth (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_xlib_surface_get_height (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_xlib_surface_get_width (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
- #endregion
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
-
- #region GLSurface
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_gl_surface_get_width (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_gl_surface_get_height (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
- #endregion
-
- #region GLX Functions
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_glx_device_get_display (IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_glx_device_get_context (IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
- #endregion
-
- #region WGL Fucntions
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
- #endregion
-
- #region EGL Functions
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
- #endregion
-
- #region DRM Functions
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_device_get_for_fd (int fd);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_device_default ();
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_drm_device_throttle (IntPtr cairo_device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format, int width, int height);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format, int width, int height, int stride);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_drm_surface_unmap (IntPtr drmSurface, IntPtr imageSurface);
- #endregion
-
- #region Device
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_device_acquire(IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_device_destroy (IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern IntPtr cairo_device_reference (IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_device_release(IntPtr device);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern Status cairo_device_status(IntPtr device);
- #endregion
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// Mono.Cairo.Operator.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// John Luke (john.luke@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum Operator
- {
- Clear,
- Source,
- Over,
- In,
- Out,
- Atop,
-
- Dest,
- DestOver,
- DestIn,
- DestOut,
- DestAtop,
-
- Xor,
- Add,
- Saturate,
- Multiply,
- Screen,
- Overlay,
- Darken,
- Lighten,
-
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.PostscriptSurface.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class PSSurface : Surface
- {
- internal PSSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public PSSurface (string filename, double width, double height)
- : base (NativeMethods.cairo_ps_surface_create (filename, width, height), true)
- {
- }
-
- public void BeginPageSetup ()
- {
- NativeMethods.cairo_ps_surface_dsc_begin_page_setup (Handle);
- }
-
- public void BeginSetup ()
- {
- NativeMethods.cairo_ps_surface_dsc_begin_setup (Handle);
- }
-
- public void DscComment (string 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);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Context.cs
-//
-// Author:
-// Miguel de Icaza (miguel@novell.com)
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright 2007 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-
-namespace Crow.Drawing {
-
- public class Path : IDisposable
- {
- IntPtr handle = IntPtr.Zero;
-
- internal Path (IntPtr handle)
- {
- this.handle = handle;
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- ~Path ()
- {
- Dispose (false);
- }
-
- public IntPtr Handle { get { return handle; } }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<Path> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_path_destroy (handle);
- handle = IntPtr.Zero;
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace Crow.Drawing {
-
- public class Pattern : IDisposable
- {
- [Obsolete]
- protected IntPtr pattern = IntPtr.Zero;
-
- public static Pattern Lookup (IntPtr pattern, bool owner)
- {
- if (pattern == IntPtr.Zero)
- return null;
-
- PatternType pt = NativeMethods.cairo_pattern_get_type (pattern);
- switch (pt) {
- case PatternType.Solid:
- return new SolidPattern (pattern, owner);
- case PatternType.Surface:
- return new SurfacePattern (pattern, owner);
- case PatternType.Linear:
- return new LinearGradient (pattern, owner);
- case PatternType.Radial:
- return new RadialGradient (pattern, owner);
- default:
- return new Pattern (pattern, owner);
- }
- }
-
- [Obsolete]
- protected Pattern ()
- {
- }
-
- internal Pattern (IntPtr handle, bool owned)
- {
- Handle = handle;
- if (!owned)
- NativeMethods.cairo_pattern_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- ~Pattern ()
- {
- Dispose (false);
- }
-
- [Obsolete ("Use the SurfacePattern constructor")]
- public Pattern (Surface surface)
- : this ( NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
- {
- }
-
- [Obsolete]
- protected void Reference ()
- {
- NativeMethods.cairo_pattern_reference (pattern);
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<Pattern> (Handle, disposing);
-
- if (!disposing|| Handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_pattern_destroy (Handle);
- Handle = IntPtr.Zero;
- }
-
- [Obsolete ("Use Dispose()")]
- public void Destroy ()
- {
- Dispose ();
- }
-
- public Status Status
- {
- get { return NativeMethods.cairo_pattern_status (Handle); }
- }
-
- public Extend Extend
- {
- get { return NativeMethods.cairo_pattern_get_extend (Handle); }
- set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
- }
-
- public Matrix Matrix {
- set {
- NativeMethods.cairo_pattern_set_matrix (Handle, value);
- }
-
- get {
- Matrix m = new Matrix ();
- NativeMethods.cairo_pattern_get_matrix (Handle, m);
- return m;
- }
- }
-
-#pragma warning disable 612
- public IntPtr Handle {
- get { return pattern; }
- private set { pattern = value; }
- }
-#pragma warning restore 612
-
- [Obsolete]
- public IntPtr Pointer {
- get { return pattern; }
- }
-
- public PatternType PatternType {
- get { return NativeMethods.cairo_pattern_get_type (Handle); }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.PatternType.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
-
- public enum PatternType
- {
- Solid,
- Surface,
- Linear,
- Radial,
- Mesh,
- RasterSource
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.PdfSurface.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class PdfSurface : Surface
- {
- internal PdfSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public PdfSurface (string filename, double width, double height)
- : base (NativeMethods.cairo_pdf_surface_create (filename, width, height), true)
- {
- }
-
- public void SetSize (double width, double height)
- {
- NativeMethods.cairo_pdf_surface_set_size (Handle, width, height);
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class RadialGradient : Gradient
- {
- internal RadialGradient (IntPtr handle, bool owned) : base (handle, owned)
- {
- }
-
- public RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
- : base (NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1), true)
- {
- }
- }
-}
-
+++ /dev/null
-// Copyright (C) 2011 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct RectangleList {
- public Status Status;
- public IntPtr Rectangles;
- public int NumRectangles;
- }
-
- public enum RegionOverlap {
- In,
- Out,
- Part,
- }
-
- public class Region : IDisposable {
-
- IntPtr handle;
- public IntPtr Handle {
- get { return handle; }
- }
-
- [Obsolete]
- public Region (IntPtr handle) : this (handle, false) {}
-
- public Region (IntPtr handle, bool owned)
- {
- this.handle = handle;
- if (!owned)
- NativeMethods.cairo_region_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- public Region () : this (NativeMethods.cairo_region_create () , true)
- {
- }
-
- public Region (Crow.Rectangle rect)
- {
- handle = NativeMethods.cairo_region_create_rectangle (ref rect);
- }
-
- public Region (RectangleList rects)
- {
- handle = NativeMethods.cairo_region_create_rectangles (rects.Rectangles, rects.NumRectangles);
- }
-
- public Region Copy ()
- {
- return new Region (NativeMethods.cairo_region_copy (Handle), true);
- }
-
- #region IDisposable
- ~Region ()
- {
- Dispose (false);
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<Region> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_region_destroy (Handle);
- handle = IntPtr.Zero;
- }
- #endregion
-
- public override bool Equals (object obj)
- {
- return (obj is Region) && NativeMethods.cairo_region_equal (Handle, (obj as Region).Handle);
- }
-
- public override int GetHashCode ()
- {
- return Handle.GetHashCode ();
- }
-
- public Status Status {
- get { return NativeMethods.cairo_region_status (Handle); }
- }
-
- public Crow.Rectangle Extents {
- get {
- Crow.Rectangle result;
- NativeMethods.cairo_region_get_extents (Handle, out result);
- return result;
- }
- }
-
- public int NumRectangles {
- get { return NativeMethods.cairo_region_num_rectangles (Handle); }
- }
-
- public Crow.Rectangle GetRectangle (int nth)
- {
- Crow.Rectangle val;
- NativeMethods.cairo_region_get_rectangle (Handle, nth, out val);
- return val;
- }
-
- public bool IsEmpty {
- get { return NativeMethods.cairo_region_is_empty (Handle); }
- }
-
- public RegionOverlap Contains (Crow.Rectangle rectangle)
- {
- return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle);
- }
-
- public bool Contains (int x, int y)
- {
- return NativeMethods.cairo_region_contains_point (Handle, x, y);
- }
-
- public void Translate (int dx, int dy)
- {
- NativeMethods.cairo_region_translate (Handle, dx, dy);
- }
-
- public Status Subtract (Region other)
- {
- return NativeMethods.cairo_region_subtract (Handle, other.Handle);
- }
-
- public Status SubtractRectangle (Crow.Rectangle rectangle)
- {
- return NativeMethods.cairo_region_subtract_rectangle (Handle, ref rectangle);
- }
-
- public Status Intersect (Region other)
- {
- return NativeMethods.cairo_region_intersect (Handle, other.Handle);
- }
-
- public Status IntersectRectangle (Crow.Rectangle rectangle)
- {
- return NativeMethods.cairo_region_intersect_rectangle (Handle, ref rectangle);
- }
-
- public Status Union (Region other)
- {
- return NativeMethods.cairo_region_union (Handle, other.Handle);
- }
-
- public Status UnionRectangle (Crow.Rectangle rectangle)
- {
- return NativeMethods.cairo_region_union_rectangle (Handle, ref rectangle);
- }
-
- public Status Xor (Region other)
- {
- return NativeMethods.cairo_region_xor (Handle, other.Handle);
- }
-
- public Status XorRectangle (Crow.Rectangle rectangle)
- {
- return NativeMethods.cairo_region_xor_rectangle (Handle, ref rectangle);
- }
- public void Reset () {
- if (IsEmpty)
- return;
- NativeMethods.cairo_region_destroy (Handle);
- handle = NativeMethods.cairo_region_create ();
- }
- public bool OverlapOut (Crow.Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out;
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.ScaledFont.cs
-//
-// (c) 2008 Jordi Mas i Hernandez (jordimash@gmail.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing {
-
- public class ScaledFont : IDisposable
- {
- protected IntPtr handle = IntPtr.Zero;
-
- internal ScaledFont (IntPtr handle, bool owner)
- {
- this.handle = handle;
- if (!owner)
- NativeMethods.cairo_scaled_font_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- public ScaledFont (FontFace fontFace, Matrix matrix, Matrix ctm, FontOptions options)
- : this (NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle), true)
- {
- }
-
- ~ScaledFont ()
- {
- Dispose (false);
- }
-
- public IntPtr Handle {
- get {
- return handle;
- }
- }
-
- public FontExtents FontExtents {
- get {
- FontExtents extents;
- NativeMethods.cairo_scaled_font_extents (handle, out extents);
- return extents;
- }
- }
-
- public Matrix FontMatrix {
- get {
- Matrix m;
- NativeMethods.cairo_scaled_font_get_font_matrix (handle, out m);
- return m;
- }
- }
-
- public FontType FontType {
- get {
- return NativeMethods.cairo_scaled_font_get_type (handle);
- }
- }
-
- public TextExtents GlyphExtents (Glyph[] glyphs)
- {
- IntPtr ptr = Context.FromGlyphToUnManagedMemory (glyphs);
- TextExtents extents;
-
- NativeMethods.cairo_scaled_font_glyph_extents (handle, ptr, glyphs.Length, out extents);
-
- Marshal.FreeHGlobal (ptr);
- return extents;
- }
-
- public Status Status
- {
- get { return NativeMethods.cairo_scaled_font_status (handle); }
- }
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<ScaledFont> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_scaled_font_destroy (handle);
- handle = IntPtr.Zero;
- }
-
- [Obsolete]
- protected void Reference ()
- {
- NativeMethods.cairo_scaled_font_reference (handle);
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Color = Crow.Color;
-namespace Crow.Drawing {
-
- public class SolidPattern : Pattern
- {
- internal SolidPattern (IntPtr handle, bool owned) : base (handle, owned)
- {
- }
-
- public SolidPattern (Color color)
- : base (NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A), true)
- {
- }
-
- public SolidPattern (double r, double g, double b)
- : base (NativeMethods.cairo_pattern_create_rgb (r, g, b), true)
- {
- }
-
- public SolidPattern (double r, double g, double b, double a)
- : base (NativeMethods.cairo_pattern_create_rgba (r, g, b, a), true)
- {
- }
-
- public SolidPattern (Color color, bool solid)
- : base (solid
- ? NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B)
- : NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A),
- true)
- {
- }
-
- public Color Color {
- get {
- double red, green, blue, alpha;
- NativeMethods.cairo_pattern_get_rgba (Handle, out red, out green, out blue, out alpha);
- return new Color (red, green, blue, alpha);
- }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.Status.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// John Luke (john.luke@gmail.com)
-// Alp Toker (alp@atoker.com)
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum Status
- {
- Success = 0,
- NoMemory,
- InvalidRestore,
- InvalidPopGroup,
- NoCurrentPoint,
- InvalidMatrix,
- InvalidStatus,
- NullPointer,
- InvalidString,
- InvalidPathData,
- ReadError,
- WriteError,
- SurfaceFinished,
- SurfaceTypeMismatch,
- PatternTypeMismatch,
- InvalidContent,
- InvalidFormat,
- InvalidVisual,
- FileNotFound,
- InvalidDash,
- InvalidDscComment,
- InvalidIndex,
- ClipNotRepresentable,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Cairo.cs
-//
-// Authors:
-// John Luke (john.luke@gmail.com)
-//
-// Copyright (C) John Luke 2005
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing
-{
-
- public enum SubpixelOrder
- {
- Default,
- Rgb,
- Bgr,
- Vrgb,
- Vbgr,
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Surface.cs
-//
-// Authors:
-// Duncan Mak
-// Miguel de Icaza.
-// Alp Toker
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell, Inc. 2003.
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace Crow.Drawing {
-
- public class Surface : IDisposable
- {
- IntPtr handle = IntPtr.Zero;
-
- [Obsolete]
- protected Surface()
- {
- }
-
- [Obsolete]
- protected Surface (IntPtr ptr) : this (ptr, true)
- {
- }
-
- protected Surface (IntPtr handle, bool owner)
- {
- this.handle = handle;
- if (!owner)
- NativeMethods.cairo_surface_reference (handle);
- if (CairoDebug.Enabled)
- CairoDebug.OnAllocated (handle);
- }
-
- public static Surface Lookup (IntPtr surface, bool owned)
- {
- SurfaceType st = NativeMethods.cairo_surface_get_type (surface);
- switch (st) {
- case SurfaceType.Image:
- return new ImageSurface (surface, owned);
- case SurfaceType.Xlib:
- return new XlibSurface (surface, owned);
- case SurfaceType.Xcb:
- return new XcbSurface (surface, owned);
- case SurfaceType.Glitz:
- return new GlitzSurface (surface, owned);
- case SurfaceType.Win32:
- return new Win32Surface (surface, owned);
- case SurfaceType.Pdf:
- return new PdfSurface (surface, owned);
- case SurfaceType.PS:
- return new PSSurface (surface, owned);
- case SurfaceType.DirectFB:
- return new DirectFBSurface (surface, owned);
- case SurfaceType.Svg:
- return new SvgSurface (surface, owned);
- case SurfaceType.GL:
- return new GLSurface (surface, owned);
- default:
- return new Surface (surface, owned);
- }
- }
-
- [Obsolete ("Use an ImageSurface constructor instead.")]
- public static Surface CreateForImage (
- ref byte[] data, Format format, int width, int height, int stride)
- {
- IntPtr p = NativeMethods.cairo_image_surface_create_for_data (
- data, format, width, height, stride);
-
- return new Surface (p, true);
- }
-
- [Obsolete ("Use an ImageSurface constructor instead.")]
- public static Surface CreateForImage (
- Format format, int width, int height)
- {
- IntPtr p = NativeMethods.cairo_image_surface_create (
- format, width, height);
-
- return new Surface (p, true);
- }
-
-
- public Surface CreateSimilar (
- Content content, int width, int height)
- {
- IntPtr p = NativeMethods.cairo_surface_create_similar (
- this.Handle, content, width, height);
-
- return Surface.Lookup(p, true);
- }
-
- ~Surface ()
- {
- Dispose (false);
- }
-
-
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || CairoDebug.Enabled)
- CairoDebug.OnDisposed<Surface> (handle, disposing);
-
- if (!disposing|| handle == IntPtr.Zero)
- return;
-
- NativeMethods.cairo_surface_destroy (handle);
- handle = IntPtr.Zero;
- }
- public virtual void SetSize (int width, int height) {
- }
-
- public Status Finish ()
- {
- NativeMethods.cairo_surface_finish (handle);
- return Status;
- }
-
- public void Flush ()
- {
- NativeMethods.cairo_surface_flush (handle);
- }
-
- public void MarkDirty ()
- {
- NativeMethods.cairo_surface_mark_dirty (Handle);
- }
-
- public void MarkDirty (Crow.Rectangle rectangle)
- {
- 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 IntPtr Handle {
- get {
- return handle;
- }
- }
-
- public PointD DeviceOffset {
- get {
- double x, y;
- NativeMethods.cairo_surface_get_device_offset (handle, out x, out y);
- return new PointD (x, y);
- }
-
- set {
- NativeMethods.cairo_surface_set_device_offset (handle, value.X, value.Y);
- }
- }
-
- [Obsolete ("Use Dispose()")]
- public void Destroy()
- {
- Dispose ();
- }
-
- public void SetFallbackResolution (double x, double y)
- {
- NativeMethods.cairo_surface_set_fallback_resolution (handle, x, y);
- }
-
- public void WriteToPng (string filename)
- {
- NativeMethods.cairo_surface_write_to_png (handle, filename);
- }
-
- [Obsolete ("Use Handle instead.")]
- public IntPtr Pointer {
- get {
- return handle;
- }
- }
-
- public Status Status {
- get { return NativeMethods.cairo_surface_status (handle); }
- }
-
- public Content Content {
- get { return NativeMethods.cairo_surface_get_content (handle); }
- }
-
- public SurfaceType SurfaceType {
- get { return NativeMethods.cairo_surface_get_type (handle); }
- }
-
- public uint ReferenceCount {
- get { return NativeMethods.cairo_surface_get_reference_count (handle); }
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class SurfacePattern : Pattern
- {
- internal SurfacePattern (IntPtr handle, bool owned) : base (handle, owned)
- {
- }
-
- public SurfacePattern (Surface surface)
- : base (NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
- {
- }
-
- //no idea why this is here, the base one is identical, but we can't remove it now
- public new Extend Extend {
- set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
- get { return NativeMethods.cairo_pattern_get_extend (Handle); }
- }
-
- public Filter Filter {
- set { NativeMethods.cairo_pattern_set_filter (Handle, value); }
- get { return NativeMethods.cairo_pattern_get_filter (Handle); }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.SurfaceType.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
-
- public enum SurfaceType
- {
- Image,
- Pdf,
- PS,
- Xlib,
- Xcb,
- Glitz,
- Quartz,
- Win32,
- BeOS,
- DirectFB,
- Svg,
- OS2,
- Win32Printing,
- QuartzImage,
- Script,
- Qt,
- Recording,
- VG,
- GL,
- Drm,
- Tee,
- Xml,
- Skia,
- SubSurface
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.SvgSurface.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class SvgSurface : Surface
- {
- internal SvgSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public SvgSurface (string filename, double width, double height)
- : base (NativeMethods.cairo_svg_surface_create (filename, width, height), true)
- {
- }
-
- public void RestrictToVersion (SvgVersion version)
- {
- NativeMethods.cairo_svg_surface_restrict_to_version (Handle, version);
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.SvgVersion.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
-
- public enum SvgVersion
- {
- // FIXME: yuck
- OnePointOne = 0,
- OnePointTwo,
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.TextExtents.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- [StructLayout (LayoutKind.Sequential)]
- public struct TextExtents
- {
- double xbearing;
- double ybearing;
- double width;
- double height;
- double xadvance;
- double yadvance;
-
- public double XBearing {
- get { return xbearing; }
- set { xbearing = value; }
- }
-
- public double YBearing {
- get { return ybearing; }
- set { ybearing = value; }
- }
-
- public double Width {
- get { return width; }
- set { width = value; }
- }
-
- public double Height {
- get { return height; }
- set { height = value; }
- }
-
- public double XAdvance {
- get { return xadvance; }
- set { xadvance = value; }
- }
-
- public double YAdvance {
- get { return yadvance; }
- set { yadvance = value; }
- }
-
- public override bool Equals (object obj)
- {
- if (obj is TextExtents)
- return this == (TextExtents)obj;
- return false;
- }
-
- public override int GetHashCode ()
- {
- return (int)XBearing ^ (int)YBearing ^ (int)Width ^ (int)Height ^ (int)XAdvance ^ (int)YAdvance;
- }
-
- public static bool operator == (TextExtents extents, TextExtents other)
- {
- return extents.XBearing == other.XBearing && extents.YBearing == other.YBearing && extents.Width == other.Width && extents.Height == other.Height && extents.XAdvance == other.XAdvance && extents.YAdvance == other.YAdvance;
- }
-
- public static bool operator != (TextExtents extents, TextExtents other)
- {
- return !(extents == other);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-// JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.Drawing
-{
- public class WGLDevice : Device
- {
- public WGLDevice (IntPtr hglrc) : base (NativeMethods.cairo_wgl_device_create (hglrc), true)
- {
- }
-
- public IntPtr Context {
- get { return NativeMethods.cairo_wgl_device_get_context (Handle); }
- }
- }
-}
-
+++ /dev/null
-//
-// Mono.Cairo.Win32Surface.cs
-//
-// Authors:
-// John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class Win32Surface : Surface
- {
- internal Win32Surface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public Win32Surface (IntPtr hdc)
- : base (NativeMethods.cairo_win32_surface_create (hdc), true)
- {
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.XcbSurface.cs
-//
-// Authors:
-// Alp Toker
-//
-// (C) Alp Toker, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
- public class XcbSurface : Surface
- {
- internal XcbSurface (IntPtr handle, bool owns) : base (handle, owns)
- {
- }
-
- public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
- : base (NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height), true)
- {
- }
-
- public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
- {
- IntPtr ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
- return new XcbSurface (ptr, true);
- }
- public override void SetSize (int width, int height)
- {
- NativeMethods.cairo_xcb_surface_set_size (Handle, width, height);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.XlibSurface.cs
-//
-// Authors:
-// Duncan Mak
-// Miguel de Icaza.
-// JP Bruyère
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell, Inc. 2003.
-// (C) JP Bruyère 2021
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.Drawing {
-
- public class XlibSurface : Surface
- {
- public XlibSurface (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
- : base (NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height), true)
- {
- }
-
- public XlibSurface (IntPtr ptr, bool own) : base (ptr, own)
- {
- }
-
- public static XlibSurface FromBitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
- {
- IntPtr ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
- return new XlibSurface(ptr, true);
- }
-
- public void SetDrawable (IntPtr drawable, int width, int height)
- {
- NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height);
- }
-
- public override void SetSize (int width, int 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 IntPtr Screen => NativeMethods.cairo_xlib_surface_get_screen (Handle);
- public IntPtr Visual=> NativeMethods.cairo_xlib_surface_get_visual (Handle);
- }
-}
+++ /dev/null
-//Copyright GPL2
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing {
-
-
- public sealed class SvgHandle : IDisposable {
- const string lib = "rsvg-2.40";
-
- public IntPtr Raw;
-
- [DllImport (lib)]
- static extern IntPtr rsvg_handle_new();
- [DllImport (lib)]
- static extern IntPtr rsvg_handle_new_from_data (byte[] data, UIntPtr n_data, out IntPtr error);
- [DllImport (lib)]
- static extern IntPtr rsvg_handle_new_from_file (string file_name, out IntPtr error);
- [DllImport (lib)]
- static extern IntPtr rsvg_handle_get_base_uri (IntPtr raw);
- [DllImport (lib)]
- static extern void rsvg_handle_set_dpi (IntPtr raw, double dpi);
- [DllImport (lib)]
- static extern void rsvg_handle_set_dpi_x_y (IntPtr raw, double dpi_x, double dpi_y);
-
- [DllImport (lib)]
- static extern void rsvg_handle_render_cairo (IntPtr raw, IntPtr cr);
- [DllImport (lib)]
- static extern void rsvg_handle_render_cairo_sub (IntPtr raw, IntPtr cr, string id);
-
- [DllImport (lib)]
- static extern void rsvg_handle_get_dimensions (IntPtr raw, IntPtr dimension_data);
- [DllImport (lib)]
- static extern bool rsvg_handle_close (IntPtr raw, out IntPtr error);
- [DllImport (lib)]
- static extern IntPtr rsvg_handle_get_title (IntPtr raw);
- [DllImport (lib)]
- static extern IntPtr rsvg_handle_get_metadata (IntPtr raw);
-
- public SvgHandle ()
- {
- Raw = rsvg_handle_new();
- }
- public SvgHandle (byte[] data)
- {
- Raw = rsvg_handle_new_from_data(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)), out IntPtr error);
- if (error != IntPtr.Zero) throw new Exception (error.ToString());
- }
- public SvgHandle (string file_name)
- {
- Raw = rsvg_handle_new_from_file(file_name, out IntPtr error);
- if (error != IntPtr.Zero) throw new Exception (error.ToString());
- }
-
-
- public double Dpi { set => rsvg_handle_set_dpi (Raw, value); }
- public void SetDpiXY (double dpi_x, double dpi_y) => rsvg_handle_set_dpi_x_y (Raw, dpi_x, dpi_y);
-
-
- public void Render(Context cr) =>
- rsvg_handle_render_cairo (Raw, cr == null ? IntPtr.Zero : cr.Handle);
-
- public void Render (Context cr, string id) =>
- rsvg_handle_render_cairo_sub (Raw, cr == null ? IntPtr.Zero : cr.Handle, id);
-
- [StructLayout(LayoutKind.Sequential)]
- struct DimensionData {
-
- public int Width;
- public int Height;
- public double Em;
- public double Ex;
-
- public static DimensionData Zero = new DimensionData ();
-
- public static DimensionData New(IntPtr raw) {
- if (raw == IntPtr.Zero)
- return DimensionData.Zero;
- return (DimensionData) Marshal.PtrToStructure (raw, typeof (DimensionData));
- }
- }
- public Size Dimensions {
- get {
- DimensionData dimension_data;
- IntPtr native_dimension_data = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (DimensionData)));
- rsvg_handle_get_dimensions(Raw, native_dimension_data);
- dimension_data = DimensionData.New (native_dimension_data);
- Marshal.FreeHGlobal (native_dimension_data);
- return new Size (dimension_data.Width, dimension_data.Height);
- }
- }
-
- public void Dispose() {
- bool raw_ret = rsvg_handle_close(Raw, out IntPtr error);
- if (error != IntPtr.Zero) throw new Exception (error.ToString());
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Text;
-using System.Linq;
-using Crow;
-
-namespace Crow.Drawing
-{
- public class Context : IDisposable
- {
-
- IntPtr handle = IntPtr.Zero;
-
- public Context(Surface surf)
- {
- handle = NativeMethods.vkvg_create(surf.Handle);
- this.FillRule = FillRule.NonZero;
- }
- ~Context()
- {
- Dispose(false);
- }
-
- public IntPtr Handle => handle;
-
- public void AddReference()
- {
- NativeMethods.vkvg_reference(handle);
- }
- public uint References() => NativeMethods.vkvg_get_reference_count(handle);
-
- public double LineWidth
- {
- get => NativeMethods.vkvg_get_line_width(handle);
- set { NativeMethods.vkvg_set_line_width(handle, (float)value); }
- }
- public LineJoin LineJoin
- {
- get => NativeMethods.vkvg_get_line_join(handle);
- set { NativeMethods.vkvg_set_line_join(handle, value); }
- }
- public LineCap LineCap
- {
- get => NativeMethods.vkvg_get_line_cap(handle);
- set { NativeMethods.vkvg_set_line_cap(handle, value); }
- }
- public uint FontSize
- {
- set { NativeMethods.vkvg_set_font_size(handle, value); }
- }
- public string FontFace
- {
- set { NativeMethods.vkvg_select_font_face(handle, value); }
- }
- public Operator Operator
- {
- set { NativeMethods.vkvg_set_operator(handle, value); }
- get { return NativeMethods.vkvg_get_operator(handle); }
- }
- public FillRule FillRule
- {
- set { NativeMethods.vkvg_set_fill_rule(handle, value); }
- get { return NativeMethods.vkvg_get_fill_rule(handle); }
- }
- public FontExtents FontExtents
- {
- get
- {
- FontExtents f_extents;
- NativeMethods.vkvg_font_extents(handle, out f_extents);
- return f_extents;
- }
- }
- public Antialias Antialias {
- set;
- get;
- }
- public TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize = 4) {
- TextExtents (s, tabSize, out TextExtents extents);
- return extents;
- }
- public void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents) {
- int size = s.Length * 4 + 1;
- Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
- bytes[encodedBytes] = 0;
- TextExtents (bytes.Slice (0, encodedBytes + 1), out extents);
- }
- public void TextExtents (Span<byte> bytes, out TextExtents extents) {
- NativeMethods.vkvg_text_extents (handle, ref bytes.GetPinnableReference (), out extents);
- }
- public Matrix Matrix
- {
- get
- {
- Matrix m;
- NativeMethods.vkvg_get_matrix(handle, out m);
- return m;
- }
- set
- {
- NativeMethods.vkvg_set_matrix(handle, ref value);
- }
- }
- public void ShowText (string text) => ShowText (text.AsSpan());
- public void ShowText (ReadOnlySpan<char> s, int tabSize = 4) {
- int size = s.Length * 4 + 1;
- Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
- bytes[encodedBytes] = 0;
- ShowText (bytes.Slice (0, encodedBytes + 1));
- }
- public void ShowText (Span<byte> bytes) {
- NativeMethods.vkvg_show_text (handle, ref bytes.GetPinnableReference());
- }
-
- public void ShowText(TextRun textRun)
- {
- NativeMethods.vkvg_show_text_run(handle, textRun.Handle);
- }
- public void Save()
- {
- NativeMethods.vkvg_save(handle);
- }
- public void Restore()
- {
- NativeMethods.vkvg_restore(handle);
- }
- public void Flush()
- {
- NativeMethods.vkvg_flush(handle);
- }
- public void Clear()
- {
- NativeMethods.vkvg_clear(handle);
- }
- public void Paint()
- {
- NativeMethods.vkvg_paint(handle);
- }
- public void PaintWithAlpha (double alpha) => Paint();
- public void Arc(float xc, float yc, float radius, float a1, float a2)
- {
- NativeMethods.vkvg_arc(handle, xc, yc, radius, a1, a2);
- }
- public void Arc(double xc, double yc, double radius, double a1, double a2)
- {
- NativeMethods.vkvg_arc(handle, (float)xc, (float)yc, (float)radius, (float)a1, (float)a2);
- }
- public void Arc (PointD center, double radius, double angle1, double angle2)
- {
- NativeMethods.vkvg_arc (handle, (float)center.X, (float)center.Y, (float)radius, (float)angle1, (float)angle2);
- }
-
- public void ArcNegative (PointD center, double radius, double angle1, double angle2)
- {
- NativeMethods.vkvg_arc_negative (handle, (float)center.X, (float)center.Y, (float)radius, (float)angle1, (float)angle2);
- }
- public void ArcNegative(float xc, float yc, float radius, float a1, float a2)
- {
- NativeMethods.vkvg_arc_negative(handle, xc, yc, radius, a1, a2);
- }
- public void Rectangle(float x, float y, float width, float height)
- {
- NativeMethods.vkvg_rectangle(handle, x, y, width, height);
- }
- public void Scale(float sx, float sy)
- {
- NativeMethods.vkvg_scale(handle, sx, sy);
- }
- public void Translate(float dx, float dy)
- {
- NativeMethods.vkvg_translate(handle, dx, dy);
- }
- public void Rotate(float alpha)
- {
- NativeMethods.vkvg_rotate(handle, alpha);
- }
- public void ArcNegative(double xc, double yc, double radius, double a1, double a2)
- {
- NativeMethods.vkvg_arc_negative(handle, (float)xc, (float)yc, (float)radius, (float)a1, (float)a2);
- }
- public void Rectangle(double x, double y, double width, double height)
- {
- NativeMethods.vkvg_rectangle(handle, (float)x, (float)y, (float)width, (float)height);
- }
- public void Scale(double sx, double sy)
- {
- NativeMethods.vkvg_scale(handle, (float)sx, (float)sy);
- }
- public void Translate(double dx, double dy)
- {
- NativeMethods.vkvg_translate(handle, (float)dx, (float)dy);
- }
- public void Translate(PointD p)
- {
- NativeMethods.vkvg_translate(handle, (float)p.X, (float)p.Y);
- }
- public void Rotate(double alpha)
- {
- NativeMethods.vkvg_rotate(handle, (float)alpha);
- }
-
- public void Fill()
- {
- NativeMethods.vkvg_fill(handle);
- }
- public void FillPreserve()
- {
- NativeMethods.vkvg_fill_preserve(handle);
- }
- public void Stroke()
- {
- NativeMethods.vkvg_stroke(handle);
- }
- public void StrokePreserve()
- {
- NativeMethods.vkvg_stroke_preserve(handle);
- }
- public void Clip()
- {
- NativeMethods.vkvg_clip(handle);
- }
- public void ClipPreserve()
- {
- NativeMethods.vkvg_clip_preserve(handle);
- }
- public void ResetClip()
- {
- NativeMethods.vkvg_reset_clip(handle);
- }
- public void NewPath()
- {
- NativeMethods.vkvg_new_path(handle);
- }
- public void NewSubPath()
- {
- NativeMethods.vkvg_new_sub_path(handle);
- }
- public void ClosePath()
- {
- NativeMethods.vkvg_close_path(handle);
- }
- public void MoveTo(PointD p)
- {
- NativeMethods.vkvg_move_to(handle, (float)p.X, (float)p.Y);
- }
- public void MoveTo(Point p)
- {
- NativeMethods.vkvg_move_to(handle, p.X, p.Y);
- }
- public void MoveTo(float x, float y)
- {
- NativeMethods.vkvg_move_to(handle, x, y);
- }
- public void RelMoveTo(float x, float y)
- {
- NativeMethods.vkvg_rel_move_to(handle, x, y);
- }
- public void LineTo(float x, float y)
- {
- NativeMethods.vkvg_line_to(handle, x, y);
- }
- public void LineTo(Point p)
- {
- NativeMethods.vkvg_line_to(handle, p.X, p.Y);
- }
- public void LineTo(PointD p)
- {
- NativeMethods.vkvg_line_to(handle, (float)p.X, (float)p.Y);
- }
- public void RelLineTo(float x, float y)
- {
- NativeMethods.vkvg_rel_line_to(handle, x, y);
- }
- public void CurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
- {
- NativeMethods.vkvg_curve_to(handle, x1, y1, x2, y2, x3, y3);
- }
- public void RelCurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
- {
- NativeMethods.vkvg_rel_curve_to(handle, x1, y1, x2, y2, x3, y3);
- }
-
- public void MoveTo(double x, double y)
- {
- NativeMethods.vkvg_move_to(handle, (float)x, (float)y);
- }
- public void RelMoveTo(double x, double y)
- {
- NativeMethods.vkvg_rel_move_to(handle, (float)x, (float)y);
- }
- public void LineTo(double x, double y)
- {
- NativeMethods.vkvg_line_to(handle, (float)x, (float)y);
- }
- public void RelLineTo(double x, double y)
- {
- NativeMethods.vkvg_rel_line_to(handle, (float)x, (float)y);
- }
- public void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
- {
- NativeMethods.vkvg_curve_to(handle, (float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3);
- }
- public void RelCurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
- {
- NativeMethods.vkvg_rel_curve_to(handle, (float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3);
- }
-
- public void SetSource(Pattern pat)
- {
- NativeMethods.vkvg_set_source(handle, pat.Handle);
- }
- public void SetSource (Color color)
- {
- NativeMethods.vkvg_set_source_rgba (handle, (float)(color.R / 255.0), (float)(color.G / 255.0), (float)(color.B / 255.0), (float)(color.A / 255.0));
- }
- public void SetSource(float r, float g, float b, float a = 1f)
- {
- NativeMethods.vkvg_set_source_rgba(handle, r, g, b, a);
- }
- public void SetSource(double r, double g, double b, double a = 1.0)
- {
- NativeMethods.vkvg_set_source_rgba(handle, (float)r, (float)g, (float)b, (float)a);
- }
- public void SetSource(Surface surf, float x = 0f, float y = 0f)
- {
- NativeMethods.vkvg_set_source_surface(handle, surf.Handle, x, y);
- }
- public void SetSourceSurface(Surface surf, float x = 0f, float y = 0f)
- {
- NativeMethods.vkvg_set_source_surface(handle, surf.Handle, x, y);
- }
- public void RenderSvg(IntPtr nsvgImage, string subId = null)
- {
- NativeMethods.vkvg_render_svg(handle, nsvgImage, subId);
- }
- public Crow.Rectangle StrokeExtents () => default;
- internal static byte[] TerminateUtf8(string s)
- {
- // compute the byte count including the trailing \0
- var byteCount = Encoding.UTF8.GetMaxByteCount(s.Length + 1);
- var bytes = new byte[byteCount];
- Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
- return bytes;
- }
- public void SetDash (double [] dashes, double offset = 0) {
- if (dashes == null)
- NativeMethods.vkvg_set_dash(handle, null, 0, 0);
- else {
- float[] floats = dashes.Cast<float> ().ToArray ();
- NativeMethods.vkvg_set_dash(handle, floats, (uint)dashes.Length, (float)offset);
- }
- }
- public float[] Dashes
- {
- set
- {
- if (value == null)
- NativeMethods.vkvg_set_dash(handle, null, 0, 0);
- else
- NativeMethods.vkvg_set_dash(handle, value, (uint)value.Length, 0);
- }
- }
-
-
- public void PushGroup () {
-
- }
- public void PopGroupToSource () {
-
- }
-
- #region IDisposable implementation
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!disposing || handle == IntPtr.Zero)
- return;
-
- NativeMethods.vkvg_destroy(handle);
- handle = IntPtr.Zero;
- }
- #endregion
- }
-}
-
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace Crow.Drawing
-{
- public class Device: IDisposable
- {
-
- IntPtr handle = IntPtr.Zero;
-
- #region CTORS & DTOR
- public Device (IntPtr instance, IntPtr phy, IntPtr dev, uint qFamIdx, SampleCount samples = SampleCount.Sample_1, uint qIndex = 0)
- {
- handle = NativeMethods.vkvg_device_create_multisample (instance, phy, dev, qFamIdx, qIndex, samples, false);
- }
- ~Device ()
- {
- Dispose (false);
- }
- #endregion
-
- public void GetDpy (out int hdpy, out int vdpy) => NativeMethods.vkvg_device_get_dpy (handle, out hdpy, out vdpy);
- public void SetDpy (int hdpy, int vdpy) => NativeMethods.vkvg_device_set_dpy (handle, hdpy, vdpy);
- public void AddReference () => NativeMethods.vkvg_device_reference (handle);
- public uint References () => NativeMethods.vkvg_device_get_reference_count (handle);
-
- public IntPtr Handle => handle;
-
- #region IDisposable implementation
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || handle == IntPtr.Zero)
- return;
-
- NativeMethods.vkvg_device_destroy (handle);
- handle = IntPtr.Zero;
- }
- #endregion
- }
-}
-
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace Crow.Drawing
-{
- public enum Status
- {
- Success = 0,
- NoMemory,
- InvalidRestore,
- InvalidPopGroup,
- NoCurrentPoint,
- InvalidMatrix,
- InvalidStatus,
- NullPointer,
- InvalidString,
- InvalidPathData,
- ReadError,
- WriteError,
- SurfaceFinished,
- SurfaceTypeMismatch,
- PatternTypeMismatch,
- InvalidContent,
- InvalidFormat,
- InvalidVisual,
- FileNotFound,
- InvalidDash
- }
-
- public enum Direction
- {
- Horizontal = 0,
- Vertical = 1
- }
-
- public enum Format
- {
- ARGB32,
- RGB24,
- A8,
- A1
- }
-
- public enum Extend
- {
- None,
- Repeat,
- Reflect,
- Pad
- }
-
- public enum Filter
- {
- Fast,
- Good,
- Best,
- Nearest,
- Bilinear,
- Gaussian,
- }
-
- public enum PatternType
- {
- Solid,
- Surface,
- Linear,
- Radial,
- Mesh,
- RasterSource,
- }
-
- public enum Operator
- {
- Clear,
- Source,
- Over,
- In,
- Out,
- Atop,
-
- Dest,
- DestOver,
- DestIn,
- DestOut,
- DestAtop,
-
- Xor,
- Add,
- Saturate,
- }
-
- public enum FontSlant
- {
- Normal,
- Italic,
- Oblique
- }
- public enum FontWeight
- {
- Normal,
- Bold,
- }
-
- public enum SampleCount
- {
- Sample_1 = 0x00000001,
- Sample_2 = 0x00000002,
- Sample_4 = 0x00000004,
- Sample_8 = 0x00000008,
- Sample_16 = 0x00000010,
- Sample_32 = 0x00000020,
- Sample_64 = 0x00000040
- }
-
- public enum LineCap
- {
- Butt,
- Round,
- Square
- }
-
- public enum LineJoin
- {
- Miter,
- Round,
- Bevel
- }
- public enum FillRule
- {
- EvenOdd,
- NonZero,
- }
- public enum Antialias
- {
- Default,
- None,
- Grey,
- Subpixel,
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// from Mono.Cairo.FontExtents.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-// Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-//
-// This is a simplistic binding of the Cairo API to C#. All functions
-// in cairo.h are transcribed into their C# equivelants
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- [StructLayout (LayoutKind.Sequential)]
- public struct FontExtents
- {
- float ascent;
- float descent;
- float height;
- float maxXAdvance;
- float maxYAdvance;
-
- public float Ascent {
- get { return ascent; }
- set { ascent = value; }
- }
-
- public float Descent {
- get { return descent; }
- set { descent = value; }
- }
-
- public float Height {
- get { return height; }
- set { height = value; }
- }
-
- public float MaxXAdvance {
- get { return maxXAdvance; }
- set { maxXAdvance = value; }
- }
-
- public float MaxYAdvance {
- get { return maxYAdvance; }
- set { maxYAdvance = value; }
- }
-
- public FontExtents (float ascent, float descent, float height, float maxXAdvance, float maxYAdvance)
- {
- this.ascent = ascent;
- this.descent = descent;
- this.height = height;
- this.maxXAdvance = maxXAdvance;
- this.maxYAdvance = maxYAdvance;
- }
-
- public override bool Equals (object obj)
- {
- if (obj is FontExtents)
- return this == (FontExtents) obj;
- return false;
- }
-
- public override int GetHashCode ()
- {
- return (int) Ascent ^ (int) Descent ^ (int) Height ^ (int) MaxXAdvance ^ (int) MaxYAdvance;
- }
-
- public static bool operator == (FontExtents extents, FontExtents other)
- {
- return extents.Ascent == other.Ascent && extents.Descent == other.Descent && extents.Height == other.Height && extents.MaxXAdvance == other.MaxXAdvance && extents.MaxYAdvance == other.MaxYAdvance;
- }
-
- public static bool operator != (FontExtents extents, FontExtents other)
- {
- return !(extents == other);
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2018-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-namespace Crow.Drawing
-{
- public class Gradient : Pattern
- {
- protected Gradient(IntPtr handle) : base (handle) { }
- public void AddColorStop (double offset, Crow.Color c)
- => NativeMethods.vkvg_pattern_add_color_stop(handle, (float)offset, c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f);
- public void AddColorStop(float offset, float r, float g, float b, float a = 1f)
- => NativeMethods.vkvg_pattern_add_color_stop(handle, offset, r, g, b, a);
- }
- public class LinearGradient : Gradient {
- public LinearGradient (float x0, float y0, float x1, float y1)
- : base (NativeMethods.vkvg_pattern_create_linear(x0, y0, x1, y1)) {
-
- }
- }
- public class RadialGradient : Gradient {
- public RadialGradient ( float cx0, float cy0, float radius0,
- float cx1, float cy1, float radius1)
- : base (NativeMethods.vkvg_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1)) {
-
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-namespace Crow.Drawing {
- public struct Matrix {
- float xx; float yx;
- float xy; float yy;
- float x0; float y0;
-
- public float XX { get { return xx; } set { xx = value; } }
- public float YX { get { return yx; } set { yx = value; } }
- public float XY { get { return xy; } set { xy = value; } }
- public float YY { get { return yy; } set { yy = value; } }
- public float X0 { get { return x0; } set { x0 = value; } }
- public float Y0 { get { return y0; } set { y0 = value; } }
-
- public static Matrix Create (float xx, float yx, float xy, float yy, float x0, float y0) {
- Matrix tmp;
- NativeMethods.vkvg_matrix_init (out tmp, xx, yx, xy, yy, x0, y0);
- return tmp;
- }
- public static Matrix CreateTranslation (float tx, float ty) {
- Matrix tmp;
- NativeMethods.vkvg_matrix_init_translate (out tmp, tx, ty);
- return tmp;
- }
- public static Matrix CreateRotation (float radian) {
- Matrix tmp;
- NativeMethods.vkvg_matrix_init_rotate (out tmp, radian);
- return tmp;
- }
- public static Matrix CreateScale (float sx, float sy) {
- Matrix tmp;
- NativeMethods.vkvg_matrix_init_scale (out tmp, sx, sy);
- return tmp;
- }
- public static Matrix Identity {
- get {
- Matrix tmp;
- NativeMethods.vkvg_matrix_init_identity (out tmp);
- return tmp;
- }
- }
-
- public void Translate (float tx, float ty) {
- Matrix tmp = this;
- NativeMethods.vkvg_matrix_translate (ref tmp, tx, ty);
- xx = tmp.xx; yx = tmp.yx;
- xy = tmp.xy; yy = tmp.yy;
- x0 = tmp.x0; y0 = tmp.y0;
- }
- public void Rotate (float radian) {
- Matrix tmp = this;
- NativeMethods.vkvg_matrix_rotate (ref tmp, radian);
- xx = tmp.xx; yx = tmp.yx;
- xy = tmp.xy; yy = tmp.yy;
- x0 = tmp.x0; y0 = tmp.y0;
- }
- public void Scale (float sx, float sy) {
- Matrix tmp = this;
- NativeMethods.vkvg_matrix_scale (ref tmp, sx, sy);
- xx = tmp.xx; yx = tmp.yx;
- xy = tmp.xy; yy = tmp.yy;
- x0 = tmp.x0; y0 = tmp.y0;
- }
- public void Invert () {
- Matrix tmp = this;
- NativeMethods.vkvg_matrix_invert (ref tmp);
- xx = tmp.xx; yx = tmp.yx;
- xy = tmp.xy; yy = tmp.yy;
- x0 = tmp.x0; y0 = tmp.y0;
- }
- public void TransformDistance (ref float dx, ref float dy) {
- NativeMethods.vkvg_matrix_transform_distance (ref this, ref dx, ref dy);
- }
- public void TransformPoint (ref float px, ref float py) {
- NativeMethods.vkvg_matrix_transform_distance (ref this, ref px, ref py);
- }
-
- public static Matrix operator *(Matrix a, Matrix b) {
- Matrix tmp;
- NativeMethods.vkvg_matrix_multiply (out tmp, ref a, ref b);
- return tmp;
- }
-
- public override string ToString () {
- return string.Format ($"({xx};{yx};{xy};{yy};{x0};{y0})");
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- internal static class NativeMethods
- {
- const string libvkvg = "vkvg";
-
- #region Device
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_device_create(IntPtr instance, IntPtr phy, IntPtr dev, uint qFamIdx, uint qIndex);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_device_destroy(IntPtr device);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_device_create_multisample(IntPtr inst, IntPtr phy, IntPtr vkdev, uint qFamIdx, uint qIndex, SampleCount samples, bool deferredResolve);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_device_reference(IntPtr dev);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint vkvg_device_get_reference_count(IntPtr dev);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_device_set_dpy(IntPtr dev, int hdpy, int vdpy);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_device_get_dpy(IntPtr dev, out int hdpy, out int vdpy);
- #endregion
-
- #region Context
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_create(IntPtr surface);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_destroy(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_flush(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_new_path(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_new_sub_path(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_close_path(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_line_to(IntPtr ctx, float x, float y);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_rel_line_to(IntPtr ctx, float x, float y);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_move_to(IntPtr ctx, float x, float y);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_rel_move_to(IntPtr ctx, float x, float y);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_arc(IntPtr ctx, float xc, float yc, float radius, float a1, float a2);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_arc_negative(IntPtr ctx, float xc, float yc, float radius, float a1, float a2);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_curve_to(IntPtr ctx, float x1, float y1, float x2, float y2, float x3, float y3);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_rel_curve_to(IntPtr ctx, float x1, float y1, float x2, float y2, float x3, float y3);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_rectangle(IntPtr ctx, float x, float y, float width, float height);
-
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_scale(IntPtr ctx, float sx, float sy);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_translate(IntPtr ctx, float dx, float dy);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_rotate(IntPtr ctx, float alpha);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_transform(IntPtr ctx, ref Matrix matrix);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_matrix(IntPtr ctx, ref Matrix matrix);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_get_matrix(IntPtr ctx, out Matrix matrix);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_identity_matrix(IntPtr ctx);
-
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_stroke(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_stroke_preserve(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_clip(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_clip_preserve(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_reset_clip(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_fill(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_fill_preserve(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_paint(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_source_rgba(IntPtr ctx, float r, float g, float b, float a);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_line_width(IntPtr ctx, float width);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_line_cap(IntPtr ctx, LineCap cap);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_line_join(IntPtr ctx, LineJoin join);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_operator(IntPtr ctx, Operator op);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern FillRule vkvg_get_fill_rule(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_fill_rule(IntPtr ctx, FillRule fr);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern Operator vkvg_get_operator(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_source_surface(IntPtr ctx, IntPtr surf, float x, float y);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_source(IntPtr ctx, IntPtr pattern);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_font_extents(IntPtr ctx, out FontExtents extents);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_text_extents(IntPtr ctx, byte[] utf8, out TextExtents extents);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_text_extents(IntPtr cr, ref byte utf8, out TextExtents extents);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_select_font_face(IntPtr ctx, string name);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_font_size(IntPtr ctx, uint size);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_show_text(IntPtr ctx, byte [] utf8);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_show_text(IntPtr cr, ref byte utf8);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_save(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_restore(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_clear(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern float vkvg_get_line_width(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern LineCap vkvg_get_line_cap(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern LineJoin vkvg_get_line_join(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_get_source(IntPtr ctx);
-
- [DllImport (libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_set_dash (IntPtr ctx, float[] dashes, uint dashCount, float offset);
-
- //void vkvg_set_dash (VkvgContext ctx, const float* dashes, uint32_t num_dashes, float offset);
- //void vkvg_get_dash (VkvgContext ctx, const float* dashes, uint32_t* num_dashes, float* offset
-
- [DllImport (libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_reference(IntPtr ctx);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint vkvg_get_reference_count(IntPtr ctx);
- #endregion
-
- #region TextRun
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_text_run_create(IntPtr ctx, byte[] utf8);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_text_run_destroy(IntPtr textRun);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_show_text_run(IntPtr ctx, IntPtr textRun);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_text_run_get_extents(IntPtr textRun, out TextExtents extents);
- #endregion
-
- #region Pattern
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_create();
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_reference(IntPtr pat);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint vkvg_pattern_get_reference_count(IntPtr pat);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_create_rgba(float r, float g, float b, float a);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_create_rgb(float r, float g, float b);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_create_for_surface(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_create_linear(float x0, float y0, float x1, float y1);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_pattern_create_radial(float cx0, float cy0, float radius0,
- float cx1, float cy1, float radius1);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_pattern_destroy(IntPtr pat);
-
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_pattern_add_color_stop(IntPtr pat, float offset, float r, float g, float b, float a);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_pattern_set_extend(IntPtr pat, Extend extend);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_pattern_set_filter(IntPtr pat, Filter filter);
-
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern Extend vkvg_pattern_get_extend(IntPtr pat);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern Filter vkvg_pattern_get_filter(IntPtr pat);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern PatternType vkvg_pattern_get_type(IntPtr pat);
- #endregion
-
- #region Matrices
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_init_identity(out Matrix matrix);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_init(out Matrix matrix,
- float xx, float yx,
- float xy, float yy,
- float x0, float y0);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_init_translate(out Matrix matrix, float tx, float ty);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_init_scale(out Matrix matrix, float sx, float sy);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_init_rotate(out Matrix matrix, float radians);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_translate(ref Matrix matrix, float tx, float ty);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_scale(ref Matrix matrix, float sx, float sy);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_rotate(ref Matrix matrix, float radians);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_multiply(out Matrix result, ref Matrix a, ref Matrix b);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_transform_distance(ref Matrix matrix, ref float dx, ref float dy);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_transform_point(ref Matrix matrix, ref float x, ref float y);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_matrix_invert(ref Matrix matrix);
- #endregion
-
- #region Surface
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_create(IntPtr device, uint width, uint height);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_create_from_image(IntPtr dev, string filePath);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_create_from_svg(IntPtr dev, string filePath);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_create_from_svg_fragment(IntPtr dev, byte[] filePath);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_create_from_bitmap(IntPtr dev, ref byte data, uint width, uint height);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_surface_destroy(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_get_vk_image(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int vkvg_surface_get_width(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int vkvg_surface_get_height(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_surface_clear(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr vkvg_surface_reference(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint vkvg_surface_get_reference_count(IntPtr surf);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_surface_write_to_png(IntPtr surf, [MarshalAs(UnmanagedType.LPStr)]string path);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_surface_write_to_memory(IntPtr surf, IntPtr pBitmap);
- #endregion
-
- #region NSVG
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr nsvg_load_file(IntPtr dev, string filePath);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr nsvg_load(IntPtr dev, ref byte fragment);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void nsvg_destroy(IntPtr nsvgImage);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void nsvg_get_size(IntPtr nsvgImage, out int width, out int height);
- [DllImport(libvkvg, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void vkvg_render_svg(IntPtr ctx, IntPtr nsvgImage, string subId);
- #endregion
- }
-}
-
+++ /dev/null
-// Copyright (c) 2018-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-namespace Crow.Drawing
-{
- public class Pattern : IDisposable
- {
- protected IntPtr handle = IntPtr.Zero;
-
- #region CTORS & DTOR
- protected Pattern(IntPtr handle)
- {
- this.handle = handle;
- }
- public Pattern(float r, float g, float b)
- {
- handle = NativeMethods.vkvg_pattern_create_rgb(r, g, b);
- }
- public Pattern(float r, float g, float b, float a)
- {
- handle = NativeMethods.vkvg_pattern_create_rgba(r, g, b, a);
- }
- public Pattern(Surface surf)
- {
- handle = NativeMethods.vkvg_pattern_create_for_surface(surf.Handle);
- }
-
- ~Pattern()
- {
- Dispose(false);
- }
- #endregion
-
- public void AddReference()
- {
- NativeMethods.vkvg_pattern_reference(handle);
- }
- public uint References() => NativeMethods.vkvg_pattern_get_reference_count(handle);
-
- public IntPtr Handle => handle;
-
- public Extend Extend
- {
- set { NativeMethods.vkvg_pattern_set_extend(handle, value); }
- get { return NativeMethods.vkvg_pattern_get_extend(handle); }
- }
- public Filter Filter
- {
- set { NativeMethods.vkvg_pattern_set_filter(handle, value); }
- get { return NativeMethods.vkvg_pattern_get_filter(handle); }
- }
-
- #region IDisposable implementation
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!disposing || handle == IntPtr.Zero)
- return;
-
- NativeMethods.vkvg_pattern_destroy(handle);
- handle = IntPtr.Zero;
- }
- #endregion
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace Crow.Drawing
-{
- public class Surface: IDisposable
- {
- IntPtr handle = IntPtr.Zero;
- Device vkvgDev;
-
- public Surface (Device device, int width, int height)
- {
- vkvgDev = device;
- if (width <= 0 || height <= 0)
- handle = NativeMethods.vkvg_surface_create (device.Handle, 1, 1);
- else
- handle = NativeMethods.vkvg_surface_create (device.Handle, (uint)width, (uint)height);
- }
- public Surface (Device device, Span<byte> data, int width, int heigth)
- {
- vkvgDev = device;
- handle = NativeMethods.vkvg_surface_create_from_bitmap (device.Handle, ref data.GetPinnableReference(), (uint)width, (uint)heigth);
- }
- public Surface (Device device, string imgPath) {
- vkvgDev = device;
- handle = NativeMethods.vkvg_surface_create_from_image (device.Handle, imgPath);
- }
- public Surface (Device device, IntPtr surfHandle) {
- vkvgDev = device;
- handle = surfHandle;
- AddReference ();
- }
-
- Surface (IntPtr devHandle, int width, int heigth)
- {
- handle = NativeMethods.vkvg_surface_create (devHandle, (uint)width, (uint)heigth);
- }
- ~Surface ()
- {
- Dispose (false);
- }
-
- public IntPtr Handle => handle;
- public IntPtr VkImage => NativeMethods.vkvg_surface_get_vk_image (handle);
- public int Width => NativeMethods.vkvg_surface_get_width (handle);
- public int Height => NativeMethods.vkvg_surface_get_height (handle);
-
- public void AddReference () => NativeMethods.vkvg_surface_reference (handle);
- public uint References () => NativeMethods.vkvg_surface_get_reference_count (handle);
-
-// public Surface CreateSimilar (uint width, uint height) {
-// return new Surface (handle, width, height);
-// }
-// public Surface CreateSimilar (int width, int height) {
-// return new Surface (handle, (uint)width, (uint)height);
-// }
-
- public void Flush () {
- //throw new NotImplementedException ();
- }
-
- public void WriteToPng (string path) {
- NativeMethods.vkvg_surface_write_to_png (handle, path);
- }
- public void WriteTo (IntPtr bitmap) {
- NativeMethods.vkvg_surface_write_to_memory (handle, bitmap);
- }
- public void Clear () {
- NativeMethods.vkvg_surface_clear (handle);
- }
-
- #region IDisposable implementation
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing || handle == IntPtr.Zero)
- return;
-
- NativeMethods.vkvg_surface_destroy (handle);
- handle = IntPtr.Zero;
- }
- #endregion
- }
-}
-
+++ /dev/null
-//Copyright GPL2
-using System;
-
-namespace Crow.Drawing {
-
-
- public sealed class SvgHandle : IDisposable {
-
- public IntPtr Raw;
-
- public SvgHandle (Device dev, Span<byte> bytes)
- {
- /*int size = svgFragment.Length * 4 + 1;
- Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (svgFragment, bytes);
- bytes[encodedBytes] = 0;*/
- Raw = NativeMethods.nsvg_load (dev.Handle, ref bytes.GetPinnableReference());
- }
- public SvgHandle (Device dev, string file_name)
- {
- Raw = NativeMethods.nsvg_load_file (dev.Handle, file_name);
- }
-
- public void Render(Context cr) =>
- cr.RenderSvg (Raw);
-
- public void Render (Context cr, string id) =>
- cr.RenderSvg (Raw, id);
-
- public Size Dimensions {
- get {
- NativeMethods.nsvg_get_size (Raw, out int w, out int h);
- return new Size (w, h);
- }
- }
-
- public void Dispose() {
- NativeMethods.nsvg_destroy (Raw);
- }
-
- }
-}
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.Drawing
-{
- [StructLayout (LayoutKind.Sequential)]
- public struct TextExtents
- {
- float xbearing;
- float ybearing;
- float width;
- float height;
- float xadvance;
- float yadvance;
-
- public float XBearing {
- get { return xbearing; }
- set { xbearing = value; }
- }
-
- public float YBearing {
- get { return ybearing; }
- set { ybearing = value; }
- }
-
- public float Width {
- get { return width; }
- set { width = value; }
- }
-
- public float Height {
- get { return height; }
- set { height = value; }
- }
-
- public float XAdvance {
- get { return xadvance; }
- set { xadvance = value; }
- }
-
- public float YAdvance {
- get { return yadvance; }
- set { yadvance = value; }
- }
-
- public override bool Equals (object obj)
- {
- if (obj is TextExtents)
- return this == (TextExtents)obj;
- return false;
- }
-
- public override int GetHashCode ()
- {
- return (int)XBearing ^ (int)YBearing ^ (int)Width ^ (int)Height ^ (int)XAdvance ^ (int)YAdvance;
- }
-
- public static bool operator == (TextExtents extents, TextExtents other)
- {
- return extents.XBearing == other.XBearing && extents.YBearing == other.YBearing && extents.Width == other.Width && extents.Height == other.Height && extents.XAdvance == other.XAdvance && extents.YAdvance == other.YAdvance;
- }
-
- public static bool operator != (TextExtents extents, TextExtents other)
- {
- return !(extents == other);
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-namespace Crow.Drawing {
- public class TextRun : IDisposable {
-
- IntPtr handle = IntPtr.Zero;
-
- #region CTORS & DTOR
- protected TextRun(IntPtr handle) {
- this.handle = handle;
- }
- public TextRun(string text) {
- handle = NativeMethods.vkvg_text_run_create (handle, Context.TerminateUtf8(text));
- }
-
- ~TextRun() {
- Dispose (false);
- }
- #endregion
-
- //public void AddReference () {
- // NativeMethods.vkvg_pattern_reference (handle);
- //}
- //public uint References () => NativeMethods.vkvg_pattern_get_reference_count (handle);
-
- public IntPtr Handle { get { return handle; } }
-
- public TextExtents Extents {
- get {
- TextExtents extents;
- NativeMethods.vkvg_text_run_get_extents (handle, out extents);
- return extents;
- }
- }
-
- #region IDisposable implementation
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- protected virtual void Dispose (bool disposing) {
- if (!disposing || handle == IntPtr.Zero)
- return;
-
- NativeMethods.vkvg_text_run_destroy (handle);
- handle = IntPtr.Zero;
- }
- #endregion
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2019-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.InteropServices;
-using Glfw;
-using vke;
-using Vulkan;
-using static Vulkan.Vk;
-using Device = vke.Device;
-
-namespace Crow.Drawing {
- /// <summary>
- /// Base class for offscreen vulkan context without swapchain
- /// </summary>
- public abstract class VulkanContextBase : IDisposable {
- protected Interface iface;
- public uint width { get; protected set; }
- public uint height { get; protected set; }
-
- protected Instance instance;
- protected PhysicalDevice phy;
- protected vke.Device dev;
- protected Queue graphicQueue;//for vkvg, we must have at least a graphic queue
- public Crow.Drawing.Device VkvgDevice { get; protected set; }
-
- public void WaitIdle() => dev.WaitIdle ();
-
- public VulkanContextBase (Interface iface) {
- this.iface = iface;
- }
-
-
- protected void createVkvgDevice () => VkvgDevice =
- new Crow.Drawing.Device (instance.Handle, phy.Handle, dev.VkDev.Handle, graphicQueue.qFamIndex, SampleCount.Sample_8);
-
- public abstract void CreateSurface (int width, int height, ref Surface surf);
- public abstract bool render ();
-
- #region IDisposable Support
- protected bool isDisposed;
- protected virtual void Dispose (bool disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- VkvgDevice.Dispose ();
-
- if (disposing) {
- dev.Dispose ();
- instance.Dispose ();
- } else
- Debug.WriteLine ("a VulkanContext has not been correctly disposed");
-
- isDisposed = true;
- }
- }
- ~VulkanContextBase () {
- Dispose (false);
- }
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
- #endregion
- }
- //vulkan context rendering to preallocated bitmap
- public class OffscreenVulkanContext : VulkanContextBase {
- public IntPtr bitmap { get; private set; }
- Surface surface;
- /// <summary>
- /// Preallocated Pointer to output bitmap
- /// </summary>
- /// <param name="pBitmap"></param>
- public OffscreenVulkanContext (Interface iface) : base (iface) {
-#if DEBUG
- instance = new Instance (Ext.I.VK_EXT_debug_utils);
-#else
- instance = new Instance ();
-#endif
- phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault ();
- VkPhysicalDeviceFeatures enabledFeatures = default;
- dev = new vke.Device (phy);
- graphicQueue = new Queue (dev, VkQueueFlags.Graphics);
- dev.Activate (enabledFeatures);
-
- createVkvgDevice ();
- }
- public override void CreateSurface (int width, int height, ref Surface surf) {
- surf?.Dispose ();
- surface = new Surface (VkvgDevice, width, height);
- surf = surface;
-
- this.width = (uint)width;
- this.height = (uint)height;
-
- if (bitmap != IntPtr.Zero)
- Marshal.FreeHGlobal (bitmap);
- bitmap = Marshal.AllocHGlobal (height * width * 4);
- Console.WriteLine($"vkCtx.CreateOffscreenSurface: w:{width} h:{height}");
- }
- public override bool render () {
- surface.WriteTo (bitmap);
- Console.WriteLine($"vkCtx.Render(WriteTo): w:{width} h:{height}");
- return true;
- }
- protected override void Dispose (bool disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- surface?.Dispose ();
- if (bitmap != IntPtr.Zero)
- Marshal.FreeHGlobal (bitmap);
-
- base.Dispose (disposing);
- }
- }
- }
- /// <summary>
- /// Base class to build vulkan application.
- /// Provide default swapchain with its command pool and buffers per image and the main present queue
- /// </summary>
- public class VulkanContext : VulkanContextBase {
- IntPtr hWin;/** GLFW window native pointer. */
- /**Vulkan Surface */
- protected VkSurfaceKHR hSurf;
- protected SwapChain swapChain;
- protected CommandPool cmdPool;
- protected PrimaryCommandBuffer[] cmds;
- protected VkSemaphore[] drawComplete;
- protected Fence drawFence;
-
- protected uint fps { get; private set; }
- protected bool updateViewRequested = true;
-
- /// <summary>readonly GLFW window handle</summary>
- public IntPtr WindowHandle => hWin;
-
- uint frameCount;
- Stopwatch frameChrono;
-
- public VulkanContext (Interface iface, IntPtr hWin, uint _width, uint _height, bool vsync = false) : base (iface) {
- this.hWin = hWin;
-
- SwapChain.IMAGES_USAGE = VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransferDst;
- SwapChain.PREFERED_FORMAT = VkFormat.B8g8r8a8Unorm;
-
- //Instance.VALIDATION = true;
- //Instance.RENDER_DOC_CAPTURE = true;
- List<string> instExts = new List<string> (Glfw3.GetRequiredInstanceExtensions ());
-#if DEBUG
- instExts.Add (Ext.I.VK_EXT_debug_utils);
-#endif
-
- instance = new Instance (instExts.ToArray());
- hSurf = instance.CreateSurface (hWin);
-
- phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault (p => p.HasSwapChainSupport);
-
- VkPhysicalDeviceFeatures enabledFeatures = default;
-
- //First create the c# device class
- dev = new vke.Device (phy);
-
- graphicQueue = new PresentQueue (dev, VkQueueFlags.Graphics, hSurf);
-
- //activate the device to have effective queues created accordingly to what's available
- dev.Activate (enabledFeatures, Ext.D.VK_KHR_swapchain);
-
- swapChain = new SwapChain (graphicQueue as PresentQueue, _width, _height, SwapChain.PREFERED_FORMAT,
- vsync ? VkPresentModeKHR.FifoKHR : VkPresentModeKHR.ImmediateKHR);
- swapChain.Activate ();
-
- width = swapChain.Width;
- height = swapChain.Height;
-
- cmdPool = new CommandPool (dev, graphicQueue.qFamIndex, VkCommandPoolCreateFlags.ResetCommandBuffer);
- cmds = cmdPool.AllocateCommandBuffer (swapChain.ImageCount);
-
- drawComplete = new VkSemaphore[swapChain.ImageCount];
- drawFence = new Fence (dev, true, "draw fence");
-
- for (int i = 0; i < swapChain.ImageCount; i++) {
- drawComplete[i] = dev.CreateSemaphore ();
- drawComplete[i].SetDebugMarkerName (dev, "Semaphore DrawComplete" + i);
- }
-
- cmdPool.SetName ("main CmdPool");
-
- createVkvgDevice ();
- }
-
- public override void CreateSurface (int width, int height, ref Surface surf) {
- WaitIdle();
-
- blitSource?.Dispose ();
- surf?.Dispose ();
- surf = new Surface (VkvgDevice, width, height);
- buildBlitCommand (surf);
-
- WaitIdle();
- }
-
- internal vke.Image blitSource;
-
- void buildBlitCommand (Crow.Drawing.Surface surf) {
- //Console.WriteLine ($"build blit w:{width} h:{height}");
- cmdPool.Reset();
-
- blitSource = new vke.Image (dev, new VkImage((ulong)surf.VkImage.ToInt64()), Vulkan.VkFormat.B8g8r8a8Unorm,
- Vulkan.VkImageUsageFlags.TransferSrc | Vulkan.VkImageUsageFlags.TransferDst | Vulkan.VkImageUsageFlags.ColorAttachment,
- width, height);
-
- for (int i = 0; i < swapChain.ImageCount; i++) {
- vke.Image blitDest = swapChain.images[i];
- vke.PrimaryCommandBuffer cmd = cmds[i];
- cmd.Start();
-
- blitDest.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
-
- blitSource.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
-
- blitSource.BlitTo (cmd, blitDest, VkFilter.Nearest);
-
- blitDest.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferDstOptimal, VkImageLayout.PresentSrcKHR,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.BottomOfPipe);
-
- blitSource.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ColorAttachmentOutput);
-
- cmd.End ();
- }
- }
- /// <summary>
- /// Main render method called each frame. get next swapchain image, process resize if needed, submit and present to the presentQueue.
- /// Wait QueueIdle after presenting.
- /// </summary>
- public override bool render () {
- WaitIdle();
-
- int idx = swapChain.GetNextImage ();
- if (idx < 0) {
- width = swapChain.Width;
- height = swapChain.Height;
- //Console.WriteLine ($"get next image failed w:{width} h:{height}");
- return false;
- }
-
- if (cmds[idx] == null)
- return false;
-
- drawFence.Wait ();
- drawFence.Reset ();
-
- graphicQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx], drawFence);
- (graphicQueue as PresentQueue).Present (swapChain, drawComplete[idx]);
-
- WaitIdle();
- iface.IsDirty = false;
- return true;
- }
- protected override void Dispose (bool disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- for (int i = 0; i < swapChain.ImageCount; i++) {
- dev.DestroySemaphore (drawComplete[i]);
- cmds[i].Free ();
- }
- drawFence.Dispose ();
- swapChain.Dispose ();
-
- vkDestroySurfaceKHR (instance.Handle, hSurf, IntPtr.Zero);
-
- if (disposing)
- cmdPool.Dispose ();
-
- base.Dispose (disposing);
- }
- }
- }
-}
+++ /dev/null
-//from Mono.Cairo
-//fake FontOptions
-
-using System;
-
-namespace Crow.Drawing
-{
- public enum SubpixelOrder
- {
- Default,
- Rgb,
- Bgr,
- Vrgb,
- Vbgr,
- }
- public enum HintMetrics
- {
- Default,
- Off,
- On,
- }
- public enum HintStyle
- {
- Default,
- None,
- Slight,
- Medium,
- Full,
- }
- public class FontOptions : IDisposable
- {
- public FontOptions () { }
-
-
- public FontOptions Copy () => default;
-
-
- public IntPtr Handle {
- get ;
- }
-
-
- public void Merge (FontOptions other)
- {
- }
-
- public void Dispose() {}
-
- public Antialias Antialias {
- get ;
- set ;
- }
-
- public HintMetrics HintMetrics {
- get ;
- set ;
- }
-
- public HintStyle HintStyle {
- get ;
- set ;
- }
-
- public Status Status {
- get ;
- }
-
- public SubpixelOrder SubpixelOrder {
- get ;
- set ;
- }
- }
-}
-
+++ /dev/null
-// Copyright (c) 2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System.Collections.Generic;
-using System;
-using Crow.Drawing;
-
-namespace Crow {
- public enum RegionOverlap {
- In,
- Out,
- Part,
- }
- public class Region : IDisposable
- {
- public List<Rectangle> list = new List<Rectangle>();
- public int count => list.Count;
- public int NumRectangles => list.Count;
- public bool IsEmpty => list.Count == 0;
- public Rectangle GetRectangle(int i) => list[i];
-
- public void AddRectangle(Rectangle r)
- {
- if (r == default)
- return;
- if (DoesNotContains (r)) {
- list.Add (r);
- boundsUpToDate = false;
- }
- }
- public void Reset()
- {
- list = new List<Rectangle>();
- _bounds = default;
- boundsUpToDate = true;
- }
- public bool DoesNotContains(Rectangle r)
- {
- foreach (Rectangle rInList in list)
- if (rInList.ContainsOrIsEqual(r))
- return false;
- return true;
- }
- public bool OverlapOut (Rectangle r) {
- foreach (Rectangle rInList in list)
- if (rInList.Intersect(r))
- return false;
- return true;
- }
-
- public bool intersect(Rectangle r)
- {
- foreach (Rectangle rInList in list)
- if (rInList.Intersect(r))
- return true;
- return false;
- }
- public void stroke(Context ctx, Color c)
- {
- foreach (Rectangle r in list)
- ctx.Rectangle(r);
-
- ctx.SetSource(c);
-
- ctx.LineWidth = 2;
- ctx.Stroke ();
- }
- public void clearAndClip(Context ctx)
- {
- if (list.Count == 0)
- return;
- foreach (Rectangle r in list)
- ctx.Rectangle(r);
-
- ctx.ClipPreserve();
- ctx.Operator = Operator.Clear;
- ctx.Fill();
- ctx.Operator = Operator.Over;
- }
-
- public void clip(Context ctx)
- {
- foreach (Rectangle r in list)
- ctx.Rectangle(r);
-
- ctx.Clip();
- }
- public void UnionRectangle (Rectangle r) {
- /*if (r == default)
- System.Diagnostics.Debugger.Break ();*/
- AddRectangle (r);
- }
- Rectangle _bounds;
- bool boundsUpToDate = true;
- public Rectangle Bounds {
- get {
- if (!boundsUpToDate) {
- if (list.Count > 0) {
- _bounds = list [0];
- for (int i = 1; i < list.Count; i++) {
- _bounds += list [i];
- }
- } else
- _bounds = default;
- boundsUpToDate = true;
- }
- return _bounds;
- }
- }
- public void clear(Context ctx)
- {
- foreach (Rectangle r in list)
- ctx.Rectangle(r);
- ctx.Operator = Operator.Clear;
- ctx.Fill();
- ctx.Operator = Operator.Over;
- }
- public override string ToString ()
- {
- string tmp = "";
- foreach (Rectangle r in list) {
- tmp += r.ToString ();
- }
- return tmp;
- }
-
- public void Dispose()
- {
-
- }
- }
-}
// Copyright (c) 2006-2014 Stefanos Apostolopoulos <stapostol@gmail.com>
-// Copyright (c) 2014-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2014-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using Glfw;
+using Drawing2D;
namespace Crow
{
using System.Threading;
using Crow.IML;
-using Crow.Drawing;
+
using Glfw;
using Path = System.IO.Path;
+using Drawing2D;
+
namespace Crow
{
/// <summary>
hWin = glfwWindowHandle;
PerformanceMeasure.InitMeasures ();
}
-#if VKVG
- /// <summary>
- /// constant boolean telling if crow assembly was built with `VKVG` support.
- /// </summary>
- public const bool HaveVkvgBackend = true;
-#else
- public const bool HaveVkvgBackend = false;
-#endif
+ IDevice dev;
+ public IDevice Device => dev;
+
/// <summary>
/// Create a standard Crow interface.
/// </summary>
#if (VKVG)
vkCtx.CreateSurface (clientRectangle.Width, clientRectangle.Height, ref surf);
#else
- surf = new ImageSurface (Format.Argb32, r.Width, r.Height);
+ surf = new ImageSurface (Format.ARGB32, r.Width, r.Height);
#endif
}
public Surface CreateSurface (ref Rectangle r) {
/// - Drawing
/// Result: the Interface bitmap is drawn in memory (byte[] bmp) and a dirtyRect and bitmap are available
/// </summary>
- public void Update(Context ctx = null){
+ public void Update(IContext ctx = null){
CrowThread[] tmpThreads;
lock (CrowThreads) {
PerformanceMeasure.End (PerformanceMeasure.Kind.Clipping);
DbgLogger.EndEvent (DbgEvtType.ClippingRegistration, true);
}
- void clear(Context ctx) {
+ void clear(IContext ctx) {
for (int i = 0; i < clipping.NumRectangles; i++)
ctx.Rectangle (clipping.GetRectangle (i));
/// <summary>Clipping Rectangles drive the drawing process. For compositing, each object under a clip rectangle should be
/// repainted. If it contains also clip rectangles, its cache will be update, or if not cached a full redraw will take place</summary>
- protected virtual void processDrawing(Context ctx){
+ protected virtual void processDrawing(IContext ctx){
DbgLogger.StartEvent (DbgEvtType.ProcessDrawing);
PerformanceMeasure.Begin (PerformanceMeasure.Kind.Drawing);
RegisterClip (w.ScreenCoordinates (w.Slot));
}
[Conditional ("DEBUG_HIGHLIGHT_FOCUS")]
- void debugHighlightFocus (Context ctx) {
+ void debugHighlightFocus (IContext ctx) {
if (HoverWidget!= null) {
ctx.SetSource (Colors.Purple);
ctx.Rectangle (HoverWidget.ScreenCoordinates (HoverWidget.Slot), 1);
internal Rectangle? textCursor = null;//last printed cursor, used to clear it.
public bool forceTextCursor = true;//when true, cursor is printed even if blinkingCursor.elapsed is not reached.
Stopwatch blinkingCursor = Stopwatch.StartNew ();
- void drawTextCursor (Context ctx) {
+ void drawTextCursor (IContext ctx) {
if (forceTextCursor) {
if (FocusedWidget is IEditableTextWidget lab) {
if (lab.DrawCursor (ctx, out Rectangle c)) {
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
/// <param name="ctx">The master interface context on which to draw the cursor</param>
/// <param name="rect">Return a clipping rectangle containing the cursor position to be cleared when needed</param>
/// <returns>True if cursor were drawed, false otherwise</returns>
- bool DrawCursor (Context ctx, out Rectangle rect);
+ bool DrawCursor (IContext ctx, out Rectangle rect);
}
}
\ No newline at end of file
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
int tmp = base.measureRawSize (lt);
return tmp < 0 ? tmp : tmp + 2 * BorderWidth;
}*/
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
drawborder2 (gr);
//gr.Restore ();
}
- void drawborder2(Context gr){
+ void drawborder2(IContext gr){
Rectangle rBack = new Rectangle (Slot.Size);
//rBack.Inflate (-Margin);
}
}
}
- void drawborder1(Context gr){
+ void drawborder1(IContext gr){
Rectangle rBack = new Rectangle (Slot.Size);
//rBack.Inflate (-Margin);
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow {
public class CircleMeter : Gauge {
#endregion
double startAngle, endAngle;
- int lineWidth, backgroundLineWidth;
+ int lineWidth, backgroundLineWidth;
/// <summary>
/// Starting andle in degree corresponding to the minimum value
/// </summary>
}
/// <summary>
/// Line width used to draw the background arc from start to end angle
- /// </summary>
+ /// </summary>
[DefaultValue (10)]
public int BackgroundLineWidth {
get => backgroundLineWidth;
}
}
const double rad = Math.PI * 2.0 / 360.0;
- protected override void onDraw (Context gr) {
+ protected override void onDraw (IContext gr) {
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
/*Rectangle r = new Rectangle (Slot.Size);
gr.Arc (r.CenterD, radius, sArad, sArad + valAngle);
else
gr.ArcNegative (r.CenterD, radius, sArad, sArad + valAngle);
- gr.Stroke ();
+ gr.Stroke ();
/*} else {
double valAngle = (sArad - sErad) * valRatio;
}*/
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using Glfw;
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.ComponentModel;
using Glfw;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
base.onMouseDown (sender, e);
}
- protected override void onDraw (Context gr) {
+ protected override void onDraw (IContext gr) {
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
base.onDraw (gr);
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.Text;
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.Xml.Serialization;
-using Crow.Drawing;
+
+using Drawing2D;
using Glfw;
break;
}
Surface dragImg = IFace.CreateSurface (r.Width, r.Height);
- using (Context gr = new Context(dragImg)) {
+ using (IContext gr = new Context(dragImg)) {
gr.LineWidth = 1;
gr.Rectangle (0,0,r.Width,r.Height);
gr.SetSource (0.2,0.3,0.9,0.5);
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow {
public class Gauge : Widget
}
#endregion
- protected override void onDraw (Context gr) {
+ protected override void onDraw (IContext gr) {
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
base.onDraw (gr);
using System.Threading;
using static Crow.Logger;
-using Crow.Drawing;
+
namespace Crow
{
}
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
DbgLogger.EndEvent (DbgEvtType.GODraw);
}
- protected override void UpdateCache (Context ctx)
+ protected override void UpdateCache (IContext ctx)
{
DbgLogger.StartEvent(DbgEvtType.GOUpdateCache, this);
if (!Clipping.IsEmpty) {
- using (Context gr = new Context (bmp)) {
+ using (IContext gr = new Context (bmp)) {
for (int i = 0; i < Clipping.NumRectangles; i++)
gr.Rectangle(Clipping.GetRectangle(i));
gr.ClipPreserve();
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.Xml.Serialization;
using System.ComponentModel;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
RegisterForRedraw ();
}
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
base.onDraw (gr);
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
+using Drawing2D;
namespace Crow
{
using System.ComponentModel;
using System.Diagnostics;
-using Crow.Drawing;
+
namespace Crow
{
else
return _pic.Dimensions.Height + 2 * Margin;
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
base.onDraw (gr);
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.ComponentModel;
using Glfw;
-using Crow.Drawing;
+
using Crow.Text;
+using Drawing2D;
namespace Crow
{
}
}
- protected virtual void measureTextBounds (Context gr) {
+ protected virtual void measureTextBounds (IContext gr) {
fe = gr.FontExtents;
te = new TextExtents ();
cachedTextSize.Width = lines[longestLine].LengthInPixel;
textMeasureIsUpToDate = true;
}
- protected virtual void drawContent (Context gr) {
+ protected virtual void drawContent (IContext gr) {
Rectangle cb = ClientRectangle;
fe = gr.FontExtents;
double lineHeight = fe.Ascent + fe.Descent;
int hoverLine = _multiline ?
(int)Math.Min (Math.Max (0, Math.Floor (mouseLocalPos.Y / (fe.Ascent + fe.Descent))), lines.Count - 1) : 0;
hoverLoc = new CharLocation (hoverLine, -1, mouseLocalPos.X);
- using (Context gr = new Context (IFace.surf)) {
+ using (IContext gr = new Context (IFace.surf)) {
setFontForContext (gr);
updateLocation (gr, ClientRectangle.Width, ref hoverLoc);
}
return null;
return cursor;
}
- public virtual bool DrawCursor (Context ctx, out Rectangle rect) {
+ public virtual bool DrawCursor (IContext ctx, out Rectangle rect) {
if (CurrentLoc == null) {
rect = default;
return false;
return true;
}
- protected void updateLocation (Context gr, int clientWidth, ref CharLocation? location) {
+ protected void updateLocation (IContext gr, int clientWidth, ref CharLocation? location) {
if (location == null)
return;
CharLocation loc = location.Value;
getLines ();
if (!textMeasureIsUpToDate) {
- using (Context gr = new Context (IFace.surf)) {
+ using (IContext gr = new Context (IFace.surf)) {
setFontForContext (gr);
measureTextBounds (gr);
}
return Margin * 2 + (lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width);
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
DbgLogger.StartEvent(DbgEvtType.GODraw, this);
+ try {
+ base.onDraw (gr);
- base.onDraw (gr);
-
- setFontForContext (gr);
+ setFontForContext (gr);
- if (!textMeasureIsUpToDate) {
- lock (linesMutex)
- measureTextBounds (gr);
- }
+ if (!textMeasureIsUpToDate) {
+ lock (linesMutex)
+ measureTextBounds (gr);
+ }
- if (ClipToClientRect) {
- gr.Save ();
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
- }
+ if (ClipToClientRect) {
+ gr.Save ();
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
- lock (linesMutex)
- drawContent (gr);
+ lock (linesMutex)
+ drawContent (gr);
- if (ClipToClientRect)
- gr.Restore ();
+ if (ClipToClientRect)
+ gr.Restore ();
- DbgLogger.EndEvent (DbgEvtType.GODraw);
+ } finally {
+ DbgLogger.EndEvent (DbgEvtType.GODraw);
+ }
}
#endregion
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
-using Crow.Drawing;
+
+using Drawing2D;
+
using static Crow.Logger;
namespace Crow
{
RegisterForLayouting (LayoutingType.Height);
}
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
DbgLogger.EndEvent (DbgEvtType.GODraw);
}
- protected override void UpdateCache (Context ctx)
+ protected override void UpdateCache (IContext ctx)
{
DbgLogger.StartEvent(DbgEvtType.GOUpdateCache, this);
Rectangle rb = Slot + Parent.ClientRectangle.Position;
if (!Clipping.IsEmpty) {
- using (Context gr = new Context (bmp)) {
+ using (IContext gr = new Context (bmp)) {
for (int i = 0; i < Clipping.NumRectangles; i++)
gr.Rectangle(Clipping.GetRectangle(i));
gr.ClipPreserve();
-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
#endregion
double v, s;
-
+
public virtual double V {
get { return v; }
set {
RegisterForRedraw ();
}
}
-
+
public virtual double S {
get { return s; }
set {
RegisterForRedraw ();
}
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
base.onDraw (gr);
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
-using Crow.Drawing;
+
using Glfw;
+using Drawing2D;
namespace Crow
{
return;
updateMaxScroll(layoutType);
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
Rectangle rBack = new Rectangle (Slot.Size);
using System;
using System.ComponentModel;
-using Crow.Drawing;
+
namespace Crow {
public class ScrollingStack : GenericStack {
NotifyValueChanged ("ChildRatio", Math.Min (1.0, (double)Children.Count / visibleItems));
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
DbgLogger.EndEvent (DbgEvtType.GODraw);
}
- protected override void UpdateCache (Context ctx)
+ protected override void UpdateCache (IContext ctx)
{
DbgLogger.StartEvent(DbgEvtType.GOUpdateCache, this);
if (!Clipping.IsEmpty) {
- using (Context gr = new Context (bmp)) {
+ using (IContext gr = new Context (bmp)) {
for (int i = 0; i < Clipping.NumRectangles; i++)
gr.Rectangle(Clipping.GetRectangle(i));
gr.ClipPreserve();
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.ComponentModel;
using System.IO;
using System.Text;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
char[] buffer = new char[20];
double readDouble ()
{
- int length = 0;
+ int length = 0;
while (Peek () >= 0) {
buffer[length] = (char)Read ();
}
return double.Parse (buffer.AsSpan(0, length));
}
- public void Draw (Context gr, bool measure = false)
+ public void Draw (IContext gr, bool measure = false)
{
char c;
}
}
/// <summary>
- /// View box
+ /// View box
/// </summary>
[DefaultValue ("32,32")]
public Size Size {
}
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
base.onDraw (gr);
if (size != default (Size))
contentSize = size;
else {
- using (Context ctx = new Context (IFace.surf)) {
+ using (IContext ctx = new Context (IFace.surf)) {
using (PathParser parser = new PathParser (path))
parser.Draw (ctx, true);
Rectangle r = ctx.StrokeExtents ();
-// Copyright (c) 2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2020-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
+using Drawing2D;
namespace Crow
{
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
+using Drawing2D;
namespace Crow
{
public override ILayoutable Parent {
get => base.Parent;
set {
- if (value != null) {
+ if (value != null) {
GenericStack gs = value as GenericStack;
if (gs == null)
throw new Exception ("Splitter may only be child of stack");
-
+
}
base.Parent = value;
}
else
IFace.MouseCursor = MouseCursor.sb_v_double_arrow;
}
-
+
public override void onMouseMove (object sender, MouseMoveEventArgs e)
- {
+ {
GenericStack gs = Parent as GenericStack;
Rectangle gsRect = gs.ClientRectangle;
Point m = gs.ScreenPointToLocal (e.Position);
lock (IFace.UpdateMutex) {
Widget w0 = gs.Children[ptrSplit - 1];
Widget w1 = gs.Children[ptrSplit + 1];
- if (gs.Orientation == Orientation.Horizontal) {
+ if (gs.Orientation == Orientation.Horizontal) {
int x = m.X - Slot.Width / 2 - gs.Spacing;
if (x > w0.Slot.Left + w0.MinimumSize.Width &&
w0.Width = new Measure((int)Math.Round (100.0 * (x - w0.Slot.X) / (double)gsRect.Width), Unit.Percent);
else
w0.Width = x - w0.Slot.X;
- }
+ }
if (w1.Width != Measure.Stretched) {
x += Slot.Width + 2 * gs.Spacing;
if (w1.Width.IsRelativeToParent)
w1.Width = new Measure((int)Math.Round (100.0 * (w1.Slot.Right - x) / (double)gsRect.Width), Unit.Percent);
else
w1.Width = w1.Slot.Right - x;
- }
+ }
}
} else {
int y = m.Y - Slot.Height / 2 - gs.Spacing;
w1.Height = new Measure((int)Math.Round (100.0 * (w1.Slot.Bottom - y) / (double)gsRect.Height), Unit.Percent);
else
w1.Height = w1.Slot.Bottom - y;
- }
+ }
}
}
}
e.Handled = true;
}
-
+
base.onMouseMove (sender, e);
}
-
+
public override bool UpdateLayout (LayoutingType layoutType)
{
GenericStack gs = Parent as GenericStack;
Height = Measure.Stretched;
}
return base.UpdateLayout (layoutType);
- }
+ }
#endregion
}
}
-// Copyright (c) 2019-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2019-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
using System.Linq;
-using Crow.Drawing;
+
+using Drawing2D;
namespace Crow
{
}
- protected override void onDraw (Context gr) {
+ protected override void onDraw (IContext gr) {
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
base.onDraw (gr);
-// Copyright (c) 2019-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2019-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
using System.Linq;
+using Drawing2D;
using Glfw;
}
#endregion
- public Table Table => Parent as Table;
+ public Table Table => Parent as Table;
public override void ChildrenLayoutingConstraints(ILayoutable layoutable, ref LayoutingType layoutType)
{
return;
}
if (this == Table.Children[0])
- layoutType &= (~LayoutingType.X);
+ layoutType &= (~LayoutingType.X);
else
- layoutType &= (~(LayoutingType.X|LayoutingType.Width));
+ layoutType &= (~(LayoutingType.X|LayoutingType.Width));
}
case LayoutingType.Height:
childrenRWLock.EnterReadLock ();
foreach (Widget c in Children.Where (cc => cc.Height.IsRelativeToParent))
- c.RegisterForLayouting (LayoutingType.Height);
+ c.RegisterForLayouting (LayoutingType.Height);
childrenRWLock.ExitReadLock ();
break;
}
return;
int spacing = Table.Spacing;
ObservableList<Column> cols = Table.Columns;
-
+
Widget first = Children[0];
TableRow firstRow = Table.Children[0] as TableRow;
if (firstRow == this) {
base.ComputeChildrenPositions();
return;
- }
- childrenRWLock.EnterReadLock();
-
+ }
+ childrenRWLock.EnterReadLock();
+
for (int i = 0; i < Children.Count && i < firstRow.Children.Count; i++)
{
Widget w = Children[i];
w.Slot.X = firstRow.Children[i].Slot.X;
- setChildWidth (w, firstRow.Children[i].Slot.Width);
-
+ setChildWidth (w, firstRow.Children[i].Slot.Width);
+
}
childrenRWLock.ExitReadLock();
return;
int spacing = Table.Spacing;
ObservableList<Column> cols = Table.Columns;
-
+
Widget first = Children[0];
TableRow firstRow = Table.Children[0] as TableRow;
if (firstRow == this) {
base.ComputeChildrenPositions();
return;
- }
- childrenRWLock.EnterReadLock();
-
+ }
+ childrenRWLock.EnterReadLock();
+
for (int i = 0; i < Children.Count && i < firstRow.Children.Count; i++)
{
Widget w = Children[i];
w.Slot.X = firstRow.Children[i].Slot.X;
- setChildWidth (w, firstRow.Children[i].Slot.Width);
-
+ setChildWidth (w, firstRow.Children[i].Slot.Width);
+
}
childrenRWLock.ExitReadLock();
return;
int spacing = Table.Spacing;
ObservableList<Column> cols = Table.Columns;
-
+
Widget first = Children[0];
TableRow firstRow = Table.Children[0] as TableRow;
if (firstRow == this) {
base.ComputeChildrenPositions();
return;
- }
- childrenRWLock.EnterReadLock();
-
+ }
+ childrenRWLock.EnterReadLock();
+
for (int i = 0; i < Children.Count && i < firstRow.Children.Count; i++)
{
Widget w = Children[i];
w.Slot.X = firstRow.Children[i].Slot.X;
- setChildWidth (w, firstRow.Children[i].Slot.Width);
-
+ setChildWidth (w, firstRow.Children[i].Slot.Width);
+
}
childrenRWLock.ExitReadLock();
return;
int spacing = Table.Spacing;
ObservableList<Column> cols = Table.Columns;
-
+
Widget first = Children[0];
TableRow firstRow = Table.Children[0] as TableRow;
if (firstRow == this) {
base.ComputeChildrenPositions();
return;
- }
- childrenRWLock.EnterReadLock();
-
+ }
+ childrenRWLock.EnterReadLock();
+
for (int i = 0; i < Children.Count && i < firstRow.Children.Count; i++)
{
Widget w = Children[i];
w.Slot.X = firstRow.Children[i].Slot.X;
- setChildWidth (w, firstRow.Children[i].Slot.Width);
-
+ setChildWidth (w, firstRow.Children[i].Slot.Width);
+
}
childrenRWLock.ExitReadLock();
IsDirty = true;
}*/
-
+
/*public override bool UpdateLayout(LayoutingType layoutType)
{
RegisteredLayoutings &= (~layoutType);
if (layoutType == LayoutingType.Width) {
if (firstRow.RegisteredLayoutings.HasFlag (LayoutingType.Width))
return false;
- if (this != firstRow) {
+ if (this != firstRow) {
Slot.Width = firstRow.Slot.Width;
if (Slot.Width != LastSlots.Width) {
IsDirty = true;
return true;
}
}
-
+
return base.UpdateLayout(layoutType);
}*/
/*public override int measureRawSize (LayoutingType lt) {
if (lt == LayoutingType.Width) {
if (Table == null)
return -1;
- TableRow firstRow = Table.Children[0] as TableRow;
+ TableRow firstRow = Table.Children[0] as TableRow;
if (this != firstRow) {
if (firstRow.RegisteredLayoutings.HasFlag (LayoutingType.Width))
return -1;
if (arg.LayoutType == LayoutingType.Width) {
Widget w = sender as Widget;
TableRow firstRow = Table.Children[0] as TableRow;
- int c = Children.IndexOf(w);
+ int c = Children.IndexOf(w);
if (c < Table.Columns.Count) {
Column col = Table.Columns[c];
if (col.Width.IsFit) {
if (arg.LayoutType == LayoutingType.Width) {
if (row == firstRow) {
base.OnChildLayoutChanges (sender, arg);
- int idx = Children.IndexOf (go);
+ int idx = Children.IndexOf (go);
foreach (TableRow r in Table.Children.Skip(1)) {
if (idx < r.Children.Count)
r.setChildWidth (r.Children[idx], go.Slot.Width);
r.contentSize = firstRow.contentSize;
- }
+ }
} //else
this.RegisterForLayouting (LayoutingType.ArrangeChildren);
return;
base.OnChildLayoutChanges (sender, arg);
}*/
- int splitIndex = -1;
+ int splitIndex = -1;
const int minColumnSize = 10;
int Spacing => Table.Spacing;
public override void onMouseMove(object sender, MouseMoveEventArgs e)
- {
+ {
if (Spacing > 0 && Table != null && Table.Children.Count > 0) {
Point m = ScreenPointToLocal (e.Position);
if (IFace.IsDown (Glfw.MouseButton.Left) && splitIndex >= 0) {
TableRow firstRow = Table.Children[0] as TableRow;
Rectangle cb = ClientRectangle;
- int splitPos = (int)(0.5 * Spacing + m.X);
+ int splitPos = (int)(0.5 * Spacing + m.X);
if (splitPos > firstRow.Children[splitIndex].Slot.Left + minColumnSize && splitPos < firstRow.Children[splitIndex+1].Slot.Right - minColumnSize) {
Table.Columns[splitIndex+1].Width = firstRow.Children[splitIndex+1].Slot.Right - splitPos;
splitPos -= Spacing;
Table.RegisterForLayouting (LayoutingType.Width);
e.Handled = true;
}
- //Console.WriteLine ($"left:{firstRow.Children[splitIndex].Slot.Left} right:{firstRow.Children[splitIndex+1].Slot.Right} cb.X:{cb.X} splitPos:{splitPos} m:{m}");
+ //Console.WriteLine ($"left:{firstRow.Children[splitIndex].Slot.Left} right:{firstRow.Children[splitIndex+1].Slot.Right} cb.X:{cb.X} splitPos:{splitPos} m:{m}");
} else {
- splitIndex = -1;
+ splitIndex = -1;
for (int i = 0; i < Children.Count - 1; i++)
{
Rectangle r = Children[i].Slot;
using System.ComponentModel;
using System.IO;
using System.Xml;
-using Crow.Drawing;
+
namespace Crow
{
///this allow applying root background to random template's component
/// </summary>
/// <param name="gr">Backend context</param>
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
DbgLogger.StartEvent (DbgEvtType.GODraw, this);
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.IO;
using System.Linq;
using System.Threading;
+using Drawing2D;
using Crow.IML;
-// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.ComponentModel;
using Crow.Text;
-using Crow.Drawing;
+
+using Drawing2D;
+
using Glfw;
namespace Crow
base.OnLayoutChanges (layoutType);
updateMaxScrolls (layoutType);
}
- protected override void drawContent (Context gr) {
+ protected override void drawContent (IContext gr) {
gr.Translate (-scrollX, -scrollY);
base.drawContent (gr);
gr.Translate (scrollX, scrollY);
protected override void updateHoverLocation (Point mouseLocalPos) {
base.updateHoverLocation (mouseLocalPos + new Point (ScrollX, ScrollY));
}
- protected override void measureTextBounds (Context gr) {
+ protected override void measureTextBounds (IContext gr) {
base.measureTextBounds (gr);
updateMaxScrolls (LayoutingType.Height);
updateMaxScrolls (LayoutingType.Width);
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.Diagnostics;
using Crow.IML;
-using Crow.Drawing;
+
using System.Threading;
using Glfw;
using System.Linq;
-
+using Drawing2D;
#if DESIGN_MODE
using System.Xml;
}
#endregion
- protected void setFontForContext (Context gr) {
+ protected void setFontForContext (IContext gr) {
#if VKVG
gr.FontFace = Font.Name;
gr.FontSize = (uint)Font.Size;
#region Rendering
/// <summary> This is the common overridable drawing routine to create new widget </summary>
- protected virtual void onDraw(Context gr)
+ protected virtual void onDraw(IContext gr)
{
DbgLogger.StartEvent(DbgEvtType.GODraw, this);
//bmp = new ImageSurface(Format.Argb32, Slot.Width, Slot.Height);
DbgLogger.StartEvent (DbgEvtType.GOCreateContext, this);
- using (Context gr = new Context (bmp)) {
+ using (IContext gr = new Context (bmp)) {
DbgLogger.EndEvent (DbgEvtType.GOCreateContext);
gr.Antialias = Interface.Antialias;
onDraw (gr);
DbgLogger.EndEvent (DbgEvtType.GORecreateCache);
}
- protected void paintCache(Context ctx, Rectangle rb) {
+ protected void paintCache(IContext ctx, Rectangle rb) {
DbgLogger.StartEvent(DbgEvtType.GOPaintCache, this);
if (clearBackground) {
ctx.Operator = Operator.Clear;
#endif
DbgLogger.EndEvent(DbgEvtType.GOPaintCache);
}
- protected virtual void UpdateCache(Context ctx){
+ protected virtual void UpdateCache(IContext ctx){
DbgLogger.StartEvent(DbgEvtType.GOUpdateCache, this);
paintCache (ctx, Slot + Parent.ClientRectangle.Position);
DbgLogger.AddEvent (DbgEvtType.GOResetClip, this);
}
/// <summary> Chained painting routine on the parent context of the actual cached version
/// of the widget </summary>
- public virtual void Paint (Context ctx)
+ public virtual void Paint (IContext ctx)
{
if (!IsVisible)
return;
DbgLogger.EndEvent (DbgEvtType.GOPaint);
}
- void paintDisabled(Context gr, Rectangle rb){
+ void paintDisabled(IContext gr, Rectangle rb){
//gr.Operator = Operator.Xor;
gr.SetSource (0.2, 0.2, 0.2, 0.8);
gr.Rectangle (rb);
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.ComponentModel;
using Glfw;
+using Drawing2D;
namespace Crow
{
<Authors>Jean-Philippe Bruyère</Authors>
<LangVersion>7.3</LangVersion>
- <CrowVersion>0.9.8</CrowVersion>
- <CrowPackageVersion>$(CrowVersion)</CrowPackageVersion>
+ <CrowVersion>0.9.9</CrowVersion>
+ <CrowPackageVersion>$(CrowVersion)-beta</CrowPackageVersion>
<!-- If you dont have a native libstb on your system, enable the managed version of stb here
TODO: this could be detected on startup or install automatically-->
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
+
+ <AssemblyVersion>1.0.0</AssemblyVersion>
+ <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
+
+ <Title>Drawing 2D Library</Title>
+ <Description>
+ 2d shapes and drawing interfaces used in C.R.O.W and Vke.net.
+ </Description>
+ <License>MIT</License>
+ <Authors>Jean-Philippe Bruyère</Authors>
+ <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
+ <PackageTags>Crow 2D GUI Widget Interface C# Net</PackageTags>
+ <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
+
+ <PackageProjectUrl>https://github.com/jpbruyere/Crow/wiki</PackageProjectUrl>
+ <PackageCopyright>Copyright 2022</PackageCopyright>
+ <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="src\**\*.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Enums.NET" Version="4.0.0" />
+ </ItemGroup>
+
+
+</Project>
--- /dev/null
+// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Drawing2D
+{
+ public enum Colors : UInt32
+ {
+ AliceBlue = 0xF0F8FFFF,
+ AntiqueWhite = 0xFAEBD7FF,
+ //Aqua = 0x00FFFFFF,
+ Aquamarine = 0x7FFFD4FF,
+ Azure = 0xF0FFFFFF,
+ Beige = 0xF5F5DCFF,
+ Bisque = 0xFFE4C4FF,
+ Black = 0x000000FF,
+ BlanchedAlmond = 0xFFEBCDFF,
+ Blue = 0x0000FFFF,
+ BlueViolet = 0x8A2BE2FF,
+ Brown = 0xA52A2AFF,
+ BurlyWood = 0xDEB887FF,
+ CadetBlue = 0x5F9EA0FF,
+ Chartreuse = 0x7FFF00FF,
+ Chocolate = 0xD2691EFF,
+ Coral = 0xFF7F50FF,
+ CornflowerBlue = 0x6495EDFF,
+ Cornsilk = 0xFFF8DCFF,
+ Crimson = 0xDC143CFF,
+ Cyan = 0x00FFFFFF,
+ DarkBlue = 0x00008BFF,
+ DarkCyan = 0x008B8BFF,
+ DarkGoldenRod = 0xB8860BFF,
+ DarkGrey = 0x202020FF,
+ DarkGreen = 0x006400FF,
+ DarkKhaki = 0xBDB76BFF,
+ DarkMagenta = 0x8B008BFF,
+ DarkOliveGreen = 0x556B2FFF,
+ DarkOrange = 0xFF8C00FF,
+ DarkOrchid = 0x9932CCFF,
+ DarkRed = 0x8B0000FF,
+ DarkSalmon = 0xE9967AFF,
+ DarkSeaGreen = 0x8FBC8FFF,
+ DarkSlateBlue = 0x483D8BFF,
+ DarkSlateGrey = 0x2F4F4FFF,
+ DarkTurquoise = 0x00CED1FF,
+ DarkViolet = 0x9400D3FF,
+ DeepPink = 0xFF1493FF,
+ DeepSkyBlue = 0x00BFFFFF,
+ DimGrey = 0x696969FF,
+ DodgerBlue = 0x1E90FFFF,
+ FireBrick = 0xB22222FF,
+ FloralWhite = 0xFFFAF0FF,
+ ForestGreen = 0x228B22FF,
+ Fuchsia = 0xFF00FFFF,
+ Gainsboro = 0xDCDCDCFF,
+ GhostWhite = 0xF8F8FFFF,
+ Gold = 0xFFD700FF,
+ GoldenRod = 0xDAA520FF,
+ Grey = 0x808080FF,
+ Green = 0x008000FF,
+ GreenYellow = 0xADFF2FFF,
+ HoneyDew = 0xF0FFF0FF,
+ HotPink = 0xFF69B4FF,
+ IndianRed = 0xCD5C5CFF,
+ Indigo = 0x4B0082FF,
+ Ivory = 0xFFFFF0FF,
+ Jet = 0x343434FF,
+ Khaki = 0xF0E68CFF,
+ Lavender = 0xE6E6FAFF,
+ LavenderBlush = 0xFFF0F5FF,
+ LawnGreen = 0x7CFC00FF,
+ LemonChiffon = 0xFFFACDFF,
+ LightBlue = 0xADD8E6FF,
+ LightCoral = 0xF08080FF,
+ LightCyan = 0xE0FFFFFF,
+ LightGoldenRodYellow = 0xFAFAD2FF,
+ LightGrey = 0xD3D3D3FF,
+ LightGreen = 0x90EE90FF,
+ LightPink = 0xFFB6C1FF,
+ LightSalmon = 0xFFA07AFF,
+ LightSeaGreen = 0x20B2AAFF,
+ LightSkyBlue = 0x87CEFAFF,
+ LightSlateGrey = 0x778899FF,
+ LightSteelBlue = 0xB0C4DEFF,
+ LightYellow = 0xFFFFE0FF,
+ Lime = 0x00FF00FF,
+ LimeGreen = 0x32CD32FF,
+ Linen = 0xFAF0E6FF,
+ Magenta = 0xFF00FFFF,
+ Maroon = 0x800000FF,
+ MediumAquaMarine = 0x66CDAAFF,
+ MediumBlue = 0x0000CDFF,
+ MediumOrchid = 0xBA55D3FF,
+ MediumPurple = 0x9370DBFF,
+ MediumSeaGreen = 0x3CB371FF,
+ MediumSlateBlue = 0x7B68EEFF,
+ MediumSpringGreen = 0x00FA9AFF,
+ MediumTurquoise = 0x48D1CCFF,
+ MediumVioletRed = 0xC71585FF,
+ MidnightBlue = 0x191970FF,
+ MintCream = 0xF5FFFAFF,
+ MistyRose = 0xFFE4E1FF,
+ Moccasin = 0xFFE4B5FF,
+ NavajoWhite = 0xFFDEADFF,
+ Navy = 0x000080FF,
+ OldLace = 0xFDF5E6FF,
+ Olive = 0x808000FF,
+ OliveDrab = 0x6B8E23FF,
+ Onyx = 0x353839FF,
+ Orange = 0xFFA500FF,
+ OrangeRed = 0xFF4500FF,
+ Orchid = 0xDA70D6FF,
+ PaleGoldenRod = 0xEEE8AAFF,
+ PaleGreen = 0x98FB98FF,
+ PaleTurquoise = 0xAFEEEEFF,
+ PaleVioletRed = 0xDB7093FF,
+ PapayaWhip = 0xFFEFD5FF,
+ PeachPuff = 0xFFDAB9FF,
+ Peru = 0xCD853FFF,
+ Pink = 0xFFC0CBFF,
+ Plum = 0xDDA0DDFF,
+ PowderBlue = 0xB0E0E6FF,
+ Purple = 0x800080FF,
+ RebeccaPurple = 0x663399FF,
+ Red = 0xFF0000FF,
+ RosyBrown = 0xBC8F8FFF,
+ RoyalBlue = 0x4169E1FF,
+ SaddleBrown = 0x8B4513FF,
+ Salmon = 0xFA8072FF,
+ SandyBrown = 0xF4A460FF,
+ SeaGreen = 0x2E8B57FF,
+ SeaShell = 0xFFF5EEFF,
+ Sienna = 0xA0522DFF,
+ Silver = 0xC0C0C0FF,
+ SkyBlue = 0x87CEEBFF,
+ SlateBlue = 0x6A5ACDFF,
+ SlateGrey = 0x708090FF,
+ Snow = 0xFFFAFAFF,
+ SpringGreen = 0x00FF7FFF,
+ SteelBlue = 0x4682B4FF,
+ Tan = 0xD2B48CFF,
+ Teal = 0x008080FF,
+ Thistle = 0xD8BFD8FF,
+ Tomato = 0xFF6347FF,
+ Turquoise = 0x40E0D0FF,
+ Violet = 0xEE82EEFF,
+ Wheat = 0xF5DEB3FF,
+ White = 0xFFFFFFFF,
+ WhiteSmoke = 0xF5F5F5FF,
+ Yellow = 0xFFFF00FF,
+ YellowGreen = 0x9ACD32FF,
+
+ Transparent = 0x00,
+ Clear = 0x01
+ }
+
+ /// <summary>
+ /// Universal Color structure
+ /// </summary>
+ public struct Color : IEquatable<Color>
+ {
+ #region CTOR
+ public Color (int r, int g, int b, int a) :
+ this ((uint)r, (uint)g, (uint)b, (uint)a) { }
+
+ public Color(uint r, uint g, uint b, uint a)
+ {
+ value =
+ ((r & 0xFF) << 24) +
+ ((g & 0xFF) << 16) +
+ ((b & 0xFF) << 8) +
+ ((a & 0xFF));
+ }
+ public Color (byte r, byte g, byte b, byte a)
+ {
+ value = ((uint)r << 24) + ((uint)g << 16) + ((uint)b << 8) + a;
+ }
+ public Color (double r, double g, double b, double a)
+ {
+ value =
+ (((uint)Math.Round (r * 255.0)) << 24) +
+ (((uint)Math.Round (g * 255.0)) << 16) +
+ (((uint)Math.Round (b * 255.0)) << 8) +
+ (((uint)Math.Round (a * 255.0)));
+ }
+ public Color (ReadOnlySpan<double> rgba) {
+ value =
+ (((uint)Math.Round (rgba[0] * 255.0)) << 24) +
+ (((uint)Math.Round (rgba[1] * 255.0)) << 16) +
+ (((uint)Math.Round (rgba[2] * 255.0)) << 8) +
+ (((uint)Math.Round (rgba[3] * 255.0)));
+ }
+ public Color (UInt32 rgba)
+ {
+ this.value = rgba;
+ }
+ public Color (Colors color)
+ {
+ this.value = (UInt32)color;
+ }
+ #endregion
+ //rgba
+ UInt32 value;
+
+ public uint R {
+ get => (value & 0xFF000000) >> 24;
+ set => this.value = (value & 0x000000FF) << 24;
+ }
+ public uint G {
+ get => (value & 0x00FF0000) >> 16;
+ set => this.value = (value & 0x000000FF) << 16;
+ }
+ public uint B {
+ get => (value & 0x0000FF00) >> 8;
+ set => this.value = (value & 0x000000FF) << 8;
+ }
+ public uint A {
+ get => (value & 0x000000FF);
+ set => this.value = (value & 0x000000FF);
+ }
+
+
+
+
+ /*public string Name;
+ public string htmlCode;
+ internal bool predefinied;*/
+
+ #region Operators
+ /*public static implicit operator string(Color c) => c.ToString();
+
+ public static implicit operator UInt32 (Color c) => c.value;*/
+
+ /*public static implicit operator Color(string s)
+ {
+ }*/
+
+ public static implicit operator Color (Colors c) => new Color ((UInt32)c);
+ public static implicit operator Colors (Color c) => (Colors)c.value;
+ public static bool operator ==(Color a, Color b) => a.Equals (b);
+ public static bool operator != (Color a, Color b) => !a.Equals (b);
+
+ public static Color operator *(Color c, Double f) => new Color(c.R,c.G,c.B,c.A * f);
+ public static Color operator +(Color c1, Color c2) => new Color(c1.R + c2.R,c1.G + c2.G,c1.B + c2.B,c1.A + c2.A);
+ public static Color operator -(Color c1, Color c2) =>new Color(c1.R - c2.R,c1.G - c2.G,c1.B - c2.B,c1.A - c2.A);
+ #endregion
+
+ /// <summary>
+ /// compute the hue of the color
+ /// </summary>
+ public uint Hue {
+ get {
+ double r = R / 255.0;
+ double g = G / 255.0;
+ double b = B / 255.0;
+ double min = Math.Min (r, Math.Min (g, b)); //Min. value of RGB
+ double max = Math.Max (r, Math.Max (g, b)); //Max. value of RGB
+ double diff = max - min; //Delta RGB value
+
+ if ( diff == 0 )//This is a grey, no chroma...
+ return 0;
+
+ double h = 0.0, s = diff / max;
+
+ double diffR = (((max - r) / 6.0) + (diff / 2.0)) / diff;
+ double diffG = (((max - g) / 6.0) + (diff / 2.0)) / diff;
+ double diffB = (((max - b) / 6.0) + (diff / 2.0)) / diff;
+
+ if (r == max)
+ h = diffB - diffG;
+ else if (g == max)
+ h = (1.0 / 3.0) + diffR - diffB;
+ else if (b == max)
+ h = (2.0 / 3.0) + diffG - diffR;
+
+ if (h < 0)
+ h += 1;
+ if (h > 1)
+ h -= 1;
+
+ return (uint)(h*255);
+ }
+ }
+ /// <summary>
+ /// compute the saturation of the color
+ /// </summary>
+ public uint Saturation {
+ get {
+ uint min = Math.Min (R, Math.Min (G, B)); //Min. value of RGB
+ uint max = Math.Max (R, Math.Max (G, B)); //Max. value of RGB
+ uint diff = max - min; //Delta RGB value
+ return diff == 0 ? 0 : (uint)(255.0 * diff / max);
+ }
+ }
+ /// <summary>
+ /// compute the RGB intensity of the color
+ /// </summary>
+ /// <value>The value.</value>
+ public uint Value => Math.Max (R, Math.Max (G, B)); //Max. value of RGB
+
+ public string HtmlCode {
+ get {
+ string tmp = $"#{R:X2}{G:X2}{B:X2}";
+ return A == 0xFF ? tmp : $"{tmp}{A:X2}";
+ }
+ }
+ public float[] floatArray => new float[]{ R / 255f, G / 255f, B / 255f, A / 255f };
+ /// <summary>
+ /// return a copy of the color with the alpha component modified
+ /// </summary>
+ /// <returns>new modified color</returns>
+ /// <param name="_A">normalized alpha component</param>
+ public Color AdjustAlpha(double _A)
+ {
+ float[] tmp = floatArray;
+ return new Color (tmp[0], tmp[1], tmp[2], _A);
+ }
+
+ public override bool Equals (object obj)
+ => obj is Color c && Equals(c);
+ /*public bool Equals (Colors other)
+ => value == (UInt32)other;*/
+
+ public bool Equals (Color other)
+ => value == other.value;
+ public override int GetHashCode ()
+ => value.GetHashCode ();
+
+ public override string ToString()
+ => EnumsNET.Enums.IsValid<Colors> ((Colors)value) ? EnumsNET.Enums.GetName((Colors)value) : HtmlCode;
+
+ public static Color FromIml (string iml)
+ {
+ Span<double> components = stackalloc double[4];
+ components[3] = 1;//init alpha to 1 so that it can be ommitted
+ ReadOnlySpan<char> c = iml.AsSpan ();
+ int i = 0;
+ int ioc = c.IndexOf (',');
+
+ while (ioc >= 0) {
+ components[i++] = double.Parse (c.Slice (0, ioc));
+ c = c.Slice (ioc + 1);
+ ioc = c.IndexOf (',');
+ }
+ components[i++] = double.Parse (c);
+ return new Color (components);
+ }
+
+ public static Color Parse(string s)
+ => string.IsNullOrEmpty (s) ? new Color (Colors.White) :
+ s[0] == '#' ? s.Length < 8 ?
+ new Color (0xff + (UInt32.Parse (s.AsSpan ().Slice (1), System.Globalization.NumberStyles.HexNumber)<<8))
+ : new Color (UInt32.Parse (s.AsSpan().Slice (1), System.Globalization.NumberStyles.HexNumber)) :
+ char.IsDigit(s[0]) ? FromIml (s) :
+ EnumsNET.Enums.TryParse<Colors> (s, out Colors cc) ? new Color(cc) :
+ throw new Exception ("Unknown color name: " + s);
+
+ public static Color FromHSV (double _h, double _v = 0xff, double _s = 0xff, double _alpha = 0xff) {
+ _h /= 255.0;
+ _v /= 255.0;
+ _s /= 255.0;
+
+ double H = _h * 360;
+ double C = _v * _s;
+ //X = C × (1 - | (H / 60°) mod 2 - 1 |)
+ double X = C * (1 - Math.Abs ((H / 60.0) % 2 - 1));
+ double m = _v - C;
+
+ if (H >= 300)
+ return new Color (C + m, m, X + m, _alpha / 255.0);
+ else if (H >= 240)
+ return new Color (X + m, m, C + m, _alpha / 255.0);
+ else if (H >= 180)
+ return new Color (m, X + m, C + m, _alpha / 255.0);
+ else if (H >= 120)
+ return new Color ( m, C + m, X + m, _alpha / 255.0);
+ else if (H >= 60)
+ return new Color (X + m, C + m, m, _alpha / 255.0);
+ return new Color (C + m, X + m, m, _alpha / 255.0);
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D
+{
+ public interface IDevice: IDisposable
+ {
+ //IntPtr Handle => handle;
+
+ void GetDpy (out int hdpy, out int vdpy);
+ void SetDpy (int hdpy, int vdpy);
+ ISurface CreateSurface (int width, int height);
+ }
+}
+
--- /dev/null
+// Copyright (c) 2018-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D
+{
+ public enum Status
+ {
+ Success = 0,
+ NoMemory,
+ InvalidRestore,
+ InvalidPopGroup,
+ NoCurrentPoint,
+ InvalidMatrix,
+ InvalidStatus,
+ NullPointer,
+ InvalidString,
+ InvalidPathData,
+ ReadError,
+ WriteError,
+ SurfaceFinished,
+ SurfaceTypeMismatch,
+ PatternTypeMismatch,
+ InvalidContent,
+ InvalidFormat,
+ InvalidVisual,
+ FileNotFound,
+ InvalidDash
+ }
+
+ public enum Direction
+ {
+ Horizontal = 0,
+ Vertical = 1
+ }
+
+ public enum Format
+ {
+ ARGB32,
+ RGB24,
+ A8,
+ A1,
+ Rgb16565 = 4
+ }
+
+ public enum Extend
+ {
+ None,
+ Repeat,
+ Reflect,
+ Pad
+ }
+
+ public enum Filter
+ {
+ Fast,
+ Good,
+ Best,
+ Nearest,
+ Bilinear,
+ Gaussian,
+ }
+
+ public enum PatternType
+ {
+ Solid,
+ Surface,
+ Linear,
+ Radial,
+ Mesh,
+ RasterSource,
+ }
+
+ public enum Operator
+ {
+ Clear,
+ Source,
+ Over,
+ In,
+ Out,
+ Atop,
+
+ Dest,
+ DestOver,
+ DestIn,
+ DestOut,
+ DestAtop,
+
+ Xor,
+ Add,
+ Saturate,
+ Multiply,
+ Screen,
+ Overlay,
+ Darken,
+ Lighten,
+ }
+
+ public enum FontSlant
+ {
+ Normal,
+ Italic,
+ Oblique
+ }
+ public enum FontWeight
+ {
+ Normal,
+ Bold,
+ }
+
+ public enum SampleCount
+ {
+ Sample_1 = 0x00000001,
+ Sample_2 = 0x00000002,
+ Sample_4 = 0x00000004,
+ Sample_8 = 0x00000008,
+ Sample_16 = 0x00000010,
+ Sample_32 = 0x00000020,
+ Sample_64 = 0x00000040
+ }
+
+ public enum LineCap
+ {
+ Butt,
+ Round,
+ Square
+ }
+
+ public enum LineJoin
+ {
+ Miter,
+ Round,
+ Bevel
+ }
+ public enum FillRule
+ {
+ EvenOdd,
+ NonZero,
+ }
+ public enum Antialias
+ {
+ Default,
+ None,
+ Grey,
+ Subpixel,
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// from Mono.Cairo.FontExtents.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+//
+// This is a simplistic binding of the Cairo API to C#. All functions
+// in cairo.h are transcribed into their C# equivelants
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2018-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Runtime.InteropServices;
+
+namespace Drawing2D
+{
+ [StructLayout (LayoutKind.Sequential)]
+ public struct FontExtents : IEquatable<FontExtents>
+ {
+ float ascent;
+ float descent;
+ float height;
+ float maxXAdvance;
+ float maxYAdvance;
+
+ public float Ascent {
+ get => ascent;
+ set { ascent = value; }
+ }
+
+ public float Descent {
+ get => descent;
+ set { descent = value; }
+ }
+
+ public float Height {
+ get => height;
+ set { height = value; }
+ }
+
+ public float MaxXAdvance {
+ get => maxXAdvance;
+ set { maxXAdvance = value; }
+ }
+
+ public float MaxYAdvance {
+ get => maxYAdvance;
+ set { maxYAdvance = value; }
+ }
+
+ public FontExtents (float ascent, float descent, float height, float maxXAdvance, float maxYAdvance)
+ {
+ this.ascent = ascent;
+ this.descent = descent;
+ this.height = height;
+ this.maxXAdvance = maxXAdvance;
+ this.maxYAdvance = maxYAdvance;
+ }
+
+ public override int GetHashCode () => HashCode.Combine (ascent, descent, height, maxXAdvance, maxYAdvance);
+ public override bool Equals (object obj) => obj is FontExtents fe ? Equals (fe) : false;
+
+ public bool Equals(FontExtents other) =>
+ ascent == other.ascent && descent == other.descent && height == other.height &&
+ maxXAdvance == other.maxXAdvance && maxYAdvance == other.maxYAdvance;
+
+ public static bool operator == (FontExtents extents, FontExtents other) => extents.Equals (other);
+ public static bool operator != (FontExtents extents, FontExtents other) => !extents.Equals (other);
+ }
+}
--- /dev/null
+// Copyright (c) 2018-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D
+{
+ public interface IContext : IDisposable
+ {
+
+ IntPtr Handle { get; }
+
+ double LineWidth { get; set; }
+ LineJoin LineJoin { get; set; }
+ LineCap LineCap { get; set; }
+ uint FontSize { get; set; }
+ string FontFace { get; set; }
+ Operator Operator { get; set; }
+ FillRule FillRule { get; set; }
+ FontExtents FontExtents { get; set; }
+ Antialias Antialias { get; set; }
+ TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize = 4);
+ void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents);
+ void TextExtents (Span<byte> bytes, out TextExtents extents);
+ Matrix Matrix { get; set; }
+ void ShowText (string text);
+ void ShowText (ReadOnlySpan<char> s, int tabSize = 4);
+ void ShowText (Span<byte> bytes);
+ void Save();
+ void Restore();
+ void Flush();
+ void Clear();
+ void Paint();
+ void PaintWithAlpha (double alpha);
+
+ void Arc(float xc, float yc, float radius, float a1, float a2);
+ void Arc(double xc, double yc, double radius, double a1, double a2);
+ void Arc (PointD center, double radius, double angle1, double angle2);
+ void ArcNegative (PointD center, double radius, double angle1, double angle2);
+ void ArcNegative(float xc, float yc, float radius, float a1, float a2);
+ void Rectangle(float x, float y, float width, float height);
+ void Scale(float sx, float sy);
+ void Translate(float dx, float dy);
+ void Rotate(float alpha);
+ void ArcNegative(double xc, double yc, double radius, double a1, double a2);
+ void Rectangle(double x, double y, double width, double height);
+ void Scale(double sx, double sy);
+ void Translate(double dx, double dy);
+ void Translate(PointD p);
+ void Rotate(double alpha);
+ void Fill();
+ void FillPreserve();
+ void Stroke();
+ void StrokePreserve();
+ void Clip();
+ void ClipPreserve();
+ void ResetClip();
+ void NewPath();
+ void NewSubPath();
+ void ClosePath();
+ void MoveTo(PointD p);
+ void MoveTo(Point p);
+ void MoveTo(float x, float y);
+ void RelMoveTo(float x, float y);
+ void LineTo(float x, float y);
+ void LineTo(Point p);
+ void LineTo(PointD p);
+ void RelLineTo(float x, float y);
+ void CurveTo(float x1, float y1, float x2, float y2, float x3, float y3);
+ void RelCurveTo(float x1, float y1, float x2, float y2, float x3, float y3);
+ void MoveTo(double x, double y);
+ void RelMoveTo(double x, double y);
+ void LineTo(double x, double y);
+ void RelLineTo(double x, double y);
+ void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3);
+ void RelCurveTo(double x1, double y1, double x2, double y2, double x3, double y3);
+ void SetSource(IPattern pat);
+ void SetSource (Color color);
+ void SetSource(float r, float g, float b, float a = 1f);
+ void SetSource(double r, double g, double b, double a = 1.0);
+ void SetSource(ISurface surf, float x = 0f, float y = 0f);
+ void SetSourceSurface(ISurface surf, float x = 0f, float y = 0f);
+ void RenderSvg(IntPtr svgNativeHandle, string subId = null);
+ Rectangle StrokeExtents ();
+ void SetDash (double [] dashes, double offset = 0);
+ float[] Dashes { set; }
+
+ //void PushGroup ();
+ //void PopGroupToSource ();
+ }
+}
+
--- /dev/null
+// Copyright (c) 2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D {
+ public struct Matrix {
+ float xx; float yx;
+ float xy; float yy;
+ float x0; float y0;
+
+ public float XX, YX;
+ public float XY, YY;
+ public float X0, Y0;
+
+ public override string ToString () {
+ return string.Format ($"({xx};{yx};{xy};{yy};{x0};{y0})");
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+namespace Drawing2D
+{
+ public interface IPattern : IDisposable
+ {
+ Extend Extend { get; set; }
+ Filter Filter { get; set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D
+{
+ public struct Point : IEquatable<Point>, IEquatable<int>
+ {
+ public int X, Y;
+
+ #region CTOR
+ public Point (int x, int y) {
+ X = x;
+ Y = y;
+ }
+ public Point (int pos) {
+ X = pos;
+ Y = pos;
+ }
+ #endregion
+
+ public int Length => (int)Math.Sqrt (Math.Pow (X, 2) + Math.Pow (Y, 2));
+ public double LengthD => Math.Sqrt (Math.Pow (X, 2) + Math.Pow (Y, 2));
+ public Point Normalized {
+ get {
+ int l = Length;
+ return new Point (X / l, Y / l);
+ }
+ }
+ public static implicit operator PointD (Point p) => new PointD (p.X, p.Y);
+ public static implicit operator Point (int i) => new Point (i, i);
+
+ public static Point operator + (Point p1, Point p2) => new Point (p1.X + p2.X, p1.Y + p2.Y);
+ public static Point operator + (Point p, int i) => new Point (p.X + i, p.Y + i);
+ public static Point operator - (Point p1, Point p2) => new Point (p1.X - p2.X, p1.Y - p2.Y);
+ public static Point operator - (Point p, int i) => new Point (p.X - i, p.Y - i);
+ public static Point operator * (Point p1, Point p2) => new Point (p1.X * p2.X, p1.Y * p2.Y);
+ public static Point operator * (Point p, int d) => new Point (p.X * d, p.Y * d);
+ public static Point operator / (Point p1, Point p2) => new Point (p1.X / p2.X, p1.Y / p2.Y);
+ public static Point operator / (Point p, int d) => new Point (p.X / d, p.Y / d);
+
+ public static bool operator == (Point s1, Point s2) => s1.Equals (s2);
+ public static bool operator != (Point s1, Point s2) => !s1.Equals (s2);
+ public static bool operator == (Point s, int i) => s.Equals(i);
+ public static bool operator != (Point s, int i) => !s.Equals (i);
+ public static bool operator > (Point p1, Point p2) => p1.X > p2.X && p1.Y > p2.Y;
+ public static bool operator > (Point s, int i) => s.X > i && s.Y > i;
+ public static bool operator < (Point p1, Point p2) => p1.X < p2.X && p1.Y < p2.Y;
+ public static bool operator < (Point s, int i) => s.X < i && s.Y < i;
+ public static bool operator >= (Point p1, Point p2) => p1.X >= p2.X && p1.Y >= p2.Y;
+ public static bool operator >= (Point s, int i) => s.X >= i && s.Y >= i;
+ public static bool operator <= (Point p1, Point p2) => p1.X <= p2.X && p1.Y <= p2.Y;
+ public static bool operator <= (Point s, int i) => s.X <= i && s.Y <= i;
+
+ public bool Equals (Point other) => X == other.X && Y == other.Y;
+ public bool Equals (int other) => X == other && Y == other;
+
+
+ public override int GetHashCode () => HashCode.Combine (X, Y);
+ public override bool Equals (object obj) => obj is Point s ? Equals (s) : false;
+ public override string ToString () => $"{X},{Y}";
+ public static Point Parse (string s) {
+ ReadOnlySpan<char> tmp = s.AsSpan ();
+ if (tmp.Length == 0)
+ return default (Point);
+ int ioc = tmp.IndexOf (',');
+ return ioc < 0 ? new Point (int.Parse (tmp)) : new Point (
+ int.Parse (tmp.Slice (0, ioc)),
+ int.Parse (tmp.Slice (ioc + 1)));
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D {
+ public struct PointD : IEquatable<PointD>, IEquatable<double> {
+ public double X;
+ public double Y;
+ public PointD (double x, double y)
+ {
+ X = x;
+ Y = y;
+ }
+
+ public double Length => Math.Sqrt (Math.Pow (X, 2) + Math.Pow (Y, 2));
+ public PointD Normalized {
+ get {
+ double l = Length;
+ return new PointD (X / l, Y / l);
+ }
+ }
+ public static implicit operator Point (PointD p) => new Point ((int)Math.Round (p.X), (int)Math.Round (p.Y));
+ public static implicit operator PointD (double i) => new PointD (i, i);
+
+ public static PointD operator + (PointD p1, PointD p2) => new PointD (p1.X + p2.X, p1.Y + p2.Y);
+ public static PointD operator + (PointD p, double i) => new PointD (p.X + i, p.Y + i);
+ public static PointD operator - (PointD p1, PointD p2) => new PointD (p1.X - p2.X, p1.Y - p2.Y);
+ public static PointD operator - (PointD p, double i) => new PointD (p.X - i, p.Y - i);
+ public static PointD operator * (PointD p1, PointD p2) => new PointD (p1.X * p2.X, p1.Y * p2.Y);
+ public static PointD operator * (PointD p, double d) => new PointD (p.X * d, p.Y * d);
+ public static PointD operator / (PointD p1, PointD p2) => new PointD (p1.X / p2.X, p1.Y / p2.Y);
+ public static PointD operator / (PointD p, double d) => new PointD (p.X / d, p.Y / d);
+
+ public static bool operator == (PointD s1, PointD s2) => s1.Equals (s2);
+ public static bool operator == (PointD s, double i) => s.Equals (i);
+ public static bool operator != (PointD s1, PointD s2) => !s1.Equals (s2);
+ public static bool operator != (PointD s, double i) => !s.Equals (i);
+ public static bool operator > (PointD p1, PointD p2) => p1.X > p2.X && p1.Y > p2.Y;
+ public static bool operator > (PointD s, double i) => s.X > i && s.Y > i;
+ public static bool operator < (PointD p1, PointD p2) => p1.X < p2.X && p1.Y < p2.Y;
+ public static bool operator < (PointD s, double i) => s.X < i && s.Y < i;
+ public static bool operator >= (PointD p1, PointD p2) => p1.X >= p2.X && p1.Y >= p2.Y;
+ public static bool operator >= (PointD s, double i) => s.X >= i && s.Y >= i;
+ public static bool operator <= (PointD p1, PointD p2) => p1.X <= p2.X && p1.Y <= p2.Y;
+ public static bool operator <= (PointD s, double i) => s.X <= i && s.Y <= i;
+
+ public override int GetHashCode () => HashCode.Combine (X, Y);
+ public override bool Equals (object obj) =>
+ obj is PointD p ? Equals (p) : obj is double d ? Equals (d) : false;
+ public bool Equals(PointD other) => X == other.X && Y == other.Y;
+ public bool Equals(double i) => X == i && Y == i;
+
+ public override string ToString () => string.Format ("{0},{1}", X, Y);
+ public static PointD Parse (string s)
+ {
+ if (string.IsNullOrEmpty (s))
+ return default (PointD);
+ string [] d = s.Trim ().Split (',');
+ if (d.Length == 2)
+ return new PointD (double.Parse (d [0]), double.Parse (d [1]));
+ else if (d.Length == 1) {
+ double tmp = double.Parse (d [0]);
+ return new PointD (tmp, tmp);
+ }
+ throw new Exception ("Crow.PointD Parsing Error: " + s);
+ }
+
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Runtime.InteropServices;
+
+namespace Drawing2D {
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Rectangle : IEquatable<Rectangle>
+ {
+ public static readonly Rectangle Zero = new Rectangle (0, 0, 0, 0);
+
+ public int X, Y, Width, Height;
+
+ #region ctor
+ public Rectangle(Point p, Size s): this (p.X, p.Y, s.Width, s.Height) { }
+ public Rectangle(Size s) : this (0, 0, s.Width, s.Height) { }
+ public Rectangle(int x, int y, int width, int height) {
+ X = x;
+ Y = y;
+ Width = width;
+ Height = height;
+ }
+ #endregion
+
+ #region PROPERTIES
+ public int Left{
+ get => X;
+ set { X = value; }
+ }
+ public int Top{
+ get => Y;
+ set { Y = value; }
+ }
+ public int Right => X + Width;
+ public int Bottom => Y + Height;
+ public Size Size{
+ get => new Size (Width, Height);
+ set {
+ Width = value.Width;
+ Height = value.Height;
+ }
+ }
+ public SizeD SizeD => new SizeD (Width, Height);
+ public Point Position{
+ get => new Point (X, Y);
+ set {
+ X = value.X;
+ Y = value.Y;
+ }
+ }
+ public Point TopLeft{
+ get => new Point (X, Y);
+ set {
+ X = value.X;
+ Y = value.Y;
+ }
+ }
+ public Point TopRight => new Point (Right, Y);
+ public Point BottomLeft => new Point (X, Bottom);
+ public Point BottomRight => new Point (Right, Bottom);
+ public Point Center => new Point (Left + Width / 2, Top + Height / 2);
+ public Point CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0);
+
+ #endregion
+
+ #region FUNCTIONS
+ public void Inflate(int xDelta, int yDelta)
+ {
+ this.X -= xDelta;
+ this.Width += 2 * xDelta;
+ this.Y -= yDelta;
+ this.Height += 2 * yDelta;
+ }
+ public void Inflate(int delta)
+ {
+ Inflate (delta, delta);
+ }
+ public Rectangle Inflated (int delta) => Inflated (delta, delta);
+ public Rectangle Inflated (int deltaX, int deltaY) {
+ Rectangle r = this;
+ r.Inflate (deltaX, deltaY);
+ return r;
+ }
+ public void Scale (double factor) {
+ X = (int)Math.Round(factor * X);
+ Y = (int)Math.Round(factor * Y);
+ Width = (int)Math.Round(factor * Width);
+ Height = (int)Math.Round(factor * Height);
+ }
+ public Rectangle Scaled (double factor) {
+ return new Rectangle (
+ (int)Math.Round(factor * X),
+ (int)Math.Round(factor * Y),
+ (int)Math.Round(factor * Width),
+ (int)Math.Round(factor * Height));
+ }
+ public RectangleD ScaledD (double factor) {
+ return new RectangleD (
+ factor * X,
+ factor * Y,
+ factor * Width,
+ factor * Height);
+ }
+ public bool ContainsOrIsEqual (Point p) => (p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height);
+ public bool ContainsOrIsEqual (Rectangle r) => r.TopLeft >= this.TopLeft && r.BottomRight <= this.BottomRight;
+ public bool Intersect(Rectangle r)
+ {
+ int maxLeft = Math.Max(this.Left, r.Left);
+ int minRight = Math.Min(this.Right, r.Right);
+ int maxTop = Math.Max(this.Top, r.Top);
+ int minBottom = Math.Min(this.Bottom, r.Bottom);
+
+ return (maxLeft < minRight) && (maxTop < minBottom);
+ }
+ public Rectangle Intersection(Rectangle r)
+ {
+ Rectangle result = new Rectangle();
+
+ if (r.Left >= Left)
+ result.Left = r.Left;
+ else
+ result.TopLeft = TopLeft;
+
+ if (r.Right >= Right)
+ result.Width = Right - result.Left;
+ else
+ result.Width = r.Right - result.Left;
+
+ if (r.Top >= Top)
+ result.Top = r.Top;
+ else
+ result.Top = Top;
+
+ if (r.Bottom >= Bottom)
+ result.Height = Bottom - result.Top;
+ else
+ result.Height = r.Bottom - result.Top;
+
+ return result;
+ }
+ #endregion
+
+ #region operators
+ public static Rectangle operator +(Rectangle r1, Rectangle r2)
+ {
+ int x = Math.Min(r1.X, r2.X);
+ int y = Math.Min(r1.Y, r2.Y);
+ int x2 = Math.Max(r1.Right, r2.Right);
+ int y2 = Math.Max(r1.Bottom, r2.Bottom);
+ return new Rectangle(x, y, x2 - x, y2 - y);
+ }
+ public static Rectangle operator + (Rectangle r, Point p) => new Rectangle (r.X + p.X, r.Y + p.Y, r.Width, r.Height);
+ public static Rectangle operator - (Rectangle r, Point p) => new Rectangle (r.X - p.X, r.Y - p.Y, r.Width, r.Height);
+ public static bool operator == (Rectangle r1, Rectangle r2) => r1.Equals (r2);
+ public static bool operator != (Rectangle r1, Rectangle r2) => !r1.Equals (r2);
+
+ public static implicit operator Rectangle (RectangleD r) => new Rectangle ((int)Math.Round(r.X), (int)Math.Round (r.Y),
+ (int)Math.Round (r.Width), (int)Math.Round (r.Height));
+ #endregion
+
+ public override int GetHashCode () => HashCode.Combine (X, Y, Width, Height);
+ public override bool Equals (object obj) => obj is Rectangle r ? Equals (r) : false;
+ public bool Equals(Rectangle other) =>
+ X == other.X && Y == other.Y && Width == other.Width && Height == other.Height;
+
+ public override string ToString () => $"{X},{Y},{Width},{Height}";
+ public static Rectangle Parse(string s)
+ {
+ string[] d = s.Split(new char[] { ',' });
+ return new Rectangle(
+ int.Parse(d[0]),
+ int.Parse(d[1]),
+ int.Parse(d[2]),
+ int.Parse(d[3]));
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Runtime.InteropServices;
+
+namespace Drawing2D {
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RectangleD
+ {
+ public static readonly RectangleD Zero = new RectangleD (0, 0, 0, 0);
+
+ public double X, Y, Width, Height;
+
+ #region ctor
+ public RectangleD(PointD p, Size s): this (p.X, p.Y, s.Width, s.Height) { }
+ public RectangleD(SizeD s) : this (0, 0, s.Width, s.Height) { }
+ public RectangleD(double x, double y, double width, double height) {
+ X = x;
+ Y = y;
+ Width = width;
+ Height = height;
+ }
+ #endregion
+
+ #region PROPERTIES
+ public double Left{
+ get => X;
+ set { X = value; }
+ }
+ public double Top{
+ get => Y;
+ set { Y = value; }
+ }
+ public double Right => X + Width;
+ public double Bottom => Y + Height;
+ public SizeD Size{
+ get => new SizeD (Width, Height);
+ set {
+ Width = value.Width;
+ Height = value.Height;
+ }
+ }
+ public PointD Position{
+ get => new PointD (X, Y);
+ set {
+ X = value.X;
+ Y = value.Y;
+ }
+ }
+ public PointD TopLeft{
+ get => new PointD (X, Y);
+ set {
+ X = value.X;
+ Y = value.Y;
+ }
+ }
+ public PointD TopRight => new PointD (Right, Y);
+ public PointD BottomLeft => new PointD (X, Bottom);
+ public PointD BottomRight => new PointD (Right, Bottom);
+ public PointD Center => new PointD (Left + Width / 2, Top + Height / 2);
+ public PointD CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0);
+
+ #endregion
+
+ #region FUNCTIONS
+ public void Inflate(double xDelta, double yDelta)
+ {
+ this.X -= xDelta;
+ this.Width += 2 * xDelta;
+ this.Y -= yDelta;
+ this.Height += 2 * yDelta;
+ }
+ public void Inflate(double delta)
+ {
+ Inflate (delta, delta);
+ }
+ public RectangleD Inflated (double delta) => Inflated (delta, delta);
+ public RectangleD Inflated (double deltaX, double deltaY) {
+ RectangleD r = this;
+ r.Inflate (deltaX, deltaY);
+ return r;
+ }
+ public bool ContainsOrIsEqual (PointD p) => (p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height);
+ public bool ContainsOrIsEqual (RectangleD r) => r.TopLeft >= this.TopLeft && r.BottomRight <= this.BottomRight;
+ public bool Intersect(RectangleD r)
+ {
+ double maxLeft = Math.Max(this.Left, r.Left);
+ double minRight = Math.Min(this.Right, r.Right);
+ double maxTop = Math.Max(this.Top, r.Top);
+ double minBottom = Math.Min(this.Bottom, r.Bottom);
+
+ return (maxLeft < minRight) && (maxTop < minBottom);
+ }
+ public RectangleD Intersection(RectangleD r)
+ {
+ RectangleD result = new RectangleD();
+
+ if (r.Left >= Left)
+ result.Left = r.Left;
+ else
+ result.TopLeft = TopLeft;
+
+ if (r.Right >= Right)
+ result.Width = Right - result.Left;
+ else
+ result.Width = r.Right - result.Left;
+
+ if (r.Top >= Top)
+ result.Top = r.Top;
+ else
+ result.Top = Top;
+
+ if (r.Bottom >= Bottom)
+ result.Height = Bottom - result.Top;
+ else
+ result.Height = r.Bottom - result.Top;
+
+ return result;
+ }
+ #endregion
+
+ #region operators
+ public static RectangleD operator +(RectangleD r1, RectangleD r2)
+ {
+ double x = Math.Min(r1.X, r2.X);
+ double y = Math.Min(r1.Y, r2.Y);
+ double x2 = Math.Max(r1.Right, r2.Right);
+ double y2 = Math.Max(r1.Bottom, r2.Bottom);
+ return new RectangleD(x, y, x2 - x, y2 - y);
+ }
+ public static RectangleD operator + (RectangleD r, PointD p) => new RectangleD (r.X + p.X, r.Y + p.Y, r.Width, r.Height);
+ public static RectangleD operator - (RectangleD r, PointD p) => new RectangleD (r.X - p.X, r.Y - p.Y, r.Width, r.Height);
+ public static bool operator == (RectangleD r1, RectangleD r2) => r1.Equals (r2);
+ public static bool operator != (RectangleD r1, RectangleD r2) => !r1.Equals (r2);
+
+ public static implicit operator RectangleD(Rectangle r) => new RectangleD(r.X,r.Y,r.Width,r.Height);
+ #endregion
+
+ public override int GetHashCode () => HashCode.Combine (X, Y, Width, Height);
+ public override bool Equals (object obj) => obj is RectangleD r ? Equals (r) : false;
+ public bool Equals (RectangleD other) =>
+ X == other.X && Y == other.Y && Width == other.Width && Height == other.Height;
+
+ public override string ToString () => $"{X},{Y},{Width},{Height}";
+ public static RectangleD Parse(string s)
+ {
+ string[] d = s.Split(new char[] { ',' });
+ return new RectangleD(
+ double.Parse(d[0]),
+ double.Parse(d[1]),
+ double.Parse(d[2]),
+ double.Parse(d[3]));
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D
+{
+ public struct Size : IEquatable<Size>, IEquatable<int>
+ {
+ public int Width, Height;
+
+ #region CTOR
+ public Size (int width, int height)
+ {
+ Width = width;
+ Height = height;
+ }
+ public Size (int size)
+ {
+ Width = size;
+ Height = size;
+ }
+ #endregion
+
+ #region operators
+ public static implicit operator Rectangle(Size s)=> new Rectangle (s);
+ public static implicit operator Size(int i)=> new Size(i, i);
+ public static implicit operator string(Size s)=> s.ToString ();
+ public static implicit operator Size(string s)=> Parse (s);
+
+ public static bool operator == (Size s1, Size s2) => s1.Equals(s2);
+ public static bool operator != (Size s1, Size s2) => !s1.Equals (s2);
+ public static bool operator > (Size s1, Size s2) => (s1.Width > s2.Width && s1.Height > s2.Height);
+ public static bool operator >= (Size s1, Size s2) => (s1.Width >= s2.Width && s1.Height >= s2.Height);
+ public static bool operator < (Size s1, Size s2) => (s1.Width < s2.Width) ? s1.Height <= s2.Height :
+ (s1.Width == s2.Width && s1.Height < s2.Height);
+ public static bool operator < (Size s, int i) => s.Width < i && s.Height < i;
+ public static bool operator <= (Size s, int i) => s.Width <= i && s.Height <= i;
+ public static bool operator > (Size s, int i) => s.Width > i && s.Height > i;
+ public static bool operator >= (Size s, int i) => s.Width >= i && s.Height >= i;
+ public static bool operator <= (Size s1, Size s2) => (s1.Width <= s2.Width && s1.Height <= s2.Height);
+ /*public static bool operator == (Size s, int i) => (s.Width == i && s.Height == i);
+ public static bool operator != (Size s, int i) => (s.Width != i || s.Height != i);*/
+ public static Size operator + (Size s1, Size s2) => new Size (s1.Width + s2.Width, s1.Height + s2.Height);
+ public static Size operator + (Size s, int i) => new Size (s.Width + i, s.Height + i);
+ public static Size operator * (Size s, int i) => new Size (s.Width * i, s.Height * i);
+ public static Size operator / (Size s, int i) => new Size (s.Width / i, s.Height / i);
+
+ public static Size operator * (Size s, double i) => new Size ((int)(s.Width * i), (int)(s.Height * i));
+ #endregion
+
+
+ public bool Equals (Size other) => Width == other.Width && Height == other.Height;
+ public bool Equals (int other) => Width == other && Height == other;
+
+ public override int GetHashCode () => HashCode.Combine (Width, Height);
+ public override bool Equals (object obj) => obj is Size s ? Equals(s) : false;
+
+ public override string ToString () => $"{Width},{Height}";
+ public static Size Parse(string s)
+ {
+ ReadOnlySpan<char> tmp = s.AsSpan ();
+ if (tmp.Length == 0)
+ return default (Size);
+ int ioc = tmp.IndexOf (',');
+ return ioc < 0 ? new Size (int.Parse (tmp)) : new Size (
+ int.Parse (tmp.Slice (0, ioc)),
+ int.Parse (tmp.Slice (ioc + 1)));
+ }
+
+ }
+}
--- /dev/null
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+
+namespace Drawing2D
+{
+ public struct SizeD : IEquatable<SizeD>, IEquatable<double> {
+ public static SizeD Zero => new SizeD (0, 0);
+
+ public double Width, Height;
+
+ #region CTOR
+ public SizeD (double width, double height)
+ {
+ Width = width;
+ Height = height;
+ }
+ public SizeD (double size)
+ {
+ Width = size;
+ Height = size;
+ }
+ #endregion
+
+ #region operators
+ public static implicit operator RectangleD (SizeD s) => new RectangleD (s);
+ public static implicit operator SizeD (double i) => new SizeD (i, i);
+ public static implicit operator string (SizeD s) => s.ToString ();
+ public static implicit operator SizeD (string s) => string.IsNullOrEmpty (s) ? Zero : Parse (s);
+
+ public static bool operator == (SizeD s1, SizeD s2) => s1.Equals (s2);
+ public static bool operator != (SizeD s1, SizeD s2) => !s1.Equals (s2);
+ public static bool operator > (SizeD s1, SizeD s2) => (s1.Width > s2.Width && s1.Height > s2.Height);
+ public static bool operator >= (SizeD s1, SizeD s2) => (s1.Width >= s2.Width && s1.Height >= s2.Height);
+ public static bool operator < (SizeD s1, SizeD s2) => (s1.Width < s2.Width) ? s1.Height <= s2.Height :
+ (s1.Width == s2.Width && s1.Height < s2.Height);
+ public static bool operator < (SizeD s, double i) => s.Width < i && s.Height < i;
+ public static bool operator <= (SizeD s, double i) => s.Width <= i && s.Height <= i;
+ public static bool operator > (SizeD s, double i) => s.Width > i && s.Height > i;
+ public static bool operator >= (SizeD s, double i) => s.Width >= i && s.Height >= i;
+ public static bool operator <= (SizeD s1, SizeD s2) => (s1.Width <= s2.Width && s1.Height <= s2.Height);
+ public static bool operator == (SizeD s, double i) => s.Equals (i);
+ public static bool operator != (SizeD s, double i) => !s.Equals (i);
+ public static SizeD operator + (SizeD s1, SizeD s2) => new SizeD (s1.Width + s2.Width, s1.Height + s2.Height);
+ public static SizeD operator + (SizeD s, double i) => new SizeD (s.Width + i, s.Height + i);
+ public static SizeD operator * (SizeD s, double i) => new SizeD (s.Width * i, s.Height * i);
+ public static SizeD operator / (SizeD s, double i) => new SizeD (s.Width / i, s.Height / i);
+ #endregion
+
+ public override int GetHashCode () => HashCode.Combine (Width, Height);
+ public override bool Equals (object obj) => obj is SizeD s ? Equals (s) : false;
+ public bool Equals(SizeD other) => Width == other.Width && Height == other.Height;
+ public bool Equals(double other) => Width == other && Height == other;
+
+ public override string ToString () => $"{Width},{Height}";
+ public static SizeD Parse (string s)
+ {
+ string [] d = s.Split (new char [] { ',' });
+ return d.Length == 1 ? new SizeD (double.Parse (d [0])) : new SizeD (
+ double.Parse (d [0]),
+ double.Parse (d [1]));
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace Drawing2D
+{
+ public interface ISurface: IDisposable
+ {
+ //IntPtr Handle { get; }
+ int Width { get; }
+ int Height { get; }
+
+ void Flush ();
+
+ void WriteToPng (string path);
+ void WriteTo (IntPtr bitmap);
+ void Clear ();
+ ISurface CreateSimilar (int width, int height);
+ }
+}
+
--- /dev/null
+// Copyright (c) 2018-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Drawing2D
+{
+ [StructLayout (LayoutKind.Sequential)]
+ public struct TextExtents : IEquatable<TextExtents>
+ {
+ float xBearing;
+ float yBearing;
+ float width;
+ float height;
+ float xAdvance;
+ float yAdvance;
+
+ public float XBearing {
+ get => xBearing;
+ set { xBearing = value; }
+ }
+
+ public float YBearing {
+ get => yBearing;
+ set { yBearing = value; }
+ }
+
+ public float Width {
+ get => width;
+ set { width = value; }
+ }
+
+ public float Height {
+ get => height;
+ set { height = value; }
+ }
+
+ public float XAdvance {
+ get => xAdvance;
+ set { xAdvance = value; }
+ }
+
+ public float YAdvance {
+ get => yAdvance;
+ set { yAdvance = value; }
+ }
+
+ public override int GetHashCode () =>
+ HashCode.Combine (xBearing, yBearing, width, height, xAdvance, yAdvance);
+ public override bool Equals (object obj) => obj is TextExtents te ? Equals (te) : false;
+
+ public bool Equals(TextExtents other) =>
+ xBearing == other.xBearing && yBearing == other.yBearing && width == other.width && height == other.height &&
+ xAdvance == other.xAdvance && yAdvance == other.yAdvance;
+ public static bool operator == (TextExtents extents, TextExtents other) => extents.Equals (other);
+ public static bool operator != (TextExtents extents, TextExtents other )=> !extents.Equals (other);
+ }
+}
class Showcase : SampleBaseForEditor
{
DbgEvtType[] logEvts = {
- DbgEvtType.MouseEnter,
+ DbgEvtType.IFace,
+ DbgEvtType.Widget
+ /*DbgEvtType.MouseEnter,
DbgEvtType.MouseLeave,
DbgEvtType.WidgetMouseDown,
DbgEvtType.WidgetMouseUp,
- DbgEvtType.WidgetMouseClick,
+ DbgEvtType.WidgetMouseClick,*/
};
static void Main ()
{
using Glfw;
using Crow.Text;
using System.Collections.Generic;
-using Crow.Drawing;
+
using System.Threading.Tasks;
using System.Linq;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Collections;
+using Drawing2D;
+
namespace Crow
{
public class Editor : TextBox {
base.onKeyDown(sender, e);
}
- protected override void drawContent (Context gr) {
+ protected override void drawContent (IContext gr) {
try {
lock(TokenMutex) {
if (source == null || source.Tokens.Length == 0) {
using System.Runtime.InteropServices;
using System.Threading;
-using Crow.Drawing;
+
using System.Diagnostics;
namespace Samples
initCommands();
base.OnInitialized();
}
- protected override void processDrawing(Context ctx)
+ protected override void processDrawing(IContext ctx)
{
base.processDrawing(ctx);
}
//Tutorial
using Crow;
-using Crow.Drawing;
+
using Glfw;
namespace TestWidget {
public class TestWidget : Widget {
- protected override void onDraw (Context gr) {
+ protected override void onDraw (IContext gr) {
base.onDraw (gr);
gr.SetSource (myColor);
gr.Rectangle (ClientRectangle);