Re: [gtk-list] Re: drawing pixel ??
- From: Brandon Long <blong fiction net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: drawing pixel ??
- Date: Sat, 10 Oct 1998 12:47:16 -0700
On 10/10/98 Francisco Cespedes Moreno uttered the following other thing:
>
> Brandon, to much thanks for your help, and sorry for my English, I'm
> Spanish.
>
> Well, now I can draw pixels, but how can I define his color?
>
> I must do for my University a program who read a pic, and apply to it
> filters. I think that I could do it draw pixel to pixel in a window. But I
> don know how to change this:
> >
> > da = gtk_drawing_area_new ();
> > gtk_drawing_area_size (GTK_DRAWING_AREA (da), 50, 50);
> > gtk_container_add (GTK_CONTAINER (window), da);
> > gtk_realize_widget (da);
> > gdk_draw_point (da->window, da->style->black_gc, 10, 10);
> ^
> |
> THAT IS THIS
> >
> How can I change this option, because I think that the color, doesn't it?
That is a Graphics Context, which contains various information about how
to draw, including foreground and background color. You can use the
routine below to allocate a GC for a specific color, or else use the
gdk_color_alloc() function along with the gdk_gc_set_foreground() to
change the graphics context color. If you do that, I suggest using
gdk_gc_copy() on black_gc and changing the color on the resulting GC.
Brandon
On 09/25/98 Eric Harlow uttered the following other thing:
> I wrote a routine called GetPen which returns a GdkGC* based on
> information I got within the last week which was quite helpful.
>
> Once I get my "pen", I use it all over the place.
>
>
>
> GdkGC *GetPen (int red, int green, int blue)
> {
> GdkColor *c;
> GdkGC *gc;
>
> c = (gdkColor *) g_malloc (sizeof (GdkColor));
> c->red = red;
> c->blue = blue;
> c->green = green;
>
> gdk_color_alloc (gdk_colormap_get_system (), c);
>
> // --- Use background pixmap HERE
> gc = gdk_gc_new (pixmap);
>
> gdk_gc_set_foreground (gc, c);
>
> return (gc);
> }
--
Brandon Long "If organized religion is the opium of the masses,
MD6 Crash Test Dummy then disorganized religion is the marijuana of the
Intel Corporation lunatic fringe." -- Kerry Thornley, "Principia"
I'm too low on the totem pole to speak for Intel.
http://www.fiction.net/blong/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]