Re: GTK+ back buffers?



On 30 May 1998, Changwoo Ryu wrote:

> Pete Ryland <pdr-lists@pdr.ml.org> writes:
> 
> > I'm trying to do some fast graphical stuff, and I need to implement a fast
> > off-screen double buffer.  Since I also need portability with other
> > platforms, the backbuffer is an "unsigned char *" and can be configured to
> > be either 16 or 24 bit (or 8 bit with a certain fixed palette - not really
> > applicable in X since you can't change the whole palette). 
> >
> > My question is this:  How do I copy the "unsigned char *" buffer to a
> > format that can be flipped to a window without having to do a put_pixel
> > call for each pixel in the image?
> 
> Use X pixmap.  Just "draw" to the pixmap, and gdk_window_copy_area
> (XCopyArea without gtk) from the pixmap to the target window.
> 
> freecell draws its cards in this way.

When you say "draw" to the pixmap, can I do this from an "unsigned char*"?
I realise that there are methods that can do putpixels to pixmaps, but is
there a function like "putpixels(myPixMap, myCharArray, myDepth)" due to
the portability constraint explained above?  It would be a *very* bad
solution imho, to have the backbuffer filled and then a loop like:

for (i = 0 to width-1)
  for (j = 0 to height-1)
    putpixel(i, j, lookupcolor(*backbuffptr++));

within the redraw function.

Pete

Pete Ryland	Home phone: +61 2 9697 9262	Mobile: 014 035 802
email: pdr@student.unsw.edu.au	ICQ UIN: 4256333
WWW: http://www.pdr.ml.org	ftp: ftp.pdr.ml.org



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