Hardware Reference
In-Depth Information
memory location; the address of that memory corresponds to the position of the pixel on the
screen. he contents of that memory location correspond to the brightness and colour of the
pixel. hat computer memory is called the display memory. If you have a program that is pro-
ducing something in a window, that window has its own working memory associated with it,
known here as screen memory. You can then do all your drawing, or setting of memory loca-
tions, in that memory area, and when you are inished, you can transfer the whole of that
into the display memory in one go. Copying blocks of memory from one place to another is
quite eicient in computer-processing terms. his means that the window appears to update
instantly. Another step in sophistication is that you can use a separate piece of memory to
work in, and then transfer that to your working memory in any position in the screen mem-
ory you choose. his is sometimes called a sprite system, but in Pygame software this is known
as a surface. his is illustrated in Figure 4-2.
Figure 4-2:
Pygame's
graphic memory
model.
You can see that the display memory is the largest, as it is the whole output seen on the TV
monitor. he screen memory corresponds to the window area you have deined for Pygame
to use. Transferring data from the screen memory to the display memory is what is done
with the display update call. You can do many operations to this screen memory, such as
drawing lines, circles and rectangles. If you want to draw some text, however, it is best to do
this in the separate area of memory called a surface. In that memory you can render text,
which means to convert the text into a bitmap or graphic representation of letters. his is
done in the depths of the computer and can involve several diferent techniques, the easiest
Search WWH ::




Custom Search