• 5103阅读
  • 1回复

求助win下QImage save图片有问题 [复制链接]

上一主题 下一主题
离线notton
 

只看楼主 倒序阅读 楼主  发表于: 2010-12-14
  用QT自建了一个登陆帐号(root)的目录:C:\Documents and Settings\root\soft\temp,但在这个目录下QImage save 图片失败,如何解决?XP下没有问题,在此目录下生成日志文件也没有问题。

     QImage fixedImage(videoW, videoH, QImage::Format_ARGB32_Premultiplied);
    QPainter painter(&fixedImage);
    painter.setCompositionMode(QPainter::CompositionMode_Source);
    painter.fillRect(fixedImage.rect(), Qt::transparent);
    painter.setCompositionMode(QPainter::CompositionMode_SourceOver);

    for(i=0; i<count; i++)
    {
        int idx = listIdx.at(i);
        double ratio = m_treeItem->mdata("effect_video_ratio").toDouble();
        QRect r = m_treeItem->getDataItem("effect_item_rect", idx).toRect();

        r.moveLeft(r.left() * ratio);
        r.moveTop(r.top() * ratio);

        painter.drawImage(r.topLeft(), *img);
    }
                    painter.end();
     bool bOk = fixedImage.save(watermarkFile);    
    
c++ dev
离线notton

只看该作者 1楼 发表于: 2010-12-15
QImage fixedImage(videoW, videoH, QImage::Format_ARGB32_Premultiplied);
由于传递参数没有检验,videoW, videoH为0造成的.

c++ dev
快速回复
限100 字节
 
上一个 下一个