我正在尝试在Windows CE6下使用CImage加载JPG图像。我在网上搜索过,但大多数都使用了如下所述的功能(但CE用户禁用了该功能):
CImage myImage;
myImage.Load(_T("C:\Image.jpg"));// Not available in windows CE
因为在 atlimage.h :
#ifndef _WIN32_WCE
inline HRESULT CImage::Load( IStream* pStream ) throw()
{
if( !InitGDIPlus() )
{
return( E_FAIL );
}
Gdiplus::Bitmap bmSrc( pStream );
if( bmSrc.GetLastStatus() != Gdiplus::Ok )
{
return( E_FAIL );
}
return( CreateFromGdiplusBitmap( bmSrc ) );
}
inline HRESULT CImage::Load( LPCTSTR pszFileName ) throw()
{
if( !InitGDIPlus() )
{
return( E_FAIL );
}
Gdiplus::Bitmap bmSrc( (CT2W)pszFileName );
if( bmSrc.GetLastStatus() != Gdiplus::Ok )
{
return( E_FAIL );
}
return( CreateFromGdiplusBitmap( bmSrc ) );
}
是否还有其他使用CImage或其他方法加载jpg / bmp / gif / png文件的替代方法?
答案 0 :(得分:0)
即使这是一篇旧帖子,我最近也在寻找这个,所以我想更新它。
Windows Ce 6支持IImagingFactory。这是一个痛苦但使用,但它的工作原理,您可以从磁盘或内存加载png或位图。
答案 1 :(得分:-1)
CImage::Load
在MFC下是definitely supported。
你能否澄清你对CE用户的禁用含义"?
没有" C"在Windows CE中驱动,所以你的示例代码不起作用,但是没有理由这样的事情不应该:
CImage myImage;
myImage.Load(_T("\\My Device\\Image.jpg"));