Re: draw a colored line...



Hope this works for yeah.....


void DrawLine( GtkWidget * drawingarea )
{
  // pass in a valid pointer created by calling gtk_drawing_area_new();

  GdkDrawable * drawable;
  GdkColormap * gdkcolormap;
  GdkGC * gdkgc;

  // Set the color of the line you want to draw here { pixel, red, green,
blue } don't touch the pixel field!!!
  GdkColor gdkcolorgreen = { 0, 0, 0xffff, 0 };

  gdkcolormap = gdk_colormap_get_system();

  gdk_colormap_alloc_color( gdkcolormap, &gdkcolorgreen, TRUE, TRUE );

  drawable = drawingarea -> window;

  gdkgc = gdk_gc_new( drawable );

  gdk_gc_set_foreground( gdkgc, &gdkcolorgreen );

  //  Change the line's attributes here if you like
  //  gdk_gc_set_line_attributes( gdkgc, 2, GDK_LINE_SOLID, GDK_CAP_BUTT,
GDK_JOIN_MITER );

  // Then just draw using coordinates (x1,y1),(x2,y2)
  gdk_draw_line( drawable, gdkgc, x1, y1 , x2, y2);
}


----- Original Message -----
From: "Joergen Scheibengruber" <mfcn gmx de>
To: <gtk-app-devel-list gnome org>
Sent: Wednesday, November 08, 2000 9:59 PM
Subject: draw a colored line...


Hi everybody!

Can somebody tell me how i draw a colored line? at the moment i just
know how to draw black lines :-(
I do this with "gdk_draw_lines (gdkpixmap,
gtkdrawingarea->style->black_gc, gdkpoints,integer);
As the second argument i have to give the function a GdkGraphikContext,
but i couldn't figure out how i can
specify the color of the line in the graphiccontext...

Thanks, Jörgen



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


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





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