[vtkusers] java vtkRenderWindow.GetPixelData

louiskoo 419655660 at qq.com
Wed Aug 19 07:07:01 EDT 2015


I use the vtkRenderWindow.GetPixelData() to capture RenderWindow screen's
image in C#:

byte[] vtkScreenBuffer = null;
            int imgWidth = 0, imgHeight = 0;
            if (vtkScreenBuffer == null)
            {
                imgWidth = _renwin.GetSize()[0];
                imgHeight = _renwin.GetSize()[1];


                vtkUnsignedCharArray data = vtkUnsignedCharArray.New();
                _renwin.GetPixelData(0, 0, imgWidth - 1, imgHeight - 1, 0,
data);

                int s = 3 * (int)data.GetNumberOfTuples();
                vtkScreenBuffer = new byte[s];
            }
            IntPtr ptr = _renwin.GetPixelData(0, 0, imgWidth - 1, imgHeight
- 1, 0);
            Marshal.Copy(ptr, vtkScreenBuffer, 0, vtkScreenBuffer.Length);


However,I don't know how to realize it in Java.  Anyone can give me a idea?



--
View this message in context: http://vtk.1045678.n5.nabble.com/java-vtkRenderWindow-GetPixelData-tp5733554.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list