… | |
… | |
2 | #include "../config.h" |
2 | #include "../config.h" |
3 | #include "rxvt.h" |
3 | #include "rxvt.h" |
4 | |
4 | |
5 | #if HAVE_IMG |
5 | #if HAVE_IMG |
6 | |
6 | |
7 | #define float_to_component(d) ((d) * 65535.99) |
|
|
8 | |
|
|
9 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height) |
7 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int x, int y, int width, int height) |
10 | : s(screen), w(width), h(height), format(format), shared(false) |
8 | : s(screen), x(x), y(y), w(width), h(height), format(format), repeat(RepeatNormal), |
|
|
9 | pm(0), ref(0) |
11 | { |
10 | { |
12 | pm = XCreatePixmap (s->display->dpy, s->display->root, w, h, format->depth); |
|
|
13 | } |
11 | } |
14 | |
12 | |
|
|
13 | rxvt_img::rxvt_img (const rxvt_img &img) |
|
|
14 | : s(img.s), x(img.x), y(img.y), w(img.w), h(img.h), format(img.format), repeat(img.repeat), pm(img.pm), ref(img.ref) |
|
|
15 | { |
|
|
16 | ++ref->cnt; |
|
|
17 | } |
|
|
18 | |
|
|
19 | #if 0 |
15 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap) |
20 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap) |
16 | : s(screen), pm(pixmap), w(width), h(height), format(format), shared(false) |
21 | : s(screen), x(0), y(0), w(width), h(height), format(format), repeat(RepeatNormal), shared(false), pm(pixmap) |
17 | { |
22 | { |
18 | } |
23 | } |
|
|
24 | #endif |
19 | |
25 | |
20 | rxvt_img * |
26 | rxvt_img * |
21 | rxvt_img::new_from_root (rxvt_screen *s) |
27 | rxvt_img::new_from_root (rxvt_screen *s) |
22 | { |
28 | { |
23 | Display *dpy = s->display->dpy; |
29 | Display *dpy = s->display->dpy; |
… | |
… | |
37 | return 0; |
43 | return 0; |
38 | |
44 | |
39 | rxvt_img *img = new rxvt_img ( |
45 | rxvt_img *img = new rxvt_img ( |
40 | s, |
46 | s, |
41 | XRenderFindVisualFormat (dpy, DefaultVisual (dpy, s->display->screen)), |
47 | XRenderFindVisualFormat (dpy, DefaultVisual (dpy, s->display->screen)), |
|
|
48 | 0, |
|
|
49 | 0, |
42 | root_pm_w, |
50 | root_pm_w, |
43 | root_pm_h, |
51 | root_pm_h |
44 | root_pixmap |
|
|
45 | ); |
52 | ); |
46 | |
53 | |
47 | img->shared = true; |
54 | img->pm = root_pixmap; |
|
|
55 | img->ref = new pixref (root_pm_w, root_pm_h); |
|
|
56 | img->ref->ours = false; |
48 | |
57 | |
49 | return img; |
58 | return img; |
50 | } |
59 | } |
51 | |
60 | |
52 | rxvt_img * |
61 | rxvt_img * |
… | |
… | |
59 | rxvt_fatal ("rxvt_img::new_from_file: %s\n", err->message); |
68 | rxvt_fatal ("rxvt_img::new_from_file: %s\n", err->message); |
60 | |
69 | |
61 | rxvt_img *img = new rxvt_img ( |
70 | rxvt_img *img = new rxvt_img ( |
62 | s, |
71 | s, |
63 | XRenderFindStandardFormat (s->display->dpy, gdk_pixbuf_get_has_alpha (pb) ? PictStandardARGB32 : PictStandardRGB24), |
72 | XRenderFindStandardFormat (s->display->dpy, gdk_pixbuf_get_has_alpha (pb) ? PictStandardARGB32 : PictStandardRGB24), |
|
|
73 | 0, |
|
|
74 | 0, |
64 | gdk_pixbuf_get_width (pb), |
75 | gdk_pixbuf_get_width (pb), |
65 | gdk_pixbuf_get_height (pb) |
76 | gdk_pixbuf_get_height (pb) |
66 | ); |
77 | ); |
67 | |
78 | img->alloc (); |
68 | img->render_pixbuf (pb, 0, 0, img->w, img->h, 0, 0); |
79 | img->render_pixbuf (pb, 0, 0, img->w, img->h, 0, 0); |
69 | |
80 | |
|
|
81 | g_object_unref (pb); |
|
|
82 | |
|
|
83 | return img; |
|
|
84 | } |
|
|
85 | |
|
|
86 | void |
|
|
87 | rxvt_img::destroy () |
|
|
88 | { |
|
|
89 | if (--ref->cnt) |
70 | return img; |
90 | return; |
|
|
91 | |
|
|
92 | if (pm && ref->ours) |
|
|
93 | XFreePixmap (s->display->dpy, pm); |
|
|
94 | |
|
|
95 | delete ref; |
71 | } |
96 | } |
72 | |
97 | |
73 | rxvt_img::~rxvt_img () |
98 | rxvt_img::~rxvt_img () |
74 | { |
99 | { |
75 | if (!shared) |
100 | destroy (); |
76 | XFreePixmap (s->display->dpy, pm); |
101 | } |
|
|
102 | |
|
|
103 | void |
|
|
104 | rxvt_img::alloc () |
|
|
105 | { |
|
|
106 | pm = XCreatePixmap (s->display->dpy, s->display->root, w, h, format->depth); |
|
|
107 | ref = new pixref (w, h); |
|
|
108 | } |
|
|
109 | |
|
|
110 | Picture |
|
|
111 | rxvt_img::src_picture () |
|
|
112 | { |
|
|
113 | Display *dpy = s->display->dpy; |
|
|
114 | |
|
|
115 | XRenderPictureAttributes pa; |
|
|
116 | pa.repeat = repeat; |
|
|
117 | Picture pic = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
|
|
118 | |
|
|
119 | XRectangle clip = { -x, -y, min (w, ref->w), min (h, ref->h) }; |
|
|
120 | XRenderSetPictureClipRectangles (dpy, pic, 0, 0, &clip, 1); |
|
|
121 | |
|
|
122 | return pic; |
77 | } |
123 | } |
78 | |
124 | |
79 | void |
125 | void |
80 | rxvt_img::unshare () |
126 | rxvt_img::unshare () |
81 | { |
127 | { |
82 | if (!shared) |
128 | if (ref->cnt == 1 && ref->ours) |
83 | return; |
129 | return; |
84 | |
130 | |
85 | rxvt_img *img = clone (); |
131 | //TODO: maybe should reify instead |
|
|
132 | Pixmap pm2 = XCreatePixmap (s->display->dpy, s->display->root, ref->w, ref->h, format->depth); |
|
|
133 | GC gc = XCreateGC (s->display->dpy, pm, 0, 0); |
|
|
134 | XCopyArea (s->display->dpy, pm, pm2, gc, 0, 0, ref->w, ref->h, 0, 0); |
|
|
135 | XFreeGC (s->display->dpy, gc); |
86 | |
136 | |
87 | ::swap (pm , img->pm); |
137 | destroy (); |
88 | ::swap (shared, img->shared); |
|
|
89 | |
138 | |
90 | delete img; |
139 | pm = pm2; |
|
|
140 | ref = new pixref (ref->w, ref->h); |
91 | } |
141 | } |
92 | |
142 | |
93 | void |
143 | void |
94 | rxvt_img::fill (const rxvt_color &c) |
144 | rxvt_img::fill (const rxvt_color &c) |
95 | { |
145 | { |
… | |
… | |
129 | |
179 | |
130 | Display *dpy = s->display->dpy; |
180 | Display *dpy = s->display->dpy; |
131 | int size = max (rh, rv) * 2 + 1; |
181 | int size = max (rh, rv) * 2 + 1; |
132 | double *kernel = (double *)malloc (size * sizeof (double)); |
182 | double *kernel = (double *)malloc (size * sizeof (double)); |
133 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
183 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
134 | rxvt_img *img = new rxvt_img (s, format, w, h); |
184 | rxvt_img *img = new rxvt_img (s, format, x, y, w, h); |
|
|
185 | img->alloc (); |
|
|
186 | |
|
|
187 | Picture src = src_picture (); |
135 | |
188 | |
136 | XRenderPictureAttributes pa; |
189 | XRenderPictureAttributes pa; |
137 | |
|
|
138 | pa.repeat = RepeatPad; |
190 | pa.repeat = RepeatPad; |
139 | Picture src = XRenderCreatePicture (dpy, pm , format, CPRepeat, &pa); |
|
|
140 | Picture dst = XRenderCreatePicture (dpy, img->pm, format, CPRepeat, &pa); |
191 | Picture dst = XRenderCreatePicture (dpy, img->pm, format, CPRepeat, &pa); |
141 | |
192 | |
142 | Pixmap tmp_pm = XCreatePixmap (dpy, pm, w, h, format->depth); |
193 | Pixmap tmp_pm = XCreatePixmap (dpy, pm, w, h, format->depth); |
143 | Picture tmp = XRenderCreatePicture (dpy, tmp_pm , format, CPRepeat, &pa); |
194 | Picture tmp = XRenderCreatePicture (dpy, tmp_pm , format, CPRepeat, &pa); |
144 | XFreePixmap (dpy, tmp_pm); |
195 | XFreePixmap (dpy, tmp_pm); |
… | |
… | |
198 | |
249 | |
199 | return mask; |
250 | return mask; |
200 | } |
251 | } |
201 | |
252 | |
202 | void |
253 | void |
203 | rxvt_img::brightness (double r, double g, double b, double a) |
254 | rxvt_img::brightness (unsigned short r, unsigned short g, unsigned short b, unsigned short a) |
204 | { |
255 | { |
205 | Display *dpy = s->display->dpy; |
256 | Display *dpy = s->display->dpy; |
206 | Picture src = create_xrender_mask (dpy, pm, True); |
257 | Picture src = create_xrender_mask (dpy, pm, True); |
207 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
258 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
208 | |
259 | |
209 | XRenderColor mask_c; |
260 | XRenderColor mask_c; |
210 | mask_c.red = float_to_component (r); |
261 | mask_c.red = r; |
211 | mask_c.green = float_to_component (g); |
262 | mask_c.green = g; |
212 | mask_c.blue = float_to_component (b); |
263 | mask_c.blue = b; |
213 | mask_c.alpha = float_to_component (a); |
264 | mask_c.alpha = a; |
214 | XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); |
265 | XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); |
215 | |
266 | |
216 | XRenderComposite (dpy, PictOpAdd, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
267 | XRenderComposite (dpy, PictOpAdd, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
217 | |
268 | |
218 | XRenderFreePicture (dpy, src); |
269 | XRenderFreePicture (dpy, src); |
219 | XRenderFreePicture (dpy, dst); |
270 | XRenderFreePicture (dpy, dst); |
220 | } |
271 | } |
221 | |
272 | |
222 | void |
273 | void |
223 | rxvt_img::contrast (double r, double g, double b, double a) |
274 | rxvt_img::contrast (unsigned short r, unsigned short g, unsigned short b, unsigned short a) |
224 | { |
275 | { |
225 | if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) |
276 | if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) |
226 | return; |
277 | return; |
227 | |
278 | |
228 | Display *dpy = s->display->dpy; |
279 | Display *dpy = s->display->dpy; |
229 | Picture src = create_xrender_mask (dpy, pm, True); |
280 | Picture src = create_xrender_mask (dpy, pm, True); |
230 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
281 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
231 | |
282 | |
232 | XRenderColor mask_c; |
283 | XRenderColor mask_c; |
233 | mask_c.red = float_to_component (r); |
284 | mask_c.red = r; |
234 | mask_c.green = float_to_component (g); |
285 | mask_c.green = g; |
235 | mask_c.blue = float_to_component (b); |
286 | mask_c.blue = b; |
236 | mask_c.alpha = float_to_component (a); |
287 | mask_c.alpha = a; |
237 | XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); |
288 | XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); |
238 | |
289 | |
239 | XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
290 | XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
240 | |
291 | |
241 | XRenderFreePicture (dpy, src); |
292 | XRenderFreePicture (dpy, src); |
… | |
… | |
291 | |
342 | |
292 | int rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
343 | int rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
293 | int channels = gdk_pixbuf_get_n_channels (pixbuf); |
344 | int channels = gdk_pixbuf_get_n_channels (pixbuf); |
294 | unsigned char *row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
345 | unsigned char *row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
295 | char *line = ximage->data; |
346 | char *line = ximage->data; |
296 | |
|
|
297 | rgba c (0, 0, 0); |
|
|
298 | |
|
|
299 | if (channels == 4 && alpha_mask == 0) |
|
|
300 | { |
|
|
301 | //pix_colors[Color_bg].get (c); |
|
|
302 | //TODO |
|
|
303 | c.r = 0xffff; c.g = 0xc0c0; c.b = 0xcbcb;//D |
|
|
304 | c.r >>= 8; |
|
|
305 | c.g >>= 8; |
|
|
306 | c.b >>= 8; |
|
|
307 | } |
|
|
308 | |
347 | |
309 | for (int y = 0; y < height; y++) |
348 | for (int y = 0; y < height; y++) |
310 | { |
349 | { |
311 | for (int x = 0; x < width; x++) |
350 | for (int x = 0; x < width; x++) |
312 | { |
351 | { |
… | |
… | |
315 | unsigned char r, g, b, a; |
354 | unsigned char r, g, b, a; |
316 | |
355 | |
317 | if (channels == 4) |
356 | if (channels == 4) |
318 | { |
357 | { |
319 | a = pixel[3]; |
358 | a = pixel[3]; |
320 | r = (pixel[0] * a + c.r * (0xff - a)) / 0xff; |
359 | r = pixel[0] * a / 0xff; |
321 | g = (pixel[1] * a + c.g * (0xff - a)) / 0xff; |
360 | g = pixel[1] * a / 0xff; |
322 | b = (pixel[2] * a + c.b * (0xff - a)) / 0xff; |
361 | b = pixel[2] * a / 0xff; |
323 | } |
362 | } |
324 | else |
363 | else |
325 | { |
364 | { |
326 | a = 0xff; |
365 | a = 0xff; |
327 | r = pixel[0]; |
366 | r = pixel[0]; |
… | |
… | |
352 | } |
391 | } |
353 | |
392 | |
354 | rxvt_img * |
393 | rxvt_img * |
355 | rxvt_img::clone () |
394 | rxvt_img::clone () |
356 | { |
395 | { |
|
|
396 | return new rxvt_img (*this); |
|
|
397 | } |
|
|
398 | |
|
|
399 | rxvt_img * |
|
|
400 | rxvt_img::reify () |
|
|
401 | { |
|
|
402 | if (x == 0 && y == 0 && w == ref->w && h == ref->h) |
|
|
403 | return clone (); |
|
|
404 | |
357 | rxvt_img *img = new rxvt_img (s, format, w, h); |
405 | rxvt_img *img = new rxvt_img (s, format, 0, 0, w, h); |
|
|
406 | img->alloc (); |
358 | |
407 | |
359 | GC gc = XCreateGC (s->display->dpy, pm, 0, 0); |
|
|
360 | XCopyArea (s->display->dpy, pm, img->pm, gc, 0, 0, w, h, 0, 0); |
|
|
361 | XFreeGC (s->display->dpy, gc); |
|
|
362 | |
|
|
363 | return img; |
|
|
364 | } |
|
|
365 | |
|
|
366 | rxvt_img * |
|
|
367 | rxvt_img::sub_rect (int x, int y, int width, int height, int repeat) |
|
|
368 | { |
|
|
369 | rxvt_img *img = new rxvt_img (s, format, width, height); |
|
|
370 | |
|
|
371 | Display *dpy = s->display->dpy; |
408 | Display *dpy = s->display->dpy; |
372 | XRenderPictureAttributes pa; |
409 | |
373 | pa.repeat = repeat; |
410 | Picture src = src_picture (); |
374 | Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
|
|
375 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
411 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
376 | |
412 | |
377 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, width, height); |
413 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); |
378 | |
414 | |
379 | XRenderFreePicture (dpy, src); |
|
|
380 | XRenderFreePicture (dpy, dst); |
415 | XRenderFreePicture (dpy, src); |
|
|
416 | XRenderFreePicture (dpy, dst); |
381 | |
417 | |
382 | return img; |
418 | return img; |
383 | } |
419 | } |
384 | |
420 | |
385 | rxvt_img * |
421 | rxvt_img * |
|
|
422 | rxvt_img::sub_rect (int x, int y, int width, int height) |
|
|
423 | { |
|
|
424 | rxvt_img *img = clone (); |
|
|
425 | |
|
|
426 | //TODO: width > w, must reify |
|
|
427 | |
|
|
428 | img->x += x; |
|
|
429 | img->y += y; |
|
|
430 | img->w = width; |
|
|
431 | img->h = height; |
|
|
432 | |
|
|
433 | return img; |
|
|
434 | } |
|
|
435 | |
|
|
436 | rxvt_img * |
386 | rxvt_img::transform (int new_width, int new_height, double matrix[9], int repeat) |
437 | rxvt_img::transform (int new_width, int new_height, double matrix[9]) |
387 | { |
438 | { |
388 | rxvt_img *img = new rxvt_img (s, format, new_width, new_height); |
439 | rxvt_img *img = new rxvt_img (s, format, 0, 0, new_width, new_height); |
|
|
440 | img->alloc (); |
389 | |
441 | |
390 | Display *dpy = s->display->dpy; |
442 | Display *dpy = s->display->dpy; |
391 | XRenderPictureAttributes pa; |
443 | Picture src = src_picture (); |
392 | pa.repeat = repeat; |
|
|
393 | Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
|
|
394 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
444 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
395 | |
445 | |
396 | XTransform xfrm; |
446 | XTransform xfrm; |
397 | |
447 | |
398 | for (int i = 0; i < 3; ++i) |
448 | for (int i = 0; i < 3; ++i) |
399 | for (int j = 0; j < 3; ++j) |
449 | for (int j = 0; j < 3; ++j) |
400 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
450 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
|
|
451 | |
|
|
452 | xfrm.matrix [0][2] += XDoubleToFixed (x);//TODO |
|
|
453 | xfrm.matrix [0][3] += XDoubleToFixed (y); |
401 | |
454 | |
402 | XRenderSetPictureFilter (dpy, src, "good", 0, 0); |
455 | XRenderSetPictureFilter (dpy, src, "good", 0, 0); |
403 | XRenderSetPictureTransform (dpy, src, &xfrm); |
456 | XRenderSetPictureTransform (dpy, src, &xfrm); |
404 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
457 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
405 | |
458 | |
… | |
… | |
420 | |
473 | |
421 | return transform (new_width, new_height, matrix); |
474 | return transform (new_width, new_height, matrix); |
422 | } |
475 | } |
423 | |
476 | |
424 | rxvt_img * |
477 | rxvt_img * |
425 | rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi, int repeat) |
478 | rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) |
426 | { |
479 | { |
427 | double s = sin (phi); |
480 | double s = sin (phi); |
428 | double c = cos (phi); |
481 | double c = cos (phi); |
429 | |
482 | |
430 | double matrix[9] = { |
483 | double matrix[9] = { |
431 | c, -s, -c * x + s * y + x, |
484 | c, -s, -c * x + s * y + x, |
432 | s, c, -s * x - c * y + y, |
485 | s, c, -s * x - c * y + y, |
433 | 0, 0, 1 |
486 | 0, 0, 1 |
434 | }; |
487 | }; |
435 | |
488 | |
436 | return transform (new_width, new_height, matrix, repeat); |
489 | return transform (new_width, new_height, matrix); |
437 | } |
490 | } |
438 | |
491 | |
439 | rxvt_img * |
492 | rxvt_img * |
440 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
493 | rxvt_img::convert_to (XRenderPictFormat *new_format, const rxvt_color &bg) |
441 | { |
494 | { |
|
|
495 | if (new_format == format) |
|
|
496 | return clone (); |
|
|
497 | |
442 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
498 | rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h); |
|
|
499 | img->alloc (); |
443 | |
500 | |
444 | Display *dpy = s->display->dpy; |
501 | Display *dpy = s->display->dpy; |
445 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
502 | Picture src = src_picture (); |
446 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
503 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
|
|
504 | int op = PictOpSrc; |
447 | |
505 | |
|
|
506 | if (format->direct.alphaMask && !new_format->direct.alphaMask) |
|
|
507 | { |
|
|
508 | // does it have to be that complicated |
|
|
509 | rgba c; |
|
|
510 | bg.get (c); |
|
|
511 | |
|
|
512 | XRenderColor rc = { c.r, c.g, c.b, 0xffff }; |
|
|
513 | XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h); |
|
|
514 | |
|
|
515 | op = PictOpOver; |
|
|
516 | } |
|
|
517 | |
448 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
518 | XRenderComposite (dpy, op, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
449 | |
519 | |
450 | XRenderFreePicture (dpy, src); |
520 | XRenderFreePicture (dpy, src); |
451 | XRenderFreePicture (dpy, dst); |
521 | XRenderFreePicture (dpy, dst); |
452 | |
522 | |
453 | return img; |
523 | return img; |
… | |
… | |
456 | rxvt_img * |
526 | rxvt_img * |
457 | rxvt_img::blend (rxvt_img *img, double factor) |
527 | rxvt_img::blend (rxvt_img *img, double factor) |
458 | { |
528 | { |
459 | rxvt_img *img2 = clone (); |
529 | rxvt_img *img2 = clone (); |
460 | Display *dpy = s->display->dpy; |
530 | Display *dpy = s->display->dpy; |
461 | Picture src = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
531 | Picture src = src_picture (); |
462 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
532 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
463 | Picture mask = create_xrender_mask (dpy, img->pm, False); |
533 | Picture mask = create_xrender_mask (dpy, img->pm, False); |
464 | |
534 | |
465 | XRenderColor mask_c; |
535 | XRenderColor mask_c; |
466 | |
536 | |