Results 1 to 7 of 7

Thread: Qt crash at drawImage

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2016
    Posts
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Qt crash at drawImage

    Hi,
    I am relatively new to Qt programming. I have hit a dead end and seek help.
    I am running Qt in Linux.
    Following is my code -
    Qt Code:
    1. QPainter painter;
    2. QImage rcptImage(216, 560, QImage::Format_Mono);
    3.  
    4. painter.begin(&rcptImage);
    5.  
    6. QImage img("./test1.bmp");
    7. QImage::Format f = img.format();
    8. printf("%d\n", f);
    9. uchar* tempData = img.bits();
    10.  
    11. QImage img1(img.bits(), 320, 240, QImage::Format_Mono);
    12. QImage::Format f1 = img1.format();
    13.  
    14. painter.drawImage(QPoint(10,10), img1);
    15.  
    16. painter.end();
    17.  
    18. rcptImage.save("/home/chaitras/output1.bmp");
    To copy to clipboard, switch view to plain text mode 
    Program is crashing at "painter.drawImage(QPoint(10,10), img1);"

    test1.bmp is a 1bpp image - 360 x 260 x 1. Attached the image.

    I am trying to reading the bits from "img" and create a new image img1 using these bits.
    And using img1, which results in a crash.

    Stacktrace is pointing to a function "convertIndexedToARGB32PM Line 95"


    convertIndexedToARGB32PM Line 95
    blend_untransformed_generic Line 4264
    fillRect_normalized Line 1491
    QRasterPaintEngine::drawImage Line 2187
    QPainter::drawImage Line 5356
    QPainter::drawImage qpainter.h Line 852
    main


    Any help on this would be appreciated.
    Attached Images Attached Images
    Last edited by anda_skoa; 29th April 2016 at 09:39. Reason: missing [code] tags

Similar Threads

  1. QImage and drawImage method
    By ally in forum Newbie
    Replies: 3
    Last Post: 6th July 2015, 10:56
  2. QPainter::drawImage randomly(?) omits some images
    By Al_ in forum Qt Programming
    Replies: 1
    Last Post: 20th July 2014, 08:14
  3. Replies: 5
    Last Post: 13th November 2013, 01:54
  4. Factoring drawImage
    By Alundra in forum Qt Programming
    Replies: 0
    Last Post: 6th November 2013, 11:39
  5. QPainter.drawImage() not working with resource image file
    By thiagoalencar22 in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2010, 21:07

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.