예제 #1
0
QImage mutableSquareImageContainer::scaledImage() const {

  QHash<triC, QImage> colorSquares;
  const QVector<triC>& squareColors = colors();
  const int curDimension = scaledDimension();
  const grid baseImage(image(), originalDimension_);
  QImage squareImage(curDimension, curDimension, QImage::Format_RGB32);
  for (int i = 0, size = squareColors.size(); i < size; ++i) {
    const triC& thisImageColor = squareColors[i];
    squareImage.fill(thisImageColor.qrgb());
    colorSquares[thisImageColor] = squareImage;
  }

  QImage returnImage(scaledSize(), QImage::Format_RGB32);
  QPainter painter(&returnImage);
  for (int yBox = 0; yBox < heightSquareCount_; ++yBox) {
    for (int xBox = 0; xBox < widthSquareCount_; ++xBox) {
      const triC& thisSquareColor =
        baseImage(xBox*originalDimension_, yBox*originalDimension_);
      painter.drawImage(QPoint(xBox*curDimension, yBox*curDimension),
                        colorSquares[thisSquareColor]);

    }
  }
  return returnImage;
}
예제 #2
0
Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
        QImage baseImage("D:/TobyYi/yibansvn/github-project/OrderManager/QuickViewTest/logo_72.png");
        QImage overlayLogoff("D:/TobyYi/yibansvn/ReleaseVerYibanPC/YibanClient/image/skin/tab_btn_close_hover.png");
        imgLb = new QLabel(this);
        QImage logoffImage = createImageWithOverlay(baseImage, overlayLogoff);
        imgLb->setScaledContents(true);
        imgLb->setPixmap(QPixmap::fromImage(logoffImage));
        imgLb->show();
        logoffImage.save("xx.png");
}
예제 #3
0
QImage QWindowCompositor::makeBackgroundImage(const QString &fileName)
{
    Q_ASSERT(m_window);

    int width = m_window->width();
    int height = m_window->height();
    QImage baseImage(fileName);
    QImage patternedBackground(width, height, baseImage.format());
    QPainter painter(&patternedBackground);

    QSize imageSize = baseImage.size();
    for (int y = 0; y < height; y += imageSize.height()) {
        for (int x = 0; x < width; x += imageSize.width()) {
            painter.drawImage(x, y, baseImage);
        }
    }

    return patternedBackground;
}