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

Method ApplyTextPropertyStateToNodeForPath

IO/Export/vtkSVGContextDevice2D.cxx:1903–1923  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1901
1902//------------------------------------------------------------------------------
1903void vtkSVGContextDevice2D::ApplyTextPropertyStateToNodeForPath(
1904 vtkXMLDataElement* node, float x, float y)
1905{
1906 vtkVector3d colord;
1907 this->TextProp->GetColor(colord.GetData());
1908 vtkColor3ub color = {
1909 static_cast<unsigned char>((colord[0] * 255.) + 0.5),
1910 static_cast<unsigned char>((colord[1] * 255.) + 0.5),
1911 static_cast<unsigned char>((colord[2] * 255.) + 0.5),
1912 };
1913
1914 YConverter yConv(this->CanvasHeight);
1915
1916 std::ostringstream xform;
1917 xform << "translate(" << x << "," << yConv(y) << ")";
1918
1919 node->SetAttribute("fill", ColorToString(color.GetData()).c_str());
1920 node->SetFloatAttribute("fill-opacity", static_cast<float>(this->TextProp->GetOpacity()));
1921
1922 node->SetAttribute("transform", xform.str().c_str());
1923}
1924
1925//------------------------------------------------------------------------------
1926void vtkSVGContextDevice2D::ApplyTransform()

Callers 1

DrawStringMethod · 0.95

Calls 8

SetFloatAttributeMethod · 0.80
ColorToStringFunction · 0.70
GetColorMethod · 0.45
GetDataMethod · 0.45
SetAttributeMethod · 0.45
c_strMethod · 0.45
GetOpacityMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected