Results 1 to 3 of 3

Thread: QImage.pixel and Format_Indexed8

  1. #1
    Join Date
    Sep 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QImage.pixel and Format_Indexed8

    Hi,

    i got a Problem (surprise!

    when I execute this code:

    Qt Code:
    1. QImage image1(10, 10, QImage::Format_Indexed8);
    2. QImage image2(10, 10, QImage::Format_Indexed8);
    3.  
    4. image1.fill(0);
    5. image2.fill(1);
    6.  
    7. image2.setPixel(1,1, image1.pixel(1,1));
    To copy to clipboard, switch view to plain text mode 

    I get this:

    ASSERT failure in QVector<T>::at: "index out of range", file c:\iwmake\build_vs2008_opensource_________________ padding_________________\include\qtcore\../../src/corelib/tools/qvector.h, line 338

    the weird thing is that i can access the imagedata via .bits. I can also show it in an QGraphicsScene....

    But why do the pixel und setpixel functions crash?

    thanks
    chef_seppel

  2. #2
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage.pixel and Format_Indexed8

    Quote Originally Posted by chef_seppel View Post
    But why do the pixel und setpixel functions crash?

    thanks
    chef_seppel
    is the pixel or setPixel that crashes?
    Franco Amato

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage.pixel and Format_Indexed8

    I think you have to set a colour table on an indexed image before you start manipulating its pixels.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Shifting a QImage up by 1 pixel row
    By MSUdom5 in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2010, 10:25
  2. QImage direct pixel access.
    By hickscorp in forum Qt Programming
    Replies: 3
    Last Post: 7th May 2010, 10:23
  3. QImage Pixel Coordinations
    By strateng in forum Newbie
    Replies: 2
    Last Post: 6th May 2010, 10:00
  4. Multithreaded per pixel operations on QImage
    By N¤X in forum Qt Programming
    Replies: 8
    Last Post: 14th September 2009, 12:29
  5. QImage-Greyscale-8-bits-pixel
    By Ivan Labrador in forum Newbie
    Replies: 5
    Last Post: 3rd August 2008, 00:08

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.