WIN32,GetBitmapBits与GetPixel
2017-03-15 11:58
344 查看
先看看MSDN上的,
The GetBitmapBits function copies the bitmap bits of a specified device-dependent bitmap into a buffer.
LONG GetBitmapBits(
_In_ HBITMAP hbmp,
_In_ LONG cbBuffer,
_Out_ LPVOID lpvBits
);
hbmp [in]
A handle to the device-dependent bitmap.
cbBuffer [in]
The number of bytes to copy from the bitmap into the buffer.
lpvBits [out] A pointer to a buffer to receive the bitmap bits. The bits are stored as an array of byte values
获取位图数据,并将数据拷贝到缓冲区中(第三个参数),位图数据是跟具体设备相关的。一般获取的位图数据为32位,如果将其保存为jpg的话,需要转换成24位的才行,某些开源看暂时不支持32的rgb空间位图。
GetPixel:
The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.
COLORREF GetPixel(
_In_ HDC hdc,
_In_ int nXPos,
_In_ int nYPos
);
获取点(x,y)下的像素值。
两者均可以获取图像数据,但是GetBitmapBits要比GetPixel快至少10倍,所以当频繁读取具体像素值时,最好用GetBitmapBits。以前做过一个项目,创建一个位图,然后在上面绘制文本,然后把结果保存为图片,这时,采用GetBitmapBits拷贝数据。
The GetBitmapBits function copies the bitmap bits of a specified device-dependent bitmap into a buffer.
LONG GetBitmapBits(
_In_ HBITMAP hbmp,
_In_ LONG cbBuffer,
_Out_ LPVOID lpvBits
);
hbmp [in]
A handle to the device-dependent bitmap.
cbBuffer [in]
The number of bytes to copy from the bitmap into the buffer.
lpvBits [out] A pointer to a buffer to receive the bitmap bits. The bits are stored as an array of byte values
获取位图数据,并将数据拷贝到缓冲区中(第三个参数),位图数据是跟具体设备相关的。一般获取的位图数据为32位,如果将其保存为jpg的话,需要转换成24位的才行,某些开源看暂时不支持32的rgb空间位图。
GetPixel:
The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.
COLORREF GetPixel(
_In_ HDC hdc,
_In_ int nXPos,
_In_ int nYPos
);
获取点(x,y)下的像素值。
两者均可以获取图像数据,但是GetBitmapBits要比GetPixel快至少10倍,所以当频繁读取具体像素值时,最好用GetBitmapBits。以前做过一个项目,创建一个位图,然后在上面绘制文本,然后把结果保存为图片,这时,采用GetBitmapBits拷贝数据。
相关文章推荐
- (vb)利用GetBitmapBits,SetBitmapBits加速图像处理
- GetBitmapBits和GetDIBits的区别(Windows GDI)
- GetObject 和 GetBitmapBits 获取位图数据的区别
- GetBitmapBits与GetDIBits补零对齐的比较
- BMP、文件格式、调色板、GetBitmapBits函数使用散记
- 在.net 中调用win32API :GetBitmapBits ,获取位图的颜色数组,发送给打印机。
- GetBitmapBits和GetDIBits的区别(Windows GDI)
- GetBitmapBits和GetDIBits的区别(Windows GDI)
- Cbitmap GetBitmapBits Copies the bits of the specified bitmap into the specified buffer http://msdn.microsoft.com/en-US/library/txffs5y2(v=vs.80).aspx
- GetBitmapBits和GetDibits函数得到的图像数据的顺序是相反的
- GetBitmapBits捕获视频帧
- GetBitmapFromScreen
- getBitmap.getWidth获取图片不是实际图片大小
- Win32 to .NET API Map
- Microsoft Win32 to Microsoft .NET Framework API Map
- SDWebimag提示 GBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 40 错误
- Bentley Map Enterprise V8i v08.11.09.805 CHS Win32 1DVD
- CBitmap::GetBitmap
- Microsoft Win32 to Microsoft .NET Framework API Map
- c#学习必修:Microsoft Win32 to Microsoft .NET Framework API Map