/usr/include/kwinxrenderutils.h is in kwin-dev 4:5.12.4-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Lubos Lunak <l.lunak@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_XRENDERUTILS_H
#define KWIN_XRENDERUTILS_H
// KWin
#include <kwinxrenderutils_export.h>
// Qt
#include <QExplicitlySharedDataPointer>
#include <QRegion>
#include <QVector>
// XCB
#include <xcb/xfixes.h>
class QColor;
class QPixmap;
/** @addtogroup kwineffects */
/** @{ */
namespace KWin
{
/**
* dumps a QColor into a xcb_render_color_t
*/
KWINXRENDERUTILS_EXPORT xcb_render_color_t preMultiply(const QColor &c, float opacity = 1.0);
/** @internal */
class KWINXRENDERUTILS_EXPORT XRenderPictureData
: public QSharedData
{
public:
explicit XRenderPictureData(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE);
~XRenderPictureData();
xcb_render_picture_t value();
private:
xcb_render_picture_t picture;
Q_DISABLE_COPY(XRenderPictureData)
};
/**
* @short Wrapper around XRender Picture.
*
* This class wraps XRender's Picture, providing proper initialization,
* convenience constructors and freeing of resources.
* It should otherwise act exactly like the Picture type.
*/
class KWINXRENDERUTILS_EXPORT XRenderPicture
{
public:
explicit XRenderPicture(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE);
explicit XRenderPicture(const QImage &img);
XRenderPicture(xcb_pixmap_t pix, int depth);
operator xcb_render_picture_t();
private:
void fromImage(const QImage &img);
QExplicitlySharedDataPointer< XRenderPictureData > d;
};
class KWINXRENDERUTILS_EXPORT XFixesRegion
{
public:
explicit XFixesRegion(const QRegion ®ion);
virtual ~XFixesRegion();
operator xcb_xfixes_region_t();
private:
xcb_xfixes_region_t m_region;
};
inline
XRenderPictureData::XRenderPictureData(xcb_render_picture_t pic)
: picture(pic)
{
}
inline
xcb_render_picture_t XRenderPictureData::value()
{
return picture;
}
inline
XRenderPicture::XRenderPicture(xcb_render_picture_t pic)
: d(new XRenderPictureData(pic))
{
}
inline
XRenderPicture::operator xcb_render_picture_t()
{
return d->value();
}
inline
XFixesRegion::operator xcb_xfixes_region_t()
{
return m_region;
}
/**
* Static 1x1 picture used to deliver a black pixel with given opacity (for blending performance)
* Call and Use, the PixelPicture will stay, but may change it's opacity meanwhile. It's NOT threadsafe either
*/
KWINXRENDERUTILS_EXPORT XRenderPicture xRenderBlendPicture(double opacity);
/**
* Creates a 1x1 Picture filled with c
*/
KWINXRENDERUTILS_EXPORT XRenderPicture xRenderFill(const xcb_render_color_t &c);
KWINXRENDERUTILS_EXPORT XRenderPicture xRenderFill(const QColor &c);
/**
* Allows to render a window into a (transparent) pixmap
* NOTICE: the result can be queried as xRenderWindowOffscreenTarget()
* NOTICE: it may be 0
* NOTICE: when done call setXRenderWindowOffscreen(false) to continue normal render process
*/
KWINXRENDERUTILS_EXPORT void setXRenderOffscreen(bool b);
/**
* Allows to define a persistent effect member as render target
* The window (including shadows) is rendered into the top left corner
* NOTICE: do NOT call setXRenderOffscreen(true) in addition!
* NOTICE: do not forget to xRenderPopTarget once you're done to continue the normal render process
*/
KWINXRENDERUTILS_EXPORT void xRenderPushTarget(XRenderPicture *pic);
KWINXRENDERUTILS_EXPORT void xRenderPopTarget();
/**
* Whether windows are currently rendered into an offscreen target buffer
*/
KWINXRENDERUTILS_EXPORT bool xRenderOffscreen();
/**
* The offscreen buffer as set by the renderer because of setXRenderWindowOffscreen(true)
*/
KWINXRENDERUTILS_EXPORT xcb_render_picture_t xRenderOffscreenTarget();
/**
* NOTICE: HANDS OFF!!!
* scene_setXRenderWindowOffscreenTarget() is ONLY to be used by the renderer - DO NOT TOUCH!
*/
KWINXRENDERUTILS_EXPORT void scene_setXRenderOffscreenTarget(xcb_render_picture_t pix);
/**
* scene_xRenderWindowOffscreenTarget() is used by the scene to figure the target set by an effect
*/
KWINXRENDERUTILS_EXPORT XRenderPicture *scene_xRenderOffscreenTarget();
namespace XRenderUtils
{
/**
* @internal
**/
KWINXRENDERUTILS_EXPORT void init(xcb_connection_t *connection, xcb_window_t rootWindow);
/**
* Returns the Xrender format that corresponds to the given visual ID.
*/
KWINXRENDERUTILS_EXPORT xcb_render_pictformat_t findPictFormat(xcb_visualid_t visual);
/**
* Returns the xcb_render_directformat_t for the given Xrender format.
*/
KWINXRENDERUTILS_EXPORT const xcb_render_directformat_t *findPictFormatInfo(xcb_render_pictformat_t format);
/**
* @internal
**/
KWINXRENDERUTILS_EXPORT void cleanup();
} // namespace XRenderUtils
} // namespace KWin
/** @} */
#endif
|