Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / kioslave / thumbnail / svgcreator.cpp
blob1b55071073c0000c972bb7edee3ad0049c0ca09e
1 /* This file is part of the KDE libraries
2 Copyright (c) 2006 Pascal LĂ©tourneau <pascal.letourneau@kdemail.net>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include <QImage>
21 #include <QPainter>
23 #include <kdemacros.h>
24 #include <ksvgrenderer.h>
26 #include "svgcreator.h"
28 extern "C"
30 KDE_EXPORT ThumbCreator *new_creator()
32 return new SvgCreator;
36 bool SvgCreator::create(const QString &path, int w, int h, QImage &img)
38 KSvgRenderer r(path);
39 if ( !r.isValid() )
40 return false;
41 QImage i(w, h, QImage::Format_ARGB32_Premultiplied);
42 i.fill(0);
43 QPainter p(&i);
44 r.render(&p);
45 img = i;
46 return true;
49 ThumbCreator::Flags SvgCreator::flags() const
51 return None;