KWinLibraries
kwinxrenderutils.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KWIN_XRENDERUTILS_H
00022 #define KWIN_XRENDERUTILS_H
00023
00024 #include <kwinconfig.h>
00025
00026 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
00027
00028 #include <QtCore/QSharedData>
00029 #include <QtGui/QColor>
00030 #include <ksharedptr.h>
00031
00032 #include <kwinglobals.h>
00033
00034 #include <X11/extensions/Xfixes.h>
00035 #include <X11/extensions/Xrender.h>
00036
00040 namespace KWin
00041 {
00042
00046 KWIN_EXPORT XserverRegion toXserverRegion( QRegion region );
00050 KWIN_EXPORT void xRenderRoundBox( Picture pict, const QRect &rect, int round, const QColor &c );
00054 KWIN_EXPORT XRenderColor preMultiply(const QColor &c, float opacity = 1.0);
00055
00057 class KWIN_EXPORT XRenderPictureData
00058 : public QSharedData
00059 {
00060 public:
00061 XRenderPictureData( Picture pic = None );
00062 ~XRenderPictureData();
00063 Picture value();
00064 private:
00065 Picture picture;
00066 Q_DISABLE_COPY( XRenderPictureData )
00067 };
00068
00076 class KWIN_EXPORT XRenderPicture
00077 {
00078 public:
00079 XRenderPicture( Picture pic = None );
00080 XRenderPicture( QPixmap pix );
00081 XRenderPicture( Pixmap pix, int depth );
00082 operator Picture();
00083 private:
00084 KSharedPtr< XRenderPictureData > d;
00085 };
00086
00087 inline
00088 XRenderPictureData::XRenderPictureData( Picture pic )
00089 : picture( pic )
00090 {
00091 }
00092
00093 inline
00094 XRenderPictureData::~XRenderPictureData()
00095 {
00096 if( picture != None )
00097 XRenderFreePicture( display(), picture );
00098 }
00099
00100 inline
00101 Picture XRenderPictureData::value()
00102 {
00103 return picture;
00104 }
00105
00106 inline
00107 XRenderPicture::XRenderPicture( Picture pic )
00108 : d( new XRenderPictureData( pic ))
00109 {
00110 }
00111
00112 inline
00113 XRenderPicture::operator Picture()
00114 {
00115 return d->value();
00116 }
00117
00121 KWIN_EXPORT XRenderPicture xRenderFill( const XRenderColor *c );
00122 KWIN_EXPORT XRenderPicture xRenderFill( const QColor &c );
00123
00124 }
00125
00126 #endif
00127
00130 #endif