|
coloring individual pixels: msg#00119gnome.gtk+.perl
Just out of curiosity, are you trying to draw the Mandelbrot set? :-) Look in the Gtk::reference manpage. Maybe you could try '$image->put_pixel($x,$y,$pixel)' But I don't really know what kind of '$pixel' is supposed to take. Maybe someone can tell us. Daniel. > 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... | > > > --__--__-- > > _______________________________________________ > gtk-perl-list mailing list > gtk-perl-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-perl-list > > > End of gtk-perl-list Digest > |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | handheld GTK+: 00119, Daniel Carrera |
|---|---|
| Next by Date: | Re: Getting window size (correctly): 00119, bcorr |
| Previous by Thread: | coloring individual pixelsi: 00119, Forrest Cahoon |
| Next by Thread: | handheld GTK+: 00119, Daniel Carrera |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |