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

Method GetJustifiedBBox

Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx:500–540  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

498
499//------------------------------------------------------------------------------
500void vtkMatplotlibMathTextUtilities::GetJustifiedBBox(
501 int rows, int cols, vtkTextProperty* tprop, int bbox[4])
502{
503 bbox[0] = 0;
504 bbox[1] = cols - 1;
505 bbox[2] = 0;
506 bbox[3] = rows - 1;
507
508 int justifyOffset[2];
509 switch (tprop->GetJustification())
510 {
511 default:
512 case VTK_TEXT_LEFT:
513 justifyOffset[0] = 0;
514 break;
515 case VTK_TEXT_CENTERED:
516 justifyOffset[0] = bbox[1] / 2;
517 break;
518 case VTK_TEXT_RIGHT:
519 justifyOffset[0] = bbox[1];
520 break;
521 }
522 switch (tprop->GetVerticalJustification())
523 {
524 default:
525 case VTK_TEXT_BOTTOM:
526 justifyOffset[1] = 0;
527 break;
528 case VTK_TEXT_CENTERED:
529 justifyOffset[1] = bbox[3] / 2;
530 break;
531 case VTK_TEXT_TOP:
532 justifyOffset[1] = bbox[3];
533 break;
534 }
535
536 bbox[0] -= justifyOffset[0];
537 bbox[1] -= justifyOffset[0];
538 bbox[2] -= justifyOffset[1];
539 bbox[3] -= justifyOffset[1];
540}
541
542//------------------------------------------------------------------------------
543void vtkMatplotlibMathTextUtilities::RotateCorners(

Callers 2

GetMetricsMethod · 0.95
RenderStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected