home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 August / CICA.cdr / win_nt / multimed / technote / graphx.zrt / GRAPHX.TXT
Encoding:
Text File  |  1992-03-27  |  92.4 KB  |  2,002 lines

  1.                                    
  2.                                    
  3.                               Multimedia
  4.                                    
  5.                             Technical Note
  6.                                    
  7.                                    
  8.                                    
  9.                                    
  10.                                    
  11.                                    
  12.                                    
  13.                                    
  14.                                    
  15.                                    
  16.                                    
  17.                                    
  18.                                    
  19.                    Graphics Design and Optimization
  20.                                    
  21.                                    
  22.                                    
  23.                                    
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.                                    
  31.                              Matt Saettler
  32.                      Multimedia Technical Support
  33.                            One Microsoft Way
  34.                       Redmond, WA 98052-6399 USA
  35.                                    
  36.                           03/92 Revision 1.00
  37.  
  38. Information in this document is subject to change without notice and
  39. does not represent a commitment on the part of Microsoft Corporation.
  40. The software described in this document is furnished under license
  41. agreement or nondisclosure agreement.  The software may be used or
  42. copied only in the accordance with the terms of the agreement.  It is
  43. against the law to copy the software on any medium except as
  44. specifically allowed in the license or nondisclosure agreement.
  45.  
  46. No part of this document may be reproduced or transmitted in any form
  47. or by any means, electronic or mechanical, including photocopying and
  48. recording, for any purpose without the express written permission of
  49. Microsoft Corporation.
  50.  
  51. This technical note is for informational purposes only.  Microsoft
  52. makes no warranties, expressed or implied in this technical note.
  53.  
  54. Microsoft, MS, MS-DOS, XENIX and the Microsoft logo are registered
  55. trademarks and Windows is a trademark of Microsoft Corporation.  Other
  56. trade names mentioned herein are trademarks of their respective
  57. manufacturers.
  58.                                    
  59.      Copyright 1992, Microsoft Corporation.  All Rights Reserved.
  60.                            Table of Contents
  61.  
  62. Overview                                                 3
  63. Uses for Graphics                                        5
  64. Life Cycle of a Graphic                                  7
  65. Pictures                                                 9
  66. Vector Graphics                                          11
  67. User Interface Graphics                                  13
  68. Cast Graphics                                            16
  69. Tile Graphics                                            20
  70. Video                                                    23
  71. Simulation Graphics                                      26
  72. Special Effects                                          28
  73. Graphics Creation, Archival and Conversion               29
  74. Graphics Loading and Storage                             31
  75. Graphics Display                                         35
  76. Glossary                                                 38
  77.                                Overview
  78.  
  79. This technical note tries to present a very important but complicated
  80. multimedia issue: graphics.  GUIs are only just starting to make use of
  81. graphics, and multimedia titles use all the capabilities of a graphics
  82. system.  This has presented a new set of problems as applications
  83. deisgners and developers try to deal with placing graphics into their
  84. applications.  This technical note discusses the design and
  85. optimization issues under the Windows environment.
  86.  
  87. Chapter one describes the uses for graphics.  This allows the
  88. definition of different graphic types based on their intended usage.
  89. Chapter two examples the life cycle of a graphic and presents some
  90. special issues that only occur at certain phases of this cycle.
  91.  
  92. Several chapters are devoted to the different types of graphics.  Each
  93. of these chapters describes the graphic type in detail and discusses
  94. optimization techniques that are specific to that type.
  95.  
  96. These are followd by chapters detailing the different phases of the
  97. life cycle and design and optimization issues that are common between
  98. the different types.  Finally, a glossary provides definitions of the
  99. many terms used in this technical note and common to multimedia with
  100. Windows design and development.
  101.  
  102. Obtaining the Current Version
  103.  
  104. Graphics design and optimization are a very complicated subjects and
  105. this document will be expanded in the future to cover these topics in
  106. more detail.  If you have specific issues that you would like to see
  107. covered, or if you would like sample code to cover any of the topics
  108. discussed in this document, please let us know, contact Multimedia
  109. Technical support at the address listed on the cover.
  110.  
  111. The current version of this technical note can be obtained from the
  112. Microsoft Multimedia Systems BBS  (MM BBS) at (206) 936-4082 in the
  113. files library in the technotes section in the graphx.zip file.  BBS
  114. modem settings are 9600 baud, no parity, 8 data bits, 1 stop bit.
  115.  
  116. This document is also available from the WINSDK forum on CompuServe.
  117.  
  118. Obtaining the Sample Code
  119.  
  120. Sample code discussed in this technical note can be obtained from the
  121. Microsoft Multimedia Systems BBS (MM BBS) at (206) 936-4082 in the
  122. files library in the samples section.  BBS modem settings are 9600
  123. baud, no parity, 8 data bits, 1 stop bit.
  124.  
  125. They are also available from the WINSDK forum on CompuServe, but newer
  126. versions will be available first on the MM BBS due to Compuserve file
  127. verification delay times.
  128.  
  129. Intended Audience
  130.  
  131. This document should be read by Multimedia Producers (as defined in the
  132. Multimedia Authoring Guide) as well as programmers using all types of
  133. tools.  You should read this document after reading the Multimedia
  134. Authoring Guide book of the MDK documentation.  This book is also
  135. available directly from Microsoft Press and other bookstores.
  136. Microsoft Press can be reached at 800-MSPRESS.
  137.  
  138. Printed Images
  139.  
  140. This document contains many printed images.  The printer dithers the
  141. color images to monochrome when it prints, resulting in an image that
  142. may not have solid colors when it is printed.  Since the issue of solid
  143. color is important in this document, please be aware of this situation.
  144.  
  145. Questions?
  146.  
  147. If you have questions, requests, or problems with this technical note,
  148. you should send to one of the following:
  149.  
  150. 1.                                                       via email on
  151.   the MM BBS, addressed to the sysop,
  152.  
  153. 2.                                                       via FAX or
  154.   mail to:
  155.  
  156.      Matt Saettler
  157.      Multimedia Technical Support
  158.      Microsoft Multimedia Group
  159.      One Microsoft Way
  160.      Redmond, WA 98052-6399
  161.      FAX: (206) 93MS-FAX
  162.  
  163. We are very interested in your feedback on the information contained in
  164. this technical note.
  165.                                    
  166.                            Uses for Graphics
  167.  
  168. This section discusses the different uses for graphics objects and
  169. therefore the different types or categories.  These areas are discussed
  170. in greater detail later in this technical note.
  171.  
  172. Pictures
  173.  
  174. This is the simplest form of graphics.  Pictures can be thought of as
  175. single-frame video.  In large quantities, pictures can also take up a
  176. lot of disc and memory space, so compression might be important.
  177. Compression might also be needed for optimal file I/O.  This is
  178. discussed later in this technical note in the section entitled Graphics
  179. Storage and Loading Optimization.
  180.  
  181. Vector Graphics
  182.  
  183. Vector graphics are a special type of picture.  A vector image consists
  184. of instructions about how to create the image rather than the actual
  185. pixels that represent the image.  To display a vector graphic, an
  186. application (or system) must interpret the instructions to create the
  187. image.  Vector graphics are generally limited to computer images.
  188.  
  189. User Interface Graphics
  190.  
  191. User interface graphics are graphics that are used to interact with the
  192. user.  Windows provides a standard graphical interface.  Many
  193. applications only use the standard interface items. However, many more
  194. options are available to you
  195.  
  196. Buttons can have pictures instead of just text -- for example, the
  197. Toolbar in Microsoft products, the "Exit" button in the Windows setup
  198. program.  These buttons greatly increase the usability of an
  199. application.
  200.  
  201. Pictures can also be used as part of the interface.  For example, a
  202. picture of a house floor plan might be used for control of security,
  203. lights, etc.  Another example is the use of SHED graphics in Microsoft
  204. Viewer, which is included with the Multimedia Development Kit (MDK).
  205.  
  206. Another option you have is using simple animations. For example, you
  207. can create animated icons that show a particular operation such as
  208. double spacing, drawing, etc.
  209.  
  210. Simulation Graphics
  211.  
  212. Simulation graphics are graphics calculated as they are displayed.
  213. This is the most CPU intensive of all uses for a particular graphic.
  214. The raw blit speed of the display is very important because the whole
  215. display is usually updated each frame.
  216.  
  217. In all current video cards, writting to regular (CPU) memory is much
  218. faster than video memory. Some MS-DOS applications use the optimization
  219. of double-buffering the display.  However, this technique is not
  220. available under Windows because most of the video modes do not support
  221. this operation.
  222.  
  223. Frame rate is usually the metric used to determine quality, but image
  224. quality is also important (quality usually means complexity, but not
  225. always).
  226.  
  227. Microsoft Flight Simulator is an example of an application that uses
  228. primarily simulation graphics.
  229.  
  230. Cast Graphics
  231.  
  232. Cast graphics are images that are constructed from many individual
  233. images.  Cast graphics are also called sprite graphics.  This is the
  234. most commonly used form of graphics in animations and are also very
  235. useful for still images.
  236.  
  237. The Living Books series from Brderbund use primarily cast graphics.
  238.  
  239. Tile Graphics
  240.  
  241. Tile graphics are pictures drawn on a square grid.  This allows easy
  242. emulation of board games and other game systems.  SimCity from Maxis is
  243. an example of an application that uses primarily tile graphics.
  244.  
  245. Tile graphics can be thought of as a constrained (to a grid) sprite.
  246.  
  247. Video
  248.  
  249. Video is inherently an animation form of graphics.  The image is, by
  250. definition, precalculated.  The playback is usually non-interactive,
  251. meaning that the user does not interact with the video while it is
  252. being shown.
  253.  
  254. Video graphics take up a lot of room and are almost always distributed
  255. on a CD-ROM.  To be effective when played from CD-ROM, compression
  256. optimization is needed.
  257.  
  258. Animator Player for Windows from Autodesk is a Windows tool that allows
  259. display of video graphics.
  260.  
  261. Audio Video Interleaved (AVI) from Microsoft and Digital Video
  262. Interleaved (DVI) from Intel also provide video graphics.  The new
  263. Digital Video MCI Command Set provides MCI commands for this type of
  264. graphical data.
  265.  
  266. Combinations
  267.  
  268. In a good multimedia application, the different types of media,
  269. including the different type of graphics, are combined to produce a
  270. high quality presenation to the user.  In fact, it is hard to find an
  271. application that only uses one of the graphic types described in this
  272. technical note.
  273.  
  274. There are many ways that each of these types of graphics can be
  275. combined.  For example, a background video can be used for displaying
  276. moving sprites, or an application might show a TV-like video as part of
  277. its user interface.
  278.                                    
  279.                         Life Cycle of a Graphic
  280.  
  281. This section discusses the different uses of graphics in an application
  282. and defines some common terms used throughout this technical note.  You
  283. should read the Multimedia Authoring Guide book of the MDK
  284. documentation to gain an understanding of a Multimedia Project.  This
  285. book is also available directly from Microsoft Press and other
  286. bookstores.  Microsoft Press can be reached at 800-MSPRESS.
  287.  
  288. Creation
  289.  
  290. Most computer graphics are created by artists. Drawn images are usually
  291. scanned using scanner hardware.  The image is then saved (archived) in
  292. a file.  Video is digitized from tape or directly from a camera using a
  293. capture board, then it is also saved in a file.
  294.  
  295. Some programs create the graphics they use just before they use them.
  296. These programs are usually programs that use simulation graphics, or
  297. commonly called simulation programs.  A common example of these
  298. programs is a flight simulator.  Note that with a simulation program
  299. some of the graphics, for instance the cockpit of a plane, are actually
  300. precalculated pictures which are created for distribution with the
  301. application.
  302.  
  303. How an image is created digitally in the computer greatly effects its
  304. quality.  For example, an image scanned at 8 bits/pixel looks very poor
  305. in quality compared to an image scanned at 24 bits/pixel and then
  306. reduced.
  307.  
  308. Application Conversion
  309.  
  310. Before an image can be used in a specific application, it must be
  311. converted and modified to fit the needs of the application.  For
  312. instance, most applications do not require 24-bit graphic data.  Some
  313. applications might require the image to be converted to 8-bit color
  314. depth.
  315.  
  316. Distribution
  317.  
  318. At some point, the image is hooked into an application.  This might
  319. mean creating hypermedia links using an authoring tool, or encoding the
  320. name of the image file into the source code.  Images can also be
  321. compressed or combined into single, large files to provide easier
  322. access and prevent the user from illegally copying the individual
  323. image.
  324.  
  325. For Multimedia, the media used for distribution is generally a CD-ROM
  326. because of the size of the data.  If floppy disks are used, then
  327. installation on the user's hard drive is usually required.  This is
  328. inconvenient for the user because time must be spent to install the
  329. data, and the user's system must have enough space available.
  330.  
  331. Loading and Storage
  332.  
  333. Once an application determines that it needs a particular image, it
  334. must first load it.  This step can also involve decompression or other
  335. modifications to the image for the display system that the application
  336. is using.  An application might also delay decompression/conversion
  337. until it actually needs to display the image.
  338.  
  339. Display
  340.  
  341. Now the application draws the image.  How the image is stored in memory
  342. (and on disc) can greatly effect the time the system takes to display
  343. the image.  Native formats (for example, DIB for Windows) are much
  344. faster at displaying images than a non-native format because the
  345. application must convert the image before displaying it.
  346.  
  347. There are two measures of time for the user:
  348.                                                          How long it
  349.        takes the system to draw an image
  350.                                                          How long the
  351.        user thinks it actually took to draw an image
  352.  
  353. An application can be slower when measured by a watch, but appear to be
  354. faster and more responsive to the user because of the way the
  355. application reacts to the user.  For example, if your screen displays
  356. text and graphics, you should display the text as quickly as possible
  357. and then work on displaying the graphic.  This will give the user time
  358. to start reading the text, taking attention away from the delay from
  359. the loading and displaying of the graphic.
  360.  
  361. Archival Storage
  362.  
  363. In this stage of an image's life it is just saved for future use.  The
  364. same image can be used several times in different projects.  For
  365. example, it might be used as  a background in one application, and a
  366. picture snapshot in another.  It is important to have a good system to
  367. keep track of available images for use in future projects because it is
  368. cheaper to re-use an image that it is to create a new one.
  369.                                    
  370.                                Pictures
  371.  
  372. The simplest form of graphic is a picture.  Pictures can be thought of
  373. as videos that don't move; they are just single frames of a video.
  374. Images can be divided into the two types: natural images and computer
  375. images.
  376.  
  377. The following is an example of a natural image.  There are many color
  378. changes in the image.  This is fairly complex picture because there are
  379. very few areas where there are not color changes.
  380.  
  381.  
  382.  
  383. Below are examples of computer images.  There are large areas of solid
  384. colors (even though they print dithered). There are also very few color
  385. changes in these image.  These are the low end of computer images (the
  386. image can be more complex than these examples).
  387.  
  388.  
  389.  
  390. How Picture Graphics Work
  391.  
  392. Pictures, like all items in a GUI, are displayed in response to a user
  393. action.  The image is read from media into memory, optionally
  394. decompressed, and then copied to the screen.  The image can be kept in
  395. memory to optimize response time for display.  Special effects can also
  396. be used when copying the image to the screen; see the section entitled
  397. Special Effects, later in this technical note.
  398.  
  399. Pictures are sometimes called raster graphics because they consist of a
  400. sequence of pixels meant to be displayed only on a raster display.
  401.  
  402. Advantages
  403.  
  404. Compared to other graphic types, pictures are much smaller because
  405. there is no animation information to store.  Usually, images are
  406. displayed as part of a UI.  These same images are displayed as the main
  407. graphical item, except in presentations and applications where the
  408. graphical image is the content (a collection of famous paintings, for
  409. example).
  410.  
  411. Single pictures are much smaller in storage and memory size than a
  412. video or other animation of the same display size.  A single
  413. 640x480x256 image takes a little over 300K.  A 15 second, 15fps vide
  414. animation of the same size would take almost 7MB!  This means that you
  415. can provide many more still images on a CD.  Pictures are usually
  416. displayed either as the basis of a user interface or as the result of a
  417. user interface action.
  418.  
  419. Optimizations
  420.  
  421. Pictures are a relatively simple type of graphic.  Most of the
  422. optimization that applies to other graphic types applies to pictures
  423. also.  It is important to know the different types of images, natural
  424. and computer, and how they will affect optimization.
  425.                                    
  426.                             Vector Graphics
  427.  
  428. Vector graphics can be thought of as a specialized compression
  429. technique for pictures.  Instead of storing the actual pixels of the
  430. image, vector graphics allows the storing of instructions about how to
  431. draw the image.
  432.  
  433. For simple images, this format is much smaller in size than any other
  434. compression method.  However, if the image is complex, this method can
  435. actually produce vector images that are much larger.  For this reason,
  436. vector graphics only work well for computer images.  In addition,
  437. Vector graphics are much slower to draw because all the instructions
  438. must be followed before the image can be displayed.
  439.  
  440. The following is an example of a vector graphic, though moderately
  441. complex.  This graphic can easily be scaled with little loss in image
  442. quality.  Note that the background is a solid color and the words are
  443. part of the image.  In a real application, you would want to leave the
  444. words out of the image so that you can make your application available
  445. in different languages.
  446.  
  447.  
  448.  
  449.  
  450.  
  451. How Vector Graphics Work
  452.  
  453. The image format encodes instructions about how to draw the image.  For
  454. example, a white rectangle could have the following instructions:
  455.      
  456.      Set Brush to White
  457.      Draw Filled Rectangle from 120,100 to 150,140
  458.  
  459. The application must read and interpret the instructions to create the
  460. image to be displayed.  For complex images (with many instructions),
  461. this can be a very long process.
  462.  
  463. Windows defines a format for vector graphics called Windows Meta File
  464. Format (WMF).  This file format is defined in the Windows SDK
  465. documentation in the File Formats chapter of the Programmers Reference.
  466. The instructions in a WMF are the GDI instructions, so creation and
  467. playback of the instructions is very easy under Windows.
  468.  
  469. PostScript is another example of a vector graphic format.  Encapsulated
  470. PostScript (EPS) is a file format for storing compressed PostScript
  471. commands.  A number of tools work with this format.
  472.  
  473. Advantages
  474.  
  475. The main advantage of using vector graphics is their size.  A simple
  476. image can be compressed to a very small size.  In addition, vector
  477. images can easily be scaled in size without losing clarity because the
  478. instructions are easily modified for the new size.
  479.  
  480. Optimizations
  481.  
  482. Vector graphics are a relatively simple graphic type.  They become very
  483. inefficient, however, when the image becomes complex.  You should try
  484. to keep the images simple and the speed should remain acceptable.
  485. Vector graphics are only applicable to computer images, but not natural
  486. image because of their complexity.
  487.  
  488. Creation of the images can also be an issue because vector graphics
  489. must be created by a computer artist using such tools as CorelDraw from
  490. Corel or AutoCAD from Autodesk.  This means that a lot of time (and
  491. expense) is needed to create these images; they cannot just be
  492. digitized like a natural image.
  493.                                    
  494.                         User Interface Graphics
  495.  
  496. Every Windows application has a user interface.  The user interface is
  497. the main way the user interacts with the application.  Presenting a
  498. pleasing and easy-to-use interface should be the goal of every
  499. application.  Multimedia allows the enhancement of the standard user
  500. interface in the graphics area.  User interface can be greatly improved
  501. by combining sounds with user interface so, for example, a sound is
  502. made when the user selects an option.  This provides additional
  503. feedback to user about his action.
  504.  
  505. This section discusses how graphics can be used to enhance an
  506. application's user interface.
  507.  
  508. How it Works
  509.  
  510. A picture is displayed that contains defined areas or hot-spots for the
  511. user to choose.  When the user selects these areas, the applications
  512. detects this selection and performs the desired operation.
  513.  
  514.  Buttons and Hot Spots
  515.  
  516. When a user clicks a mouse button in Windows, the button or hot spot
  517. appears depressed and the following happens:
  518.                                                          If the cursor
  519.   is moved off of the button or hot spot, the image is "un-depressed"
  520.                                                          If the user
  521.   releases the mouse button (WM_xBUTTONUP) when the button or hot spot
  522.   is depressed, then the related action takes place
  523.                                                          If the user
  524.   releases the moust button (WM_xBUTTONUP) when the button or hot spot
  525.   is un-depressed, then no action takes place
  526.  
  527. These actions apply even if the user moves the mouse out of the current
  528. window.  Therefore you should use SetCapture when the user clicks the
  529. button.  To determine if the mouse pointer user is over the button or
  530. hot spot, use PtInRect.
  531.  
  532. The following is an image from the sample Viewer application in the
  533. MDK.  It shows a picture of the United States and has some defined
  534. buttons (hot-spots) for certain states.  Note that the buttons are not
  535. only identified by position, but also have the state abbreviation for
  536. easy identification if the state location is not known.
  537.                                    
  538.                                    
  539.  
  540. A button does not need to be rectangular in shape.  For non-rectangular
  541. buttons or hot spot shapes, you should use multiple rectangles to
  542. represent the area of coverage.  For complex shapes, several rectangles
  543. may need to be used to closely represent the shape of the area.  You
  544. will need to trade off accurately representing the shape with the
  545. number of rectangles required.  The fewer rectangles, the faster the
  546. response time to the user selection.
  547.  
  548.  User Interface Creation Issues
  549.  
  550. Buttons should be created from one image.  The program should calculate
  551. the depressed and un-depressed bitmaps as they are needed.  The program
  552. should also draw the 3D borders on the button.
  553.  
  554. When using a background image as the UI, you should keep the background
  555. image separate from the buttons that are placed on it.  This allows
  556. greater flexibility in design.  The non-optimal alternative to this
  557. first medhot is to encode the button images directly onto the
  558. background image.  However, this means that the buttons cannot be
  559. rearranged or modified without re-authoring the background image.
  560.  
  561. A background image can be very large (640x480x256 is 300K).  You should
  562. keep images compressed (DIB RLE works very well for most images).  See
  563. the section Graphics Loading and Storage Issues in this technical note.
  564.  
  565. References
  566.  
  567. A good source of UI information is the Common User Access (CUA) Guide.
  568. This guide is included with the Windows SDK and is also available from
  569. IBM.  It provides UI details on common interface items and provides a
  570. good framework for designing interface items not specifically
  571. described.  The new Windows 3.1 SDK will also include a new Style Guide
  572. that will contain more information than is available in the CUA guide.
  573.  
  574. General Guidelines
  575.  
  576. Consistency is an essential part of good user interface design.  Be
  577. consistent in your layout, design, sizing, etc. You should also strive
  578. for consistency across applications (not just your own application) and
  579. with the rest of the system that the user sees.  You should also make
  580. buttons obvious to the user (unless that's part of the game).  Changing
  581. the cursor is one good way to show to the user a hot spot is located.
  582.  
  583. Because Windows provides device independence.,  you should be sure your
  584. UI code and design can handle the different devices that user might
  585. have.  You should watch the following areas:
  586.   1.                                                    Color type:
  587.      monochrome, color.
  588.   2.                                                    Color depth
  589.      (4bit, 8 bit, 24bit, etc.)
  590.   3.                                                    Screen
  591.      resolution (320x200, 640x480, 800x600, 1024x768, 1280x1024)
  592.   4.                                                    Palette or no
  593.      palette
  594.   5.                                                    Transparent
  595.      blit options
  596.                                    
  597.                              Cast Graphics
  598.  
  599. Cast graphics is a set of images that can be placed onto a display in
  600. specified locations.  The location of the image can vary over time
  601. (thus the image appears to move).  A more complex system will allow the
  602. actual graphic to change over a period of time so that  it is also
  603. animated.  For instance, a ball can spin, a bird can flap its wings,
  604. etc.,  combined with movement of the graphic, creating an excellent
  605. animation.
  606.  
  607. A member of a cast can be thought of as a character.  The word
  608. character is what the graphic usually represents: it is a person or
  609. plane or other graphic object displayed on screen.  Cast members are
  610. also called sprites.  The technique of cast-based animation is also
  611. called sprite animation.
  612.  
  613. Many graphics programs use cast animation for creating animations.
  614. Action! from Macromind and Animation Works from Gold Disk both are good
  615. examples of tools that use cast-based graphics.
  616.  
  617. How it Works
  618.  
  619. Cast animation depends on an application's ability to combine sprites
  620. onto a single image (called compositing).  This composit image is also
  621. dependent on using transparent blit operations.  Usually the final
  622. image (the frame) is first created as an off-screen bitmap and then
  623. copied to the display. However, the composite image can also be created
  624. directly on screen.
  625.  
  626. Sprites are drawn in a particular order called Z-order.  The "Z" refers
  627. to the third dimension (along with X and Y) and defines the position of
  628. the sprite front-to-back.  For example, a tree in an image is in front
  629. of the clouds, and an image of a flying bird is to be drawn between the
  630. clouds and the tree.  The clouds would be drawn, then the bird, then
  631. the tree.  The resulting image is then displayed on the screen and the
  632. process starts for the next frame.
  633.  
  634. Sprites can consist of a sequence of images that define motion for the
  635. sprite.  For example, consider an image of a dog walking, or a bird
  636. flying.  On each successive frame, the next image is used for the
  637. sprite so that the sprite appears to be in motion.  When the last image
  638. is reached, the first image is re-used resulting is a looping
  639. animation.
  640.  
  641. The images usually have a transparent area to allow compositing onto a
  642. larger image.  The transparent area can be defined by a particular
  643. color in the image, or by a monochrome mask.  The mask uses up extra
  644. memory, but can be useful.  'Losing' a color for a transparency
  645. indicator is usually not a problem with graphics with a color depth of
  646. 256 colors.
  647.  
  648. Some video modes on some cards support a technique called page-
  649. flipping.  This involves drawing to one video area while the other is
  650. being displayed and then, with a simple command to the video card,
  651. switch to the new video area so that it is displayed.  This technique
  652. allows much cleaner animations because the final image is not drawn to
  653. the video area that is currently being displayed and therefore avoids
  654. blit tear (see glossary).  Windows does not support page-flipping
  655. because most of the video cards and modes it supports do not allow this
  656. technique.
  657.  
  658. The following is a sequence of six frames that show a animation of a
  659. dog walking.  Note that this is a perfect case for a looping animation
  660. as walking is a cyclical action.  However. note that the dog in these
  661. pictures moves in the image: for a real sprite, the image would stay in
  662. the same place in the images so that motion can be simulated by
  663. changing the placement of the graphic itself.  This sequence of images
  664. is from the RLEAPP.ZIP sample code.  See the Overview section for
  665. information about obtaining this sample code.
  666.  
  667. The images are set up to use a color transparency; the background is a
  668. solid color (even though it is dithered when it prints) so that it can
  669. easily be transparent when the image is displayed.  This will allow
  670. this image to be placed on top of another image with the image below
  671. showing through.  For example, the background would show through the
  672. dogs legs instead of the image of the dog being a complete rectangle
  673. (as shown below) with a dog in it surrounded by the background image.
  674.  
  675.  
  676.  
  677.  
  678.  
  679. Advantages
  680.  
  681. The main advantage of cast-based animation is the ability to be
  682. interactive.  How and when a sprite moves can be in direct response to
  683. a user action (a mouse click, etc.).  The Living Books series from
  684. Brderbund is an excellent example of using uses this technique in an
  685. application.  Contrast this flexibility to what is needed with a frame-
  686. based animation, discussed in the video chapter later in this technical
  687. note.
  688.  
  689. This technique allows moderetly complex animations with limited disc
  690. space.  A long animation can be created just by moving a sprite back
  691. and forth across the screen allowing greater realism without major CPU
  692. usage.  Video animations can give more complex images, but are not as
  693. suitable for interactivity.
  694.  
  695. Types of Sprites
  696.  
  697. The main requirement for performing cast based animations is that the
  698. image be transparent so that it can be composited on the frame.
  699. Usually, bitmaps are used for the images, although fonts can also be
  700. used.
  701.  
  702. In Windows, fonts have a defined transparent region because they are
  703. monochrome images.  Only the part of the image that is black is drawn
  704. and the part that is white is considered to be transparent.  This
  705. results in very fast display, but fonts are limited to one color (it
  706. doesn't have to appear as black).  The image of the sprite can be
  707. changed by chosing which character to use from the specified font.
  708. Font data must be included with the application for the animation to
  709. work correctly.  This is very a very complicated method that is only
  710. uesful when memory is a major consideration.
  711.  
  712. Flat Worlds
  713.  
  714. For a flat world, the view is usually top-down, or a bird's eye view.
  715. Examples of this type of application include most arcade games,
  716. strategy games, and presentation-oriented applications.
  717.  
  718. Most arcade games are sprite based, with the game elements (from
  719. bullets to the enemy) being sprites.  However, arcade games also have
  720. dedicated hardware that allows sprites to be composited quickly
  721. directly on the display.  In a flat world, sprites move in a plane that
  722. is parallel to the screen; that is, left, right, up and down.  The
  723. sprites don't move in the Z plane.
  724.  
  725. Moving the background image allows for the simulation of movement in a
  726. larger area than the screen allows.  In addition, some games have
  727. multiple background images to further enhance the illusion of movement.
  728. For example, a background image of hills, then a foreground image of
  729. trees, both scrolling by (but at different speeds), gives a much better
  730. illusion of motion.  Many cartoons on TV use this technique in its
  731. analog form.
  732.  
  733. How the image moves varies between different applications.  In some
  734. games, the background image only moves horizontally across the screen.
  735. The player's sprite usually moves from left to right (actually, the
  736. background image moves from right to left) and encounters other
  737. creatures and objects as they travel.  In some games, the background
  738. travels vertically across the display.  The player's sprite is usually
  739. at the bottom of the display and the enemy usually comes into range at
  740. the top of the display.
  741.  
  742. In more complex applications, the player's sprite is allowed free
  743. movement while the background moves to allow the player's sprite to
  744. recenter itself in the display.  In very complex applications, the
  745. background image can actually be a video (a sequence of precalculated-
  746. calculated images) with the interactive sprites drawn on top of a very
  747. complicated background.
  748.  
  749. 3D Worlds
  750.  
  751. 3D worlds differ from flat worlds mostly in the perspective in which
  752. the images are displayed.  The images are displayed with a "near and a
  753. "far" perspective with "near" being at the bottom and "far" being
  754. towards the horizon which is usually about in the middle or top 1/3 of
  755. the display.
  756.  
  757. In 3D worlds, sprites can move in a plane that is not parallel to the
  758. screen.  The character can also move up and down in the plane.  These
  759. sprites can move closer or get farther from the user and generally
  760. change size as they move.
  761.  
  762. This type of application takes advantage of multiple image planes.  For
  763. example, trees in the foreground might be in front of (in Z-order) the
  764. player's character.  In addition, motion or position information is
  765. often used to determine where the player's sprite is allowed to move.
  766. Sierra Online's games are a very good example of this type of
  767. application.
  768.  
  769. Optimizations
  770.  
  771. Creation of the image is the most time-consuming operation.  There are
  772. two areas that take time: loading the sprite image in memory, and the
  773. actual blit itself.
  774.  
  775. You should keep all the sprite images in memory, if possible.  It is
  776. more efficient to use a single bitmap with different versions of the
  777. sprite than it is to use a separate bitmap for each.  The different
  778. versions should be arranged on a grid in the single bitmap so that it
  779. is easy to change and modify images when necessary.
  780.  
  781. For blitting, you should use transparent operations.  If necessary, use
  782. a DIB bitmap and write your own optimized drawing routines to draw onto
  783. the bitmap.  Examples of drawing directly into DIBs with custom
  784. routines is demonstrated in the TRIQ.ZIP sample code.  See the Overview
  785. section, earlier in this technical note, for information about
  786. obtaining this sample code.
  787.  
  788. In addition, compression can also help reduce some operations (loading,
  789. storage, blitting, etc.).  See the Graphics Loading and Storage Issues
  790. section, later in this technical note,  for a discussion on
  791. compression.
  792.  
  793. Dirty area optimizaions are much easier for cast-based animations than
  794. they are with any other form of animation.  Because every movement is
  795. known to the application it is easy for the application to only redraw
  796. the areas that contained movement.  Remember that the old location of
  797. the sprite as well as the new area must be updated on the screen.
  798.                                    
  799.                              Tile Graphics
  800.  
  801. This type of application allows for a very complex display using very
  802. few graphics.  SimCity from Maxis is a good example of tile graphics.
  803. Civilization from MicroProse also uses this technique.  Many role-
  804. playing games also use this technique to represent cities, terrain,
  805. etc.
  806.  
  807. This type of graphic allows for easy representation of a series of
  808. virtual "places" or "tiles".  For example, in SimCity, each tile on the
  809. screen represents a city block.  Each tile can change based on the
  810. changes that take place in that virtual place.  For example, when road
  811. is built in a tile in Civilization, the image of the tile changes to
  812. include an image of a road.
  813.  
  814. Another powerful use of tiles is derived from board games where armies
  815. and other items are represented by squares of cardboard printed with
  816. images (called tiles, which is where the name comes from).  This allows
  817. the representation of a movable object that is currently "in" the
  818. virtual place represented by the tile.  For example, in Civilization, a
  819. chariot is represented by a picture of a chariot that is "in" (covering
  820. in Z-order) the terrain image for the tile.  When the chariot is moved,
  821. the original tile is redrawn and the new tile is drawn with the chariot
  822. on top.
  823.  
  824. Tiles are generally represented as squares, but are sometimes organized
  825. in a hex (six-sided) shape.  This shape allows uniform placement on the
  826. display and adds better distance representation (but it is more complex
  827. to display).  Hexes are usually only used for strategy games.
  828.  
  829. Another implementation uses diamond shaped tiles with 3D perspective.
  830. This technique is used in A-Train from Maxis.
  831.  
  832. Images can also be animated using the same technique as sprites:
  833. multiple images.  SimCity uses this technique to make factories belch
  834. smoke, cars move, etc.
  835.  
  836. How Tile Graphics Work
  837.  
  838. Usually the application works on a grid with each entry (row, column)
  839. represented by a tile.  Each tile has specific attributes that effect
  840. how it is to be displayed.  For instance, the terrain of a tile could
  841. consist of water, plains, mountains, etc.  In addition, the tile can
  842. have roads, railroads, cities, factories, and houses.
  843.  
  844. Each attribute has an associated image so that it can be represented to
  845. the user.  For example, in Civilization when a city is built on a tile,
  846. an image of a city is drawn.  The images are drawn in a specific order
  847. (Z-order).  For example, base terrain (hills, plain, etc.), then roads,
  848. then units that are "in" the tile.
  849.  
  850. One major trick you can use for optimization is combining attribute
  851. images into one big bitmap.  This prevents many small bitmaps from
  852. being created, which wastes memory.  Instead, the images are arranged
  853. on a grid (since they are all of similar size) and can be easily
  854. retrieved from the source bitmap image.
  855.  
  856. Another trick that is used often is replaceable images.  SimCity uses
  857. this technique to change the representation of the tiles from modern
  858. times to medieval to futuristic times .  It is the same code for each
  859. display, just the images used have changed.
  860.  
  861. Tile images can be thought of as limited-motion (but still animated)
  862. sprites.
  863.  
  864. While transparent capabilities are important for sprites so that they
  865. can have non-rectangular shapes, transparent images are also very
  866. important for tiles so that they can be stacked.
  867.  
  868. Advantages
  869.  
  870. The main advantage of tile-based animations is that they can easily
  871. represent a virtual world to the user.  For example, blocks in SimCity
  872. appear as blocks on the screen, and the cities in Civilization are
  873. dependent on the squares around them for food and trade.
  874.  
  875. Flat Worlds
  876.  
  877. This is a top-down display of the tiles.  Z-order between tiles is not
  878. a factor because they are all on the same "plane".  However, Z-order
  879. within a tile is still important.
  880.  
  881. Often the individual images are drawn in fake-3D to give the illusion
  882. of perspective.  SimCity uses this technique in its images.
  883.  
  884. Dirty area optimizations are very useful for this type of graphic.
  885.  
  886. The following is an example of a normal grid for a tile-based graphic.
  887. Images would be drawn into each square and then the entire image
  888. displayed on the screen.
  889.  
  890.  
  891.  
  892. 3D Worlds
  893.  
  894. This is a view where the tiles themselves have a Z-order (usually front
  895. to back).  Distant tiles are at the top, and the near tiles are at the
  896. bottom to maintain the illusion of perspective.  Note that the images
  897. now have an actual appearance of height and can obscure tiles that are
  898. farther away (above).
  899.  
  900. Because this technique allows large images to be "in" a tile, the
  901. compositing time can be very long.  Note how long it takes Civilization
  902. to draw the city view.  However, the resulting images can be very good.
  903.  
  904. The following is an example of one way to arrange the squares to
  905. provide a perspective image.  The vanishing point is to the upper
  906. right.
  907.  
  908.  
  909.  
  910. For example, the city view in Civilization displays the "attributes"
  911. (the population, buildings, etc.) of the city on a tile basis that is
  912. drawn back-to-front.  This technique allows the images in the near
  913. tiles to cover the images in far tiles because they are drawn later.
  914. For example, in Civilization in the city view, the city walls are drawn
  915. almost last, allowing them to cover the previous tile row of buildings
  916. in the city.
  917.  
  918. Optimizations
  919.  
  920. Since tiles are just a subset of sprites, all the optimizations
  921. discussed in that section also apply.
  922.  
  923. If perspective is used, the height of the tile must be taken into
  924. account when it needs to be modifed.  In addition, the height of the
  925. neighboring tiles will need to be checked to make sure that they don't
  926. need to be redrawn to recreate the updated image.
  927.                                    
  928.                                  Video
  929.  
  930. Video is defined in this technical note as the continuous playback of a
  931. precalculated animation.  This is usually referred to as frame-based
  932. animation.  This method is usually contrasted with cast-based
  933. animation.
  934.  
  935. Within video animations, there are two major types of graphics:
  936. natural images and computer images.  Natural images are normally
  937. considered "video"; images of real events stored in digital form.
  938. Computer graphics are defined as simple, cartoon-like images, but can
  939. also be used as video.
  940.  
  941. The main difference between these two types of graphics is the
  942. complexity of the image.  Natural images are very complex in both
  943. number of colors and changes in colors.  On the other hand, computer
  944. graphics usually use few colors and don't change color very often.
  945. Some computer-generated images are classified as natural images because
  946. of their use of color.  For example, most images generated by 3D Studio
  947. from Autodesk are natural images even though they are generated solely
  948. by computer.
  949.  
  950. Video is usually used in conjunction with audio, either for a sound
  951. track or for the actual audio for the recorded images.  For example, in
  952. SimCity a video animation of a newscaster could tell the user how the
  953. mayor is doing .
  954.  
  955. Videos differ from other graphics types, such as animated sprites,
  956. because they are so large that they cannot be loaded (and therefore
  957. played) from memory.  They must be streamed from a hard disk or CD-ROM
  958. disc.  Data that is streamed is read at a given rate, usually as fast
  959. as the media transfer rate will allow.  In addition, sprite animations
  960. are usually a small number of frames that are repeated to provided
  961. continuous movement.  Of course, that is why they are small in size.
  962.  
  963. The following factors effect the quality of a Video animation:
  964.                                                         Pixel depth
  965.                                                         Compression
  966.      method
  967.                                                         Image (frame)
  968.      size on screen
  969.                                                         Image (frame)
  970.      size on disc
  971.                                                         Frame rate
  972.      (frequency)
  973.  
  974. The following is an example of a sequence of natural images showing the
  975. movement of an elephant.  Note that these could also be used as a
  976. sprite because the images are small and they loop easily.
  977.  
  978.  
  979.  
  980.  
  981.  
  982. How Video Graphics Work
  983.  
  984. Video animation is accomplished by displaying a sequence of images on
  985. the screen.  Each image is called a frame, and the number of frames per
  986. second (Hertz or Hz) is called the frame rate.  A frame rate of 15Hz is
  987. considered minimum to show motion.  8 bit color depth is considered
  988. minimum to show natural images.  Image size on the screen should be
  989. large enough for the user to understand the video (but this needs to be
  990. balanced with the transfer rate of the media and the frame rate and
  991. image size desired).
  992.  
  993. An 8-bit image at 160x120 pixels (somewhat of a standard because it is
  994. exactly 1/4 of 640x480) is about 20K per image.  At 15 frames/second,
  995. this is about 300K for just the images not including audio.  Because
  996. video is, by definition, predetermined data, it is well suited for
  997. playing from a CD-ROM directly.  The main limitation for playback is
  998. the 150K/second transfer rate of the CD-ROM (if it meets MPC
  999. standards).  The main advantage is the cost of a CD-ROM disc compared
  1000. to the equivalent number of floppy disks.
  1001.  
  1002. The MPC specification specifically limits the time the CD-ROM can take
  1003. to transfer the 150K/second data to 40% of the CPU bandwidth.  The rest
  1004. of the bandwidth is then available for the application to display the
  1005. images and play the waveform data.  Most CD-ROMs that are not MPC
  1006. compatible don't meet the 40% requirement.  In fact, most take 100% of
  1007. the CPU, leaving no time to actually do anything with the data!
  1008.  
  1009. The process is really very simple in theory; just take a sequence of
  1010. images and blit them to the screen at the appropriate time.  In
  1011. practice, however, many optimizations are needed to make videos
  1012. actually work.
  1013.  
  1014. Microsoft's Audio Video Interleaved (AVI) system provides tools and
  1015. playback for software-only videos.  This system will be in Beta by
  1016. early Q2, 1992.
  1017.  
  1018. Providing the user with limited interaction with a video can create
  1019. very good effects.  For example, the application Guest from Trilobyte
  1020. takes the user through a haunted house.  The user interacts with the
  1021. picture and the result is a video showing movement within the house
  1022. with images generated by 3D Studio from Autodesk.  The user clicks on
  1023. an area in the image (such as a door, staircase, etc.) and a video is
  1024. shown that visually presents to the user the results of the action.
  1025. This is a good example of combining multiple types of graphics (video,
  1026. pictures and UI) into a multimedia application.
  1027.  
  1028. Advantages
  1029.  
  1030. The main advantage of video animations is that they can be much more
  1031. complex because the images are calculated when the file is created.
  1032. For example, you can use 3D Studio from Autodesk to create a very
  1033. complex 3D animation that takes hours to calculate, but it can be
  1034. played back very quickly.  Contrast this capability to what is possible
  1035. using simulations or cast-based animations.
  1036.  
  1037. However, video does use up a lot of disc space.  Delta-frame
  1038. compression can help you reduce this, but the total space can still be
  1039. large.  At 150K/second of data, a 30-second video is over 4MB of data.
  1040. This means that CD-ROM is vital for the economical distribution of
  1041. digital video data.
  1042.  
  1043. Video playback from CD-ROM is limited by the following:
  1044.   1.                                                    150K/second
  1045.      from CD
  1046.   2.                                                    Time for
  1047.      decompression algorithm
  1048.   3.                                                    Blit speed of
  1049.      video
  1050.   4.                                                    Time for
  1051.      interface operation (mouse movement, etc.)
  1052.   5.                                                    Time for other
  1053.      operations (waveform, MIDI, etc.)
  1054.  
  1055. Optimizations
  1056.  
  1057. Optimizations for video can be broken into two areas: compression and
  1058. interleaving.
  1059.  
  1060.  Compression
  1061.  
  1062. Because of the size of the data, and the limitations of transfer rates,
  1063. the images must be compressed to get an acceptable video.  Since the
  1064. video data is precalculated, a lot of time can be spent choosing the
  1065. optimal compression algorithm for the specific image data being used.
  1066.  
  1067.  Interleaving Data
  1068.  
  1069. Becauise both the image and video data must be played together, it
  1070. makes sense to place them both in the same file.  This process is
  1071. called interleaving.  Interleaving's main advantage is that is avoids
  1072. the slow seek times present in many CD-ROM drives (the MPC
  1073. specification only requires an average of 1 second).  The data is
  1074. placed in a file in blocks (RIFF chunks work very well) so that the
  1075. data is read just before it is needed.
  1076.                                    
  1077.                           Simulation Graphics
  1078.  
  1079. Simulation graphic images are calculated just before they are drawn.
  1080. This is the most CPU-intensive form of graphics.  Examples of
  1081. applications that primarily use simulation graphics are Microsoft
  1082. Flight Simulator and WingCommander from Origin.
  1083.  
  1084. A simulation graphics program is representing (or simulating) a
  1085. situation to the user.  In a flight simulator, the program must draw
  1086. all the objects that the user would see from the cockpit.  To provide a
  1087. realistic display (usually the goal of the simulation applications),
  1088. the display must be updated at least 7 frames per second.  This means
  1089. that every operation must be carefully optimized.
  1090.  
  1091. How Simulations Graphics Work
  1092.  
  1093. This section explains only the general effects of simulations.  There
  1094. are many good books available on calculating images based on
  1095. simulations, but they are all very technical in scope.
  1096.  
  1097. In general, application realism, complexity are driven by:
  1098.   1.                                                    Object
  1099.      complexity
  1100.   2.                                                    Light source
  1101.   3.                                                    Object
  1102.      representation
  1103.  
  1104. Object complexity directly affects the appearance of objects in the
  1105. simulated world.  Implementing a light source and shading the objects
  1106. accordingly, also increases the complexity of the calculations
  1107. necessary to draw the frame.  Objects can be represented by anything
  1108. from a simple wire frame (a series of lines), to filled polygons, to an
  1109. actual perspective representation.
  1110.  
  1111. Old flight simulators used wire frame images.  The current version of
  1112. Microsoft Flight Simulator uses filled polygons.  WingCommander from
  1113. Origin uses precalculated, computer generated images to represent the
  1114. objects in the world.
  1115.  
  1116. Because it is very difficult for the program to remember the different
  1117. positions of objects between frames, simulation graphics cannot take
  1118. advantage of the dirty area optimization.  This means that the
  1119. application must redraw the complete frame each time.
  1120.  
  1121. Because of the dependence on blit speed, most simulations don't yet run
  1122. under Windows.  This is because the screen pixel resolution affects
  1123. blit speed.  A 640x480x256 display has more than four times the number
  1124. of pixels as a 320x200x256 display.  This means that, everything else
  1125. being equal, a full-screen blit should take four times longer to draw
  1126. on the higher resolution display.  Most current simulators don't want
  1127. to give up that extra time and prefer to provide better quality
  1128. simulations.
  1129.  
  1130. Advantages
  1131.  
  1132. The main advantage of simulations is that they can provide the most
  1133. 'realism' to the user; an airplane moves like an airplane, the car
  1134. drives like a car, etc.
  1135.  
  1136. Because of the competition among simulation applications, ISVs
  1137. generally push the capabilities of personal computers to their limit.
  1138. The result is that they are not concerned with device independence and
  1139. other enhancements provided by Windows; they are generally happy in the
  1140. MS-DOS world.  This will change as the hardware capabilities of
  1141. machines running Windows improves and as the memory requirements and
  1142. complexity of applications increases, making the protected mode
  1143. environment provided by Windows attractive.
  1144.  
  1145. Optimizations
  1146.  
  1147. If the video blit speed is slow and the delta-frame algorithm is fast,
  1148. it might be faster to generate a delta-frame instead of generating the
  1149. whole frame.  However, this will break down when the time to calculate
  1150. and draw the delta-frame is greater than the time to draw the entire
  1151. screen.
  1152.  
  1153. Since simulations depend on blit speed, you should use DIB bitmaps at
  1154. DIB_PAL_COLORS.  You should take advantage of the memory Windows gives
  1155. you (it's protect mode!).  Since MPCs are 386 minimum, you can write 32-
  1156. bit code, which is much faster than regular 16-bit code.  Examples of
  1157. drawing directly into DIBs with custom routines and using 32-bit code
  1158. are demonstrated in the TRIQ.ZIP sample code.  See the Overview section
  1159. for information about obtaining this sample code.
  1160.                                    
  1161.                             Special Effects
  1162.  
  1163. Special effects can be used when displaying or moving images to provide
  1164. variety to the user.  You can use a couple of techniques to create
  1165. special effects with graphics.
  1166.  
  1167. Palette Effects
  1168.  
  1169. Palette effects provide a fast and effecient way to modify the image on
  1170. the display with out having to redraw the image.
  1171.  
  1172.  Palette Fade
  1173.  
  1174. This technique is the ubiquitous "fade to black" and can be used for
  1175. transitions between images.  This is a very effective and simple
  1176. special effect that can add a lot to a presentation.
  1177.  
  1178.  Cross Fade
  1179.  
  1180. A palette transition is used to change the displayed image.  This is
  1181. accomplished by merging two images into one image that has a specially
  1182. constructed palette.  This technique is demonstrated in the
  1183. MERGEDIB.ZIP sample code.  See the Overview section, earlier in this
  1184. technical note,  for information on how to obtain this sample code.
  1185.  
  1186. Blit Effects
  1187.  
  1188. Instead of displaying the entire image at once, you can display it over
  1189. time.  For example, you can create a "wipe" effect by copying just a
  1190. portion of the image at a time moving from left to right.  The image
  1191. will appear to come onto the screen a little at a time.
  1192.  
  1193. Good authoring tools provide many effects that you can use.  You should
  1194. experiment with different types of effects.  Some can be quite
  1195. interesting if they don't take a lot of time to perform.
  1196.  
  1197. ROP Effects
  1198.  
  1199. Raster operations (ROPs), combined with changing brushes, can be used
  1200. to create a special class of blit effects.  By using an increasingly
  1201. white brush, you can make an image appear to "fade" in as more and more
  1202. pixels of the image appear on the display.
  1203.                                    
  1204.               Graphics Creation, Archival and Conversion
  1205.  
  1206. Creation is the first step in the life cycle of a graphic.  How a
  1207. graphic is created and the source used greatly effects its quality.
  1208. Before creating an image, you should know how it is going to be used
  1209. and the factors of its use.  For example, should the image be scanned
  1210. at 24 bit or 8 bit?  Should the image be dithered by the artist or left
  1211. as is?  Will the image be required to be displayed as-is on 16 color
  1212. display?  The answers to these questions will greatly effect how the
  1213. image will need to be converted for distribution.
  1214.  
  1215. After the image is created, it is stored until it is needed.  For
  1216. example, most photographs today come from archival companies and are
  1217. called "stock photos".  You should plan on creating a similar system
  1218. for the digital images you will be collecting for your multimedia
  1219. projects.
  1220.  
  1221. For a particular project, the archived image must then be converted and
  1222. modified to fit the needs of the planned application.
  1223.  
  1224. To famliarize yourself with the multimedia project process, you should
  1225. read the Multimedia Authoring Guide book provided in the Multimedia
  1226. Development Kit (MDK) and also available from Microsoft Press in the
  1227. Multimedia Authoring and Tools Guide.
  1228.  
  1229. Creation
  1230.  
  1231. Images can be created in the following ways:
  1232.   
  1233.                                                         Computer
  1234.      Generated: the computer generates the image directly using a
  1235.      program such as 3D Studio from Autodesk .
  1236.                                                         Computer
  1237.      Artist Drawn: an artist draws the image using a computer drawing
  1238.      program.
  1239.                                                         Scanned: a
  1240.      technician scans (digitizes) the image using a computer program
  1241.      and special hardware.  The source can be a photograph, a slide, or
  1242.      even a still-frame taken with a video camera.
  1243.                                                         Video Capture:
  1244.      a technician captures (digitizes) an analog video signal using a
  1245.      computer program and special hardware.  This differs from scanning
  1246.      in that it is a sequence of related images.
  1247.  
  1248. After the image is created, a certain amount of editing must be done.
  1249. At a minimum, a coordinator must sign-off on the image's quality and
  1250. content.  The image might also need to be enhanced or otherwise
  1251. modified once it is digitized.  This will require a computer artist
  1252. working with a paint program.
  1253.  
  1254. Archival
  1255.  
  1256. The multimedia producer should plan on using the image in future
  1257. projects.  Archiving the image for future use is a good way to amortize
  1258. the cost of creating the image over multiple projects.  This means that
  1259. the image should be stored in the highest quality format available for
  1260. future use.  For images, this generally means 24 bit (for waveforms, it
  1261. means 44.1KHz and 16 bits).  The image should be free of any edits,
  1262. except for minor touch ups.  For example, dithering should not be done
  1263. at the archival image stage.
  1264.  
  1265. A good archival database tool is critical when a large number of images
  1266. are must archived.  After scannning thousands or even just hundreds of
  1267. images, it is very hard to find a particular, especially when you have
  1268. several images of similar content (even filenames can't be relied on
  1269. for clues).  A good database tool will allow you to keep keywords as
  1270. well as dates and other information about each image.  In addition, the
  1271. RIFF file format allows you to store information directly in the file.
  1272. Look for tools that allow you to use the RIFF INFO fields.
  1273.  
  1274. Conversion
  1275.  
  1276. Once an image is chosen for use in a specific project, conversion and
  1277. other editing may need to be performed.  You will need to know what
  1278. color depths and screen sizes must be supported.  To support both 256
  1279. colors and 16 colors, you might need to supply two copies of the image
  1280. for distribution, allowing the application to choose the image based on
  1281. the current environment.  For example, Viewer provides automatic image
  1282. selection based on color depth.
  1283.  
  1284. Images generated for use in Windows should have 236 colors.  This is
  1285. because Windows itself uses 20 colors for the user interface and
  1286. (usually) only 236 are available for an application to use.  An
  1287. optimization for blit speed insures that a palette of 256 colors has
  1288. the 20 system colors where and when Windows requires them.  This type
  1289. of palette is called the identity palette because the palette from the
  1290. application matches exactly the Windows palette and no translation is
  1291. required.
  1292.  
  1293. If multiple images must be displayed at the same time, remember that
  1294. the total number colors is limited to 236 (on a 256 color device).
  1295. This means that images should share a common palette so that the image
  1296. creator can control how they will look together on a screen.  The image-
  1297. editing tools in the MDK can be used for this process.
  1298.  
  1299. Other conversions must be determined by the optimizations needed by the
  1300. application.  For example, a video sequence must be compressed into an
  1301. acceptable format before it is distributed.  The AVI Beta will provide
  1302. tools to perform this conversion.
  1303.                                    
  1304.                      Graphics Loading and Storage
  1305.  
  1306. Once the image is distributed on CD-ROM, the application must read the
  1307. image from the disc and then store it into memory before it can display
  1308. it.  Compression is very important as it improves both load time and
  1309. storage space.
  1310.  
  1311. Load Time
  1312.  
  1313. Graphics data can be quite large.  And, while a CD-ROM can hold many
  1314. images, the transfer rate is just 150K/second, and a full screen image
  1315. at 640x480x256 is about 300K.  This image takes at least 2 seconds to
  1316. just read from disc, and this does not include overhead of actually
  1317. opening the file.
  1318.  
  1319. You can try moving often-used images to the user's hard drive, but you
  1320. should limit this to a bare minimum of space.  Try to keep your
  1321. application from using more than 2MB total, including the application
  1322. itself.
  1323.  
  1324. To help improve the file read times, try to keep the file compressed on
  1325. disc so that the I/O time is minimized.  For computer images, the RLE
  1326. compression of DIBs is very nice.  However, this compression does not
  1327. work well with natural images.
  1328.  
  1329. The Joint Picture Experts Group (JPEG) has developed a compression
  1330. format that is optimized for natural images.  However, it is new and is
  1331. not yet supported by Windows directly (and image editing tools are just
  1332. starting to support it).
  1333.  
  1334. For video images, the Motion Picture Experts Group (MPEG) has a
  1335. compression format defined for video and audio.  However, this format
  1336. is even newer than the JPEG format.  In addition, it is a very
  1337. complicated format; acceptable performance requires hardware
  1338. assistance.
  1339.  
  1340. You can also make tradeoffs between image quality and size and
  1341. decompression time.  JPEG and MPEG already provide for this capability
  1342. in the definitions of their algorithms.  However, other algorithms can
  1343. also be used to obtain lossy compression.  For example, you could use
  1344. RLE compression to obtain a lossy delta frame compression of a video
  1345. image.  AVI uses this technique in order to provide a tradeoff between
  1346. image quality and size given a fixed 150K/second transfer rate.
  1347.  
  1348. The disadvantage of using compression is that it takes time to
  1349. decompress the image before it can be displayed.  Make sure that the
  1350. file read time you saved doesn't get lost in a slow decompress time.
  1351.  
  1352. If you have several smaller images, it is better to combine them into
  1353. one larger bitmap to improve both file read time and memory usage.
  1354. Just opening a file on a CD-ROM can take 2 seconds if the directory
  1355. entries are not cached by MSCDEX.  Having one file to read can greatly
  1356. reduce the time spent just reading files.  Be sure you can reference
  1357. just a part of the image with the authoring tool you are using for your
  1358. application.
  1359.  
  1360. Memory Usage
  1361.  
  1362. Images are kept in memory only as long as they are needed, or they are
  1363. expected to be needed.  This provides the application with the quickest
  1364. response time to user actions.  Most graphics will spend very little
  1365. time in memory, while others spend most of their time there.  For
  1366. example, the bitmaps for the Windows maximize button is almost always
  1367. in memory because it is used so often.
  1368.  
  1369. Effecient use of memory caching of images can greatly improve the
  1370. performance of a UI graphic because the images will already be in
  1371. memory when they are needed.
  1372.  
  1373. If the file is on the disc in a compressed form, it might make sense to
  1374. keep it compressed in memory until it is actually drawn.  RLE
  1375. compression is perfect for this as the driver does the expansion
  1376. (decompression) of the image as needed.  For larger images, this can
  1377. significantly reduce the memory requirements at the expense of having
  1378. to decompress the image every time it must be displayed.
  1379.  
  1380. However, most compression formats don't easily allow copying just a
  1381. portion of the image without decompressing the entire image first.
  1382. This means that if you are using the image for a background while using
  1383. the dirty-area optimization, you will want to keep the image
  1384. decompressed in memory.
  1385.  
  1386. General Compression Issues
  1387.  
  1388. To obtain optimal compression and image quality, it is important to
  1389. understand the images you will be using and the different capabilities
  1390. and limitations of the compression algorithms available.
  1391.  
  1392.  Types of Compression
  1393.  
  1394. Compression algorithms take the following forms:
  1395.                                                         Intraframe
  1396.                                                         Interframe
  1397.                                                         Lossy
  1398.                                                         Lossless
  1399.   
  1400.   Intraframe
  1401.  
  1402. Intraframe is the compression of the data for a single frame.  This
  1403. doesn't differ from compression used on a single image in a video or a
  1404. single picture.
  1405.   
  1406.   Interframe
  1407.  
  1408. Interframe compresses the video by only encoding the differences or
  1409. delta between frames.  This is commonly called delta-frame compression.
  1410. This type of compression takes advantage of the fact that not much of
  1411. the image changes between frames of a video.
  1412.   
  1413.   Lossy and Lossless
  1414.  
  1415. Lossy and lossless are two terms that describe the quality of a
  1416. compression.  Lossless means that no data is lost; the decompressed
  1417. image is exactly the same as the original.
  1418.  
  1419. Lossy means that the decompressed image is not the same, but looks as
  1420. close as possible to the original.  Lossy compression affords the best
  1421. compression rates, but depends on good quality algorithms to determine
  1422. what information can be lost and still provide good video quality.
  1423.  
  1424. A good compression algorithm will give the technician control over the
  1425. tradeoffs between image quality and image size.  Lossless compression
  1426. has no reduction in image quality whereas a lossy compression has at
  1427. least some loss (but it may appear to be the same to the human eye).
  1428. Be sure to test the results of new compression methods with a number of
  1429. users to get a good idea of the quality of the final images.  Also,
  1430. make sure to use different types of images when testing the algorithm
  1431. to get a good idea of the capabilities and problems with the algorithm.
  1432.  
  1433. The RLEAPP sample code (see the Overview section, earlier in this
  1434. technical note,  for locations of the sample code) shows video using
  1435. the compression method that is directly supported by Windows (RLE).
  1436.   
  1437.   Natural Images and Computer Images
  1438.  
  1439. If your image is simple in its use of color changes, then RLE
  1440. compression is the best choice.  On the other hand, if you have a
  1441. natural image, then you will have to search for an appropriate
  1442. algorithm to use in your application.  JPEG or GIF are the most common
  1443. choices.
  1444.   
  1445.   Dithering
  1446.  
  1447. This is a pixel-depth conversion process usually used when few colors
  1448. are available.  The images printed in this document are dithered to two
  1449. colors (black and white) when they are printed.  The process trades
  1450. pixel resolution to gain (perceived) color depth.  Squares (for
  1451. example, 2x2, 4x4, etc.) of pixels are created to represent to the eye
  1452. more colors than are actually available.  Print media uses a similar
  1453. technique to obtain a range of shades from just 3 or 4 actual colors.
  1454. You should know that this algorithm has the inherent side effect (or
  1455. artifact) of changing a computer image into a natural image.
  1456.  
  1457.  Available Compression Algorithms
  1458.  
  1459. Since CD-ROM is a read-only distribution media, the optimimal
  1460. compression place emphasis on the image decompression speed and
  1461. tradeoff the complexity for compression.  The complexity (which is
  1462. usually directly related to amount) of compression must be controlled
  1463. for the target environment.  For example, AVI uses simple compression
  1464. because playback is intended for every MPC.  On the other hand, DVI
  1465. requires special hardware for decompression.  It can obtain much better
  1466. images because the decompression is more complex, but requires the user
  1467. to have expensive hardware.
  1468.   
  1469.   None
  1470.  
  1471. When the image is small and compression wouldn't help much, or you want
  1472. the image to be readable by a wide range of applications, this may be
  1473. the best choice.
  1474.   
  1475.   RLE
  1476.  
  1477. Run Length Encoded.  This is a common form of compression that involves
  1478. encoding "runs" of colors into fewer bytes.  For example, instead of
  1479. having a black background of repeated pixels, the RLE format would
  1480. encode this to just a couple of bytes consisting of run length and
  1481. pixel value.  There is a specific RLE format defined in Windows 3.0 as
  1482. a DIB.  This RLE format also allows for skips and jumps, making it
  1483. ideal for delta-frame compression.  The main advantage of this format
  1484. over any other is that it is directly supported by Windows and is
  1485. therefore very fast.
  1486.   
  1487.   JPEG
  1488.  
  1489. Joint Picture Experts Group.  This is a compression algorithm defined
  1490. by JPEG.  It is based on 24-bit natural images.  One main limitation is
  1491. that it is not directly supported by Windows and is therefore slower
  1492. because an image must be decompressed into an image format that Windows
  1493. can understand (DIB).  Another limitation is that is works on 24-bit
  1494. images.  This means that a lot of memory and processing can be wasted
  1495. if the display is only 8-bit (the usual case for multimedia on PCs
  1496. today).
  1497.   
  1498.   GIF
  1499.  
  1500. This is a file format owned by CompuServe.  It is generally a good
  1501. compression format, but JPEG is better (even though JPEG works on 24-
  1502. bit images, you get better compression by expanding the file to 24-bits
  1503. and then using JPEG to compress it).
  1504.   
  1505.   DVI
  1506.  
  1507. Digital Video Interactive.  This is a hardware and software solution to
  1508. video graphics.  Intel has announced that the algorithm implemented
  1509. will move to MPEG (now that it is defined).  This is a very high
  1510. quality (compared to AVI) image compression.  However, it requires
  1511. hardware to obtain the image quality and size.  Unfortunately, this
  1512. hardware currently costs about $2,000, so not many of your users will
  1513. have this hardware.
  1514.   
  1515.   AVI
  1516.  
  1517. Audio Video Interleaved.  Microsoft's software-only video solution to
  1518. video graphics.  This algorithm is optimized for 8-bit images and the
  1519. quality is good, but image size is limited.  The main advantage of this
  1520. system over DVI is that AVI will run on any MPC system and doesn't
  1521. require additional hardware.  This system will be in Beta in the second
  1522. quarter of 1992.
  1523.   
  1524.   MPEG
  1525.  
  1526. Motion Picture Experts Group.  This algorithm has just recently been
  1527. defined.  It is a very complex algorithm and will require additional
  1528. hardware to achieve acceptable frame rates.  DVI has committed to
  1529. supporting this industry standard in their hardware.
  1530.   
  1531.   Custom Compression
  1532.  
  1533. You can create your own compression algorithms that are optimized for
  1534. use on your images.  In theory, you can get very good compression, but
  1535. you still must convert your images to DIB format in order to display
  1536. them under Windows.
  1537.                                    
  1538.                            Graphics Display
  1539.  
  1540. Windows uses a device-independent system to provide a GUI on many PC
  1541. systems.  The advantage to the user in a GUI is that hardware selection
  1542. can be based on price and capabilities.  The advantage to the ISV is
  1543. that their application runs on all these platforms, increasing their
  1544. market.  In addition, more and more users will insist that their
  1545. applications run in the prefered GUI environment.
  1546.  
  1547. The problem for the developers of graphics programs is that the
  1548. performance of the system is dependent on the system (CPU, video
  1549. hardware and drivers) that the user has.  A bad driver can adversely
  1550. effect the capabilities of the system for multimedia.  In the
  1551. Multimedia Group at Microsoft, a lot of time has been devoted to
  1552. optimizing the video drivers for images.  You should be aware that some
  1553. users might have an older driver that is not very fast.  In fact, some
  1554. old drivers are an order of magnitude slower in displaying graphics.
  1555. These users should upgrade to the newer drivers when they are available
  1556. from their video card hardware vendors.
  1557.  
  1558. Draw Speed
  1559.  
  1560. The main speed problem when drawing DIBs is color translation.  Color
  1561. translation is explained in Section 2.3 of the Programmer's Reference
  1562. of the Windows 3.0 SDK documentation.  Optimization is necessary to
  1563. eliminate the need for the driver to translate the pixel values before
  1564. putting them into display memory.
  1565.  
  1566. The following can improve draw speed:
  1567.                                                          Avoid color
  1568.        translation
  1569.                                                         Use the
  1570.           'identity' palette
  1571.                                                         Use
  1572.           DIB_PAL_COLORS
  1573.                                                          Use dirty
  1574.        redraw (only what needs to be changed)
  1575.                                                          Optimize your
  1576.        code to use 32-bit data for image operations.  Examples of
  1577.        using 32-bit code and drawing directly into DIBs with custom
  1578.        routines are demonstrated in the TRIQ.ZIP sample code.  See the
  1579.        Overview section, earlier in  this technical note,  for
  1580.        information about obtaining this sample code.
  1581.  
  1582.  Dirty Area
  1583.  
  1584. This optimization can result in dramatic increases in speed.  You
  1585. should try to design your application to take advantage of this
  1586. technique.
  1587.  
  1588. You should only update the dirty areas of the screen.  This method is
  1589. easiest to implement when the application is moving an object around on
  1590. the screen, such as sprites.  For example, in Mixed Up Mother Goose
  1591. from Sierra Online, the character moves around the screen but only the
  1592. area around the character is redrawn each time it changes.  To
  1593. accomplish this, the background bitmap is kept in memory along with the
  1594. image(s) of the character (in addition to an off-screen copy of the
  1595. display).  When an area of the screen is determined to have changed,
  1596. the areas that have changed in the off-screen copy are drawn with the
  1597. background.  Then the character (or other sprites) are drawn onto the
  1598. off-screen copy using transparent blits.  Finally, the area that has
  1599. changed is copied from the off-screen bitmap onto the display.
  1600.  
  1601. This method can also be used when multiple sprites are moving on the
  1602. screen; just apply the technique to each sprite in turn and, when the
  1603. off-screen image is updated, update the dirty areas.  You can also
  1604. optimize for the case where sprites are next to, or touching, each
  1605. other.
  1606.  
  1607. Delta-frame animation is one application of this method.  In delta-
  1608. frame, only the differences between frames are stored and displayed.
  1609. Because the information that is copied to the screen is much smaller,
  1610. the update takes less time.  In addition, the size of the data is much
  1611. smaller.  AVI uses this technique to display compressed video directly
  1612. from the CD-ROM.  The RLEAPP.ZIP sample code demonstrates this
  1613. optimization using RLE DIBs.  See the Overview section, earlier in this
  1614. technical note for information on how to obtain the sample code.
  1615.  
  1616.  Offscreen Bitmap
  1617.  
  1618. This is an important optimization tool that simplifies updates of dirty
  1619. areas.  This optimization takes advantage of the fact that drawing to
  1620. memory is usually much faster than drawing to the screen.  This will
  1621. have the most benefit when the display is a composite of multiple
  1622. images.  It is usually used in conjunction with dirty area redraw
  1623. optimization to obtain high-quality animations.
  1624.  
  1625. The off-screen bitmap needs to be at least the size of the image on the
  1626. screen.  It can actually be bigger if you want to optimize scrolling
  1627. the image on screen; if it is already drawn in the off-screen bitmap,
  1628. just update the screen with the new portion of the image.
  1629.  
  1630. You don't need to use an off-screen bitmap to perform the dirty update
  1631. technique, just do the updates directly on the screen.  The result,
  1632. however, will flash as the background and then each of the sprites are
  1633. drawn.  However, this does use less memory when the off-screen bitmap
  1634. is large.
  1635.  
  1636. Palettes
  1637.  
  1638. Optmizing the usage of color can provide improved performance.
  1639.  
  1640.  DIB_PAL_COLORS
  1641.  
  1642. This is a flag on the DIB bitmap functions, telling the functions that
  1643. the bitmap data (pixels) consists of indexes into the current logical
  1644. palette.  This means that no translation is needed from bitmap's
  1645. palette into the logical palette.  This can enhance display of the
  1646. bitmap because the application has control over the color matching
  1647. between multiple bitmaps that may use different palettes.
  1648.  
  1649.  Identity Palette
  1650.  
  1651. This is the process of making the logical palette exactly match the
  1652. system palette. This is accomplished by putting the appropriate system
  1653. colors into the reserved places in the palette.  Sample code is
  1654. available that demonstrates this technique in RLEAPP.ZIP.  See the
  1655. Overview section earlier in this technical note for information on how
  1656. to obtain this sample code.
  1657.  
  1658. When DIB_PAL_COLORS is combined with an identity palette, no pixel
  1659. color translation is needed and the driver can just copy the image data
  1660. directly into the display memory.
  1661.  
  1662.  Common Palettes
  1663.  
  1664. This is the process of using a common palette between multiple images
  1665. displayed on the screen at one time.  This is not a draw speed
  1666. optimization, but it does optimize the quality of display of the
  1667. images.  This is because the technician who creates the images has
  1668. control over the resulting palette instead of the application or
  1669. Windows.
  1670.  
  1671.  Fade
  1672.  
  1673. A changing palette can be animated to create special effects.  The most
  1674. useful is a fade where an image appears to disappear from the screen.
  1675. This is a pretty simple process (you need to use DIB_PAL_COLORS to fade
  1676. the image up from a single color).
  1677.  
  1678. Palette animation can also be used to create an animation directly
  1679. instead of using a sequence of images.  This technique is demonstrated
  1680. in the LAVA.ZIP sample code.  See the Overview section earlier in this
  1681. technical note  for more information about where to obtain the sample
  1682. code.
  1683.  
  1684.  Cross Fade
  1685.  
  1686. A palette transition is used to change the displayed image.  This is
  1687. accomplished by merging two images into one image with a specially
  1688. constructed palette.  This technique is demonstrated in the
  1689. MERGEDIB.ZIP sample code.  See the Overview section earlier in this
  1690. technical note for information on how to obtain this sample code.
  1691.  
  1692. Transparent Blits
  1693.  
  1694. Transparent blits allow the compositing of several images onto a final
  1695. image.  There are three ways to blit an image with transparency:
  1696.                                                         Multiple
  1697.      ROPs.  This method works on any Windows driver.  It involves a
  1698.      combination of raster operations (ROPs) to obtain the desired
  1699.      effect.  It is very slow as the image must be copied four times to
  1700.      obtain one transparent blit.
  1701.                                                         Image mask.
  1702.      This method works on any Windows driver.  It involves a
  1703.      combination of raster operations (ROPs) to obtain the desired
  1704.      effect.  It is slightly faster than the multiple ROP method
  1705.      because it only requires three blit operations.  However, it does
  1706.      require an image mask.
  1707.   
  1708.   NEWTRANSPARENT.  This is the fastest method, but it only works
  1709.      with Windows video drivers that support it (all the multimedia
  1710.      drivers).
  1711.   
  1712.   The TRANSBLT.ZIP sample code demonstrates all of these methods.  See
  1713.      the Overview earlier in this technical note section for
  1714.      information about where to obtain the sample code.
  1715.                                    
  1716.                                Glossary
  1717.  
  1718. Animation:  The display of a series of a graphic images, simulating
  1719. motion.  Animation can be frame-based or cast-based.  The Movie Player
  1720. included with the Multimedia extensions uses cast-based animation.
  1721.  
  1722. Applet: An application started from the Control Panel. Control Panel
  1723. applets each configure a particular system feature; for example,
  1724. printers, video drivers, or Page: 38
  1725. system sounds
  1726.  
  1727. AVI (Audio Video Interleaved):  Microsoft's Multimedia Systems Group is
  1728. developing a product that synchronizes motion video and audio without
  1729. the use of specialized hardware.  This could be used to create "talking
  1730. head" presentations, display animation sequences, and present
  1731. multimedia slide shows.
  1732.  
  1733. Blit: Copying one image to another.  The copy can include ROPs to
  1734. modify how the destination image appears.
  1735.  
  1736. Blit Tear: A visible (to the user) artifact when blitting.  This is
  1737. usually caused by the display updating the monitor as the image is
  1738. being copied.  The monitor ends up with one frame with half the new
  1739. image and half the old image.  This is particularly visible with large
  1740. images.
  1741.  
  1742. Cast-Based Animation: Also called "sprite animation".  A method of
  1743. animation that uses many graphical elements that are combined (or
  1744. composited) while the animation is playing into a final image that is
  1745. displayed. Contrast with frame-based animation.
  1746.  
  1747. CD-DA (Compact Disc-Digital Audio):  An optical data-storage format
  1748. that provides for the storage of up to 73 minutes of high-quality
  1749. digital-audio data on a compact disc.  Also known as Red Book audio.
  1750. This is the standard audio CD format known around the world.
  1751.  
  1752. CD-I (Compact Disc Interactive):  An interactive multimedia player
  1753. which attaches to TV sets and reads special optical discs (CD-I
  1754. format).  The CD-I disc standard integrates data, still-frame images,
  1755. audio and motion video on the same disc.  This standard is being
  1756. developed by Philips.   Also know as Green Book.
  1757.  
  1758. CD-ROM (Compact Disc-Read Only Memory): An optical data-storage
  1759. technology that allows large quantities of data to be stored on a
  1760. compact disc. Also known as Yellow Book.
  1761.  
  1762. CDTV (Commodore Dynamic Total Vision):  An interactive multimedia CD-
  1763. ROM player which attaches to TV sets and reads CD-ROM discs.  This
  1764. Commodore proprietary hardware is targeted to the home and directly
  1765. competes against CD-I.
  1766.  
  1767. CD-XA (CD-ROM eXtended Architecture):  An extension of the CD-ROM
  1768. standard that provides for integrated (interleaved) storage of
  1769. compressed audio data along with other data on a CD-ROM disc in a media-
  1770. dependent form.  This format is the same format that is used by CD-I.
  1771. This standard also defines the way data is read from a disc.  Audio
  1772. data is combined with text and graphic data on a single track so they
  1773. can be read at virtually the same time.  These extensions are now
  1774. included in the standard CD-ROM definition (Yellow Book).
  1775.  
  1776. CMYK: Cyan, magenta, yellow, black.  A color encoding method commonly
  1777. used in printing.  The black is not really needed, but is included as a
  1778. specific color because it is used so often.  Many color printers use
  1779. these four colors in a ribbon to print color images.
  1780.  
  1781. Collision Detection: Used in cast-based animation to determine when two
  1782. images have touched or collided.  Used mainly in games; for example,
  1783. detecting when the missile hits the player's ship.
  1784.  
  1785. Color Cube:  A particular color is composed of three components.  Since
  1786. there are three components, the range of colors can be expressed in
  1787. three dimensions, or a cube.  A color cube refers to the color spectrum
  1788. that can be represented by a particular color encoding method; for
  1789. example, RGB or HSL or NTSC.
  1790.  
  1791. Color Depth: The number of bits assigned to represent color information
  1792. in an image.  Color depth can also refer to the perceived (by the user)
  1793. amount of color information.  Choices are usually 1 bit, 4 bits with a
  1794. palette, 256 bits with a palette, 16 bits without a palette and 24 bits
  1795. without a palette.  The color depth of the palette is usually 24 bits.
  1796.  
  1797. Composite: To combine.  This is the generation of a single image from
  1798. multiple image elements.  It forms the basis of cast-based animation.
  1799.  
  1800. Composite Video: An analog video signal that has the components (hue,
  1801. saturation, luminance, HSL) combined into one signal.  This type of
  1802. analog video signal is of lower quality than an SVHS video signal.
  1803.  
  1804. Compression: A digital process that allows data to be stored or
  1805. transmitted using less than the normal number of bits.  DVI is an
  1806. example of hardware compression and AVI is an example of software
  1807. compression.
  1808.  
  1809. Computer Images: Defined in this techical note to be graphical images
  1810. that do not contain many changes in color from pixel to pixel.  "Many
  1811. changes" is a relative term and it generally determined by the point at
  1812. which a compression algorithm that is meant for image without many
  1813. changes stops being effective.
  1814.  
  1815. DVI (Digital Video Interactive): A proprietary technology developed by
  1816. Intel (and licensed by IBM) for full-motion video at a high level of
  1817. compression (hardware).  This technology will be supported under
  1818. Windows using MCI commands.
  1819.  
  1820. DIB (Device-Independent Bitmap): A Windows bitmap data structure
  1821. consisting of header fields, an optional color table (palette), and
  1822. bitmap data. Depending on the number of colors represented in a given
  1823. bitmap, the bitmap bits can be represented in 1, 4, 8, or 24 bits, with
  1824. or without a palette.
  1825.  
  1826. Dithering: This is a pixel-depth conversion process usually only used
  1827. when a very few colors are available; for instance, 16 colors.  The
  1828. process trades pixel resolution for (perceived) color depth.  Squares
  1829. (for example, 2x2, 4x4, etc.) of pixels are created to represent to the
  1830. eye more colors than are actually available.  Print media uses a
  1831. similar technique to obtain many shades from just 3 or 4 actual colors.
  1832. This algorithm has the inherent side effect (or artifact) of changing a
  1833. computer image into a natural image.
  1834.  
  1835. Frame: A single image that the user sees displayed.  This is the final
  1836. image in cast-based animation, or the actual image in frame-based
  1837. animation.
  1838.  
  1839. Frame-Based Animation: An animation technique that displays a sequence
  1840. of images.  Usually these images are delta-framed.  Frame-based
  1841. animation allows for more complicated animations at a higher speed than
  1842. any other animation technique because the data is precalculated.
  1843.  
  1844. Frame Rate: The speed at which images are displayed.  The faster the
  1845. rate, the better the quality of the animation.  Frame rate, image size,
  1846. and image complexity are the three aspects of an animation which must
  1847. be weighed to obtain the best quality.
  1848.  
  1849. General MIDI: A synthesizer specification created by the MIDI
  1850. Manufacturers Association (MMA) defining a common configuration and set
  1851. of capabilities for consumer MIDI synthesizers.
  1852.  
  1853. Hot Spot: An area of an image that, when selected by the user (usually
  1854. by clicking with a mouse), performs an action in the application.
  1855. Commonly, hot spots are represented graphically by buttons, but hot
  1856. spots may be hidden to allow the user to explore the image to discover
  1857. what happens.
  1858.  
  1859. HSL: Hue, saturation, and luminance.  This one method of representing a
  1860. particular color.  The luminance represents the brightness of the color
  1861. and the Hue and saturation give the rest of the color information.
  1862. This method is similar to what is used by NTSC television signals.
  1863. Black and white TVs just decode the luminance portion of the signal to
  1864. present a picture while color TVs decode the entire signal.
  1865.  
  1866. IHV: Independent Hardware Vendor.  A Microsoft term used to refer to
  1867. companies in the PC computer industry who make hardware products
  1868. (machines, upgrade kits, CD-ROM drives, etc.).
  1869.  
  1870. IMA (Interactive Multimedia Association): A professional trade
  1871. association of companies, institutions, and individuals involved in
  1872. producing and using interactive multimedia technology.
  1873.  
  1874. Interleaving: The technique of combining different types of data into
  1875. one stream of data.  This technique is used by AVI for CD-ROMs to
  1876. combine image and audio data to create a video.
  1877.  
  1878. ISV: Independent Software Vendor.  A Microsoft term used to refer to
  1879. companies in the PC computer industry who make software products
  1880. (applications, tools, authoring systems, etc.).
  1881.  
  1882. JPEG (Joint Picture Experts Group): A standards committee for still
  1883. images.
  1884.  
  1885. MCI (Media Control Interface):  High-level control software that
  1886. provides a device-independent interface to multimedia devices and media
  1887. files. MCI includes a command-message interface and a command-string
  1888. interface.  This interface is supported by both IBM and Microsoft.
  1889.  
  1890. MIDI (Musical Instrument Digital Interface): A standard protocol for
  1891. communication between musical instruments and computers.
  1892.  
  1893. MSCDEX (Microsoft Compact Disc Extensions): A terminate-and-stay-
  1894. resident (TSR) program that makes CD-ROM drives appear to MS-DOS as
  1895. network drives. MSCDEX uses hardware-dependent drivers to communicate
  1896. with CD-ROM drives.
  1897.  
  1898. MPEG (Motion Pictures Experts Group): A standards committee for motion
  1899. video.
  1900.  
  1901. MPMC (Multimedia PC Marketing Council):  A subsidiary of the Software
  1902. Publishers Association composed of  12 companies involved in developing
  1903. Multimedia products.  These companies currently include CompuAdd,
  1904. Creative Labs, Fujitsu, Headland/Video 7, Media Vision, Microsoft, NCR,
  1905. NEC, Olivetti, Philips, Tandy, and Zenith Data Systems.  This industry
  1906. standard platform is based on Microsoft's Windows with Multimedia
  1907. extensions.
  1908.  
  1909. Natural Image: As defined by this technical note, an image that has
  1910. many changes in color from pixel to pixel.  Contrast this with computer
  1911. image.
  1912.  
  1913. Off-Screen Bitmap: A copy of the image that is displayed on the screen
  1914. that is in system memory.  This is an optimization technique that takes
  1915. advantage of the fact the on most PCs, system memory is much faster
  1916. than display memory.  This means that it is faster to carry out blit
  1917. operations on system memory and then, when finished with the image,
  1918. copy it to the display.  This technique is especially beneficial when
  1919. using cast-based animation.
  1920.  
  1921. Palette:  In Windows, a palette is a data structure defining the colors
  1922. used in a bitmap image.
  1923.  
  1924. Pixel:  A single point of an image.  A screen's resolution is commonly
  1925. referred to in pixels (for example, a common form of VGA resolution is
  1926. 640x480 with a color depth of 16 colors).
  1927.  
  1928. Planes: When compositing, the relative Z-order of the images can be
  1929. imagined as a sequence of planes in which the images are placed.
  1930.  
  1931. The video hardware can also allow two or more planes of display with
  1932. the foreground display plane having a special method to determine where
  1933. the background plane shows through.
  1934.  
  1935. Raster Graphics:  A type of image fomat optimized for display on a
  1936. raster device.  This is the most common form of images.
  1937.  
  1938. RGB: Red, green, blue.  A color encoding method commonly used by
  1939. computers.  Compare this method to HSL and CMYK.
  1940.  
  1941. RIFF (Resource Interchange File Format):  A tagged-file specification
  1942. used to define standard formats for multimedia files. Tagged-file
  1943. structure helps prevent compatibility problems that often occur when
  1944. file-format definitions change over time. Because each piece of data in
  1945. the file is identified by a standard header, an application that does
  1946. not recognize a given data element can skip over the unknown
  1947. information.  This specification is jointly supported by IBM and
  1948. Microsoft.
  1949.  
  1950. RLE:  Run Length Encoded.  Generically, this refers to a compression
  1951. method for computer images that only encodes color changes instead of
  1952. encoding each pixel.  A specific definition of RLE is defined in the
  1953. Windows DIB format.  This RLE format also includes line skips and
  1954. column jumps, making it ideal for encoding a delta-frame image of a
  1955. computer image.
  1956.  
  1957. ROP. Raster operation.  The simplest ROP is SRC_COPY.  More complicated
  1958. ROPs allow combinations of the source and destination images along with
  1959. a brush image.  ROPs are explained in the Windows SDK documentation.
  1960. See the Chapter "Binary and Ternary Raster-Operation Codes" in the
  1961. Windows SDK documentation in the Programmer's Reference book.
  1962.  
  1963. Scanning. Scanning is the process of digitizing an image.  This is one
  1964. way to create images.
  1965.  
  1966. Skips and Jumps: This is a technique defined in the Windows RLE DIB
  1967. format for encoding just the changes (deltas) from a previous image.
  1968. The skips (rows) and jumps (columns) allows the efficient encoding of
  1969. pixels that have not changed from the original image.
  1970.  
  1971. Sprite: An image that is moved in the display to provide animation.
  1972. The image itself can change while it is being moved to enhance the
  1973. illusion.
  1974.  
  1975. Vector Graphics: A type of picture optimized for display on a system
  1976. that uses instructions for display.  Contrast this with raster
  1977. graphics.
  1978.  
  1979. Video: Digital and Analog.  Digital video is defined by this technical
  1980. note as a precalculated sequence of images that are displayed to show
  1981. an animation; audio is usually present.  Analog video is common TV
  1982. signals; audio is almost always present.
  1983.  
  1984. Video Capture: The process of digitizing an analog video image.
  1985.  
  1986. Video Compression:  A method for reducing the amount of information
  1987. required to store and recall a frame of video.  Compression is critical
  1988. to delivering digital full motion video to the user in the most
  1989. effective manner (in terms of performance and storage costs).
  1990.  
  1991. Video Overlay: Hardware that displays an analog video signal in
  1992. combination with a computer display.  The analog video is commonly on a
  1993. separate video plane from the computer display.
  1994.  
  1995. WAVE file:  A Microsoft/IBM standard file format for storing waveform
  1996. audio data. A WAVE file uses the RIFF format and has a .WAV filename
  1997. extension.
  1998.  
  1999. Z-Order: The order in which a sprite is displayed.  Sprites that are
  2000. displayed later than other sprites appear to be in front (closer) to
  2001. the user.  The "Z" refers to the third dimension (front/back).
  2002.