… | |
… | |
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 | |
10 | #define float_to_component(d) ((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 | class rxvt_img |
15 | { |
15 | { |
… | |
… | |
64 | this->repeat = repeat; |
64 | this->repeat = repeat; |
65 | } |
65 | } |
66 | |
66 | |
67 | void unshare (); // prepare for write |
67 | void unshare (); // prepare for write |
68 | void fill (const rxvt_color &c); |
68 | void fill (const rxvt_color &c); |
69 | void brightness (unsigned short r, unsigned short g, unsigned short b, unsigned short a); |
69 | //void linear_gradient (const XLinearGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); |
70 | void contrast (unsigned short r, unsigned short g, unsigned short b, unsigned short a); |
70 | //void radial_gradient (const XRadialGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); |
|
|
71 | //void conical_gradient (const XConicalGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); |
|
|
72 | void brightness (int32_t r, int32_t g, int32_t b, int32_t a); |
|
|
73 | void contrast (int32_t r, int32_t g, int32_t b, int32_t a); |
71 | |
74 | |
72 | void brightness (double r, double g, double b, double a = 1.) |
75 | void brightness (double r, double g, double b, double a = 1.) |
73 | { |
76 | { |
74 | brightness (float_to_component (r), |
77 | brightness (float_to_component (r), |
75 | float_to_component (g), |
78 | float_to_component (g), |
… | |
… | |
93 | rxvt_img *transform (int new_width, int new_height, double matrix[9]); |
96 | rxvt_img *transform (int new_width, int new_height, double matrix[9]); |
94 | rxvt_img *scale (int new_width, int new_height); |
97 | rxvt_img *scale (int new_width, int new_height); |
95 | rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi); |
98 | rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi); |
96 | rxvt_img *convert_format (XRenderPictFormat *format, const rxvt_color &bg); |
99 | rxvt_img *convert_format (XRenderPictFormat *format, const rxvt_color &bg); |
97 | rxvt_img *blend (rxvt_img *img, double factor); |
100 | rxvt_img *blend (rxvt_img *img, double factor); |
|
|
101 | |
|
|
102 | // egregiuous helper category |
|
|
103 | rxvt_img *replace (rxvt_img *&p) |
|
|
104 | { |
|
|
105 | delete p; |
|
|
106 | p = this; |
|
|
107 | return this; |
|
|
108 | } |
98 | }; |
109 | }; |
99 | |
110 | |
100 | #endif |
111 | #endif |
101 | |
112 | |
102 | #endif |
113 | #endif |