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

Method GetPixelData

Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx:1211–1246  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1209
1210//------------------------------------------------------------------------------
1211unsigned char* vtkOpenGLRenderWindow::GetPixelData(
1212 int x1, int y1, int x2, int y2, int front, int right)
1213{
1214 int y_low, y_hi;
1215 int x_low, x_hi;
1216
1217 if (y1 < y2)
1218 {
1219 y_low = y1;
1220 y_hi = y2;
1221 }
1222 else
1223 {
1224 y_low = y2;
1225 y_hi = y1;
1226 }
1227
1228 if (x1 < x2)
1229 {
1230 x_low = x1;
1231 x_hi = x2;
1232 }
1233 else
1234 {
1235 x_low = x2;
1236 x_hi = x1;
1237 }
1238
1239 int width = (x_hi - x_low) + 1;
1240 int height = (y_hi - y_low) + 1;
1241
1242 unsigned char* ucdata = new unsigned char[width * height * 3];
1243 vtkRecti rect(x_low, y_low, width, height);
1244 this->ReadPixels(rect, front, GL_RGB, GL_UNSIGNED_BYTE, ucdata, right);
1245 return ucdata;
1246}
1247
1248//------------------------------------------------------------------------------
1249int vtkOpenGLRenderWindow::GetPixelData(

Callers 1

TestRenderToImageFunction · 0.45

Calls 5

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

Tested by 1

TestRenderToImageFunction · 0.36