… | |
… | |
101 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
101 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
102 | |
102 | |
103 | XRenderPictureAttributes pa; |
103 | XRenderPictureAttributes pa; |
104 | |
104 | |
105 | pa.repeat = RepeatPad; |
105 | pa.repeat = RepeatPad; |
106 | Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
106 | Picture src = XRenderCreatePicture (dpy, pm , format, CPRepeat, &pa); |
107 | Pixmap tmp = XCreatePixmap (dpy, pm, w, h, format->depth); |
107 | Pixmap tmp = XCreatePixmap (dpy, pm, w, h, format->depth); |
108 | Picture dst = XRenderCreatePicture (dpy, tmp, format, CPRepeat, &pa); |
108 | Picture dst = XRenderCreatePicture (dpy, tmp, format, CPRepeat, &pa); |
109 | XFreePixmap (dpy, tmp); |
109 | XFreePixmap (dpy, tmp); |
110 | |
110 | |
111 | if (kernel && params) |
111 | if (kernel && params) |
… | |
… | |
268 | |
268 | |
269 | if (channels == 4 && alpha_mask == 0) |
269 | if (channels == 4 && alpha_mask == 0) |
270 | { |
270 | { |
271 | //pix_colors[Color_bg].get (c); |
271 | //pix_colors[Color_bg].get (c); |
272 | //TODO |
272 | //TODO |
|
|
273 | c.r = 0xffff; c.g = 0xc0c0; c.b = 0xcbcb;//D |
273 | c.r >>= 8; |
274 | c.r >>= 8; |
274 | c.g >>= 8; |
275 | c.g >>= 8; |
275 | c.b >>= 8; |
276 | c.b >>= 8; |
276 | } |
277 | } |
277 | |
278 | |
… | |
… | |
345 | |
346 | |
346 | for (int i = 0; i < 3; ++i) |
347 | for (int i = 0; i < 3; ++i) |
347 | for (int j = 0; j < 3; ++j) |
348 | for (int j = 0; j < 3; ++j) |
348 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
349 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
349 | |
350 | |
|
|
351 | XRenderSetPictureFilter (dpy, src, "good", 0, 0); |
350 | XRenderSetPictureTransform (dpy, src, &xfrm); |
352 | XRenderSetPictureTransform (dpy, src, &xfrm); |
351 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
353 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
352 | |
354 | |
353 | XRenderFreePicture (dpy, src); |
355 | XRenderFreePicture (dpy, src); |
354 | XRenderFreePicture (dpy, dst); |
356 | XRenderFreePicture (dpy, dst); |
… | |
… | |
358 | |
360 | |
359 | rxvt_img * |
361 | rxvt_img * |
360 | rxvt_img::scale (int new_width, int new_height) |
362 | rxvt_img::scale (int new_width, int new_height) |
361 | { |
363 | { |
362 | double matrix[9] = { |
364 | double matrix[9] = { |
363 | new_width / (double)w, 0, 0, |
365 | w / (double)new_width, 0, 0, |
364 | 0, new_height / (double)h, 0, |
366 | 0, h / (double)new_height, 0, |
365 | 0, 0, 1 |
367 | 0, 0, 1 |
366 | }; |
368 | }; |
367 | |
369 | |
368 | return transform (new_width, new_height, RepeatNormal, matrix); |
370 | return transform (new_width, new_height, RepeatNormal, matrix); |
369 | } |
371 | } |
370 | |
372 | |
371 | rxvt_img * |
373 | rxvt_img * |
|
|
374 | rxvt_img::rotate (int new_width, int new_height, int repeat, int x, int y, double phi) |
|
|
375 | { |
|
|
376 | double s = sin (phi); |
|
|
377 | double c = cos (phi); |
|
|
378 | |
|
|
379 | double matrix[9] = { |
|
|
380 | c, -s, -c * x + s * y + x, |
|
|
381 | s, c, -s * x - c * y + y, |
|
|
382 | 0, 0, 1 |
|
|
383 | }; |
|
|
384 | |
|
|
385 | return transform (new_width, new_height, repeat, matrix); |
|
|
386 | } |
|
|
387 | |
|
|
388 | rxvt_img * |
372 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
389 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
373 | { |
390 | { |
374 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
391 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
375 | |
392 | |
376 | Display *dpy = s->display->dpy; |
393 | Display *dpy = s->display->dpy; |