Cairo# 1.10.0 assembly.
* configure.ac: drop cairo conditionality * cairo/AssemblyInfo.cs: set version to 1.10.0.0 * cairo/Makefile.am: unconditional build and add Region.cs * cairo/cairo-api.xml: initial type exposure. * pango/Makefile.am: use cairo-sharp.dll and cairo-api.xml * pango/Pango.metadata: drop explicit symbol additions. * gdk/Gdk.metadata: drop explicit symbol additions. * gdk/Makefile.am: use cairo-sharp.dll and cairo-api.xml * gtk/Makefile.am: use cairo-sharp.dll and cairo-api.xml * sample/Makefile.am: use cairo-sharp.dll * sample/GtkDemo/Makefile.am: use cairo-sharp.dll This is an initial stab at a 1.10 binding. It will probably take more based on the number of errors still coming out of the Gdk build.
This commit is contained in:
parent
02bac350eb
commit
f6d11d67b6
12 changed files with 281 additions and 57 deletions
|
@ -1,5 +1,5 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly:AssemblyVersion("2.0.0.0")]
|
||||
[assembly:AssemblyVersion("1.10.0.0")]
|
||||
[assembly:AssemblyDelaySign(false)]
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
ASSEMBLY_NAME = Mono.Cairo
|
||||
ASSEMBLY_NAME = cairo-sharp
|
||||
ASSEMBLY = $(ASSEMBLY_NAME).dll
|
||||
SNK = $(srcdir)/mono.snk
|
||||
|
||||
if ENABLE_MONO_CAIRO
|
||||
TARGET=$(ASSEMBLY)
|
||||
else
|
||||
TARGET=
|
||||
endif
|
||||
|
||||
noinst_DATA = $(TARGET)
|
||||
|
||||
|
@ -48,6 +44,7 @@ sources = \
|
|||
PSSurface.cs \
|
||||
RadialGradient.cs \
|
||||
Rectangle.cs \
|
||||
Region.cs \
|
||||
ScaledFont.cs \
|
||||
SolidPattern.cs \
|
||||
Status.cs \
|
||||
|
|
252
cairo/Region.cs
Normal file
252
cairo/Region.cs
Normal file
|
@ -0,0 +1,252 @@
|
|||
// 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 Cairo
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RectangleInt {
|
||||
public int X;
|
||||
public int Y;
|
||||
public int Width;
|
||||
public int Height;
|
||||
}
|
||||
|
||||
public enum RegionOverlap {
|
||||
In,
|
||||
Out,
|
||||
Part,
|
||||
}
|
||||
|
||||
public class Region : IDisposable {
|
||||
|
||||
const string libname = "libcairo.dll";
|
||||
|
||||
IntPtr handle;
|
||||
public IntPtr Handle {
|
||||
get { return handle; }
|
||||
}
|
||||
|
||||
~Region ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern IntPtr cairo_region_reference (IntPtr region);
|
||||
|
||||
public Region (IntPtr handle)
|
||||
{
|
||||
handle = cairo_region_reference (handle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern IntPtr cairo_region_create ();
|
||||
|
||||
public Region ()
|
||||
{
|
||||
handle = cairo_region_create ();
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern IntPtr cairo_region_create_rectangle (ref RectangleInt rect);
|
||||
|
||||
public Region (RectangleInt rect)
|
||||
{
|
||||
handle = cairo_region_create_rectangle (ref rect);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern IntPtr cairo_region_create_rectangles (RectangleInt[] rects, int count);
|
||||
|
||||
public Region (RectangleInt[] rects)
|
||||
{
|
||||
handle = cairo_region_create_rectangles (rects, rects.Length);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern IntPtr cairo_region_copy (IntPtr original);
|
||||
|
||||
public Region Copy ()
|
||||
{
|
||||
return new Region (cairo_region_copy (Handle));
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern void cairo_region_destroy (IntPtr region);
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
}
|
||||
|
||||
void Dispose (bool disposing)
|
||||
{
|
||||
if (handle != IntPtr.Zero)
|
||||
cairo_region_destroy (Handle);
|
||||
handle = IntPtr.Zero;
|
||||
if (disposing)
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern bool cairo_region_equal (IntPtr a, IntPtr b);
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
return (obj is Region) && cairo_region_equal (Handle, (obj as Region).Handle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_status (IntPtr region);
|
||||
|
||||
public Status Status {
|
||||
get { return cairo_region_status (Handle); }
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern void cairo_region_get_extents (IntPtr region, out RectangleInt extents);
|
||||
|
||||
public RectangleInt Extents {
|
||||
get {
|
||||
RectangleInt result;
|
||||
cairo_region_get_extents (Handle, out result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern int cairo_region_num_rectangles (IntPtr region);
|
||||
|
||||
public int NumRectangles {
|
||||
get { return cairo_region_num_rectangles (Handle); }
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern void cairo_region_get_rectangle (IntPtr region, int nth, out RectangleInt rectangle);
|
||||
|
||||
public RectangleInt GetRectangle (int nth)
|
||||
{
|
||||
RectangleInt val;
|
||||
cairo_region_get_rectangle (Handle, nth, out val);
|
||||
return val;
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern bool cairo_region_is_empty (IntPtr region);
|
||||
|
||||
public bool IsEmpty {
|
||||
get { return cairo_region_is_empty (Handle); }
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref RectangleInt rectangle);
|
||||
|
||||
public RegionOverlap ContainsPoint (RectangleInt rectangle)
|
||||
{
|
||||
return cairo_region_contains_rectangle (Handle, ref rectangle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
|
||||
|
||||
public bool ContainsPoint (int x, int y)
|
||||
{
|
||||
return cairo_region_contains_point (Handle, x, y);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern void cairo_region_translate (IntPtr region, int dx, int dy);
|
||||
|
||||
public void Translate (int dx, int dy)
|
||||
{
|
||||
cairo_region_translate (Handle, dx, dy);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
|
||||
|
||||
public Status Subtract (Region other)
|
||||
{
|
||||
return cairo_region_subtract (Handle, other.Handle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref RectangleInt rectangle);
|
||||
|
||||
public Status SubtractRectangle (RectangleInt rectangle)
|
||||
{
|
||||
return cairo_region_subtract_rectangle (Handle, ref rectangle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
|
||||
|
||||
public Status Intersect (Region other)
|
||||
{
|
||||
return cairo_region_intersect (Handle, other.Handle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref RectangleInt rectangle);
|
||||
|
||||
public Status IntersectRectangle (RectangleInt rectangle)
|
||||
{
|
||||
return cairo_region_intersect_rectangle (Handle, ref rectangle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_union (IntPtr dst, IntPtr other);
|
||||
|
||||
public Status Union (Region other)
|
||||
{
|
||||
return cairo_region_union (Handle, other.Handle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_union_rectangle (IntPtr dst, ref RectangleInt rectangle);
|
||||
|
||||
public Status UnionRectangle (RectangleInt rectangle)
|
||||
{
|
||||
return cairo_region_union_rectangle (Handle, ref rectangle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
|
||||
|
||||
public Status Xor (Region other)
|
||||
{
|
||||
return cairo_region_xor (Handle, other.Handle);
|
||||
}
|
||||
|
||||
[DllImport (libname)]
|
||||
static extern Status cairo_region_xor_rectangle (IntPtr dst, ref RectangleInt rectangle);
|
||||
|
||||
public Status XorRectangle (RectangleInt rectangle)
|
||||
{
|
||||
return cairo_region_xor_rectangle (Handle, ref rectangle);
|
||||
}
|
||||
}
|
||||
}
|
6
cairo/cairo-api.xml
Normal file
6
cairo/cairo-api.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<api>
|
||||
<symbol type="manual" cname="cairo_t" name="Cairo.Context"/>
|
||||
<symbol type="manual" cname="cairo_font_options_t" name="Cairo.FontOptions"/>
|
||||
<symbol type="manual" cname="cairo_region_t" name="Cairo.Region"/>
|
||||
</api>
|
|
@ -165,9 +165,6 @@ AC_SUBST(LIB_PREFIX)
|
|||
AC_SUBST(LIB_SUFFIX)
|
||||
AC_SUBST(GENERATED_SOURCES)
|
||||
|
||||
PKG_CHECK_MODULES(MONO_CAIRO, mono-cairo >= $MONO_REQUIRED_VERSION, enable_mono_cairo=no, enable_mono_cairo=yes)
|
||||
AC_SUBST(MONO_CAIRO_LIBS)
|
||||
|
||||
GTK_REQUIRED_VERSION=2.99.0
|
||||
GLIB_REQUIRED_VERSION=2.27.90
|
||||
|
||||
|
@ -204,7 +201,6 @@ else
|
|||
fi
|
||||
AC_SUBST(MDOC)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_MONO_CAIRO, test "x$enable_mono_cairo" = "xyes")
|
||||
AM_CONDITIONAL(ENABLE_DOTNET, test "x$enable_dotnet" = "xyes")
|
||||
AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes")
|
||||
|
||||
|
@ -278,7 +274,6 @@ echo ""
|
|||
echo " Optional assemblies included in the build:"
|
||||
echo ""
|
||||
echo " * gtk-dotnet.dll: $enable_dotnet"
|
||||
echo " * Mono.Cairo.dll: $cairo_comment"
|
||||
echo ""
|
||||
echo " NOTE: if any of the above say 'no' you may install the"
|
||||
echo " corresponding development packages for them, rerun"
|
||||
|
|
|
@ -204,7 +204,6 @@
|
|||
<attr path="/api/namespace/struct[@cname='GdkRgbCmap']/field[@name='NColors']" name="writeable">false</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkWindowObject']" name="hidden">1</attr>
|
||||
<add-node path="/api"><symbol type="manual" cname="cairo_t" name="Cairo.Context"/></add-node>
|
||||
<add-node path="/api"><symbol type="manual" cname="cairo_font_options_t" name="Cairo.FontOptions"/></add-node>
|
||||
<remove-node path="/api/namespace/object[@name='Pixbuf']/method[@name='Gettext']" />
|
||||
</metadata>
|
||||
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
SUBDIRS = . glue
|
||||
|
||||
if ENABLE_MONO_CAIRO
|
||||
local_mono_cairo=$(top_builddir)/cairo/Mono.Cairo.dll
|
||||
else
|
||||
local_mono_cairo=
|
||||
endif
|
||||
|
||||
pkg = gdk
|
||||
SYMBOLS = gdk-symbols.xml
|
||||
INCLUDE_API = $(srcdir)/../glib/glib-api.xml $(top_builddir)/gio/gio-api.xml $(top_builddir)/pango/pango-api.xml
|
||||
INCLUDE_API = $(top_srcdir)/glib/glib-api.xml $(top_srcdir)/cairo/cairo-api.xml $(top_builddir)/gio/gio-api.xml $(top_builddir)/pango/pango-api.xml
|
||||
METADATA = Gdk.metadata
|
||||
references = $(top_builddir)/glib/glib-sharp.dll $(top_builddir)/gio/gio-sharp.dll $(top_builddir)/pango/pango-sharp.dll $(local_mono_cairo)
|
||||
references = $(top_builddir)/glib/glib-sharp.dll $(top_builddir)/gio/gio-sharp.dll $(top_builddir)/pango/pango-sharp.dll $(top_builddir)/cairo/cairo-sharp.dll
|
||||
glue_includes = gdk/gdk.h
|
||||
|
||||
sources = \
|
||||
|
@ -74,4 +68,4 @@ customs = \
|
|||
|
||||
add_dist =
|
||||
|
||||
include ../Makefile.include
|
||||
include $(top_srcdir)/Makefile.include
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
SUBDIRS = . glue
|
||||
|
||||
if ENABLE_MONO_CAIRO
|
||||
local_mono_cairo=$(top_builddir)/cairo/Mono.Cairo.dll
|
||||
else
|
||||
local_mono_cairo=
|
||||
endif
|
||||
|
||||
pkg = gtk
|
||||
pkgconfigdir=$(libdir)/pkgconfig
|
||||
pkgconfig_DATA=gtk-sharp-3.0.pc
|
||||
|
||||
SYMBOLS = gtk-symbols.xml
|
||||
INCLUDE_API = $(srcdir)/../glib/glib-api.xml $(top_builddir)/gio/gio-api.xml $(top_builddir)/pango/pango-api.xml $(top_builddir)/atk/atk-api.xml $(top_builddir)/gdk/gdk-api.xml
|
||||
INCLUDE_API = $(top_srcdir)/glib/glib-api.xml $(top_srcdir)/cairo/cairo-api.xml $(top_builddir)/gio/gio-api.xml $(top_builddir)/pango/pango-api.xml $(top_builddir)/atk/atk-api.xml $(top_builddir)/gdk/gdk-api.xml
|
||||
METADATA = Gtk.metadata
|
||||
references = $(top_builddir)/glib/glib-sharp.dll $(top_builddir)/gio/gio-sharp.dll $(top_builddir)/pango/pango-sharp.dll $(top_builddir)/atk/atk-sharp.dll $(top_builddir)/gdk/gdk-sharp.dll $(local_mono_cairo)
|
||||
references = $(top_builddir)/glib/glib-sharp.dll $(top_builddir)/cairo/cairo-sharp.dll $(top_builddir)/gio/gio-sharp.dll $(top_builddir)/pango/pango-sharp.dll $(top_builddir)/atk/atk-sharp.dll $(top_builddir)/gdk/gdk-sharp.dll
|
||||
glue_includes = gtk/gtk.h
|
||||
|
||||
sources = \
|
||||
|
@ -145,5 +139,5 @@ customs = \
|
|||
|
||||
add_dist = gtk-sharp-3.0.pc.in
|
||||
|
||||
include ../Makefile.include
|
||||
include $(top_srcdir)/Makefile.include
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
SUBDIRS = . glue
|
||||
|
||||
if ENABLE_MONO_CAIRO
|
||||
local_mono_cairo=$(top_builddir)/cairo/Mono.Cairo.dll
|
||||
else
|
||||
local_mono_cairo=
|
||||
endif
|
||||
|
||||
pkg = pango
|
||||
METADATA = Pango.metadata
|
||||
INCLUDE_API = $(top_srcdir)/cairo/cairo-api.xml
|
||||
SYMBOLS = pango-symbols.xml
|
||||
references = ../glib/glib-sharp.dll $(local_mono_cairo)
|
||||
references = $(top_builddir)/glib/glib-sharp.dll $(top_builddir)/cairo/cairo-sharp.dll
|
||||
glue_includes = pango/pango.h
|
||||
|
||||
sources = \
|
||||
|
@ -62,5 +57,5 @@ customs = \
|
|||
|
||||
add_dist =
|
||||
|
||||
include ../Makefile.include
|
||||
include $(top_srcdir)/Makefile.include
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@
|
|||
<attr path="/api/namespace/*[@cname='PangoLayoutLine']/method[@name='Unref']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='PangoScriptIter']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='PangoWin32FontCache']" name="hidden">1</attr>
|
||||
<add-node path="/api"><symbol type="manual" cname="cairo_t" name="Cairo.Context"/></add-node>
|
||||
<move-node path="/api/namespace/class[@name='Version']/method[@cname='pango_version_check']">/api/namespace/class[@name='Global']</move-node>
|
||||
<move-node path="/api/namespace/class[@name='Version']/method[@cname='pango_version_string']">/api/namespace/class[@name='Global']</move-node>
|
||||
</metadata>
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
if ENABLE_MONO_CAIRO
|
||||
cairo_ref=$(top_builddir)/cairo/Mono.Cairo.dll
|
||||
else
|
||||
cairo_ref=Mono.Cairo
|
||||
endif
|
||||
|
||||
assemblies = \
|
||||
$(top_builddir)/glib/glib-sharp.dll $(top_builddir)/gio/gio-sharp.dll \
|
||||
$(top_builddir)/pango/pango-sharp.dll $(top_builddir)/atk/atk-sharp.dll \
|
||||
$(top_builddir)/gdk/gdk-sharp.dll $(top_builddir)/gtk/gtk-sharp.dll
|
||||
$(top_builddir)/glib/glib-sharp.dll \
|
||||
$(top_builddir)/gio/gio-sharp.dll \
|
||||
$(top_builddir)/cairo/cairo-sharp.dll \
|
||||
$(top_builddir)/pango/pango-sharp.dll \
|
||||
$(top_builddir)/atk/atk-sharp.dll \
|
||||
$(top_builddir)/gdk/gdk-sharp.dll \
|
||||
$(top_builddir)/gtk/gtk-sharp.dll
|
||||
|
||||
references = $(addprefix -r:, $(assemblies) $(cairo_ref))
|
||||
references = $(addprefix -r:, $(assemblies)
|
||||
TARGETS = GtkDemo.exe
|
||||
DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
||||
CLEANFILES = $(TARGETS) $(DEBUGS)
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
SUBDIRS = test GtkDemo pixmaps valtest opaquetest gio gtk-gio
|
||||
|
||||
if ENABLE_MONO_CAIRO
|
||||
cairo_ref=-r:$(top_builddir)/cairo/Mono.Cairo.dll
|
||||
else
|
||||
cairo_ref=-r:Mono.Cairo
|
||||
endif
|
||||
|
||||
if ENABLE_DOTNET
|
||||
DOTNET_TARGETS=drawing-sample.exe
|
||||
DOTNET_ASSEMBLY=../gtkdotnet/gtk-dotnet.dll
|
||||
|
@ -21,6 +15,7 @@ DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
|||
assemblies = \
|
||||
$(top_builddir)/glib/glib-sharp.dll \
|
||||
$(top_builddir)/gio/gio-sharp.dll \
|
||||
$(top_builddir)/cairo/cairo-sharp.dll \
|
||||
$(top_builddir)/pango/pango-sharp.dll \
|
||||
$(top_builddir)/atk/atk-sharp.dll \
|
||||
$(top_builddir)/gdk/gdk-sharp.dll \
|
||||
|
@ -71,7 +66,7 @@ treemodeldemo.exe: $(srcdir)/TreeModelDemo.cs $(assemblies)
|
|||
$(CSC) $(CSFLAGS) -out:treemodeldemo.exe $(references) $(srcdir)/TreeModelDemo.cs
|
||||
|
||||
cairo-sample.exe: $(srcdir)/CairoSample.cs $(assemblies)
|
||||
$(CSC) $(CSFLAGS) -out:cairo-sample.exe $(references) $(cairo_ref) $(srcdir)/CairoSample.cs
|
||||
$(CSC) $(CSFLAGS) -out:cairo-sample.exe $(references) $(srcdir)/CairoSample.cs
|
||||
|
||||
testdnd.exe: $(srcdir)/TestDnd.cs $(assemblies)
|
||||
$(CSC) $(CSFLAGS) -unsafe -out:testdnd.exe $(references) $(srcdir)/TestDnd.cs
|
||||
|
|
Loading…
Reference in a new issue