Re: Drawing charts with gtk



These methods sound like they would work, and I think the color selection is a
good idea. OpenGL, however, is certainly overkill, since I this app would have
to run quickly even on computers which aren't OpenGL accelerated. I don't know
much about GnomeCanvas, I will research it. However, the drawings which this
will require will be very simple, just arcs of a disk, nothing more, so 
drawing area may be sufficient.

Thanks for your suggestions!


Carlos Pereira a dit ca:
To select your directories, a very powerful method is:

1) Use a double-buffer;

2) When a press_event is received (meaning that
the user wants to see the contents of a given 
directory):

i) read the x,y position where the user clicked;
ii) draw each directory with a different color,
in the background buffer; these colors have absolutely
nothing to do with the colors that the user see on
the foreground color. However, you must guarantee
that the method used to draw the directories is
exactly the same as in the normal drawing routines.
iii) read the color of the x,y position in the
background buffer;
iv) the directory which has the color of the x,y position
is the directory the user selected;

Assuming that the user is using 8,8,8 bits for the r,g,b 
channels, this method allow you to select among 65,535 
directories in a single scan. If you need more ;-) you
need to scan the background buffer again (so in practise
there is really no limit for the number of objects to select).

I don't know whether this is the best method in your case,
it might be an overkill. You might also consider OpenGL (Mesa) to
draw those fancy directories, though again it might be an overkill.
This method to select objects is typically used in complex OpenGL 
applications, where you have different classes of 3D objects, 
3D projections, lights, etc., so there is really no deterministic
way to select objects.

You should also consider GnomeCanvas, I believe is much better
for these things than just a drawing_area.

A raw drawing_area, without nothing on top (as GtkGLArea) is 
intended only for very simple drawings. With OpenGL you could
even use different textures to draw the background of each 
directory... again this might an overkill (bloatware)...

Carlos

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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