Re: [gtk-list] Newbie plotting question



> The question is, is there a program out there that effectively
> demonstrates how to simply do gdk_draw_* routines on an on-screen widget?
> I'm only aiming to be able to draw individual pixels at a time, but there
> doesn't seem to be any obvious way of doing it.

Having recently been through the same trauma, this is how I ended up doing it:

       GdkPoint points[10];

       /* Some code to set up the points goes here */

       points[0].x = ....;
       points[0].y = ....;

       points[1].x = ....;
       points[1].y = ....;

       /* Draw the points onto the GtkWidget 'widget' */

       gdk_draw_points(widget->window,
                       widget->style->fg_gc[GTK_STATE_NORMAL],
                       points, 10);

Note that for 'any color you want' you'll have to work with the color
allocation stuff that's been talked about a number of times on the list.
I haven't done any of that so can't help there.

Daniel.

-- 
Daniel Stephens (daniel@cheeseplant.org)
Systems Analyst - Linux, gcc, g++, Perl, GNU Advocate
"Nothing is _too_ weird" <A HREF="http://mall.lnd.com/daniels/">Home!?</A>



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