|
coloring individual pixels: msg#00117gnome.gtk+.perl
Can someone help me out with an example? I want to color all the individual pixels in a pixmap according to some mathematical function, and I'm just confused as heck. Here's some snippets of non-working code which will hopefully give somewhat of an idea what I'm trying to do ... .... once I've set up my pixmap (which I don't have right! Ack!) $gc = new Gtk::Gdk::GC ( $widget->window ); for ($x=0; $x<$width; $x++) { for ($y=0; $y<$height; $y++) { $gc->set_foreground($widget->window->get_colormap->color_alloc (f_color($x, $y))); $pixmap->draw_point($widget->window, $gc, $x, $y); } } .... sub f_color { my ($x, $y) = @_; # this will eventually do some clever math thing, but # returning just one color is fine for now. return { red => 65000, green => 32500, blue => 0 }; } I'm trying to go from the example at http://www.gtkperl.org/sample-chart.html, but that doesn't tell me how to work with individual pixels. Everything I'm trying is failing. Any help would be most appreciated. | Forrest Cahoon | forrest@xxxxxxxxxxxx |------------------------------| | 850 21st Ave SE |----------------------| Only unbalanced people | | Mpls MN 55414-2514 | | can tip the scales... | |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: What container widget to use ?: 00117, Dermot Musgrove |
|---|---|
| Next by Date: | handheld GTK+: 00117, Daniel Carrera |
| Previous by Thread: | handheld GTK+ ?i: 00117, raptor |
| Next by Thread: | coloring individual pixels: 00117, Daniel Carrera |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |