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

Method FillBox

Imaging/Sources/vtkImageCanvasSource2D.cxx:277–321  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Draw a data. Only implentented for 2D extents.

Source from the content-addressed store, hash-verified

275//------------------------------------------------------------------------------
276// Draw a data. Only implentented for 2D extents.
277void vtkImageCanvasSource2D::FillBox(int min0, int max0, int min1, int max1)
278{
279 int* extent;
280 void* ptr;
281 int z = this->DefaultZ;
282
283 // Pre-multiply coords if needed
284 if (this->Ratio[0] != 1.0)
285 {
286 min0 = int(double(min0) * this->Ratio[0]);
287 max0 = int(double(max0) * this->Ratio[0]);
288 }
289 if (this->Ratio[1] != 1.0)
290 {
291 min1 = int(double(min1) * this->Ratio[1]);
292 max1 = int(double(max1) * this->Ratio[1]);
293 }
294 if (this->Ratio[2] != 1.0)
295 {
296 z = int(double(z) * this->Ratio[2]);
297 }
298
299 // Clip the data to keep in bounds
300 extent = this->ImageData->GetExtent();
301 min0 = (min0 < extent[0]) ? extent[0] : min0;
302 max0 = (max0 < extent[0]) ? extent[0] : max0;
303 min0 = (min0 > extent[1]) ? extent[1] : min0;
304 max0 = (max0 > extent[1]) ? extent[1] : max0;
305 min1 = (min1 < extent[2]) ? extent[2] : min1;
306 max1 = (max1 < extent[2]) ? extent[2] : max1;
307 min1 = (min1 > extent[3]) ? extent[3] : min1;
308 max1 = (max1 > extent[3]) ? extent[3] : max1;
309 z = (z < extent[4]) ? extent[4] : z;
310 z = (z > extent[5]) ? extent[5] : z;
311
312 ptr = this->ImageData->GetScalarPointer(min0, min1, z);
313 switch (this->ImageData->GetScalarType())
314 {
315 vtkTemplateMacro(vtkImageCanvasSource2DFillBox(
316 this->ImageData, this->DrawColor, static_cast<VTK_TT*>(ptr), min0, max0, min1, max1));
317 default:
318 vtkErrorMacro(<< "FillBox: Cannot handle ScalarType.");
319 }
320 this->Modified();
321}
322
323//------------------------------------------------------------------------------
324// Fill a tube (thick line for initial 2D implementation.

Callers 15

TestWriteToUnicodeFileFunction · 0.80
TestWriteToMemoryFunction · 0.80
TestCheckerboardWidgetFunction · 0.80
vtkVRRendererMethod · 0.80
pickImageData.pyFile · 0.80
RequestDataMethod · 0.80
TestYIQToRGB.pyFile · 0.80
TestHSVToRGB.pyFile · 0.80
TestHSIToRGB.pyFile · 0.80

Calls 5

GetScalarPointerMethod · 0.80
GetExtentMethod · 0.45
GetScalarTypeMethod · 0.45
ModifiedMethod · 0.45

Tested by 5

TestWriteToUnicodeFileFunction · 0.64
TestWriteToMemoryFunction · 0.64
TestCheckerboardWidgetFunction · 0.64
testWipeMethod · 0.64