您的位置:首页 > Web前端

DirectX Programmer's Reference Components

2011-01-13 12:00 295 查看
标题取自MSDN for VC6(另外MSDN中Platform SDK/Graphics and Multimedia Services/GDI/OpenGL中有OpenGL相关资料)

DirectX包含下面几个组件:

DirectDraw、DirectSound、DirectPlay、Direct3D、DirectInput、DirectSetup和AutoPlay(MSDN for VC6)

在MSDN for VS 2005中,可以看到DirectMusic、DirectPlay Voice、DirectShow等组件,不知道有没有重复,没有深入地了解。

DrectDraw

DirectDraw is a software interface that provides direct access to display devices while maintaining compatibility with the Windows graphics device interface (GDI). It is not a high-level application programming interface (API) for graphics. DirectDraw provides a device-independent way for games and Windows subsystem software, such as 3-D graphics packages and digital video codecs, to gain access to the features of specific display devices.

DirectDraw是一套类似GDI(兼容GDI)的software interface,能充分利用硬件加速——在计算机中通过把计算量非常大的工作分配给专门的硬件来处理来减轻中央处理器的工作量的技术。

Device-Independent Bitmaps

Windows, and therefore DirectX, uses the Device-Independent Bitmap (DIB) as its native graphics file format. Essentially, a DIB is a file that contains information describing an image's dimensions, the number of colors it uses, values describing those colors, and data that describes each pixel. For example, the following application-defined function, taken from the ddutil.cpp file that comes with the DirectX APIs in the Platform SDK, combines Win32 and DirectX functions to load a DIB onto a DirectX surface.

Bitmaps与GDI中Bitmaps(VC中DDB与DIB位图编程)类似。

Drawing Surfaces

On the other hand, DirectDraw can give you drawing surfaces that represent actual video memory. This means that when you use DirectDraw, you can write directly to the memory on the video card, making your graphics routines extremely fast. These surfaces are represented as contiguous blocks of memory, making it easy to perform addressing within them.

GDI也是与设备无关,但是GDI没有充分利用如显卡等硬件的硬件加速。

A surface, or DirectDrawSurface object, represents a linear area of display memory. A surface usually resides in the display memory of the display card, although surfaces can exist in system memory.Unless specifically instructed otherwise during the creation of the DirectDrawSurface object, DirectDraw object will put the DirectDrawSurface object wherever the best performance can be achieved given the requested capabilities. DirectDrawSurface objects can take advantage of specialized processors on display cards, not only to perform certain tasks faster, but to perform some tasks in parallel with the system CPU.

DirectDrawSurface Object可以充分利用显卡(类似GPU编程?),不仅仅是更快地完成指定的计算任务(perform certain tasks faster),还能与CPU一起完成并行计算。

可以使用IDirectDraw2::CreateSurface来创建DirectDrawSurface Object,包括IDirectDrawSurface3.

From this illustration, you can see that all surface are created by a DirectDraw object and are often used closely with palettes. Although each surface object can be assigned a palette, palettes aren't required for anything but primary surfaces that use pixel formats of 8-bits in depth or less.



DirectDrawSurface可以附加到不同的Palette(调色板?)上。

DirectDrawSurface objects expose their functionality through the IDirectDrawSurface, IDirectDrawSurface2, and IDirectDrawSurface3 interfaces. The IDirectDrawSurface interface is the oldest version of the interface and is provided by default when you create a surface by using the IDirectDraw2::CreateSurface method.

DirectDrawSurface对象的功能都是通过IDirectDrawSurface的接口来提供的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐