Results 1 to 2 of 2

Thread: Huge image tearing / disappearing on extreme scaling

  1. #1
    Join Date
    Jul 2015
    Posts
    52
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Huge image tearing / disappearing on extreme scaling

    I have a big image of 7589x5537 that I put in a scene as a QPixmapGraphicsItem.

    If I scale the QGraphicsView to 14.2318 and rotate it -35 degrees, the render of the pixmap starts behaving weirdly; tearing or completely disappearing.

    This happens also at other rotations and scales, but only if they are big scaling of more than 14.

    I've read about X11 limitations but I'm on Windows.

    I'm on Qt 5.5

    I've tested changing the content of the image to a bucketfill of tree pattern, exactly the same behaviour. The image is indexed, but with a RGB I have the same issue.

    Anybody has a clue why this happens and how to fix it? Is the problem reproducible?

    Qt Code:
    1. #include <QtWidgets>
    2.  
    3. int main(int argc, char *argv[]) {
    4. QApplication a(argc, argv);
    5. QFileInfo imagefile("tree_map.png");
    6.  
    7. QPixmap imagepm(imagefile.absoluteFilePath());
    8.  
    9. item->setTransformationMode(Qt::FastTransformation);
    10. scene->addItem(item);
    11.  
    12. QGraphicsView* view = new QGraphicsView(scene);
    13. view->rotate(-35);
    14. view->scale(14.2318,14.2318);
    15. view->show();
    16. return a.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 

    I'm not sure the image is correctly handled by Qt Forums and, although I believe anybody could create it again, you will also find it here:

    https://www.dropbox.com/s/y4ibs7p1j0...e_map.jpg?dl=0
    Attached Images Attached Images

  2. #2
    Join Date
    Jul 2015
    Posts
    52
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Huge image tearing / disappearing on extreme scaling

    I haven't found how to edit the previous post in the forum. Here a MWE example that auto-generates the image:

    Qt Code:
    1. #include <QtWidgets>
    2.  
    3. int main(int argc, char *argv[]) {
    4. QApplication a(argc, argv);
    5.  
    6. unsigned int w = 7589;
    7. unsigned int h = 5537;
    8.  
    9. QImage image(w, h, QImage::Format_ARGB32);
    10. for(unsigned int j = 0; j < h; j++)
    11. {
    12. for(unsigned int i = 0; i < w; i++)
    13. {
    14. QRgb rgb = qRgb(i%255,j%255,(i+j)%255);
    15. image.setPixel(i, j, rgb);
    16. }
    17. }
    18.  
    19. QPixmap imagepm = QPixmap::fromImage(image);
    20.  
    21. item->setTransformationMode(Qt::FastTransformation);
    22. scene->addItem(item);
    23.  
    24. QGraphicsView* view = new QGraphicsView(scene);
    25. view->rotate(-35);
    26. view->scale(14.2318,14.2318);
    27. view->show();
    28. return a.exec();
    29. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 6
    Last Post: 7th January 2016, 10:53
  2. Replies: 4
    Last Post: 15th May 2013, 13:58
  3. Scaling window with image
    By danioto in forum Newbie
    Replies: 6
    Last Post: 20th October 2012, 13:58
  4. Issue in exporting image with huge GraphicScene
    By rangde1pratu in forum Qt Programming
    Replies: 4
    Last Post: 13th April 2012, 09:21
  5. QWebView and image scaling
    By naresh in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2010, 03:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.