Re: [newbie] How to plot to drawing_area



On Sat, 1 Feb 2003 18:09:48 -0300
"Individual . ." <individual mi cl> wrote:

I decided it would be great if I could learn how to plot an image to a 
window, pixel by pixel. Getting the  image is no problem at all, since 
I wrote a simple c++ class that uses libpng 
(<http://pngwriter.sourceforge.net/>).
The plotting part is what is holding me up.

I have looked at the scribble program that is given as an example, but 
I must say that the lack of a chapter on drawing_area widgets in the 
tutorial isn't helping me one bit!

Plotting pixel by pixel is _slow_. It's better to use GdkRGB, e.g. using
gdk_draw_rgb_image(). What you have to do is read from the png file to a buffer
containing an array of rgb values. This is then drawn to a drawable. See the
example in the GDK manual.

HTH, Roland
-- 
R.F. Smith                           /"\    ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in email
http://www.xs4all.nl/~rsmith/         X     No Word docs in email
                                     / \    Respect for open standards

Attachment: pgpJthx7xmZnm.pgp
Description: PGP signature



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