Search Tips Advanced Search |
| Delphi Graphics and Game Programming Exposed with DirectX 7.0 by John Ayres Wordware Publishing, Inc. ISBN: 1556226373 Pub Date: 12/01/99
Search this book:
Previous | Table of Contents | Next
#### Lines Next to pixels, lines are the most common graphical element seen in user interfaces. The GDI uses lines of different colors to simulate the beveled surfaces common in Windows user interfaces. Of course, lines have several thousand other practical uses, from representing scales and rulers to graphs and other more complex graphical content. Strictly speaking, a line is simply a collection of pixels arranged in a linear fashion.
| line: A collection of pixels, usually arranged in a linear or connecting configuration.
Lines have a mathematical discipline all their own, known as geometry. The study of lines and the mathematics that manipulate them is almost a fundamental requirement for any serious graphics programming. Even if the application will not be strictly output lines, it is sometimes useful to utilize geometry (and trigonometry, see below) to produce incredibly realistic scene generation. We’ll see more of this when we cover ray casting engines later in the book. Figure 3-3: A line is a collection of pixels #### Polygons Polygons are quite prevalent in the world of 2-D graphics programming. Buttons are usually square or rectangular in shape, and it’s not uncommon to see controls or graphics that are triangular, pentagonal, or configured into some other shape. Simply put, a polygon is a collection of lines, connected at the end to form some sort of closed shape.
| polygon: A collection of lines, arranged in such a way that the ends are connected to form a continuous, closed shape.
Circles, ovals, and curves can be lumped into this category. The concept of polygons is absolutely critical to 3-D programming. Like lines, polygons are governed by a mathematical discipline known as trigonometry (actually, trigonometry and geometry are almost joined at the hip, and I use the relationship to lines and polygons loosely). Trigonometry is the study of angles, and this coupled with polygonal shapes allows the creation of incredibly realistic 3-D environments. We’ll see some examples of this later in the book. Figure 3-4: A polygon is a collection of lines #### Bitmaps Computer graphics would quickly get boring if only lines and polygons could be used to construct a scene in a game or an interface for a business application. The human brain has incredible pattern recognition skills, and utilizing this in a game or user interface can bring to life exotic locales or make a business application easy and intuitive to use. Take a look at the Windows desktop or any business application, and the prevalent use of icons and other graphical metaphors to indicate a function. Generally speaking, these can be considered bitmaps. Like lines, a bitmap is a collection of pixels arranged in such a way that they represent a picture.
| bitmap: A collection of pixels arranged in a rectangular configuration in such a way that they form a recognizable shape, such as a picture or texture.
Digitized photos, the little images of floppy disks, printers, and pieces of paper on buttons in a business application, and the texture on the walls of the latest 3-D first-person shooter are all considered bitmaps. To coin a clichÈ, a picture is indeed worth a thousand words, and their liberal use in games and applications can result in several hundred, or perhaps even thousands, of bitmap images in use in any one program. By their very nature, bitmaps consume lots of memory, but few serious applications can succeed without employing them. Figure 3-5: A bitmap is a collection of pixels #### Graphical Element Classifications Apart from the basic graphical elements described above, conversations in graphical programming sometimes indicate a broader subdivision of graphic types. Graphical output can generally be divided into two classifications: raster and vector. It is rare to hear about game applications being described as one or the other, but it is very common to discuss graphically based business applications or tools in terms of a raster-based or vector-based application. Raster Graphics Raster graphics are images that are composed of individual pixels statically arranged in such a way as to represent a picture or image. Realistically, this refers to images such as icons and bitmaps.
| raster graphics: Graphics that are composed of a collection of pixels that together form a picture or image. Generally refers to bitmaps, icons, and other such graphical types.
In general, raster graphics are very resolution dependent, and tend to lose resolution when scaled to a different size. The algorithms necessary for scaling or rotating raster graphics are generally very complex, and the quality of the results varies wildly depending upon the implementation. The most common raster graphic file format is the humble Windows bitmap. Bitmaps can be created using the Paint application that comes with Windows. Delphi contains an Images directory that includes several bitmap files to be used as button glyphs or backgrounds within applications. Vector Graphics Vector graphics are images that are described as a series of connected points in a virtual 2-D or 3-D grid. This type of graphic includes lines, polygons, circles, and curves. TrueType fonts, being described by a collection of connected points, are also considered to be vector graphics.
| vector graphics: Graphics that are represented by a series of connected points in a virtual 2-D or 3-D Cartesian (or similar) coordinate system. Generally refers to lines, polygons, curves, and other such graphical types.
Unlike raster graphics, vector graphics are resolution independent, and can be scaled to any size without degradation of image quality. Although somewhat complex, the algorithms for scaling and rotating vector graphics are well documented and easily implemented, and the quality of the results is identical from implementation to implementation. A common vector graphic file format is the Windows metafile. Its most prevalent use is with clip art type graphics that come with word processors and presentation programs. Because of its resolution independence, clip art stored in this format can be enlarged or shrunk as the user requires.
Previous | Table of Contents | Next

Products | Contact Us | About Us | Privacy | Ad Info | Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.