Go to the documentation of this file.
25#include "RenderPath.h"
26#include "SVGRenderStyle.h"
30#include <QPainterPathStroker>
34bool RenderPath::strokeContains(
const FloatPoint& point,
bool requiresStroke)
const
39 if (requiresStroke && !SVGPaintServer::strokePaintServer(style(),
this))
45static 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)
53 s.setCapStyle(Qt::RoundCap);
55 if (style->svgStyle()->joinStyle() ==
MiterJoin) {
56 s.setJoinStyle(Qt::MiterJoin);
57 s.setMiterLimit((qreal) style->svgStyle()->strokeMiterLimit());
58 }
else if(style->svgStyle()->joinStyle() ==
RoundJoin)
59 s.setJoinStyle(Qt::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());
72 s.setDashPattern(pattern);
78 return s.createStroke(path);
81FloatRect RenderPath::strokeBBox()
const
83 QPainterPath outline =
getPathStroke(*(path().platformPath()),
this, style());
84 return outline.boundingRect();
static QPainterPath getPathStroke(const QPainterPath &path, const RenderObject *object, const RenderStyle *style)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Jul 18 2024 00:00:00 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.