网站首页  词典首页

请输入您要查询的函数:

 

术语 createdibsection
释义 CreateDIBSection
语法:
HBITMAP CreateDIBSection(
__in HDC hdc,
__in const BITMAPINFO *pbmi,
__in UINT iUsage,
__out VOID **ppvBits,
__in HANDLE hSection,
__in DWORD dwOffset
);
CreateDIBSection函数
该CreateDIBSection函数创建一个DIB中的应用程序可以直接写入。该功能为您提供了一个指向位图的位值的位置。您可以提供一个处理一个文件映射对象,该函数将用于创建位图,也可以让系统分配为位图的内存。
参数
hdc [in]
一个句柄,设备上下文。如果iUsage价值DIB_PAL_COLORS,该函数使用该设备上下文的逻辑调色板初始化DIB的颜色。
pbmi [in]
一个BITMAPINFO结构,指定DIB的,包括位图的尺寸和颜色的各种属性的指针。
iUsage [in]
对在BITMAPINFO结构bmiColors数组成员中的数据类型指出pbmi至(或逻辑调色板索引或文字RGB值)。下面的值定义。
ValueMeaning
DIB_PAL_COLORSThe成员bmiColors是一个16个数组进入其中hdc指定的设备环境的逻辑调色板位索引。
DIB_RGB_COLORSThe BITMAPINFO结构包含一个文字的RGB值的数组。
ppvBits [out]
一个变量,它接收一个指向DIB的位值的指针。
hSection [in]
一个句柄,文件映射对象,该函数将使用创建的DIB。此参数可以为NULL。
如果hSection不是NULL,它必须是一个处理一个文件映射对象通过调用PAGE_READWRITE或PAGE_WRITECOPY旗CreateFileMapping函数创建。只读DIB的部分不支持。其他方式处理会导致CreateDIBSection创建失败。
如果hSection不是NULL,则CreateDIBSection功能定位偏移量在文件dwOffset位位值映射对象提到hSection。应用程序可以在以后检索hSection处理调用与HBITMAP的GetObject函数CreateDIBSection返回。
如果hSection为NULL,系统分配的DIB的内存。在这种情况下,CreateDIBSection函数忽略dwOffset参数。应用程序不能以后能获得的句柄,该内存。在填补调用GetObject函数将为NULL在DIBSECTION结构dshSection成员。
dwOffset [in]
偏移量从文件的开头映射对象引用的hSection在为位图位值存储开始。此值被忽略,如果hSection为NULL。位图位值是双字边界对齐,所以dwOffset必须是一个DWORD大小的倍数。
返回值
如果函数成功,返回值是一个句柄到新创建的DIB,和* ppvBits点位图位值。
如果函数失败,返回值为NULL,* ppvBits为NULL。
这个函数可以返回以下值。
返回codeDescription
ERROR_INVALID_PARAMETEROne或输入参数更是无效的。
备注
如上所述,如果hSection为NULL,系统分配的DIB的内存。该系统关闭句柄,内存当您稍后删除调用DeleteObject函数的DIB。如果hSection不是NULL,您必须关闭hSection内存处理后调用DeleteObject删除自己的位图。
您不能从一个应用程序粘贴到另一个应用程序中的DIB部分。
CreateDIBSection不使用位图信息参数biXPelsPerMeter或90400,未能提供决议BITMAPINFO结构的信息。
您需要保证的GDI子系统已完成任何绘图由CreateDIBSection创建了一个位图,然后再提请位图自己。访问位图必须是同步的。通过调用这个函数的GdiFlush。这适用于任何指针使用位图位值,包括通过诸如SetDIBits在调用的函数指针。
ICM的:没有色彩管理工作。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
参见
位图概述
位图功能
BITMAPINFO
CreateFileMapping
DeleteObject
DIBSECTION
GetDIBColorTable
GetObject
GdiFlush
SetDIBits
SetDIBColorTable
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==CreateDIBSection Function
The CreateDIBSection function creates a DIB that applications can write to directly. The function gives you a pointer to the location of the bitmap bit values. You can supply a handle to a file-mapping object that the function will use to create the bitmap, or you can let the system allocate the memory for the bitmap.
Syntax
HBITMAP CreateDIBSection(
__in HDC hdc,
__in const BITMAPINFO *pbmi,
__in UINT iUsage,
__out VOID **ppvBits,
__in HANDLE hSection,
__in DWORD dwOffset
);
Parameters
hdc [in]
A handle to a device context. If the value of iUsage is DIB_PAL_COLORS, the function uses this device context's logical palette to initialize the DIB colors.
pbmi [in]
A pointer to a BITMAPINFO structure that specifies various attributes of the DIB, including the bitmap dimensions and colors.
iUsage [in]
The type of data contained in the bmiColors array member of the BITMAPINFO structure pointed to by pbmi (either logical palette indexes or literal RGB values). The following values are defined.
ValueMeaning
DIB_PAL_COLORSThe bmiColors member is an array of 16-bit indexes into the logical palette of the device context specified by hdc.
DIB_RGB_COLORSThe BITMAPINFO structure contains an array of literal RGB values.

ppvBits [out]
A pointer to a variable that receives a pointer to the location of the DIB bit values.
hSection [in]
A handle to a file-mapping object that the function will use to create the DIB. This parameter can be NULL.
If hSection is not NULL, it must be a handle to a file-mapping object created by calling the CreateFileMapping function with the PAGE_READWRITE or PAGE_WRITECOPY flag. Read-only DIB sections are not supported. Handles created by other means will cause CreateDIBSection to fail.
If hSection is not NULL, the CreateDIBSection function locates the bitmap bit values at offset dwOffset in the file-mapping object referred to by hSection. An application can later retrieve the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection.
If hSection is NULL, the system allocates memory for the DIB. In this case, the CreateDIBSection function ignores the dwOffset parameter. An application cannot later obtain a handle to this memory. The dshSection member of the DIBSECTION structure filled in by calling the GetObject function will be NULL.
dwOffset [in]
The offset from the beginning of the file-mapping object referenced by hSection where storage for the bitmap bit values is to begin. This value is ignored if hSection is NULL. The bitmap bit values are aligned on doubleword boundaries, so dwOffset must be a multiple of the size of a DWORD.
Return Value
If the function succeeds, the return value is a handle to the newly created DIB, and *ppvBits points to the bitmap bit values.
If the function fails, the return value is NULL, and *ppvBits is NULL.
This function can return the following value.
Return codeDescription
ERROR_INVALID_PARAMETEROne or more of the input parameters is invalid.

Remarks
As noted above, if hSection is NULL, the system allocates memory for the DIB. The system closes the handle to that memory when you later delete the DIB by calling the DeleteObject function. If hSection is not NULL, you must close the hSection memory handle yourself after calling DeleteObject to delete the bitmap.
You cannot paste a DIB section from one application into another application.
CreateDIBSection does not use the BITMAPINFOHEADER parameters biXPelsPerMeter or biYPelsPerMeter and will not provide resolution information in the BITMAPINFO structure.
You need to guarantee that the GDI subsystem has completed any drawing to a bitmap created by CreateDIBSection before you draw to the bitmap yourself. Access to the bitmap must be synchronized. Do this by calling the GdiFlush function. This applies to any use of the pointer to the bitmap bit values, including passing the pointer in calls to functions such as SetDIBits .
ICM: No color management is done.
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
BITMAPINFO
CreateFileMapping
DeleteObject
DIBSECTION
GetDIBColorTable
GetObject
GdiFlush
SetDIBits
SetDIBColorTable
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183494(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:23:51