[vtkusers] Problem in VTK 5-03 with screen capture

Sergios Goudanis sergiosgoudanis at gmail.com
Sat May 19 05:19:57 EDT 2007


I have a problem with the screen capture in vtk 5-03.

This code copies the image of the main render window to the clipboard.
The problem is that after its execution, you cannot see any actor in the
screen (something like opacity 0. to all actors)

This worked fine for years (up to the 5-01 version).
Has anybody any information about how to resolve this?(or maybe it is a bug)

Thank you in advance!

  int *size = this->renWin->GetSize();
        this->renWin->SetupMemoryRendering(size[0], size[1],
GetDC()->GetSafeHdc());
        this->renWin->Render();

        unsigned char *data = this->ren->GetVTKWindow()->GetPixelData(0, 0,
size[0]-1, size[1]-1, 1);

        CDC *pDC = GetDC();
        CBitmap bitmap;
        bitmap.CreateCompatibleBitmap(pDC, size[0], size[1]);

        unsigned long *bits = new unsigned long[size[0] * size[1]];
        int i, j, k;
        for (j=0; j<size[1]; j++) {
            for (i=0; i<size[0]; i++) {
                k = 3 * ((size[1] - j - 1) * size[0] + i);
                bits[j*size[0]+i] = RGB(data[k+2], data[k+1], data[k]);
            }
        }
        bitmap.SetBitmapBits(size[0] * size[1] * 4, (void *)bits);
        delete []bits;
        delete []data;

        EmptyClipboard();
        SetClipboardData(CF_BITMAP, bitmap);
        CloseClipboard();
        bitmap.DeleteObject();
        ReleaseDC(pDC);
        this->renWin->ResumeScreenRendering();
        this->renWin->Render();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070519/38f2d3c1/attachment.htm>


More information about the vtkusers mailing list