… | |
… | |
217 | } |
217 | } |
218 | |
218 | |
219 | rxvt_img * |
219 | rxvt_img * |
220 | rxvt_img::transform (int new_width, int new_height, int repeat, double matrix[9]) |
220 | rxvt_img::transform (int new_width, int new_height, int repeat, double matrix[9]) |
221 | { |
221 | { |
222 | //TODO |
222 | rxvt_img *img = new rxvt_img (s, format, new_width, new_height); |
|
|
223 | |
|
|
224 | Display *dpy = s->display->dpy; |
|
|
225 | XRenderPictureAttributes pa; |
|
|
226 | pa.repeat = repeat; |
|
|
227 | Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
|
|
228 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
|
|
229 | |
|
|
230 | XTransform xfrm; |
|
|
231 | |
|
|
232 | for (int i = 0; i < 3; ++i) |
|
|
233 | for (int j = 0; j < 3; ++j) |
|
|
234 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
|
|
235 | |
|
|
236 | XRenderSetPictureTransform (dpy, src, &xfrm); |
|
|
237 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
|
|
238 | |
|
|
239 | XRenderFreePicture (dpy, src); |
|
|
240 | XRenderFreePicture (dpy, dst); |
|
|
241 | |
|
|
242 | return img; |
223 | } |
243 | } |
224 | |
244 | |
225 | rxvt_img * |
245 | rxvt_img * |
226 | rxvt_img::scale (int new_width, int new_height) |
246 | rxvt_img::scale (int new_width, int new_height) |
227 | { |
247 | { |
… | |
… | |
238 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
258 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
239 | { |
259 | { |
240 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
260 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
241 | |
261 | |
242 | Display *dpy = s->display->dpy; |
262 | Display *dpy = s->display->dpy; |
243 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
263 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
244 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
264 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
245 | |
265 | |
246 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
266 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
247 | |
267 | |
248 | XRenderFreePicture (dpy, src); |
268 | XRenderFreePicture (dpy, src); |