Re: [gtk-list] Re: GDK



>  Perhaps it would be easier if some one good wrote about 75 lines of code
>  that would demonstrate the key features of the toolkit and eluminate the
>  following issues.
>  
>  1. Where can you draw stuff? (Any widget->window?)

Any drawable.  That is, any GdkWindow or GdkPixmap.

>  2. How do you erase stuff?

You paint with your "background" color, whatever that happens to be.

>  3. How do you make drawings stick? (If I cover the window, the drawings
>  dissappear.)

You don't make them stick.  X will tell you when you need to repaint
an area --- you will get an ExposeNotify event for your window.  In
Gtk+ terms, this means your widget's "expose" signal handler will be
called.

>  4. Why can't one say "Draw a #00aaff line"? (Expain the details of the
>  color argument of gtk_draw_XXX(...))

Because there are half a zillion parameters you can configure for
drawing, including color, dash style, line thickness, cap and join
styles, bit planes, and whatnot.  It would be really inconvenient to
have to specify everything every time you did a draw operation.

The solution is to have a Graphic Context structure, or GC, that
contains this information.  You then pass this structure to your
drawing routines.  Since you often draw stuff that has the same color
or line style, for example, you can use the same GC to draw all of it.

>  I think this would be helpful to a lot of potential developers who know
>  next to nothing about X programing. I'm thanking anyone in advance who
>  would do this for us.

This is a document I wrote a long time ago with the basic concepts you
need to know to do X programming.  It is not as complete as I would
like, but you may find it useful.

http://www.gnome.org/devel/docs/gnome-dev-info/x-concepts-docs.html

  Federico



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