Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How do I make the pasted image clear?
Forum Updated to NodeBB v4.3 + New Features

How do I make the pasted image clear?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 268 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blackzero
    wrote on last edited by
    #1

    I created a save plot and want to put a logo in a predetermined position but after the logo is pasted the logo becomes broken or blurred, what should be done?

        int logoHeight = 30;
        QSize plotSize = ui->customPlot->size();
        QSize imageSize(plotSize.width(), plotSize.height() + logoHeight);
    
        QImage image(imageSize, QImage::Format_ARGB32);
        image.fill(Qt::white);
    
        QPainter painter(&image);
    
    
        ui->customPlot->setGeometry(0, logoHeight, plotSize.width(), plotSize.height());
        ui->customPlot->render(&painter);
        QString LogoGraph = (setLogoGp != "None") ? setLogoGp : ":/img/Logo.png";
        QPixmap logo(LogoGraph);
    
        if (!logo.isNull()) {
            int logoWidth = 150;
            int logoHeight = 25;
    
            QPixmap scaledLogo = logo.scaled(logoWidth, logoHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    
            int x = 50;
            int y = imageSize.height() - logoHeight - 5;
    
            painter.drawPixmap(QRect(x, y, logoWidth, logoHeight), scaledLogo);
        }
    
        image.save(fileName);
    
    Pl45m4P 1 Reply Last reply
    0
    • B Blackzero

      I created a save plot and want to put a logo in a predetermined position but after the logo is pasted the logo becomes broken or blurred, what should be done?

          int logoHeight = 30;
          QSize plotSize = ui->customPlot->size();
          QSize imageSize(plotSize.width(), plotSize.height() + logoHeight);
      
          QImage image(imageSize, QImage::Format_ARGB32);
          image.fill(Qt::white);
      
          QPainter painter(&image);
      
      
          ui->customPlot->setGeometry(0, logoHeight, plotSize.width(), plotSize.height());
          ui->customPlot->render(&painter);
          QString LogoGraph = (setLogoGp != "None") ? setLogoGp : ":/img/Logo.png";
          QPixmap logo(LogoGraph);
      
          if (!logo.isNull()) {
              int logoWidth = 150;
              int logoHeight = 25;
      
              QPixmap scaledLogo = logo.scaled(logoWidth, logoHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
      
              int x = 50;
              int y = imageSize.height() - logoHeight - 5;
      
              painter.drawPixmap(QRect(x, y, logoWidth, logoHeight), scaledLogo);
          }
      
          image.save(fileName);
      
      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Blackzero said in How do I make the pasted image clear?:

      what should be done?

      Use proper image- and logo dimensions and don't scale your image after the logo is added since they do not seem so share the same aspect ratio.
      If you stretch or shrink your image with the logo inside, the logo may look bad afterwards


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      B 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @Blackzero said in How do I make the pasted image clear?:

        what should be done?

        Use proper image- and logo dimensions and don't scale your image after the logo is added since they do not seem so share the same aspect ratio.
        If you stretch or shrink your image with the logo inside, the logo may look bad afterwards

        B Offline
        B Offline
        Blackzero
        wrote on last edited by
        #3

        @Pl45m4 However, the size of the actual logo is so large that it is enough to cover the entire screen, is there a solution to make it clear, so that it still manages the size of the logo?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved