16,802
社区成员




bool CdlgImgwidget::_LoadIndexPage( QString Imgepath,uint PageIndex /*= 0*/ )
{
bool bReturn = false;
m_bShowView = false;
CxImage *pximage = new CxImage;
if(pximage->Load(Imgepath.toAscii().constData()))
{
UINT nCountPage=pximage->GetNumFrames();
if(nCountPage > PageIndex)
{
pximage->SetFrame(PageIndex);
pximage->Load(Imgepath.toAscii().constData());
if(pximage->IsValid())
{
HBITMAP bm = pximage->MakeBitmap(NULL);
*m_SrcPixmap = QPixmap::fromWinHBITMAP(bm);
m_ImgSrcSize = m_SrcPixmap->size();
int dvDpiX = m_SrcPixmap->logicalDpiX();
int dvDpiY = m_SrcPixmap->logicalDpiY();
int imgDpiX = pximage->GetXDPI();
int imgDpiY = pximage->GetYDPI();
m_ImgViewSize.setWidth(m_ImgSrcSize.width() * dvDpiX / imgDpiX + 6);
m_ImgViewSize.setHeight(m_ImgSrcSize.height() * dvDpiY / imgDpiY);
*m_ViewPixmap = m_SrcPixmap->scaled(m_ImgViewSize.width(),m_ImgViewSize.height(),Qt::KeepAspectRatio, Qt::SmoothTransformation);
m_nCurrentIndexPage = PageIndex;
bReturn = true;
m_bShowView = true;
}
}
}
delete pximage;
pximage = NULL;
return bReturn;
}