我正在绘制一个带有"marker-end"的SVG线,使其成为一个箭头.它绘制的箭头延伸到线的末端,使整个箭头更长,但我希望整个箭头与原始线的长度相同.也就是说,箭头的尖端应位于线的端点.我怎么做?
缩短线以适应箭头的大小将无法正常工作.箭头的大小取决于线的粗细(这是好的),但我不知道厚度,因为它可以在已经写入SVG文档的样式元素中指定.
在这个例子中,我希望箭头完全在方形内部,其尖端位于方形角落,而不是伸出方形.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<g><marker id="arrowhead0" viewBox="0 0 60 60" refX="0" refY="30" markerUnits="strokeWidth" markerWidth="8" markerHeight="10" orient="auto">
<path d="M 0 0 L 60 30 L 0 60 z" fill="#800000" /> </marker>
<line marker-end="url(#arrowhead0)" x1="1" y1="1" x2="100" y2="100" stroke="#800000" />
<rect x="1" y="1" width="100" height="100" stroke="green" fill="none"/>
</g></svg>Run Code Online (Sandbox Code Playgroud)
我想在SVG中使用纯色背景颜色绘制文本,但我无法访问文本大小.(它是在已经写入文档的样式元素中.)使用矩形很容易,除了我需要将其大小指定为"当前文本大小".我能这样做吗?还有其他想法吗?
为什么这段代码会出现这个错误?我不是要进行明确的专业化。这是在 Visual Studio 2012 Desktop Express 中。
错误 C2906:“T *testTemplate::popNoWait(int *)”:显式特化需要“模板 <>”
template <class T> class testTemplate
{
public:
T *pop(int timeout_ms);
T *popNoWait(int *remaining = NULL);
};
T *testTemplate<class T>::pop(int timeout_ms)
{
return popNoWait();
}
T *testTemplate<class T>::popNoWait(int *remaining)
{
return NULL;
}
Run Code Online (Sandbox Code Playgroud)