1/*
2 * Copyright 2005 by Aaron Seigo <aseigo@kde.org>
3 * Copyright 2008 by Andrew Lake <jamboarder@yahoo.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef PLASMA_PAINTUTILS_H
22#define PLASMA_PAINTUTILS_H
23
24#include <QtGui/QApplication>
25#include <QtGui/QGraphicsItem>
26#include <QtGui/QPainterPath>
27
28#include <plasma/plasma_export.h>
29#include "theme.h"
30
31/** @headerfile plasma/paintutils.h <Plasma/PaintUtils> */
32
33namespace Plasma
34{
35
36class Svg;
37
38/**
39 * Namespace for all Image Effects specific to Plasma
40 **/
41namespace PaintUtils
42{
43
44/**
45 * Creates a blurred shadow of the supplied image.
46 */
47PLASMA_EXPORT void shadowBlur(QImage &image, int radius, const QColor &color);
48
49/**
50 * Returns a pixmap containing text with blurred shadow.
51 * Text and shadow colors default to Plasma::Theme colors.
52 */
53PLASMA_EXPORT QPixmap shadowText(QString text,
54 const QFont &font,
55 QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor),
56 QColor shadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor),
57 QPoint offset = QPoint(1,1),
58 int radius = 2);
59
60PLASMA_EXPORT QPixmap shadowText(QString text,
61 QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor),
62 QColor shadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor),
63 QPoint offset = QPoint(1,1),
64 int radius = 2);
65
66PLASMA_EXPORT QPixmap texturedText(const QString &text, const QFont &font, Plasma::Svg *texture);
67
68PLASMA_EXPORT void drawHalo(QPainter *painter, const QRectF &rect);
69
70/**
71 * Returns a nicely rounded rectanglular path for painting.
72 */
73PLASMA_EXPORT QPainterPath roundedRectangle(const QRectF &rect, qreal radius);
74
75/**
76 * center two pixmap together in the biggest rectangle
77 * @since 4.5
78 */
79PLASMA_EXPORT void centerPixmaps(QPixmap &from, QPixmap &to);
80
81/**
82 * Blends a pixmap into another
83 */
84PLASMA_EXPORT QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount);
85
86} // PaintUtils namespace
87
88} // Plasma namespace
89
90#endif
91