Drawing a line on GnomeCanvas
- From: "Jean-Christophe Berthon" <jean-christophe berthon cgey com>
- To: "Gtk List" <gtk-list gnome org>
- Subject: Drawing a line on GnomeCanvas
- Date: Fri, 3 Aug 2001 17:48:26 +0200
Hello,
I have a problem to draw a line using Gnome primitives on a GnomeCanvas
(although I work it out on a DrawingArea using gdk_draw_line...).
Below is the code I'm using and here is the answer on the console :
"
[spa_dev srv_spatio GtkCanvas]$ src/gtkcanvas
Gtk-CRITICAL **: file gtkobject.c: line 939 (gtk_object_add_arg_type):
assertion `arg_type > GTK_TYPE_NONE' failed.
GnomeUI-WARNING **: gnome_canvas_item_construct(): could not find argument
"points" in the `GnomeCanvasLine' class ancestry line
GnomeUI-WARNING **: gnome_canvas_item_construct(): could not find argument
"points" in the `GnomeCanvasLine' class ancestry line
Segmentation fault
"
/***** The Code used *****/
void function(GtkWidget *cnvGnomeCanvas)
{
GnomeCanvasPoints *points;
gint x, y;
points = gnome_canvas_points_new (2);
x = 50;
y = 50;
points->coords[0] = (double)x-2;
points->coords[1] = (double)y;
points->coords[2] = (double)x+2;
points->coords[3] = (double)y;
gnome_canvas_item_new (gnome_canvas_root(GNOME_CANVAS(cnvGnomeCanvas)),
gnome_canvas_line_get_type (),
"points", points,
"fill_color", "black",
"width_units", 1.0,
"cap_style", GDK_CAP_ROUND,
NULL);
points->coords[0] = (double)x;
points->coords[1] = (double)y-2;
points->coords[2] = (double)x;
points->coords[3] = (double)y+2;
gnome_canvas_item_new (gnome_canvas_root(GNOME_CANVAS(cnvGnomeCanvas)),
gnome_canvas_line_get_type (),
"points", points,
"fill_color", "black",
"width_units", 1.0,
"cap_style", GDK_CAP_ROUND,
NULL);
gnome_canvas_points_free (points);
}
Best regards,
---
Jean-Christophe Berthon
Cap Gemini -- Ernst & Young
France
Skill Integration System -- Image Quality
Email: Jean-Christophe Berthon cgey com
Tel: (+33) 561 31 6639
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]