经过如下转换的图片如何保存,求救啊,代码如下
QImage* ReflectPicture :: reflect(QImage*imgSrc,const QColor& c)
{
QRgb bgcolor=c.rgb();
int dy;
int h=imgSrc->height();
dy=h/3;
int w=imgSrc->width();
int hs=h*2 ;
int hofs=0;//h/3 ;
Qt :: TransformationMode mode=Qt :: SmoothTransformation ;
QImage img=imgSrc->scaled(w,h,Qt :: IgnoreAspectRatio,mode);
QImage *result=new QImage(w,hs,QImage :: Format_RGB32);
result->fill(bgcolor);
for(int x=0;x<w;x++)
for(int y=0;y<h;y++)
result->setPixel(x,hofs+y,img.pixel(x,y));
if(reflectionEffect!=NoReflection)
{
int ht=hs-h-hofs ;
int hte=ht ;
for(int x=0;x<w;x++)
for(int y=0;y<ht;y++)
{
QRgb color=img.pixel(x,img.height()-y-1);
result->setPixel(x,h+hofs+y,blendColor(color,bgcolor,128*(hte-dy)/hte));
}
}
return result ;
}
[ 此帖被dianfengxiao在2009-07-23 09:49重新编辑 ]