[Qt-interest] Quicktime C -> QImage

Diego Iastrubni diegoiast at gmail.com
Mon Apr 19 01:33:57 CEST 2010


Alex,

You need to read a little more theory, this is not that simple. You need to
considerate the line width (rowbytes in your code) and you need to count
properly the bytes per pixel. In comment here I use the QImage methods to
reading those variables. I hopemy guesses are good enough to drive you to
the correct direction.


for ( int y=0; y<240; y++ )
  for( inx x = 0; x<320; x++ ) {
    int offset = /*img->bytesPerLine()*/  rowBytes * y + x*4 /*
img->depth()/8 */;
    displayImage->setPixel(x,y,pixels[offset]);
  }
}


On Mon, Apr 19, 2010 at 1:52 AM, Alexander Carôt <alexander_carot at gmx.net>wrote:

> Hi all,
>
> I am using Quicktime video images, which I finally want to display on a
> QImage. However, I have a problem to actually map the Quicktime image
> correctly. First I create the image as follows:
>
> *************
> image = CGImageCreate( width, height, 8, 32, rowBytes, colorspace,
>
> kCGImageAlphaNoneSkipFirst, provider, NULL, true, kCGRenderingIntentDefault
> );
> ************
>
>
> and then I thought about using the QImage::setPixel(...) in this way:
>
>
> ************
>    unsigned int *pixels = (unsigned int *) image;
>    int i = 0;
>    for (int y = 0; y < 240; y++){
>      for (int x = 0; x < 320; x++){
>        displayImage->setPixel(x,y,pixels[i]);
>        i++;
>      }
>    }
> **************
>
> This, however, just produces garbage on the screen. Is anyone experienced
> with this an can point me to my actual problem ?
>
> Thanks a lot in advance
>
> -- A l e x
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100419/9895d5f0/attachment.html 


More information about the Qt-interest-old mailing list