KHTML
Go to the documentation of this file.
25 #include "RenderPath.h"
26 #include "SVGRenderStyle.h"
30 #include <QPainterPathStroker>
34 bool RenderPath::strokeContains(
const FloatPoint& point,
bool requiresStroke)
const
39 if (requiresStroke && !SVGPaintServer::strokePaintServer(style(),
this))
45 static QPainterPath
getPathStroke(
const QPainterPath &path,
const RenderObject*
object,
const RenderStyle* style)
47 QPainterPathStroker s;
48 s.setWidth(SVGRenderStyle::cssPrimitiveToLength(
object, style->svgStyle()->strokeWidth(), 1.0));
50 if (style->svgStyle()->capStyle() ==
ButtCap)
51 s.setCapStyle(Qt::FlatCap);
52 else if (style->svgStyle()->capStyle() ==
RoundCap)
55 if (style->svgStyle()->joinStyle() ==
MiterJoin) {
57 s.setMiterLimit((qreal) style->svgStyle()->strokeMiterLimit());
58 }
else if(style->svgStyle()->joinStyle() ==
RoundJoin)
61 const DashArray& dashes = WebCore::dashArrayFromRenderingStyle(style);
62 double dashOffset = SVGRenderStyle::cssPrimitiveToLength(
object, style->svgStyle()->strokeDashOffset(), 0.0);
64 unsigned int dashLength = !dashes.isEmpty() ? dashes.size() : 0;
67 unsigned int count = (dashLength % 2) == 0 ? dashLength : dashLength * 2;
69 for(
unsigned int i = 0; i < count; i++)
70 pattern.append(dashes[i % dashLength] / (
float)s.width());
78 return s.createStroke(path);
81 FloatRect RenderPath::strokeBBox()
const
83 QPainterPath outline =
getPathStroke(*(path().platformPath()),
this, style());
84 return outline.boundingRect();
QString pattern(Mode mode=Reading)
static QPainterPath getPathStroke(const QPainterPath &path, const RenderObject *object, const RenderStyle *style)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jan 30 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.