… | |
… | |
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 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
|
|
226 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
|
|
227 | |
|
|
228 | XTransform xfrm; |
|
|
229 | |
|
|
230 | for (int i = 0; i < 3; ++i) |
|
|
231 | for (int j = 0; j < 3; ++j) |
|
|
232 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
|
|
233 | |
|
|
234 | XRenderSetPictureTransform (dpy, src, &xfrm); |
|
|
235 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
|
|
236 | |
|
|
237 | XRenderFreePicture (dpy, src); |
|
|
238 | XRenderFreePicture (dpy, dst); |
|
|
239 | |
|
|
240 | return img; |
223 | } |
241 | } |
224 | |
242 | |
225 | rxvt_img * |
243 | rxvt_img * |
226 | rxvt_img::scale (int new_width, int new_height) |
244 | rxvt_img::scale (int new_width, int new_height) |
227 | { |
245 | { |
… | |
… | |
238 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
256 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
239 | { |
257 | { |
240 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
258 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
241 | |
259 | |
242 | Display *dpy = s->display->dpy; |
260 | Display *dpy = s->display->dpy; |
243 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
261 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
244 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
262 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
245 | |
263 | |
246 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
264 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
247 | |
265 | |
248 | XRenderFreePicture (dpy, src); |
266 | XRenderFreePicture (dpy, src); |