MCPcopy Create free account
hub / github.com/Kitware/VTK / GetRGBACharPixelData

Method GetRGBACharPixelData

Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx:2331–2367  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2329
2330//------------------------------------------------------------------------------
2331unsigned char* vtkOpenGLRenderWindow::GetRGBACharPixelData(
2332 int x1, int y1, int x2, int y2, int front, int right)
2333{
2334 int y_low, y_hi;
2335 int x_low, x_hi;
2336 int width, height;
2337
2338 if (y1 < y2)
2339 {
2340 y_low = y1;
2341 y_hi = y2;
2342 }
2343 else
2344 {
2345 y_low = y2;
2346 y_hi = y1;
2347 }
2348
2349 if (x1 < x2)
2350 {
2351 x_low = x1;
2352 x_hi = x2;
2353 }
2354 else
2355 {
2356 x_low = x2;
2357 x_hi = x1;
2358 }
2359
2360 width = abs(x_hi - x_low) + 1;
2361 height = abs(y_hi - y_low) + 1;
2362
2363 unsigned char* ucdata = new unsigned char[(width * height) * 4];
2364 vtkRecti rect(x_low, y_low, width, height);
2365 this->ReadPixels(rect, front, GL_RGBA, GL_UNSIGNED_BYTE, ucdata, right);
2366 return ucdata;
2367}
2368
2369//------------------------------------------------------------------------------
2370int vtkOpenGLRenderWindow::GetRGBACharPixelData(

Callers 1

Calls 5

ReadPixelsMethod · 0.95
absFunction · 0.50
SetNumberOfComponentsMethod · 0.45
SetNumberOfValuesMethod · 0.45
GetPointerMethod · 0.45

Tested by 1