All pastes #121925 Raw Edit

Stuff

public cpp v1 · immutable
·published 2006-08-08 08:17 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++) {      int red = qRed(in.pixel(pos, line));      int green = qGreen(in.pixel(pos, line));      int blue = qBlue(in.pixel(pos, line));      int alpha = qAlpha(in.pixel(pos, line));      //qDebug() << QColor(inPixels[pos]);      //QRgb outpix = qRgba(red, green, blue, alpha);      //outPixels[pos] = outpix;      out.setPixel(pos, line, qRgba(red, green, blue, alpha));    }  }  return out;}int main(int argc, char* argv[]){  QApplication app(argc, argv);  QImage img("/Users/axeljaeger/Documents/qimgtext/Bild 1.png");  QLabel rgb;  img = rotateRgb(img);  img.save("/Users/axeljaeger/Desktop/test.png", "PNG");  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();}