Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinxrenderutils.h
Show All 34 Lines | |||||
35 | 35 | | |||
36 | /** @addtogroup kwineffects */ | 36 | /** @addtogroup kwineffects */ | ||
37 | /** @{ */ | 37 | /** @{ */ | ||
38 | 38 | | |||
39 | namespace KWin | 39 | namespace KWin | ||
40 | { | 40 | { | ||
41 | /** | 41 | /** | ||
42 | * dumps a QColor into a xcb_render_color_t | 42 | * dumps a QColor into a xcb_render_color_t | ||
43 | */ | 43 | **/ | ||
44 | KWINXRENDERUTILS_EXPORT xcb_render_color_t preMultiply(const QColor &c, float opacity = 1.0); | 44 | KWINXRENDERUTILS_EXPORT xcb_render_color_t preMultiply(const QColor &c, float opacity = 1.0); | ||
45 | 45 | | |||
46 | /** @internal */ | 46 | /** @internal */ | ||
47 | class KWINXRENDERUTILS_EXPORT XRenderPictureData | 47 | class KWINXRENDERUTILS_EXPORT XRenderPictureData | ||
48 | : public QSharedData | 48 | : public QSharedData | ||
49 | { | 49 | { | ||
50 | public: | 50 | public: | ||
51 | explicit XRenderPictureData(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE); | 51 | explicit XRenderPictureData(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE); | ||
52 | ~XRenderPictureData(); | 52 | ~XRenderPictureData(); | ||
53 | xcb_render_picture_t value(); | 53 | xcb_render_picture_t value(); | ||
54 | private: | 54 | private: | ||
55 | xcb_render_picture_t picture; | 55 | xcb_render_picture_t picture; | ||
56 | Q_DISABLE_COPY(XRenderPictureData) | 56 | Q_DISABLE_COPY(XRenderPictureData) | ||
57 | }; | 57 | }; | ||
58 | 58 | | |||
59 | /** | 59 | /** | ||
60 | * @short Wrapper around XRender Picture. | 60 | * @short Wrapper around XRender Picture. | ||
61 | * | 61 | * | ||
62 | * This class wraps XRender's Picture, providing proper initialization, | 62 | * This class wraps XRender's Picture, providing proper initialization, | ||
63 | * convenience constructors and freeing of resources. | 63 | * convenience constructors and freeing of resources. | ||
64 | * It should otherwise act exactly like the Picture type. | 64 | * It should otherwise act exactly like the Picture type. | ||
65 | */ | 65 | **/ | ||
66 | class KWINXRENDERUTILS_EXPORT XRenderPicture | 66 | class KWINXRENDERUTILS_EXPORT XRenderPicture | ||
67 | { | 67 | { | ||
68 | public: | 68 | public: | ||
69 | explicit XRenderPicture(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE); | 69 | explicit XRenderPicture(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE); | ||
70 | explicit XRenderPicture(const QImage &img); | 70 | explicit XRenderPicture(const QImage &img); | ||
71 | XRenderPicture(xcb_pixmap_t pix, int depth); | 71 | XRenderPicture(xcb_pixmap_t pix, int depth); | ||
72 | operator xcb_render_picture_t(); | 72 | operator xcb_render_picture_t(); | ||
73 | private: | 73 | private: | ||
Show All 40 Lines | |||||
114 | XFixesRegion::operator xcb_xfixes_region_t() | 114 | XFixesRegion::operator xcb_xfixes_region_t() | ||
115 | { | 115 | { | ||
116 | return m_region; | 116 | return m_region; | ||
117 | } | 117 | } | ||
118 | 118 | | |||
119 | /** | 119 | /** | ||
120 | * Static 1x1 picture used to deliver a black pixel with given opacity (for blending performance) | 120 | * Static 1x1 picture used to deliver a black pixel with given opacity (for blending performance) | ||
121 | * Call and Use, the PixelPicture will stay, but may change it's opacity meanwhile. It's NOT threadsafe either | 121 | * Call and Use, the PixelPicture will stay, but may change it's opacity meanwhile. It's NOT threadsafe either | ||
122 | */ | 122 | **/ | ||
123 | KWINXRENDERUTILS_EXPORT XRenderPicture xRenderBlendPicture(double opacity); | 123 | KWINXRENDERUTILS_EXPORT XRenderPicture xRenderBlendPicture(double opacity); | ||
124 | /** | 124 | /** | ||
125 | * Creates a 1x1 Picture filled with c | 125 | * Creates a 1x1 Picture filled with c | ||
126 | */ | 126 | **/ | ||
127 | KWINXRENDERUTILS_EXPORT XRenderPicture xRenderFill(const xcb_render_color_t &c); | 127 | KWINXRENDERUTILS_EXPORT XRenderPicture xRenderFill(const xcb_render_color_t &c); | ||
128 | KWINXRENDERUTILS_EXPORT XRenderPicture xRenderFill(const QColor &c); | 128 | KWINXRENDERUTILS_EXPORT XRenderPicture xRenderFill(const QColor &c); | ||
129 | 129 | | |||
130 | /** | 130 | /** | ||
131 | * Allows to render a window into a (transparent) pixmap | 131 | * Allows to render a window into a (transparent) pixmap | ||
132 | * NOTICE: the result can be queried as xRenderWindowOffscreenTarget() | 132 | * NOTICE: the result can be queried as xRenderWindowOffscreenTarget() | ||
133 | * NOTICE: it may be 0 | 133 | * NOTICE: it may be 0 | ||
134 | * NOTICE: when done call setXRenderWindowOffscreen(false) to continue normal render process | 134 | * NOTICE: when done call setXRenderWindowOffscreen(false) to continue normal render process | ||
135 | */ | 135 | **/ | ||
136 | KWINXRENDERUTILS_EXPORT void setXRenderOffscreen(bool b); | 136 | KWINXRENDERUTILS_EXPORT void setXRenderOffscreen(bool b); | ||
137 | 137 | | |||
138 | /** | 138 | /** | ||
139 | * Allows to define a persistent effect member as render target | 139 | * Allows to define a persistent effect member as render target | ||
140 | * The window (including shadows) is rendered into the top left corner | 140 | * The window (including shadows) is rendered into the top left corner | ||
141 | * NOTICE: do NOT call setXRenderOffscreen(true) in addition! | 141 | * NOTICE: do NOT call setXRenderOffscreen(true) in addition! | ||
142 | * NOTICE: do not forget to xRenderPopTarget once you're done to continue the normal render process | 142 | * NOTICE: do not forget to xRenderPopTarget once you're done to continue the normal render process | ||
143 | */ | 143 | **/ | ||
144 | KWINXRENDERUTILS_EXPORT void xRenderPushTarget(XRenderPicture *pic); | 144 | KWINXRENDERUTILS_EXPORT void xRenderPushTarget(XRenderPicture *pic); | ||
145 | KWINXRENDERUTILS_EXPORT void xRenderPopTarget(); | 145 | KWINXRENDERUTILS_EXPORT void xRenderPopTarget(); | ||
146 | 146 | | |||
147 | /** | 147 | /** | ||
148 | * Whether windows are currently rendered into an offscreen target buffer | 148 | * Whether windows are currently rendered into an offscreen target buffer | ||
149 | */ | 149 | **/ | ||
150 | KWINXRENDERUTILS_EXPORT bool xRenderOffscreen(); | 150 | KWINXRENDERUTILS_EXPORT bool xRenderOffscreen(); | ||
151 | /** | 151 | /** | ||
152 | * The offscreen buffer as set by the renderer because of setXRenderWindowOffscreen(true) | 152 | * The offscreen buffer as set by the renderer because of setXRenderWindowOffscreen(true) | ||
153 | */ | 153 | **/ | ||
154 | KWINXRENDERUTILS_EXPORT xcb_render_picture_t xRenderOffscreenTarget(); | 154 | KWINXRENDERUTILS_EXPORT xcb_render_picture_t xRenderOffscreenTarget(); | ||
155 | 155 | | |||
156 | /** | 156 | /** | ||
157 | * NOTICE: HANDS OFF!!! | 157 | * NOTICE: HANDS OFF!!! | ||
158 | * scene_setXRenderWindowOffscreenTarget() is ONLY to be used by the renderer - DO NOT TOUCH! | 158 | * scene_setXRenderWindowOffscreenTarget() is ONLY to be used by the renderer - DO NOT TOUCH! | ||
159 | */ | 159 | **/ | ||
160 | KWINXRENDERUTILS_EXPORT void scene_setXRenderOffscreenTarget(xcb_render_picture_t pix); | 160 | KWINXRENDERUTILS_EXPORT void scene_setXRenderOffscreenTarget(xcb_render_picture_t pix); | ||
161 | /** | 161 | /** | ||
162 | * scene_xRenderWindowOffscreenTarget() is used by the scene to figure the target set by an effect | 162 | * scene_xRenderWindowOffscreenTarget() is used by the scene to figure the target set by an effect | ||
163 | */ | 163 | **/ | ||
164 | KWINXRENDERUTILS_EXPORT XRenderPicture *scene_xRenderOffscreenTarget(); | 164 | KWINXRENDERUTILS_EXPORT XRenderPicture *scene_xRenderOffscreenTarget(); | ||
165 | 165 | | |||
166 | namespace XRenderUtils | 166 | namespace XRenderUtils | ||
167 | { | 167 | { | ||
168 | /** | 168 | /** | ||
169 | * @internal | 169 | * @internal | ||
170 | **/ | 170 | **/ | ||
171 | KWINXRENDERUTILS_EXPORT void init(xcb_connection_t *connection, xcb_window_t rootWindow); | 171 | KWINXRENDERUTILS_EXPORT void init(xcb_connection_t *connection, xcb_window_t rootWindow); | ||
172 | 172 | | |||
173 | /** | 173 | /** | ||
174 | * Returns the Xrender format that corresponds to the given visual ID. | 174 | * Returns the Xrender format that corresponds to the given visual ID. | ||
175 | */ | 175 | **/ | ||
176 | KWINXRENDERUTILS_EXPORT xcb_render_pictformat_t findPictFormat(xcb_visualid_t visual); | 176 | KWINXRENDERUTILS_EXPORT xcb_render_pictformat_t findPictFormat(xcb_visualid_t visual); | ||
177 | 177 | | |||
178 | /** | 178 | /** | ||
179 | * Returns the xcb_render_directformat_t for the given Xrender format. | 179 | * Returns the xcb_render_directformat_t for the given Xrender format. | ||
180 | */ | 180 | **/ | ||
181 | KWINXRENDERUTILS_EXPORT const xcb_render_directformat_t *findPictFormatInfo(xcb_render_pictformat_t format); | 181 | KWINXRENDERUTILS_EXPORT const xcb_render_directformat_t *findPictFormatInfo(xcb_render_pictformat_t format); | ||
182 | 182 | | |||
183 | /** | 183 | /** | ||
184 | * @internal | 184 | * @internal | ||
185 | **/ | 185 | **/ | ||
186 | KWINXRENDERUTILS_EXPORT void cleanup(); | 186 | KWINXRENDERUTILS_EXPORT void cleanup(); | ||
187 | 187 | | |||
188 | } // namespace XRenderUtils | 188 | } // namespace XRenderUtils | ||
189 | 189 | | |||
190 | } // namespace KWin | 190 | } // namespace KWin | ||
191 | 191 | | |||
192 | /** @} */ | 192 | /** @} */ | ||
193 | 193 | | |||
194 | #endif | 194 | #endif |