1 | #include "../config.h" |
1 | #include "../config.h" |
2 | #include "rxvt.h" |
2 | #include "rxvt.h" |
3 | |
3 | |
4 | #if HAVE_IMG |
4 | #if HAVE_IMG |
5 | |
5 | |
6 | rxvt_img::rxvt_img (rxvt_screen *screen, Pixmap *pm, XRenderPictFormat *format, int width, int height) |
6 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height) |
7 | : s(screen), pm(pixmap) w(width), h(height), format(format) |
7 | : s(screen), w(width), h(height), format(format) |
8 | { |
8 | { |
|
|
9 | pm = XCreatePixmap (s->display->dpy, s->display->root, w, h, format->depth); |
9 | } |
10 | } |
10 | |
11 | |
11 | rxvt_img::rxvt_img (rxvt_screen *screen, GdkPixbuf *pixbuf, |
12 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap) |
12 | int x, int y, int width, int height) |
13 | : s(screen), pm(pixmap), w(width), h(height), format(format) |
13 | : s(screen), w(width), h(height) |
|
|
14 | { |
14 | { |
15 | } |
15 | } |
16 | |
16 | |
17 | rxvt_img::~rxvt_img () |
17 | rxvt_img::~rxvt_img () |
18 | { |
18 | { |
… | |
… | |
25 | { |
25 | { |
26 | XGCValues gcv; |
26 | XGCValues gcv; |
27 | gcv.foreground = c; |
27 | gcv.foreground = c; |
28 | GC gc = XCreateGC (s->display->dpy, pm, GCForeground, &gcv); |
28 | GC gc = XCreateGC (s->display->dpy, pm, GCForeground, &gcv); |
29 | XFillRectangle (s->display->dpy, pm, gc, 0, 0, w, h); |
29 | XFillRectangle (s->display->dpy, pm, gc, 0, 0, w, h); |
|
|
30 | XFreeGC (s->display->dpy, gc); |
30 | } |
31 | } |
31 | |
32 | |
32 | rxvt_img *copy () |
33 | void |
|
|
34 | rxvt_img::blur (int rh, int rv) |
33 | { |
35 | { |
34 | Pixmap pm2 = XCreatePixmap (s->display->dpy, pm, w, h, depth); |
36 | //TODO |
35 | XCopyArea (s->display->dpy, pm, pm2, 0, 0, w, h, 0, 0); |
|
|
36 | return new rxvt_img (s, pm2, format, w, h); |
|
|
37 | } |
37 | } |
|
|
38 | |
|
|
39 | void |
|
|
40 | rxvt_img::brightness (double r, double g, double b, double a) |
|
|
41 | { |
|
|
42 | //TODO |
|
|
43 | } |
|
|
44 | |
|
|
45 | void |
|
|
46 | rxvt_img::contrast (double r, double g, double b, double a) |
|
|
47 | { |
|
|
48 | //TODO |
|
|
49 | } |
|
|
50 | |
|
|
51 | void |
|
|
52 | rxvt_img::render (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y) |
|
|
53 | { |
|
|
54 | //TODO |
|
|
55 | } |
|
|
56 | |
|
|
57 | rxvt_img * |
|
|
58 | rxvt_img::copy () |
|
|
59 | { |
|
|
60 | GC gc = XCreateGC (s->display->dpy, pm, 0, 0); |
|
|
61 | Pixmap pm2 = XCreatePixmap (s->display->dpy, pm, w, h, format->depth); |
|
|
62 | XCopyArea (s->display->dpy, pm, pm2, gc, 0, 0, w, h, 0, 0); |
|
|
63 | XFreeGC (s->display->dpy, gc); |
|
|
64 | return new rxvt_img (s, format, w, h, pm2); |
|
|
65 | } |
|
|
66 | |
|
|
67 | rxvt_img * |
|
|
68 | rxvt_img::transform (int new_width, int new_height, double matrix[16]) |
|
|
69 | { |
|
|
70 | //TODO |
|
|
71 | } |
|
|
72 | |
|
|
73 | rxvt_img * |
|
|
74 | rxvt_img::scale (int new_width, int new_height) |
|
|
75 | { |
|
|
76 | // use transform |
|
|
77 | //TODO |
|
|
78 | } |
|
|
79 | |
38 | |
80 | |
39 | #endif |
81 | #endif |
40 | |
82 | |