All pastes #121908 Raw Edit

Anonymous

public cpp v1 · immutable
·published 2006-08-08 07:46 UTC
rendered paste body
#include <QtGui>QImage rotateRgb(const QImage &in){  QImage out(in.size(), in.format());  //QImage out(in.size(), in.format());  for(int line = 0; line < in.height(); line++) {    //const QRgb* inPixels = reinterpret_cast<const QRgb*>(in.scanLine(line));    //QRgb* outPixels = reinterpret_cast<QRgb*>(out.scanLine(line));    for(int pos = 0; pos < in.width(); pos++) {      char red = qRed(in.pixel(line, pos));      char green = qGreen(in.pixel(line, pos));      char blue = qBlue(in.pixel(line, pos));      char alpha = qAlpha(in.pixel(line, pos));      //qDebug() << QColor(inPixels[pos]);      //QRgb outpix = qRgba(red, green, blue, alpha);      //outPixels[pos] = outpix;      out.setPixel(line, pos, qRgba(red, green, blue, alpha));    }  }  return out;}int main(int argc, char* argv[]){  QApplication app(argc, argv);  QImage img("qt.png");  QLabel rgb;  img = rotateRgb(img);  QLabel brg;  brg.setPixmap(QPixmap::fromImage(img));  img = rotateRgb(img);  QLabel grb;  grb.setPixmap(QPixmap::fromImage(img));  img = rotateRgb(img);  rgb.setPixmap(QPixmap::fromImage(img));  rgb.show();  brg.show();  grb.show();  return app.exec();}