1 | #ifndef IMG_H |
1 | #ifndef IMG_H), |
2 | #define IMG_H |
2 | #define IMG_H |
3 | |
3 | |
4 | #if HAVE_BG_PIXMAP |
4 | #if HAVE_BG_PIXMAP |
5 | #define HAVE_IMG 1 |
5 | #define HAVE_IMG 1 |
6 | #endif |
6 | #endif |
… | |
… | |
9 | |
9 | |
10 | #define float_to_component(d) (int32_t)((d) * 65535.99) |
10 | #define float_to_component(d) (int32_t)((d) * 65535.99) |
11 | |
11 | |
12 | #include <X11/extensions/Xrender.h> |
12 | #include <X11/extensions/Xrender.h> |
13 | |
13 | |
14 | class rxvt_img |
14 | struct rxvt_img |
15 | { |
15 | { |
16 | void destroy (); |
|
|
17 | Picture src_picture (); |
|
|
18 | |
|
|
19 | public: |
|
|
20 | typedef double nv; |
16 | typedef double nv; |
21 | |
17 | |
22 | // *could* also hold the Pixmap itself |
18 | // *could* also hold the Pixmap itself |
23 | struct pixref |
19 | struct pixref |
24 | { |
20 | { |
… | |
… | |
57 | } |
53 | } |
58 | |
54 | |
59 | // inplace |
55 | // inplace |
60 | void move (int dx, int dy) |
56 | void move (int dx, int dy) |
61 | { |
57 | { |
62 | x -= dx; |
58 | x += dx; |
63 | y -= dy; |
59 | y += dy; |
64 | } |
60 | } |
65 | |
61 | |
66 | void repeat_mode (int repeat) |
62 | void repeat_mode (int repeat) |
67 | { |
63 | { |
68 | this->repeat = repeat; |
64 | this->repeat = repeat; |
… | |
… | |
91 | float_to_component (g), |
87 | float_to_component (g), |
92 | float_to_component (b), |
88 | float_to_component (b), |
93 | float_to_component (a)); |
89 | float_to_component (a)); |
94 | } |
90 | } |
95 | |
91 | |
|
|
92 | void draw (rxvt_img *img, int op = PictOpOver, nv mask = 1.); |
|
|
93 | |
96 | // copy |
94 | // copy |
97 | rxvt_img *reify (); // make x, y 0, make real width/height |
95 | rxvt_img *reify (); // make x, y 0, make real width/height |
98 | rxvt_img *blur (int rh, int rv); |
96 | rxvt_img *blur (int rh, int rv); |
99 | rxvt_img *clone (); |
97 | rxvt_img *clone (); |
100 | rxvt_img *sub_rect (int x, int y, int width, int height); |
98 | rxvt_img *sub_rect (int x, int y, int width, int height); |
101 | rxvt_img *transform (nv matrix[3][3]); |
99 | rxvt_img *transform (const nv matrix[3][3]); |
102 | rxvt_img *scale (int new_width, int new_height); |
100 | rxvt_img *scale (int new_width, int new_height); |
103 | rxvt_img *rotate (int cx, int cy, nv phi); |
101 | rxvt_img *rotate (int cx, int cy, nv phi); |
104 | rxvt_img *convert_format (XRenderPictFormat *format, const rgba &bg); |
102 | rxvt_img *convert_format (XRenderPictFormat *format, const rgba &bg); |
105 | rxvt_img *blend (rxvt_img *img, nv factor = 1.); |
103 | rxvt_img *blend (rxvt_img *img, nv factor = 1.); |
106 | |
104 | |
… | |
… | |
109 | { |
107 | { |
110 | delete p; |
108 | delete p; |
111 | p = this; |
109 | p = this; |
112 | return this; |
110 | return this; |
113 | } |
111 | } |
|
|
112 | |
|
|
113 | private: |
|
|
114 | |
|
|
115 | void destroy (); |
|
|
116 | Picture picture (); |
|
|
117 | rxvt_img *transform (const nv *matrix); |
114 | }; |
118 | }; |
115 | |
119 | |
116 | #endif |
120 | #endif |
117 | |
121 | |
118 | #endif |
122 | #endif |