How to intercept the scene of window in VTK

Source: Internet
Author: User
The Initialize function in the VTK vtkrenderwindowinteractor initializes the interactive window, but the actual project often requires the window to be displayed on other pages, such as PNG images and so on. The concrete method can see Vtkrenderwindow class introduction.
This article mainly describes how to capture the screen of the current window.

//renWin:当前活动窗口;//pdata:后返回的数据指针,RGBA,32位,存储格式为RGBARGBA....//maxlen: 防止pdata开辟的空间不够bool GetOutput(vtkRenderWindow *renWin,unsigned char* pdata, int maxlen){    int w = renWin->GetSize()[0];    int h = renWin->GetSize()[1];    if (maxlen<w*h * 4)        return false;    vtkSmartPointer<vtkUnsignedCharArray> pixels = vtkSmartPointer<vtkUnsignedCharArray>::New();    pixels->SetArray(pdata, w*h * 4, 1);    renWin->GetRGBACharPixelData(0, 0, h - 1, w - 1, 1, pixels);    return true;}

The above code can be used to intercept the current scene of the desired window, in addition to this way, can also be saved in PNG format just call the VTK PNG class.

How to intercept the scene of window in VTK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.