1 | #ifndef IMG_H |
1 | #ifndef IMG_H |
2 | #define IMG_H |
2 | #define IMG_H |
3 | |
3 | |
4 | #if defined HAVE_BG_PIXMAP && defined BG_IMAGE_FROM_FILE && defined ENABLE_TRANSPARENCY && defined HAVE_PIXBUF |
4 | #if HAVE_BG_PIXMAP && BG_IMAGE_FROM_FILE && ENABLE_TRANSPARENCY && HAVE_PIXBUF |
5 | #define HAVE_IMG 1 |
5 | #define HAVE_IMG 1 |
6 | #endif |
6 | #endif |
7 | |
7 | |
8 | #if HAVE_IMG |
8 | #if HAVE_IMG |
9 | |
9 | |
… | |
… | |
12 | struct rxvt_img |
12 | struct rxvt_img |
13 | { |
13 | { |
14 | rxvt_screen *s; |
14 | rxvt_screen *s; |
15 | Pixmap pm; |
15 | Pixmap pm; |
16 | int w, h; |
16 | int w, h; |
17 | int depth; |
|
|
18 | XRenderPictFormat *format; |
17 | XRenderPictFormat *format; |
|
|
18 | bool shared; // true if we don't own it |
19 | |
19 | |
20 | rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height); |
20 | rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height); |
21 | rxvt_img (rxvt_screen *screen, Pixmap *pixmap, XRenderPictFormat *format, int width, int height); |
21 | rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap); |
|
|
22 | static rxvt_img *new_from_root (rxvt_screen *s); // get root pixmap |
|
|
23 | static rxvt_img *new_from_file (rxvt_screen *s, const char *filename); // from pixbuf |
|
|
24 | |
22 | ~rxvt_img (); |
25 | ~rxvt_img (); |
23 | |
|
|
24 | void render (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y); |
|
|
25 | |
26 | |
26 | Pixmap steal () |
27 | Pixmap steal () |
27 | { |
28 | { |
28 | Pixmap res = pm; |
29 | shared = true; |
29 | pm = 0; |
|
|
30 | return res; |
30 | return pm; |
31 | } |
31 | } |
32 | |
32 | |
33 | // inplace |
33 | // inplace |
|
|
34 | void unshare (); // create a copy of the pixmap if !shared |
34 | void fill (const rxvt_color &c); |
35 | void fill (const rxvt_color &c); |
35 | void blur (int rh, int rv); |
36 | void blur (int rh, int rv); |
36 | void brightness (double r, double g, double b, double a = 1.); |
37 | void brightness (double r, double g, double b, double a = 1.); |
37 | void contrast (double r, double g, double b, double a = 1.); |
38 | void contrast (double r, double g, double b, double a = 1.); |
|
|
39 | bool render_pixbuf (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y); |
38 | |
40 | |
39 | // copy |
41 | // copy |
40 | rxvt_img *copy (); |
42 | rxvt_img *clone (); |
|
|
43 | rxvt_img *sub_rect (int x, int y, int width, int height, int repeat = RepeatNormal); |
|
|
44 | rxvt_img *transform (int new_width, int new_height, double matrix[9], int repeat = RepeatNormal); |
41 | rxvt_img *scale (int new_width, int new_height); |
45 | rxvt_img *scale (int new_width, int new_height); |
42 | rxvt_img *transform (int new_width, int new_height, double matrix[16]); |
46 | rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi, int repeat = RepeatNormal); |
|
|
47 | rxvt_img *convert_to (XRenderPictFormat *format); |
43 | }; |
48 | }; |
44 | |
49 | |
45 | #endif |
50 | #endif |
46 | |
51 | |
47 | #endif |
52 | #endif |