计算机专业中英文翻译---windows编程模式(编辑修改稿)内容摘要:
grammers were largely insulated from these API differences because they wrote to the MFC standard, which was designed to work with either Win16 or Win32 underneath. Bitmaps Without graphics images, Microsoft Windowsbased applications would be pretty dull. Some applications depend on images for their usefulness, but any application can be spruced up with the addition of decorative clip art from a variety of sources. Windows bitmaps are arrays of bits mapped to display pixels. That might sound simple, but you have to learn a lot about bitmaps before you can use them to create professional applications for Windows. This chapter starts with the old way of programming bitmaps— creating the devicedependent GDI bitmaps that work with a memory device context. You need to know these techniques because many programmers are still using them and you39。 ll also need to use them on occasion. Next you39。 ll graduate to the modern way of programming bitmaps— creating deviceindependent bitmaps (DIBs). If you use DIBs, you39。 ll have an easier time with colors and with the printer. In some cases you39。 ll get better performance. The Win32 function CreateDIBSection gives you the benefits of DIBs bined with all the features of GDI bitmaps. Finally, you39。 ll learn how to use the MFC CBitmapButton class to put bitmaps on pushbuttons. (Using CBitmapButton to put bitmaps on pushbuttons has nothing to do with DIBs, but it39。 s a useful technique that would be difficult to master without an example.) GDI Bitmaps and DeviceIndependentBitmaps There are two kinds of Windows bitmaps: GDI bitmaps and DIBs. GDI bitmap objects are represented by the Microsoft Foundation Class (MFC) Library version CBitmap class. The GDI bitmap object has an associated Windows data structure, maintained inside the Windows GDI module, that is devicedependent. Your program can get a copy of the bitmap data, but the bit arrangement depends on the display hardware. GDI bitmaps can be freely transferred among programs on a single puter, but because of their device dependency, transferring bitmaps by disk or modem doesn39。 t make sense. NOTE In Win32, you39。 re allowed to put a GDI bitmap handle on the clipboard for transfer to another process, but behind the scenes Windows converts the devicedependent bitmap to a DIB and copies the DIB to shared memory. That39。 s a good reason to consider using DIBs from the start. DIBs offer many programming advantages over GDI bitmaps. Because a DIB carries its own color information, color palette management is easier. DIBs also make it easy to control gray shades when printing. Any puter running Windows can process DIBs, which are usually stored in BMP disk files or as a resource in your program39。 s EXE or DLL file. The wallpaper background on your monitor is read from a BMP file when you start Windows. The primary storage format for Microsoft Paint is the BMP file, and Visual C++ uses BMP files for toolbar buttons and other images. Other graphic interchange formats are available, such as TIFF, GIF, and JPEG, but only the DIB format is directly supported by the Win32 API. Color Bitmaps and Monochrome Bitmaps Now might be a good time to reread the Windows Color Mapping section in Chapter 5. As you39。 ll see in this chapter, Windows deals with color bitmaps a little differently from the way it deals with brush colors. Many color bitmaps are 16color. A standard VGA boa。计算机专业中英文翻译---windows编程模式(编辑修改稿)
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。
用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。