Strip comments and inline ids onto h*
This commit is contained in:
parent
1997a7846d
commit
0f5f617adb
362 changed files with 2519 additions and 6694 deletions
23
42-04.html
23
42-04.html
|
|
@ -10,16 +10,9 @@
|
|||
<meta name="vspubdate" content="07/01/97" />
|
||||
<meta name="vscategory" content="Web and Software Development: Game Development,Web and Software Development: Graphics and Multimedia Development" />
|
||||
|
||||
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Wu'ed in Haste; Fried, Stewed at Leisure</title><!-- HEADER -->
|
||||
<!-- Empty Reference Subhead -->
|
||||
<!--ISBN=1576101746//-->
|
||||
<!--TITLE=Michael Abrash's Graphics Programming Black Book Special Edition//-->
|
||||
<!--AUTHOR=Michael Abrash//-->
|
||||
<!--PUBLISHER=The Coriolis Group, Inc.//-->
|
||||
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Wu'ed in Haste; Fried, Stewed at Leisure</title>
|
||||
<meta name="chapter" content="42" />
|
||||
<meta name="pages" content="784-787" />
|
||||
<!--UNASSIGNED1//-->
|
||||
<!--UNASSIGNED2//-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
@ -37,7 +30,7 @@
|
|||
|
||||
<p><br /></p>
|
||||
|
||||
<p><b>LISTING 42.4 L42-4.C</b></p><!-- CODE //-->
|
||||
<p><b>LISTING 42.4 L42-4.C</b></p>
|
||||
<pre>
|
||||
/* Function to draw a non-antialiased line from (X0,Y0) to (X1,Y1), using a
|
||||
* simple fixed-point error accumulation approach.
|
||||
|
|
@ -105,11 +98,11 @@ void DrawLine(int X0, int Y0, int X1, int Y1, int Color)
|
|||
DrawPixel(X0, Y0, Color);
|
||||
} while (--DeltaX);
|
||||
}
|
||||
</pre><!-- END CODE //-->
|
||||
</pre>
|
||||
|
||||
<p>Listing 42.1 isn’t particularly fast, because it calls <b>DrawPixel()</b> for each pixel. On the other hand, <b>DrawPixel()</b> makes it easy to try out Wu antialiasing in a variety of modes; just adapt the code in Listing 42.3 for the 256-color mode you want to support. For example, Listing 42.5 shows code to draw Wu-antialiased lines in 640x480 256-color mode on SuperVGAs built around the Tseng Labs ET4000 chip with at least 512K of display memory installed. It’s well worth checking out Wu antialiasing at 640x480. Although antialiased lines look much smoother than normal lines at 320x200 resolution, they’re far from perfect, because the pixels are so big that the eye can’t blend them properly. At 640x480, however, Wu-antialiased lines look fabulous; from a couple of feet away, they look as straight and smooth as if they were drawn with a ruler.</p>
|
||||
|
||||
<p><b>LISTING 42.5 L42-5.C</b></p><!-- CODE //-->
|
||||
<p><b>LISTING 42.5 L42-5.C</b></p>
|
||||
<pre>
|
||||
/* Mode set and pixel-drawing functions for the 640x480 256-color mode of
|
||||
* Tseng Labs ET4000-based SuperVGAs.
|
||||
|
|
@ -151,7 +144,7 @@ void SetMode()
|
|||
regset.x.ax = 0x002E;
|
||||
int86(0x10, &regset, &regset);
|
||||
}
|
||||
</pre><!-- END CODE //-->
|
||||
</pre>
|
||||
|
||||
<p>Listing 42.1 requires that the DAC palette be set up so that a <b>NumLevel</b>-long block of palette entries contains linearly decreasing intensities of the drawing color. The size of the block is programmable, but must be a power of two. The more intensity levels, the better. Wu says that 32 intensities are enough; on my system, eight and even four levels looked pretty good. I found that gamma correction, which gives linearly spaced intensity steps, improved antialiasing quality significantly. Fortunately, we can program the palette with gamma-corrected values, so our drawing code doesn’t have to do any extra work.</p>
|
||||
|
||||
|
|
@ -174,10 +167,6 @@ void SetMode()
|
|||
|
||||
<div align="center">
|
||||
Graphics Programming Black Book © 2001 Michael Abrash
|
||||
</div><!-- all of the reference materials (books) have the footer and subfoot reveresed -->
|
||||
<!-- reference_subfoot = footer -->
|
||||
<!-- reference_footer = subfoot -->
|
||||
<!-- BEGIN SUB FOOTER -->
|
||||
<!-- END FOOTER -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in a new issue