[Qt-interest] QT program having issues over VNC

Cole, Derek dcole at integrity-apps.com
Tue May 24 16:53:01 CEST 2011


Well, where I call that bits() method, I am just trying to get the raw data from the image chip. I store it in this loop like so:

     int chipDataLength = chip.bytesPerLine();
     int bpp = chipDataLength/imwidth;

 unsigned char * tempData = (unsigned char *)malloc(imheight*chipDataLength*sizeof(unsigned char));
unsigned char * oneBandData = (unsigned char *)malloc(imheight*imwidth*sizeof(unsigned char));
tempData = chip.bits();
    for (int i = 0; i < imheight; i++){
        for (int j = 0; j < imwidth; j++){
            oneBandData[i*imwidth+j] = tempData[i*chipDataLength + j*4];
        }
    }

so chipDataLength gives me the length in bytes of a single row of the image. bpp is the number of bytes per pixel.  in the line in the loop, i am multiplying i by the data width, and j by 4 because I only really care about picking up one channel out of the grayscale image (since all the channels were set to the same gray value). How to I made adjustments to this to pad that 4-bit value to an 8bit unsigned char? It seems like it should be happening implicitly since my  arrays are unsigned char, right?



________________________________
From: Diego Iastrubni [diegoiast at gmail.com]
Sent: Tuesday, May 24, 2011 1:08 AM
To: Cole, Derek
Cc: Arnold Krille; qt-interest at trolltech.com
Subject: Re: [Qt-interest] QT program having issues over VNC


On Mon, May 23, 2011 at 9:24 PM, Cole, Derek <dcole at integrity-apps.com<mailto:dcole at integrity-apps.com>> wrote:
I think this is narrowing in on that same thing - I am passing single-band data to my image filters, so they just work in grayscale essentially. I noticed that when I create my image chip from the QImage, and then do a bytesPerLine() call, I basically get 4x width on SSH, and only 2x width when I am running it from VNC. I had no idea this call would be dependent on something like that. My image

what does "bits()" return? It seems that over ssh you get a 32bit image (RGBA) and under vnc you get only 16 (4 bits per channel). If so - should e trivial to fix. How do you construct your QImage?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110524/f1cae069/attachment.html 


More information about the Qt-interest-old mailing list