seed r403 - trunk/modules/canvas
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r403 - trunk/modules/canvas
- Date: Sat, 6 Dec 2008 04:03:04 +0000 (UTC)
Author: racarr
Date: Sat Dec 6 04:03:04 2008
New Revision: 403
URL: http://svn.gnome.org/viewvc/seed?rev=403&view=rev
Log:
Seed-canvas: Line join..test.
Added:
trunk/modules/canvas/test15.js (contents, props changed)
Modified:
trunk/modules/canvas/Makefile.am
trunk/modules/canvas/seed-canvas.c
Modified: trunk/modules/canvas/Makefile.am
==============================================================================
--- trunk/modules/canvas/Makefile.am (original)
+++ trunk/modules/canvas/Makefile.am Sat Dec 6 04:03:04 2008
@@ -7,7 +7,7 @@
libcanvas_la_LDFLAGS = \
`pkg-config --libs seed cairo`
-EXTRA_DIST=test1.js test2.js test3.js test4.js test5.js test6.js test7.js test8.js test9.js test10.js test11.js test12.js test13.js test14.js
+EXTRA_DIST=test1.js test2.js test3.js test4.js test5.js test6.js test7.js test8.js test9.js test10.js test11.js test12.js test13.js test14.js test15.js
AM_CPPFLAGS = \
-I../../libseed/ \
Modified: trunk/modules/canvas/seed-canvas.c
==============================================================================
--- trunk/modules/canvas/seed-canvas.c (original)
+++ trunk/modules/canvas/seed-canvas.c Sat Dec 6 04:03:04 2008
@@ -124,6 +124,28 @@
g_free(line_cap);
cairo_set_line_cap(cr, cap);
+
+}
+
+gboolean seed_canvas_set_linejoin (SeedContext ctx,
+ SeedObject this_object,
+ SeedString property_name,
+ SeedValue value,
+ SeedException * e)
+{
+ GET_CR;
+ cairo_line_join_t join = CAIRO_LINE_JOIN_MITER;
+ gchar * line_join =
+ seed_value_to_string(ctx, value, e);
+
+ if (!strcmp(line_join, "round"))
+ join = CAIRO_LINE_JOIN_ROUND;
+ else if (!strcmp(line_join, "bevel"))
+ join = CAIRO_LINE_JOIN_BEVEL;
+
+ g_free(line_join);
+
+ cairo_set_line_join (cr, join);
}
@@ -610,10 +632,11 @@
{0, 0, 0}
};
+//TODO: Implement getters that use cairo for consistency...
seed_static_value canvas_properties[] = {
{"lineWidth", 0, seed_canvas_set_linewidth, 0},
{"lineCap", 0, seed_canvas_set_linecap, 0},
-// {"lineJoin", seed_canvas_set_linejoin, 0, 0}
+ {"lineJoin", 0, seed_canvas_set_linejoin, 0},
{0, 0, 0, 0}
};
Added: trunk/modules/canvas/test15.js
==============================================================================
--- (empty file)
+++ trunk/modules/canvas/test15.js Sat Dec 6 04:03:04 2008
@@ -0,0 +1,40 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("Gdk");
+Seed.import_namespace("Gtk");
+Seed.import_namespace("Canvas");
+
+
+Gtk.init(null, null);
+
+w = new Gtk.Window();
+d = new Gtk.DrawingArea();
+w.add(d);
+
+w.resize(150, 150);
+
+w.show_all();
+
+d.signal.expose_event.connect(function(){
+ var cr = Gdk.cairo_create(d.window);
+ var ctx = new Canvas.CairoCanvas(cr);
+
+ var lineJoin = ['round','bevel','miter'];
+ ctx.lineWidth = 10;
+ for (i=0;i<lineJoin.length;i++){
+ ctx.lineJoin = lineJoin[i];
+ ctx.beginPath();
+ ctx.moveTo(-5,5+i*40);
+ ctx.lineTo(35,45+i*40);
+ ctx.lineTo(75,5+i*40);
+ ctx.lineTo(115,45+i*40);
+ ctx.lineTo(155,5+i*40);
+ ctx.stroke();
+ }
+
+ return true;
+ });
+Gtk.main();
+
+
+
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]