网站首页  词典首页

请输入您要查询的函数:

 

术语 createbitmap
释义 CreateBitmap
语法:
HBITMAP CreateBitmap(
__in int nWidth,
__in int nHeight,
__in UINT cPlanes,
__in UINT cBitsPerPel,
__in const VOID *lpvBits
);
CreateBitmap函数
该CreateBitmap函数创建一个具有指定宽度,高度位图和颜色格式(彩色飞机位每像素)。
参数
nWidth [in]
位图的宽度,以像素为单位。
nHeight [in]
位图高度,以像素为单位。
cPlanes [in]
该设备使用的颜色飞机数量。
cBitsPerPel [in]
所要求的,以确定一个像素的颜色位数。
lpvBits [in]
一个对色彩数据数组用于设置的像素矩形的颜色指针。每次扫描的矩形线必须字对齐(扫描线未字对齐必须用零填充)。如果该参数是NULL,新图的内容是不确定的。
返回值
如果函数成功,返回值是一个位图句柄。
如果函数失败,返回值为NULL。
这个函数可以返回以下值。
返回codeDescription
ERROR_INVALID_BITMAPThe位图计算的大小小于零。
备注
该CreateBitmap函数创建一个依赖于设备的位图。
之后创建一个位图,它可以成为一个设备上下文选择通过调用SelectObject函数。然而,位图,只能选择到设备上下文,如果位图和区具有相同的格式。
该CreateBitmap函数可用于制造彩色位图。然而,出于性能方面的应用程序应该使用CreateBitmap创建单色位图和CreateCompatibleBitmap创建位图的颜色。每当从CreateBitmap色位图选入返回一个设备上下文时,系统会检查位图相匹配的设备上下文它被选定为格式。由于CreateCompatibleBitmap需要一个设备上下文,它返回一个位图,它具有与指定的设备上下文相同的格式。因此,后续调用SelectObject更快了由CreateCompatibleBitmap色位图比位图的颜色从CreateBitmap返回。
如果位图是单色的,零代表前景色的代表和为目标设备上下文的背景颜色。
如果应用程序设置nWidth或nHeight参数为零,CreateBitmap返回句柄1 × 1像素,单色位图。
当您不再需要的位图,调用DeleteObject函数将其删除。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
参见
位图概述
位图功能
CreateBitmapIndirect
CreateCompatibleBitmap
CreateDIBitmap
DeleteObject
GetBitmapBits
SelectObject
SetBitmapBits
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==CreateBitmap Function
The CreateBitmap function creates a bitmap with the specified width, height, and color format (color planes and bits-per-pixel).
Syntax
HBITMAP CreateBitmap(
__in int nWidth,
__in int nHeight,
__in UINT cPlanes,
__in UINT cBitsPerPel,
__in const VOID *lpvBits
);
Parameters
nWidth [in]
The bitmap width, in pixels.
nHeight [in]
The bitmap height, in pixels.
cPlanes [in]
The number of color planes used by the device.
cBitsPerPel [in]
The number of bits required to identify the color of a single pixel.
lpvBits [in]
A pointer to an array of color data used to set the colors in a rectangle of pixels. Each scan line in the rectangle must be word aligned (scan lines that are not word aligned must be padded with zeros). If this parameter is NULL, the contents of the new bitmap is undefined.
Return Value
If the function succeeds, the return value is a handle to a bitmap.
If the function fails, the return value is NULL.
This function can return the following value.
Return codeDescription
ERROR_INVALID_BITMAPThe calculated size of the bitmap is less than zero.

Remarks
The CreateBitmap function creates a device-dependent bitmap.
After a bitmap is created, it can be selected into a device context by calling the SelectObject function. However, the bitmap can only be selected into a device context if the bitmap and the DC have the same format.
The CreateBitmap function can be used to create color bitmaps. However, for performance reasons applications should use CreateBitmap to create monochrome bitmaps and CreateCompatibleBitmap to create color bitmaps. Whenever a color bitmap returned from CreateBitmap is selected into a device context, the system checks that the bitmap matches the format of the device context it is being selected into. Because CreateCompatibleBitmap takes a device context, it returns a bitmap that has the same format as the specified device context. Thus, subsequent calls to SelectObject are faster with a color bitmap from CreateCompatibleBitmap than with a color bitmap returned from CreateBitmap.
If the bitmap is monochrome, zeros represent the foreground color and ones represent the background color for the destination device context.
If an application sets the nWidth or nHeight parameters to zero, CreateBitmap returns the handle to a 1-by-1 pixel, monochrome bitmap.
When you no longer need the bitmap, call the DeleteObject function to delete it.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWingdi.h (include Windows.h)
LibraryGdi32.lib
DLLGdi32.dll
See Also
Bitmaps Overview
Bitmap Functions
CreateBitmapIndirect
CreateCompatibleBitmap
CreateDIBitmap
DeleteObject
GetBitmapBits
SelectObject
SetBitmapBits
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183485(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:19:21