Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -4,18 +4,18 @@
#### Masked Images {#Heading4}
Masked images are rendered by drawing an object’s pixels through a mask;
Masked images are rendered by drawing an object's pixels through a mask;
pixels are actually drawn only where the mask specifies that drawing is
allowed. This makes it possible to draw nonrectangular objects that
don’t improperly interfere with one another when they overlap. Masked
don't improperly interfere with one another when they overlap. Masked
images also make it possible to have transparent areas (windows) within
objects. Masked images produce far more realistic animation than do
rectangular images, and therefore are more desirable. Unfortunately,
masked images are also considerably slower to draw—however, a good
assembly language implementation can go a long way toward making masked
images draw rapidly enough, as illustrated by this chapter’s code.
images draw rapidly enough, as illustrated by this chapter's code.
(Masked images are also known as *sprites*; some video hardware supports
sprites directly, but on the PC it’s necessary to handle sprites in
sprites directly, but on the PC it's necessary to handle sprites in
software.)
Masked images make it possible to render scenes so that a given image
@ -24,27 +24,27 @@ so images are displayed in *z-order* (by distance). By consistently
drawing images that are supposed to be farther away before drawing
nearer images, the nearer images will appear in front of the other
images, and because masked images draw only precisely the correct pixels
(as opposed to blank pixels in the bounding rectangle), there’s no
(as opposed to blank pixels in the bounding rectangle), there's no
interference between overlapping images to destroy the illusion.
In this chapter, I’ve used the approach of having separate, paired masks
In this chapter, I've used the approach of having separate, paired masks
and images. Another, quite different approach to masking is to specify a
transparent color for copying, and copy only those pixels that are not
the transparent color. This has the advantage of not requiring separate
mask data, so it’s more compact, and the code to implement this is a
little less complex than the full masking I’ve implemented. On the other
mask data, so it's more compact, and the code to implement this is a
little less complex than the full masking I've implemented. On the other
hand, the transparent color approach is less flexible because it makes
one color undrawable. Also, with a transparent color, it’s not possible
one color undrawable. Also, with a transparent color, it's not possible
to keep the same base image but use different masks, because the mask
information is embedded in the image data.
#### Internal Animation {#Heading5}
I’ve added another feature essential to producing convincing animation:
I've added another feature essential to producing convincing animation:
*internal animation*, which is the process of changing the appearance of
a given object over time, as distinguished from changing only the
*location* of a given object. Internal animation makes images look
active and alive. I’ve implemented the simplest possible form of
active and alive. I've implemented the simplest possible form of
internal animation in Listing 46.1—alternation between two images—but
even this level of internal animation greatly improves the feel of the
overall animation. You could easily increase the number of images cycled
@ -57,10 +57,10 @@ like.
#### Dirty-Rectangle Management {#Heading6 align="center"}
As mentioned above, dirty-rectangle animation makes it possible to
access display memory a minimum number of times. The previous chapter’s
code didn’t do any of that; instead, it copied all portions of every
access display memory a minimum number of times. The previous chapter's
code didn't do any of that; instead, it copied all portions of every
dirty rectangle to the screen, regardless of overlap between rectangles.
The code I’ve presented in this chapter goes to the other extreme,
The code I've presented in this chapter goes to the other extreme,
taking great pains never to draw overlapped portions of rectangles more
than once. This is accomplished by checking for overlap whenever a
rectangle is to be added to the dirty list. When overlap with an
@ -71,7 +71,7 @@ additional overlap is detected.
A good deal of code is required to generate a fully nonoverlapped dirty
list. Is it worth it? It certainly can be, but in the case of Listing
46.1, probably not. For one thing, you’d need larger, heavily overlapped
46.1, probably not. For one thing, you'd need larger, heavily overlapped
objects for this approach to pay off big. Besides, this program is
mostly in C, and spends a lot of time doing things other than actually
accessing display memory. It also takes a fair amount of time just to
@ -79,7 +79,7 @@ generate the nonoverlapped list; the overhead of all the looping,
intersecting, and calling required to generate the list eats up a lot of
the benefits of accessing display memory less often. Nonetheless, fully
nonoverlapped drawing can be useful under the right circumstances, and
I’ve implemented it in Listing 46.1 so you’ll have something to refer to
I've implemented it in Listing 46.1 so you'll have something to refer to
should you decide to go this route.
There are a couple of additional techniques you might try if you want to
@ -121,17 +121,17 @@ time to make the animation look wrong.
This violated a fundamental rule of animation: *No pixel should ever be
displayed in a perceptibly incorrect state*. To correct the problem,
I’ve sorted the dirty rectangles first by Y coordinate, and secondly by
I've sorted the dirty rectangles first by Y coordinate, and secondly by
X coordinate. This means the screen updates from to draw a given image
should be drawn nearly simultaneously. Run the code from the last
chapter and then this chapter; you’ll see quite a difference in
chapter and then this chapter; you'll see quite a difference in
appearance.
Avoid the trap of thinking animation is merely a matter of drawing the
right pixels, one after another. Animation is the art of drawing *the
right pixels at the right times* so that the eye and brain see what you
want them to see. Animation is a lot more challenging than merely
cranking out pixels, and it sure as heck isn’t a purely linear process.
cranking out pixels, and it sure as heck isn't a purely linear process.
------------------------ --------------------------------- --------------------
[Previous](46-02.html) [Table of Contents](index.html) [Next](47-01.html)