KHTML
SVGPaintServerPatternQt.cpp
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> 00003 00004 This file is part of the KDE project 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 aint with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #include "config.h" 00023 00024 #if ENABLE(SVG) 00025 #include "SVGPaintServerPattern.h" 00026 00027 namespace WebCore { 00028 00029 bool SVGPaintServerPattern::setup(QPainter* painter, QPainterPath* painterPath, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const 00030 { 00031 // FIXME: Reactivate old pattern code 00032 00033 /* 00034 QPainter* painter(context ? context->platformContext() : 0); 00035 Q_ASSERT(painter); 00036 00037 QPainterPath* _path = static_cast<QPainterPath*>(qtContext->path()); 00038 Q_ASSERT(_path != 0); 00039 00040 RenderStyle* renderStyle = object->style(); 00041 00042 painter->setPen(Qt::NoPen); 00043 painter->setBrush(Qt::NoBrush); 00044 QImage* patternimage = new QImage(tile()->bits(), tile()->width(), tile()->height(), QImage::Format_ARGB32_Premultiplied); 00045 patternimage->setAlphaBuffer(true); 00046 if (type & APPLY_TO_FILL) { 00047 //QColor c = color(); 00048 //c.setAlphaF(style->fillPainter()->opacity() * style->opacity() * opacity()); 00049 KRenderingFillPainter fillPainter = KSVGPainterFactory::fillPainter(renderStyle, object); 00050 QBrush brush(QPixmap::fromImage(*patternimage)); 00051 _path->setFillRule(fillPainter.fillRule() == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); 00052 painter->setBrush(brush); 00053 } 00054 if (type & APPLY_TO_STROKE) { 00055 //QColor c = color(); 00056 //c.setAlphaF(style->strokePainter()->opacity() * style->opacity() * opacity()); 00057 KRenderingStrokePainter strokePainter = KSVGPainterFactory::strokePainter(renderStyle, object); 00058 00059 QPen pen; 00060 QBrush brush(QPixmap::fromImage(*patternimage)); 00061 00062 setPenProperties(strokePainter, pen); 00063 pen.setBrush(brush); 00064 painter->setPen(pen); 00065 } 00066 00067 painter->drawPath(*_path); 00068 00069 delete patternimage; 00070 */ 00071 00072 return true; 00073 } 00074 00075 } // namespace WebCore 00076 00077 #endif 00078 00079 // vim:ts=4:noet