2
Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
3
Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
aint with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
24
#include "SVGPaintServerPattern.h"
26
#include "TransformationMatrix.h"
27
#include "GraphicsContext.h"
28
#include "ImageBuffer.h"
30
#include "RenderObject.h"
31
#include "SVGPatternElement.h"
34
#include <QPainterPath>
38
bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
43
FloatRect targetRect = object->relativeBBox(false);
44
m_ownerElement->buildPattern(targetRect);
49
QPainter* painter = context->platformContext();
50
QPainterPath* path = context->currentPath();
52
RenderStyle* style = object->style();
53
const SVGRenderStyle* svgStyle = object->style()->svgStyle();
55
RefPtr<Pattern> pattern = Pattern::create(tile()->image(), true, true);
58
painter->setPen(Qt::NoPen);
59
painter->setBrush(Qt::NoBrush);
61
TransformationMatrix affine;
62
affine.translate(patternBoundaries().x(), patternBoundaries().y());
63
affine.multiply(patternTransform());
65
QBrush brush(pattern->createPlatformPattern(affine));
66
if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) {
67
painter->setBrush(brush);
68
context->setFillRule(svgStyle->fillRule());
71
if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) {
75
applyStrokeStyleToContext(context, style, object);
81
void SVGPaintServerPattern::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const
86
} // namespace WebCore