Memory Device Contexts
内存设备环境
To enable applications to place output in memory rather than sending it to an actual device, use a special device context for bitmap operations called a memory device context.
要使程序能输出到内存中,而不是实际的设备上,使用操作位图的特殊设备环境,称之为内存设备环境。
A memory DC enables the system to treat a portion of memory as a virtual device。
内存设备环境能使系统处理的内存部分,就像虚拟设备一样。
It is an array of bits in memory that an application can use temporarily to store the color data for bitmaps created on a normal drawing surface.
它使得程序将正常的图的位图颜色数据临时存储在内存中
Because the bitmap is compatible with the device, a memory DC is also sometimes referred to as a compatible device context.
由于位图是与设备共存,内存设备环境有些时候被称之为共存设备环境。
The memory DC stores bitmap images for a particular device. An application can create a memory DC by calling the CreateCompatibleDC function.
内存设备环境存储的是一个特殊设备的位图图像, 应用程序可以调用
CreateCompatibleDC 函数创建内存设备环境。
The original bitmap in a memory DC is simply a placeholder。 Its dimensions are one pixel by one pixel. Before an application can begin drawing, it must select a bitmap with the appropriate width and height into the DC by calling the
SelectObject function.
最初在内存设备环境里的位图,仅仅预留位置。尺寸是一个像素一个像素的,在程序开始绘制之前,它必须调用的
SelectObject函数 到设备环境选择一张位图和适当的宽,高。
To create a bitmap of the appropriate dimensions, use the
CreateBitmap,
CreateBitmapIndirect, or
CreateCompatibleBitmap function. After the bitmap is selected into the memory DC, the system replaces the single-bit array with an array large enough to store color information for the specified rectangle of pixels.
若要创建的适当尺寸的位图,使用 CreateBitmap、 CreateBitmapIndirect 或 CreateCompatibleBitmap 的函数。 之后位图选入区内存后,系统会将单位数组替换数组大小不足以存储在指定的矩形的像素的颜色信息。
When an application passes the handle returned by CreateCompatibleDC to one of the drawing functions, the requested output does not appear on a device's drawing surface. Instead, the system stores the color information for the resultant line, curve, text, or region in the array of bits. The application can copy the image stored in memory back onto a drawing surface by calling the BitBlt function, identifying the memory DC as the source device context and a window or screen DC as the target device context.
当一个应用程序传递返回 CreateCompatibleDC 绘图功能之一的句柄时,请求的输出不显示设备的绘图图面上。 相反,系统的位数组中存储结果行、 曲线、 文本或区域的颜色信息。 应用程序可以将复制存储在内存回上绘图图面中通过调用标识作为源设备环境和窗口或屏幕设备环境作为目标设备环境的内存区的 BitBlt 函数的图像。