Kurzbeschreibung
Synopsis
Buchrückseite
- Win32 GDI and DirectDraw: Accurate, under the hood, and in depth
- Beyond the API: Internals, restrictions, performance, and real-life problems
- Complete: Pixel, lines, curves, filled area, bitmap, image processing, fonts, text, metafile, printing, and more
- Up to date: Windows 2000 and Windows 98 graphics enhancements
- CD-ROM: Exclusive and professional quality generic C++ classes, reusable functions, demonstration programs, kernel mode drivers, GDI exploration tools, and more!
Hewlett-Packard Professional Books
To deliver high-performance Windows applications, you need an in-depth understanding of the Win32 GDI and DirectDrawbut until now, it's been virtually impossible to discover what's going on "behind" Microsoft's API calls. This book rips away the veil, giving experienced Windows programmers all the information and techniques they need to maximize performance, efficiency, and reliability! You'll discover how to make the most of Microsoft's Windows graphics APIsincluding the important new graphics capabilities built into Windows 2000. Coverage includes:
- Uncovering the Windows system architecture and graphics system internal data structure
- Building graphics API "spies" that show what's going on "under the hood"
- Detecting GDI resource leaks and other powerful troubleshooting techniques
- Expert techniques for working with the Win32 GDI and DirectDraw APIs
- Device context, coordinate space and transformation, pixels, lines, curves, and area fills
- Bitmaps, image processing, fonts, text, enhanced metafiles, printing, and more
Windows Graphics Programming delivers extensive code, practical techniques, and unprecedented insightplus an exclusive CD-ROM containing original system-level tools, kernel mode drivers, sample code, and generic C++ classes for Windows graphics programming without MFC. If you want to build Windows graphics applications that deliver breakthrough performance and reliability, you'll find this book indispensable.
Über den Autor
Prolog. Abdruck erfolgt mit freundlicher Genehmigung der Rechteinhaber. Alle Rechte vorbehalten.
Preface
To be truly valuable, a new book on Windows programming should be in-depth, complete, up to date, accurate, practical, and useful.
An in-depth book should go beneath the API layer to talk about API design rationale, internal data structure, and implementation outline. It should provide spying and exploration tools for you.
A complete and up-to-date book should focus on the best implementation of Win32 API so far, Windows 2000, which will be basis for future Microsoft operating systems, and cover its new features.
An accurate book should be based on actual exploration of Win32 API features and verify all the details. Relying solely on Microsoft documentation is definitely not good enough, because it merely describes the abstract Win32 API and unfortunately has some incomplete, out-of-date, and vague information.
A practical and useful book for programmers and software engineers should go beyond mere description of API and simple illustrative examples, to solve real-world problems, provide reusable building blocks, supply useful tools, and encourage readers to write professional programs.
In particular, a book of this sort is needed to elucidate Win32 GDI, or Windows graphics programming in general, which is a fundamental building block of all Windows programs. The most in-depth coverage to date may be provided by Matt Pietrek's books, which discuss the internal working of Windows 3.1 GDI. The most complete and up-to-date description of GDI is offered by Microsoft's MSDN library. Half of Charles Petzold's famous book Programming Windows, Fifth Edition, is devoted to Windows 98 GDI programming.
But for the whole Windows programming community dealing with Windows GDI frequently, something more in-depth, more complete, more up-to-date, more accurate, and more useful is needed. These are the goals that have guided the preparation of this book.
What Is This Book About?
This book is about Windows graphics programming using Win32 GDI API, with an introduction to DirectDraw, and an even more brief introduction to Direct3D Immediate Mode. It covers common features implemented on all Win32 platforms, pure 32-bit features implemented on Windows NT/2000 only, and the most recent additions to GDI for Windows 2000 and Windows 98. For example, alpha blending, transparent bitblting, gradient fill, right-to-left reading order, layered window, and sending JPEG/PNG images to printer are fully covered.
This book is about programming Windows with a deep understanding of how things are actually implemented, so as to use Win32 API more effectively, efficiently, and confidently.
This book is about reading any Win32 documentation perceptively and analytically, trying to understand the minds of people designing and implementing Win32 API, and using logical reasoning and experiments to fully understand Win32 API, even to find missing information and identify mistakes in its documentation.
This book is about using programming tools effectively to help you understand Win32 API. More importantly, it demonstrates how you can build your own tools, often using hard-core system programming techniques, and design interesting experiments to explore the undocumented world underneath Win32 API. The first few chapters can be read as a system-level Windows programming book, which can be applied to other areas of Windows programming.
This book is about creating reusable building blocks for practical employment. Besides simple testing and demonstration programs, the book contains lots of reusable functions, C++ classes, drivers, tools, and nontrivial programs, which can be used in actual production-quality Windows programs. It develops a whole C++ class library of object-oriented Windows programming, which supports simple window, SDI window, MDI window, dialog box, toolbar, status window, property sheet, sub-classing, common dialog box, etc. It provides classes for DIB/DDB/DIB section handling, EMF rendering, image processing, color quantization, error-diffusion halftoning, JPEG image decoding/encoding, font file decoding, font embedding, PANOSE font matching, glyph drawing, 3D text, device-independent multiple-page layout, DirectDraw wrapper, Direct3D IM wrapper, and so on.
The code shown in this book does not rely on Microsoft Foundation Class, or any third-party class library, so it can be used in any C++ program. All the class names start with the letter "K," so you can easily mix them with MFC, ATL, or OWL, or your own class library.
How Is This Book Organized?
The book covers Windows graphics programming at three layers: the implementation layer, the API layer, and the application layer.
The implementation layer covers what is behind the Win32 GDI API and DirectX COM interfaces, which is the undocumented world of Windows graphics engine and the Win32 subsystem client DLLs. Chapters 2, 3, and 4 cover the behind-the-scenes implementation layer to build a solid foundation for understanding the API layer.
The API layer provides precise, accurate, step-by-step description of Win32 GDI API, DirectDraw, and a little bit of Direct3D IM. The application layer builds on top of the API layer to solve real-world problems, implement reusable functions, C++ classes, and nontrivial programs. The API layer and application layer are mixed together according to individual topics. Normally, the first part of a chapter covers the API layer and then moves to real application-related programs. For more complicated topics like bitmap, one chapter covers the basics and two chapters cover more advanced usage.
Chapter 1, "Basic Techniques and Knowledge," reviews basic Windows programming techniques, which will be used in the rest of the book. It covers basic Windows programming, Intel assembly language, the program development environment, the Win32 executable file format, and the architecture of the Windows operating system. My favorite part is simple API hooking by overwriting Win32 module's import/export directories.
Chapter 2, "Windows Graphics System Architecture," gives a grand tour of the Windows graphics system from the Win32 subsystem DLLs down to the graphics device drivers. It touches on Windows graphics system components, GDI architec-
ture, DirectX architecture, printing subsystem architecture, the graphics engine, display drivers, and finally printer drivers. My favorite parts are the description of system service calls, which bridges user mode GDI implementation with the kernel mode graphics engine, a tool to list undocumented system service calls (from GDI32.DLL, USER32.DLL, NTDLL.DLL, and WIN32K.SYS), and a simple printer driver which generates HTML pages with embedded bitmaps.
Chapter 3, "GDI/DirectDraw Internal Data Structures," can be read as a detective story or treasure-hunting adventure. It starts by explaining the Win32 handle-based object-orient programming paradigm, then tries to understand what a GDI object handle is, proceeds to actually locate the GDI handle table, decode it, and finally expose the complicated web of data structures the Windows graphics system keeps internally. Virtual memory querying, Microsoft's debug symbol files, homegrown tools and Microsoft Visual C++ debugger are used to locate the GDI handle table. A kernel mode driver is developed to read from the kernel mode address space. The Fosterer program developed in Chapter 3 uses Microsoft's GDI debugger extension to decode the GDI handle table, and graphics engine/DirectX internal data structures, all with the convenience of a single machine. You just can't afford to miss trying the Fosterer program, on either a Windows NT or Windows 2000 machine. But first, you need to install debug symbol files and get Microsoft's WinDbg.
Description of internal data structure should be treated as reference material to gain deep...