Here is a good structure to compose image frame:

qt-x11-opensource-4.0.0-b2/tools/qvfb/qanimationwriter.cpp
It is as target only linux but i rewrite it to win32

http://fop-miniscribus.googlecode.co...emo_write_mng/

Compose image sequence

Qt Code:
  1. void Gui_Main::setCaptureEnabled(bool enable)
  2. {
  3. /* start stop QBasicTimer FrameTimeLine; */
  4. RRunning = enable;
  5. if (enable && framerate > 32) {
  6. FrameTimeLine.start(framerate,this);
  7. } else {
  8. FrameTimeLine.stop();
  9. }
  10. }
  11. QImage Gui_Main::CatScreen()
  12. {
  13. QDesktopWidget *desk = qApp->desktop();
  14. QPixmap desktopscreen = QPixmap::grabWindow(desk->screen()->winId());
  15. QPixmap small = desktopscreen.scaledToWidth(100);
  16. devimg->paint( small );
  17. scrollArea->setWidget(devimg);
  18. delete &desktopscreen;
  19. return small.toImage();
  20. }
  21.  
  22. void Gui_Main::StartRead()
  23. {
  24. if (RRunning) {
  25. StopRead();
  26. return;
  27. }
  28. QString filename = QFileDialog::getSaveFileName(this, "Save animation", "animation.mng", "*.mng");
  29. if (filename.size() > 0) {
  30. animation = new AnimationWriter(filename,"MNG");
  31. animation->setFrameRate(framerate);
  32. animation->appendFrame(CatScreen());
  33. setCaptureEnabled(true);
  34. }
  35. }
  36. void Gui_Main::timerEvent(QTimerEvent *event)
  37. {
  38. if (event->timerId() == FrameTimeLine.timerId()) {
  39. timeline++;
  40. qDebug() << "### timeline " << timeline;
  41. animation->appendFrame(CatScreen());
  42. }
  43. }
  44. void Gui_Main::StopRead()
  45. {
  46. setCaptureEnabled(false);
  47. delete animation;
  48. animation = 0;
  49. }
To copy to clipboard, switch view to plain text mode 


try it
1# svn co http://fop-miniscribus.googlecode.co...emo_write_mng/ movietest
2#
copy path from QTDIR /src/3rdparty/zlib & libpng to movietest dir

INCLUDEPATH += ui libpng zlib

and build it...

it write file .... but QMovie on read say:
MNG error 4097: Image is larger than defined maximum; chunk MHDR; subcode 0:0
MNG error 1028: Chunk-length is invalid; chunk MOVE; subcode 0:0

MHDR is a chunk format to learn and after you can register your image to a simple movie like gif animated ...

to look original search qanimationwriter.cpp on http://www.google.com/codesearch