Re: Canvas limitations (was Re: Coding question, canvas)



Richard Hult <rhult@hem2.passagen.se> writes:

> > Hey, I just wrote a grid item.  It's not large, so here it is.  It's
> > not a grid of lines, it only draws points.
> > 
> > /* Grid item type for GossipCanvas widget
> 
> Ok, thanks! I will look at this. You forgot to attach the .h-file but I
> managed to reproduce it without too much thinking ;)

Yeah, I didn't intend this to be some code contribution, just a quick
flash of how such a thing might look like.

> Is there any particular reason for duplicating the whole
> gnome_canvas stuff?

It is part of our current experimental simulator project, "Gossip".  I
didn't want to depend on the gnome libs, so I stole the canvas and
renamed it.  Also, I wanted to try out some ideas, especially
regarding bindings to Guile.  We want to write our schematic entry
tool in Scheme.  Once I know whether I have anything concrete I will
of course contribute back to the GnomeCanvas.  We will have to use it
anyway in the end, to pick up all the goodies, but right now, Gnome is
moving to quickly for me.

> I changed all instances of gossip_canvas* to gnome_canvas and as far
> as I can see, it's working perfectly here. What is the set_coords
> method for?

This is one of the ideas I wanted to try out.  I added a new parameter
to gnome_canvas_item_new and gnome_canvas_item_set which holds a
vector of doubles.  How these doubles are interpreted is up to the
canvas item.  For the grid, it contains just the x and y spacing, for
lines and polygons, it contains all the points of the line.  I also
added a method to change individual coordinates in the vector so that
the item can more easily compute a tighter bounding box for the
changed region.  When the endpoint of a line with many segments is
moved, I don't want to whole line to repaint.

Then I think that canvas items have coordinates by nature, and
unifying them would be a good thing.

But the main motivation for the vectors of doubles is that it is dead
easy to wrap for Guile with the existing mechanisms, and the type
"vector of doubles" translates naturally into Scheme land.

- Marius



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]