Re: events on a lot of triangles: [simplification of a previous post]

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

 



Here's another idea that I use in my program giv. Whenever I am painting an object on screen, I am painting the same object in an off-screen image with the same drawing commands but with "color" that is a combination of R,G,B that encode the index of the object. The important catch is that you have to turn off anti-aliasing for this to work. During motion events I then extract the corresponding pixel from the off-screen image, decode the R,G, and B to get the index of the object, which points to a vector of properties that I show.

Regards,
Dov

2009/2/7 Fabio Mariotti <mariotti.fabio@xxxxxxxxx>
Ok I have 2 partial answers to myself:


I need to draw triangles (and circles) on the screen (any drawable)
and have active events on each object I draw: namely mouse_over, click.. etc..
[they can overlap]

Is there any alternative to gnome-canvas?
In particular gnome-canvas was working nicely up to 20000 objects
but a bit heavy with 40000. (I would guess that an equivalent
canvas solution will suffer the same problem..)

Is there a simple way to "recode" a simple z-buffer using existing tools?
With simple I mean that I do not have to recalculate exposed pixels.

1) There is no simple coding or otherwise I would be doing a canvas!

2) for my little application I have a possible solution:
    I set up a z-buffer as simple integers vector. I store 2 doubles
    at least for each figure so an integer shouldn't harm the memory.
    Due to the type of application, on an click at x,y, I can guess
    a limited number of triangles which might be present in the area.
    I can redraw the area in the style of a canvas and propagate
    the event. Grab it. destroy the canvas-like object. and redraw
    in normal style.
    I am not sure if I can actually do it... more over I'll still need
    the canvas part.
    The advantage is that (of course I do not have to code again
    the pixel stuff) I can change shape of my
    objects at will (ok twice) and moreover I can simply use the event
    stuff which exists already.
    The overload on the users side shouldn't e that big They will stare
    at the screen anyway.. ;).
    On which widget can I draw a canvas at arbitrary coordinates?
    I'll find it out ;)
    [
    I got the idea from an old post...
    http://mail.gnome.org/archives/gtk-list/2006-September/msg00275.html
    Where I discussed the problem in different terms.
    I didn't actually try it. The first reason was that on win machines it would
    have made no difference.
    ]

   A note: would it be a possibility to have a gdk widget named shape(for example)
  which simply draw itself and gets events?
  It is just the same problem of shaped windows and the like.

  sorry again for the long post..
  Faio


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux