Re: A simple GdkDrawingArea question

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

 



The problem with the first is that:

gdk_draw_arc (widget->window,
                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                TRUE,
                0, 0, widget->allocation.width, widget->allocation.height,
                0, 64 * 360);

They use a premade graphic context:
widget->style->fg_gc[GTK_WIDGET_STATE (widget)]

But not a custom graphic context with a custom color.
On the second, to draw a rectangle:

void        gdk_draw_rectangle              (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gboolean filled,
                                             gint x,
                                             gint y,
                                             gint width,
                                             gint height);

I need a pointer to a graphic context and that's my problem. I don't
know how to create a custom graphic context. I don't know how to parse
a foreground or background color to the graphic context, because as I
said, the gdk_gc_set_foreground and gdk_gc_set_background calls aren't
working like I think they must work and I don't know what I'm doing
wrong.
I can't find a good example of drawing using a custom color and not a
graphic context that is on gtk like widget->style->something.

On Thu, 28 Oct 2004 14:54:48 -0400 (EDT), Jack Chen
<jacks_small_world@xxxxxxxxx> wrote:
> Hi,
> 
> There's an example and some explanations for the GtkDrawingArea widget
> in the GTK's API reference.
> 
> http://developer.gnome.org/doc/API/2.0/gtk/GtkDrawingArea.html
> 
> If you know or want to develop an OpenGL application (with GTK), you
> can have a look at GtkGlExt. All of the examples GtkGlExt provided use
> GtkDrawingArea as its OpenGL rendering widget.
> 
> Honestly I don't really know what you want to achieve, but if you just
> want to draw a big black rectangle containing a smaller rectangle
> containing texts, I would just use 2 of the functions here
> 
> http://developer.gnome.org/doc/API/2.0/gdk/gdk-Drawing-Primitives.html
> 
> to draw a rectangle and words. But I never did that before so I can't
> give any guarantees.
> 
> After you have your drawing function, just
> 
> g_signal_connect (G_OBJECT (drawing_area), "expose_event",
>                   G_CALLBACK (your_drawing_function),
>                   "your_addition_parameter_string");
> 
> And it should work.
> 
> Bye!
> 
> Jack
> 
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
_______________________________________________

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