1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2008 Lubos Lunak <l.lunak@kde.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
21 #ifndef KWIN_XRENDERUTILS_H
22 #define KWIN_XRENDERUTILS_H
24 #include <kwinconfig.h>
26 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
28 #include <QtCore/QSharedData>
29 #include <QtGui/QColor>
30 #include <ksharedptr.h>
32 #include <kwinglobals.h>
34 #include <X11/extensions/Xfixes.h>
35 #include <X11/extensions/Xrender.h>
37 /** @addtogroup kwineffects */
44 * Convert QRegion to XserverRegion.
46 KWIN_EXPORT XserverRegion
toXserverRegion( QRegion region
);
48 * draws a round box on the renderscene
50 KWIN_EXPORT
void xRenderRoundBox( Picture pict
, const QRect
&rect
, int round
, const QColor
&c
);
52 * dumps a QColor into a XRenderColor
54 KWIN_EXPORT XRenderColor
preMultiply(const QColor
&c
, float opacity
= 1.0);
57 class KWIN_EXPORT XRenderPictureData
61 XRenderPictureData( Picture pic
= None
);
62 ~XRenderPictureData();
66 Q_DISABLE_COPY( XRenderPictureData
)
70 * @short Wrapper around XRender Picture.
72 * This class wraps XRender's Picture, providing proper initialization,
73 * convenience constructors and freeing of resources.
74 * It should otherwise act exactly like the Picture type.
76 class KWIN_EXPORT XRenderPicture
79 XRenderPicture( Picture pic
= None
);
80 XRenderPicture( QPixmap pix
);
81 XRenderPicture( Pixmap pix
, int depth
);
84 KSharedPtr
< XRenderPictureData
> d
;
88 XRenderPictureData::XRenderPictureData( Picture pic
)
94 XRenderPictureData::~XRenderPictureData()
97 XRenderFreePicture( display(), picture
);
101 Picture
XRenderPictureData::value()
107 XRenderPicture::XRenderPicture( Picture pic
)
108 : d( new XRenderPictureData( pic
))
113 XRenderPicture::operator Picture()
119 * Creates a 1x1 Picture filled with c
121 KWIN_EXPORT XRenderPicture
xRenderFill( const XRenderColor
*c
);
122 KWIN_EXPORT XRenderPicture
xRenderFill( const QColor
&c
);