l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Dec 12 15:03

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] [Fwd] Re: Text and Image Scrolling in Xlib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] [Fwd] Re: Text and Image Scrolling in Xlib

I replied directly to Sharad, but his e-mail is over quota!
I decided that it's a useful enough piece of info to be archived on
vox-tech, so I'm fwd'ing my response here. :^)

(And if Sharad's email works again, I can just point him to the archive URL
of this message ;^) ;^) )


----- Forwarded message from Bill Kendrick <nbs@sonic.net> -----

On Wed, Nov 26, 2003 at 04:54:19PM -0800, Sharad Bajaj wrote:
> Hello Mr Bill,
> I was looking for help regrading Xlib for some graphics as I have
> two window i want to play movie in one window and in another window
> i want to scroll some image and text,For that purpose i gone thru so
> many documents so find problems
> (1) How Blitting is possible in Xlib as when we make windows we specify
> same GC and whenever we will update gc it will update all display.
> (2) How can we scroll text or Image flicker free in Xlib.

Hi Sharad - Sorry I hadn't gotten back to you, I've been fairly busy,
and I'm pretty rusty with my Xlib coding. :^)

Most of my X-Window programs have been single-window applications, so I can't
really think of how to answer your first question.

For your second, you'll want to use 'double buffering.'

In my game "Bobobot," I create an X-Window 'Pixmap' which I call

I do all of my drawing and erasing there, for each loop of the program...
for each 'frame' I want to display, in other words.

Then, when I'm all done, I merely copy the ENTIRE backbuffer onto my
window (an X-Window 'Window' type I named "window" :^) )

So what happens is my image is constructed 'behind the scenes,' and then
finally revealed, all at once, when it's done.

Of course, this happens many times per second... and under X-Window,
with PC hardware, sometimes there can be 'tearing' between frames
(e.g., half of the window shows the new frame, while the other half
still shows the old, but that only happens for a split second, and not
very often).

It greatly reduces flickering, though!  Of course, you pay for it because
you need to have another, window-sized chunk of memory (the Pixmap),
and because you have to do the final, large copy at the end of each frame.

So, it looks better, but costs a little memory and time.  Typically,
computers are fast enough and have enough memory for this not to matter.
It's worth it, to have the program look better. :)

I hope that all makes sense!  Good luck! :)


----- End forwarded message -----

bill@newbreedsoftware.com                           Got kids?  Get Tux Paint! 
http://newbreedsoftware.com/bill/       http://newbreedsoftware.com/tuxpaint/

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.