2008-10-09 Mike Kestner <mkestner@novell.com>
* configure.in.in: kill dead config.in. * sample/CairoSample.cs: some dispose handling and cleanup. * sample/cairo-sample.exe.config.in: kill, no pinvoke needed now. * sample/GException.cs: GException test sample. * sample/GtkCairo.cs: kill, replaced by Gdk.CairoHelper.Create. * sample/Makefile.am: cleanup. svn path=/trunk/gtk-sharp/; revision=115366
This commit is contained in:
parent
9dd35dd137
commit
eca047e0ce
8 changed files with 79 additions and 145 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2008-10-09 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* configure.in.in: kill dead config.in.
|
||||||
|
* sample/CairoSample.cs: some dispose handling and cleanup.
|
||||||
|
* sample/cairo-sample.exe.config.in: kill, no pinvoke needed now.
|
||||||
|
* sample/GException.cs: GException test sample.
|
||||||
|
* sample/GtkCairo.cs: kill, replaced by Gdk.CairoHelper.Create.
|
||||||
|
* sample/Makefile.am: cleanup.
|
||||||
|
|
||||||
2008-10-08 Mike Gorse <mgorse@novell.com>
|
2008-10-08 Mike Gorse <mgorse@novell.com>
|
||||||
|
|
||||||
* Atk/Makefile.am, Atk/ObjectFactory.custom, Atk/glue/Makefile.am,
|
* Atk/Makefile.am, Atk/ObjectFactory.custom, Atk/glue/Makefile.am,
|
||||||
|
|
|
@ -258,7 +258,6 @@ sample/valtest/Makefile
|
||||||
sample/valtest/valtest.exe.config
|
sample/valtest/valtest.exe.config
|
||||||
sample/opaquetest/Makefile
|
sample/opaquetest/Makefile
|
||||||
sample/opaquetest/opaquetest.exe.config
|
sample/opaquetest/opaquetest.exe.config
|
||||||
sample/cairo-sample.exe.config
|
|
||||||
])
|
])
|
||||||
|
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Knockout : DrawingArea
|
||||||
Surface check = cr.Target.CreateSimilar (Content.Color, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
|
Surface check = cr.Target.CreateSimilar (Content.Color, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
|
||||||
|
|
||||||
// draw the check
|
// draw the check
|
||||||
Context cr2 = new Context (check);
|
using (Context cr2 = new Context (check)) {
|
||||||
cr2.Operator = Operator.Source;
|
cr2.Operator = Operator.Source;
|
||||||
cr2.Color = new Color (0.4, 0.4, 0.4);
|
cr2.Color = new Color (0.4, 0.4, 0.4);
|
||||||
cr2.Rectangle (0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
|
cr2.Rectangle (0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
|
||||||
|
@ -53,7 +53,7 @@ class Knockout : DrawingArea
|
||||||
|
|
||||||
cr2.Rectangle (x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
|
cr2.Rectangle (x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
|
||||||
cr2.Fill ();
|
cr2.Fill ();
|
||||||
//cr2.Destroy ();
|
}
|
||||||
|
|
||||||
// Fill the whole surface with the check
|
// Fill the whole surface with the check
|
||||||
SurfacePattern check_pattern = new SurfacePattern (check);
|
SurfacePattern check_pattern = new SurfacePattern (check);
|
||||||
|
@ -98,16 +98,15 @@ class Knockout : DrawingArea
|
||||||
cr.Save ();
|
cr.Save ();
|
||||||
|
|
||||||
// Draw a black circle on the overlay
|
// Draw a black circle on the overlay
|
||||||
Context cr_overlay = new Context (overlay);
|
using (Context cr_overlay = new Context (overlay)) {
|
||||||
cr_overlay.Color = new Color (0.0, 0.0, 0.0);
|
cr_overlay.Color = new Color (0.0, 0.0, 0.0);
|
||||||
OvalPath (cr_overlay, xc, yc, radius, radius);
|
OvalPath (cr_overlay, xc, yc, radius, radius);
|
||||||
cr_overlay.Fill ();
|
cr_overlay.Fill ();
|
||||||
|
|
||||||
// Draw 3 circles to the punch surface, then cut
|
// Draw 3 circles to the punch surface, then cut
|
||||||
// that out of the main circle in the overlay
|
// that out of the main circle in the overlay
|
||||||
Context cr_tmp = new Context (punch);
|
using (Context cr_tmp = new Context (punch))
|
||||||
Draw3Circles (cr_tmp, xc, yc, radius, 1.0);
|
Draw3Circles (cr_tmp, xc, yc, radius, 1.0);
|
||||||
//cr_tmp.Destroy ();
|
|
||||||
|
|
||||||
cr_overlay.Operator = Operator.DestOut;
|
cr_overlay.Operator = Operator.DestOut;
|
||||||
cr_overlay.SetSourceSurface (punch, 0, 0);
|
cr_overlay.SetSourceSurface (punch, 0, 0);
|
||||||
|
@ -116,15 +115,15 @@ class Knockout : DrawingArea
|
||||||
// Now draw the 3 circles in a subgroup again
|
// Now draw the 3 circles in a subgroup again
|
||||||
// at half intensity, and use OperatorAdd to join up
|
// at half intensity, and use OperatorAdd to join up
|
||||||
// without seams.
|
// without seams.
|
||||||
Context cr_circles = new Context (circles);
|
using (Context cr_circles = new Context (circles)) {
|
||||||
cr_circles.Operator = Operator.Over;
|
cr_circles.Operator = Operator.Over;
|
||||||
Draw3Circles (cr_circles, xc, yc, radius, 0.5);
|
Draw3Circles (cr_circles, xc, yc, radius, 0.5);
|
||||||
// cr_circles.Destroy ();
|
}
|
||||||
|
|
||||||
cr_overlay.Operator = Operator.Add;
|
cr_overlay.Operator = Operator.Add;
|
||||||
cr_overlay.SetSourceSurface (circles, 0, 0);
|
cr_overlay.SetSourceSurface (circles, 0, 0);
|
||||||
cr_overlay.Paint ();
|
cr_overlay.Paint ();
|
||||||
// cr_overlay.Destroy ();
|
}
|
||||||
|
|
||||||
cr.SetSourceSurface (overlay, 0, 0);
|
cr.SetSourceSurface (overlay, 0, 0);
|
||||||
cr.Paint ();
|
cr.Paint ();
|
||||||
|
@ -136,14 +135,11 @@ class Knockout : DrawingArea
|
||||||
|
|
||||||
protected override bool OnExposeEvent (Gdk.EventExpose e)
|
protected override bool OnExposeEvent (Gdk.EventExpose e)
|
||||||
{
|
{
|
||||||
#if GTK_SHARP_2_8
|
using (Context cr = Gdk.CairoHelper.Create (e.Window)) {
|
||||||
Context cr = Gdk.CairoHelper.Create (e.Window);
|
|
||||||
#else
|
|
||||||
Context cr = Gdk.Graphics.CreateDrawable (e.Window);
|
|
||||||
#endif
|
|
||||||
int w, h;
|
int w, h;
|
||||||
e.Window.GetSize (out w, out h);
|
e.Window.GetSize (out w, out h);
|
||||||
Draw (cr, w, h);
|
Draw (cr, w, h);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Sample program demostrating using Cairo with Gtk#
|
// Sample program demostrating using System.Drawing with Gtk#
|
||||||
//
|
//
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using System;
|
using System;
|
||||||
|
|
24
sample/GExceptionTest.cs
Executable file
24
sample/GExceptionTest.cs
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
// HelloWorld.cs - GTK Window class Test implementation
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2001-2002 Mike Kestner
|
||||||
|
|
||||||
|
namespace GtkSamples {
|
||||||
|
|
||||||
|
using Gtk;
|
||||||
|
using Gdk;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public class GExceptionTest {
|
||||||
|
|
||||||
|
public static int Main (string[] args)
|
||||||
|
{
|
||||||
|
Application.Init ();
|
||||||
|
Gtk.Window win = new Gtk.Window ("GException");
|
||||||
|
win.SetIconFromFile ("this.filename.does.not.exist");
|
||||||
|
// Notreached, GException should throw on above call.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,91 +0,0 @@
|
||||||
//
|
|
||||||
//
|
|
||||||
// GDK-X11 interface
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Gtk;
|
|
||||||
using Cairo;
|
|
||||||
|
|
||||||
namespace Gdk
|
|
||||||
{
|
|
||||||
public class Graphics
|
|
||||||
{
|
|
||||||
//Use [DllImport("libgdk-win32-2.0-0.dll")] for Win32
|
|
||||||
[DllImport("libgdk-x11-2.0.so")]
|
|
||||||
internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr raw);
|
|
||||||
|
|
||||||
[DllImport("libgdk-x11-2.0.so")]
|
|
||||||
internal static extern IntPtr gdk_x11_drawable_get_xid (IntPtr raw);
|
|
||||||
|
|
||||||
[DllImport("libgdk-x11-2.0.so")]
|
|
||||||
internal static extern IntPtr gdk_drawable_get_visual (IntPtr raw);
|
|
||||||
|
|
||||||
[DllImport("libgdk-x11-2.0.so")]
|
|
||||||
internal static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr raw);
|
|
||||||
|
|
||||||
[DllImport("libgdk-x11-2.0.so")]
|
|
||||||
internal static extern IntPtr gdk_cairo_create (IntPtr raw);
|
|
||||||
|
|
||||||
public static Cairo.Context CreateDrawable (Gdk.Drawable drawable)
|
|
||||||
{
|
|
||||||
IntPtr x_drawable = IntPtr.Zero;
|
|
||||||
int x_off = 0, y_off = 0;
|
|
||||||
|
|
||||||
int x, y, w, h, d;
|
|
||||||
((Gdk.Window)drawable).GetGeometry(out x, out y, out w, out h, out d);
|
|
||||||
|
|
||||||
bool is_gdk_window = drawable is Gdk.Window;
|
|
||||||
if (is_gdk_window)
|
|
||||||
((Gdk.Window) drawable).GetInternalPaintInfo(out drawable,
|
|
||||||
out x_off, out y_off);
|
|
||||||
|
|
||||||
x_drawable = drawable.Handle;
|
|
||||||
IntPtr visual = gdk_drawable_get_visual(x_drawable);
|
|
||||||
|
|
||||||
IntPtr Xdisplay = gdk_x11_drawable_get_xdisplay(x_drawable);
|
|
||||||
IntPtr Xvisual = gdk_x11_visual_get_xvisual(visual);
|
|
||||||
IntPtr Xdrawable = gdk_x11_drawable_get_xid (x_drawable);
|
|
||||||
|
|
||||||
Cairo.XlibSurface s = new Cairo.XlibSurface (Xdisplay,
|
|
||||||
Xdrawable,
|
|
||||||
Xvisual,
|
|
||||||
w, h);
|
|
||||||
|
|
||||||
Cairo.Context g = new Cairo.Context (s);
|
|
||||||
|
|
||||||
// this can be safely removed now, just keep it for a bit more
|
|
||||||
//Cairo.Context g = new Cairo.Context (
|
|
||||||
// gdk_cairo_create (x_drawable ));
|
|
||||||
|
|
||||||
if (is_gdk_window)
|
|
||||||
g.Translate (-(double)x_off,-(double)y_off);
|
|
||||||
return g;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ DOTNET_TARGETS=
|
||||||
DOTNET_ASSEMBLY=
|
DOTNET_ASSEMBLY=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TARGETS = polarfixed.exe custom-widget.exe custom-cellrenderer.exe gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe size.exe scribble.exe scribble-xinput.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe testdnd.exe actions.exe spawn.exe assistant.exe registerprop.exe $(GLADE_TARGETS) $(DOTNET_TARGETS)
|
TARGETS = polarfixed.exe custom-widget.exe custom-cellrenderer.exe gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe size.exe scribble.exe scribble-xinput.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe testdnd.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe cairo-sample.exe $(GLADE_TARGETS) $(DOTNET_TARGETS)
|
||||||
|
|
||||||
DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ glade-viewer.exe: $(srcdir)/GladeViewer.cs $(assemblies)
|
||||||
glade-test.exe: $(srcdir)/GladeTest.cs $(srcdir)/test.glade $(assemblies)
|
glade-test.exe: $(srcdir)/GladeTest.cs $(srcdir)/test.glade $(assemblies)
|
||||||
$(CSC) /resource:$(srcdir)/test.glade,test.glade /out:glade-test.exe $(references) $(srcdir)/GladeTest.cs
|
$(CSC) /resource:$(srcdir)/test.glade,test.glade /out:glade-test.exe $(references) $(srcdir)/GladeTest.cs
|
||||||
|
|
||||||
cairo-sample.exe: $(srcdir)/CairoSample.cs $(srcdir)/GtkCairo.cs $(assemblies)
|
cairo-sample.exe: $(srcdir)/CairoSample.cs $(assemblies)
|
||||||
$(CSC) /out:cairo-sample.exe $(references) /r:Mono.Cairo $(srcdir)/CairoSample.cs $(srcdir)/GtkCairo.cs
|
$(CSC) /out:cairo-sample.exe $(references) /r:Mono.Cairo $(srcdir)/CairoSample.cs
|
||||||
|
|
||||||
testdnd.exe: $(srcdir)/TestDnd.cs $(assemblies)
|
testdnd.exe: $(srcdir)/TestDnd.cs $(assemblies)
|
||||||
$(CSC) /debug /unsafe /out:testdnd.exe $(references) $(srcdir)/TestDnd.cs
|
$(CSC) /debug /unsafe /out:testdnd.exe $(references) $(srcdir)/TestDnd.cs
|
||||||
|
@ -100,6 +100,9 @@ assistant.exe: $(srcdir)/Assistant.cs $(assemblies)
|
||||||
registerprop.exe: $(srcdir)/PropertyRegistration.cs $(assemblies)
|
registerprop.exe: $(srcdir)/PropertyRegistration.cs $(assemblies)
|
||||||
$(CSC) /out:registerprop.exe $(references) $(srcdir)/PropertyRegistration.cs
|
$(CSC) /out:registerprop.exe $(references) $(srcdir)/PropertyRegistration.cs
|
||||||
|
|
||||||
|
gexceptiontest.exe: $(srcdir)/GExceptionTest.cs $(assemblies)
|
||||||
|
$(CSC) /out:gexceptiontest.exe $(references) $(srcdir)/GExceptionTest.cs
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
HelloWorld.cs \
|
HelloWorld.cs \
|
||||||
Assistant.cs \
|
Assistant.cs \
|
||||||
|
@ -115,6 +118,7 @@ EXTRA_DIST = \
|
||||||
TreeViewDemo.cs \
|
TreeViewDemo.cs \
|
||||||
ManagedTreeViewDemo.cs \
|
ManagedTreeViewDemo.cs \
|
||||||
NodeViewDemo.cs \
|
NodeViewDemo.cs \
|
||||||
|
GExceptionTest.cs \
|
||||||
GladeViewer.cs \
|
GladeViewer.cs \
|
||||||
GladeTest.cs \
|
GladeTest.cs \
|
||||||
test.glade \
|
test.glade \
|
||||||
|
@ -122,7 +126,6 @@ EXTRA_DIST = \
|
||||||
TestDnd.cs \
|
TestDnd.cs \
|
||||||
CustomCellRenderer.cs \
|
CustomCellRenderer.cs \
|
||||||
DrawingSample.cs \
|
DrawingSample.cs \
|
||||||
cairo-sample.exe.config \
|
|
||||||
CustomWidget.cs \
|
CustomWidget.cs \
|
||||||
Actions.cs \
|
Actions.cs \
|
||||||
PropertyRegistration.cs \
|
PropertyRegistration.cs \
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<configuration>
|
|
||||||
<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
|
|
||||||
<dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
|
|
||||||
<dllmap dll="libgdk-win32-2.0-0.dll" target="libgdk-x11-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
|
|
||||||
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
|
|
||||||
</configuration>
|
|
Loading…
Reference in a new issue