Yet another canvas library
- From: Rick L Vinyard Jr <rvinyard cs nmsu edu>
- Cc: gtk-devel-list gnome org
- Subject: Yet another canvas library
- Date: Tue, 28 Feb 2006 20:05:50 -0700
On Tue, 2006-02-28 at 18:10 +0000, Gustavo J. A. M. Carneiro wrote:
> My proposal would be rather different. Have a single CanvasItem
> object, which would emit a "draw" signal with a cairo_context_t as
> argument.
I too needed a canvas, so I put one together late last year.
If anyone's interested I have YACL (Yet Another Canvas Library; these
things are breeding like rabbits) at http://libpapyrus.sourceforge.net/
Actually, I think the fact that numerous canvas projects are popping up
speaks to the need for a powerful Gtk+ canvas.
I took that exact approach with a virtual draw method that takes a cairo
context as a parameter (actually, since I moved it to cairomm it takes a
Cairo::RefPtr<Cairo::Context> ) simply because I wanted to be able to
extend the drawing shapes as I needed.
It has resulted in putting some basic shapes into the library like
GnomeCanvas has, but the focus was on the ability to inherit from
Papyrus::Drawable (or further down the hierarchy like Papyrus::Shape)
and extend the draw() or draw_shape() methods.
One of the ways that I handled the hit detection was through a virtual
method called pick(x,y). The default implementation was to check the
bounding box, but where important I left it open for the derived classes
to use more appropriate methods; say Preparata's trapezoid method for
point-location in polygons and such.
I also took the approach of separating the canvas library itself from
the Gtkmm widgets; the canvas itself only depends upon cairomm.
Anyway, if anyone has any feedback or comments I'd welcome the input.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]