All pastes #121891 Raw Edit

Something

public cpp v1 · immutable
·published 2006-08-08 07:29 UTC
rendered paste body
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()/4; pos++) {      char red = qRed(inPixels[pos]);      char green = qGreen(inPixels[pos]);      char blue = qBlue(inPixels[pos]);      char alpha = qAlpha(inPixels[pos]);      //qDebug() << QColor(inPixels[pos]);      QRgb outpix = qRgba(red, green, blue, alpha);      outPixels[pos] = outpix;    }  }  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();}