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

Method ComputeTextColors

Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx:905–926  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

903
904//------------------------------------------------------------------------------
905void vtkMatplotlibMathTextUtilities::ComputeTextColors(vtkTextProperty* tprop, TextColors& tcolors)
906{
907 double* fgColor = tprop->GetColor();
908 tcolors.fgR = static_cast<unsigned char>(fgColor[0] * 255);
909 tcolors.fgG = static_cast<unsigned char>(fgColor[1] * 255);
910 tcolors.fgB = static_cast<unsigned char>(fgColor[2] * 255);
911 tcolors.fgA = tprop->GetOpacity();
912
913 double* bgColor = tprop->GetBackgroundColor();
914 tcolors.bgR = static_cast<unsigned char>(bgColor[0] * 255);
915 tcolors.bgG = static_cast<unsigned char>(bgColor[1] * 255);
916 tcolors.bgB = static_cast<unsigned char>(bgColor[2] * 255);
917 tcolors.bgA = tprop->GetBackgroundOpacity();
918 tcolors.hasBackground = (static_cast<unsigned char>(tcolors.bgA * 255) != 0);
919
920 double* frameColor = tprop->GetFrameColor();
921 tcolors.frR = static_cast<unsigned char>(frameColor[0] * 255);
922 tcolors.frG = static_cast<unsigned char>(frameColor[1] * 255);
923 tcolors.frB = static_cast<unsigned char>(frameColor[2] * 255);
924 tcolors.hasFrame = tprop->GetFrame() && tprop->GetFrameWidth() > 0;
925 tcolors.frW = tprop->GetFrameWidth();
926}
927
928//------------------------------------------------------------------------------
929bool vtkMatplotlibMathTextUtilities::SetMathTextFont(vtkTextProperty* tprop)

Callers 1

RenderStringMethod · 0.95

Calls 3

GetColorMethod · 0.45
GetOpacityMethod · 0.45
GetBackgroundColorMethod · 0.45

Tested by

no test coverage detected