Algoritm for collect UChar* from a QImage Object



  • Hi!

    I need perform some custom operations between the texture creation process in OpenGL, but the bindtexture operation in Qt encapsulate all this operations(Like WrapS ant WrapT texture coordinates).

    It means i will need call the OpenGL bind and create Mipmaps myself without Qt , and to do that i will need access to the UChar data inside a QImage previously loaded.

    Looking at the QImage Object, it exposes the UChar* data in a different fashion, where we have "Lines" of data instead of have a big block of data.

    Anyone there have an already done alogorithm to read an entire image from a QImage object in a unsigned char* array?

    Kind Regards.



  • image->bits()

    I dont think Qt devs would store each line in a different memory section...
    First line pointer valid too, or it should be.



  • Indeed. However, note that there might be padding between scanlines depending on your image size and format.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.