2010-08-04

Slitaz -- Qt / coverflow



coverflow.cpp
#include <qdiriterator>
#include <qimagereader>
#include <qthreadpool>
#include <qpaintevent>
#include <qfileinfo>
#include <qpainter>
#include <qcache>

#include "coverflow_p.h"
#include "coverflow.h"

#define COVERFLOW_IMAGE_HEIGHT (200)
#define COVERFLOW_IMAGE_WIDTH (250)

/* ============================================================================
* PRIVATE Methods
*/
static QImage *mirrorImage (const QImage *image) {
QImage *tmpImage = new QImage(image->mirrored(false, true));

QPoint p1, p2;
p2.setY(tmpImage->height());

QLinearGradient gradient(p1, p2);
gradient.setColorAt(0, QColor(0, 0, 0, 100));
gradient.setColorAt(1, Qt::transparent);

QPainter p(tmpImage);
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
p.fillRect(0, 0, tmpImage->width(), tmpImage->height(), gradient);
p.end();

return(tmpImage);
}
[..]