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

Method GetBoundingBox

Rendering/FreeType/vtkFreeTypeTools.cxx:450–477  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

448
449//------------------------------------------------------------------------------
450bool vtkFreeTypeTools::GetBoundingBox(
451 vtkTextProperty* tprop, const vtkStdString& str, int dpi, int bbox[4])
452{
453 // We need the tprop and bbox
454 if (!tprop || !bbox)
455 {
456 vtkErrorMacro(<< "Wrong parameters, one of them is nullptr or zero");
457 return false;
458 }
459
460 if (str.empty())
461 {
462 std::fill(bbox, bbox + 4, 0);
463 return true;
464 }
465
466 MetaData metaData;
467 bool result = this->PrepareMetaData(tprop, dpi, metaData);
468 if (result)
469 {
470 result = this->CalculateBoundingBox(str, metaData);
471 if (result)
472 {
473 memcpy(bbox, metaData.bbox.GetData(), sizeof(int) * 4);
474 }
475 }
476 return result;
477}
478
479//------------------------------------------------------------------------------
480bool vtkFreeTypeTools::GetMetrics(

Callers 5

GetBoundsMethod · 0.45
GetBoundsMethod · 0.45
TestTextBoundingBoxFunction · 0.45

Calls 5

PrepareMetaDataMethod · 0.95
CalculateBoundingBoxMethod · 0.95
fillFunction · 0.50
emptyMethod · 0.45
GetDataMethod · 0.45

Tested by 1

TestTextBoundingBoxFunction · 0.36