此帖出自嵌入式系统论坛
最新回复
贴代码 照这种格式来写,速度保证3秒内绘制完成,10M的图片都没有问题,用完的东西就赶快回收掉,内存宝贵呀。
BOOL CImageMaster::DrawIntegrity(HDC hdc, ImageDrawMode mode, const RECT *pDstRect, const RECT *pSrcRect, BOOL bDraw)
{
if(pDstRect == NULL)
{
return FALSE;
}
if (m_ImageInfo.Width >= 1024 || m_ImageInfo.Height >= 768)
{
RECT rcDraw = {0};
CalculateDrawArea(mode,pDstRect,pSrcRect,&rcDraw);//计算绘制区域
m_ImageInfo.Width = rcDraw.right - rcDraw.left;
m_ImageInfo.Height = rcDraw.bottom - rcDraw.top;
}
m_pImagingFactory->CreateBitmapFromImage(m_pImage, m_ImageInfo.Width, m_ImageInfo.Height, m_ImageInfo.PixelFormat, InterpolationHintDefault, &m_pBitmap);
if(m_pImage != NULL)
{
m_pImage->Release();
m_pImage = NULL;
}
m_pBitmap->QueryInterface(IID_IImage, (void **)&m_pImage);
if (m_pBitmap != NULL)
{
m_pBitmap->Release();
m_pBitmap = NULL;
}
if(IsOKMemoryDC(&m_IntegrityMemDCInfo) == FALSE)
{
if(IsOKImagingInterfaces() == FALSE)
{
return FALSE;
}
if(CreateMemoryDC(hdc,&m_IntegrityMemDCInfo,m_ImageInfo.Width,m_ImageInfo.Height) == FALSE)
{
return FALSE;
}
RECT rcMemDC = {0,0,m_ImageInfo.Width,m_ImageInfo.Height};
HRESULT hr = m_pImage->Draw(m_IntegrityMemDCInfo.hdc,&rcMemDC,NULL);
if(FAILED(hr))
{
ReleaseImagingInterfaces();
DeleteMemoryDC(&m_IntegrityMemDCInfo);
return FALSE;
}
}
BOOL bResult = TRUE;
if(bDraw == TRUE)
{
RECT rcDraw = {0};
CalculateDrawArea(mode,pDstRect,pSrcRect,&rcDraw);
bResult = Draw(hdc,&rcDraw,&m_IntegrityMemDCInfo,pSrcRect);
}
return bResult;
}
详情
回复
发表于 2010-3-8 17:33
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
| |
|
|
| |
|
|
浏览过的版块 |
EEWorld Datasheet 技术支持