[Gtk-sharp-list] GnomeCanvas questions
Jorge García
jgarcia@ac.upc.es
Tue, 27 Apr 2004 18:12:50 +0200
Hi,
I have found the answer to the second question: in
gnome/glue/canvaspoints.c there is the g_print of the coordinates.
Doesn't it be removed?
Jorge
GnomeCanvasPoints* gtksharp_gnome_canvas_points_new_from_array (guint
num_points, double *coords)
{
int i, len;
GnomeCanvasPoints *pts = gnome_canvas_points_new (num_points);
g_print ("{");
len = num_points * 2;
for (i = 0; i < len; i++) {
pts->coords[i] = coords[i];
g_print ("%f ", pts->coords[i]);
}
g_print ("}\n");
return pts;
}
On dl, 2004-04-26 at 19:41, Jorge García wrote:
> Hi,
>
> does someone know how is the best method for declare a CanvasGroup?
>
> With this sentence I get the following error:
> CanvasGroup group = new CanvasGroup(canvas.Root(),CanvasGroup.GType);
>
> ui.cs(196) error CS1501: No overload for method `Gnome.CanvasGroup'
> takes `2' arguments
>
> But if I make like samples/Fifteen.cs example and I define a subclass of
> CanvasGroup then it works:
>
> MyGroup group = new MyGroup(canvas.Root());
>
> ...
>
> public class MyGroup: Gnome.CanvasGroup{
> public MyGroup (CanvasGroup group)
> : base (group, CanvasGroup.GType)
> {
>
> }
> }
>
>
>
> Another question that I have is how to write lines fast. I use this
> function (ported from George Lebl's DeveloperWorks article):
>
> void DrawALine(CanvasGroup group,double x1, double y1, double x2, double
> y2, string color){
>
> double[] coords = {x1, y1, x2, y2};
> /* allocate a new points array */
> CanvasPoints points = new CanvasPoints(coords);
>
> /* draw the line */
> CanvasLine item = new CanvasLine(group);
> item.Points = points;
> item.FillColor = color;
> item.WidthUnits = 1.0;
> item.CanvasEvent += new Gnome.CanvasEventHandler (Item_Event);
> }
>
> The problem with this function is that each time that it calls to
> "new CanvasPoints(coords)" the coordinates are showed by the console,
> and its makes veeeery slow my program (that uses thousands of lines)
>
>
> Thank you very much in advance,
>
> Jorge
>
>
>
>
>
>
>
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list