[vtkusers] java vtkRenderWindow.GetPixelData

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Aug 19 11:01:00 EDT 2015


You can use the VTK way, which will create a ImageData of the captured data.

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot

On Wed, Aug 19, 2015 at 5:07 AM, louiskoo <419655660 at qq.com> wrote:

> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150819/3c4b57e4/attachment.html>


More information about the vtkusers mailing list