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



>  translate: perform a simple translation (dx, dy), then request an
>  update.

The translate method has been obsoleted by the affine
transformations.  I need to go through the canvas sources and remove
old cruft :-)

>  bounds: return the item's bounding box.
>  
>  update: build an ArtVpath, make an affine transformation and update the
>  region of the canvas that is covered by the calculated svpclip. This
>  would be done by putting lots of small paths together, one for each
>  dot, as you suggested, right?

The update method is really for setting up whatever you may need to
render your item.  When the canvas repaints itself, the render method
of an item may be called more than once (to repaint different regions,
for example).  The update method is intended to set up stuff first.

>  render:	gnome_canvas_render_svp for the item, and then propagate
>  towards to root of the class tree.

You can use Xlib for the non-AA version of the canvas, or you can use
libart or write directly to the RGB buffer for the AA case.  For your
grid, I would suggest writing directly to the RGB buffer.

>  point: calculate the distance from a point to the item. In my example,
>  with lots of small dots, would this be the distance from the point to
>  the nearest dot then? Or would it be zero since it's within the
>  bounding box? The bounding box would be the complete area of the grid in
>  my case, if I got that part right.

It depends.  What would you consider to be "inside" the grid? :-)
Returning always zero is fine, unless you want "insideness" to be true
only when the user is near one of the grid lines (so the squares
between grid lines would be "outside").

>  event: take care of events.

Most generic items do not need to handle events by themselves; this is
just the standard signal placeholder.

>  Did I get this right? If it's way off, maybe you should give up trying
>  to explain it to me ;)

Not at all :-)

  Federico



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