CImage转换Gdiplus::Bitmap
来源:互联网 发布:java 有序集合 编辑:程序博客网 时间:2024/05/18 02:59
Gdiplus::Bitmap* CImage2Image(const CImage* pImage )
{
if(!pImage)
return NULL;
Gdiplus::Bitmap* image = new Gdiplus::Bitmap( pImage->GetWidth(), pImage->GetHeight() );
Gdiplus::Rect bound( 0, 0, pImage->GetWidth(), pImage->GetHeight() );
Gdiplus::BitmapData lockedBitmapData;
int bpp = pImage->GetBPP();
int imageRowSize = pImage->GetWidth() * (bpp/8);
if ( bpp == 24 )
{
image->LockBits( &bound, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &lockedBitmapData );
}
else if ( bpp == 32 )
{
image->LockBits( &bound, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &lockedBitmapData );
}
else
{
// we shouldn't be getting here
AfxDebugBreak();
return NULL;
}
BYTE* pSrcPointer = (BYTE*)pImage->GetBits();
BYTE* pDstPointer = (BYTE*)lockedBitmapData.Scan0;
for ( int i=0; i<pImage->GetHeight(); i++ )
{
memcpy( pDstPointer, pSrcPointer, imageRowSize );
pSrcPointer += pImage->GetPitch();
pDstPointer += lockedBitmapData.Stride;
}
image->UnlockBits( &lockedBitmapData );
return image;
}
{
if(!pImage)
return NULL;
Gdiplus::Bitmap* image = new Gdiplus::Bitmap( pImage->GetWidth(), pImage->GetHeight() );
Gdiplus::Rect bound( 0, 0, pImage->GetWidth(), pImage->GetHeight() );
Gdiplus::BitmapData lockedBitmapData;
int bpp = pImage->GetBPP();
int imageRowSize = pImage->GetWidth() * (bpp/8);
if ( bpp == 24 )
{
image->LockBits( &bound, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &lockedBitmapData );
}
else if ( bpp == 32 )
{
image->LockBits( &bound, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &lockedBitmapData );
}
else
{
// we shouldn't be getting here
AfxDebugBreak();
return NULL;
}
BYTE* pSrcPointer = (BYTE*)pImage->GetBits();
BYTE* pDstPointer = (BYTE*)lockedBitmapData.Scan0;
for ( int i=0; i<pImage->GetHeight(); i++ )
{
memcpy( pDstPointer, pSrcPointer, imageRowSize );
pSrcPointer += pImage->GetPitch();
pDstPointer += lockedBitmapData.Stride;
}
image->UnlockBits( &lockedBitmapData );
return image;
}
- CImage转换Gdiplus::Bitmap
- 数组转换为Gdiplus::Bitmap
- Gdiplus byte *数据转换为Bitmap类型图片
- gdiplus Bitmap 转 gdi BITMAP
- OpenCV中IplImage 与 Gdiplus 中Bitmap之间的相互转换
- OpenCV中IplImage 与 Gdiplus 中Bitmap之间的相互转换
- gdiplus图片格式转换
- CImage封装gdiplus的初始化和引用计数
- 通过BYTE数组创建Gdiplus::Bitmap
- new Gdiplus::Bitmap(100,200); error C2660
- Gdiplus::Bitmap::FromStream 加载资源失败
- Gdiplus::Bitmap::FromStream 加载资源失败
- Opencv Mat转MFC Gdiplus::Bitmap
- GDIPLUS
- CImage 与 Mat 相互转换
- error C2664: 'Gdiplus::Bitmap::LockBits' : cannot convert parameter 1 from 'Gdiplus::Rect *__w64 '
- CImage
- CImage
- 70路小报:美国最佳投资人泰尔给创业者的建议
- 创意味儿十足的web布局及交互设计
- Android 获取当前日期和时间
- GoldenGate安装及配置
- C++的语义类型和弱引用
- CImage转换Gdiplus::Bitmap
- mysql的引擎讲解
- 报错:org.hibernate.HibernateException: No Hibernate Session bound to thread
- J2EE开发框架(ssh)发展史
- libnl1.1-6 /netlink/genl/genl.h no such directory
- 中国量子芯片又破世界纪录 实现最快量子逻辑门
- 记WinCE下调试SIM900 GSM module
- Testlink1.9.5安装配置及使用手册
- Encounter with Mathematics - 《数学概观》