1 |
root |
1.1 |
#ifndef IMG_H |
2 |
|
|
#define IMG_H |
3 |
|
|
|
4 |
root |
1.8 |
#if HAVE_BG_PIXMAP && BG_IMAGE_FROM_FILE && ENABLE_TRANSPARENCY && HAVE_PIXBUF |
5 |
root |
1.1 |
#define HAVE_IMG 1 |
6 |
|
|
#endif |
7 |
|
|
|
8 |
|
|
#if HAVE_IMG |
9 |
|
|
|
10 |
|
|
#include <X11/extensions/Xrender.h> |
11 |
|
|
|
12 |
|
|
struct rxvt_img |
13 |
|
|
{ |
14 |
|
|
rxvt_screen *s; |
15 |
|
|
Pixmap pm; |
16 |
root |
1.15 |
int x, y, w, h, repeat; |
17 |
root |
1.1 |
XRenderPictFormat *format; |
18 |
root |
1.6 |
bool shared; // true if we don't own it |
19 |
root |
1.1 |
|
20 |
|
|
rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height); |
21 |
root |
1.3 |
rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap); |
22 |
root |
1.5 |
static rxvt_img *new_from_root (rxvt_screen *s); // get root pixmap |
23 |
root |
1.6 |
static rxvt_img *new_from_file (rxvt_screen *s, const char *filename); // from pixbuf |
24 |
root |
1.4 |
|
25 |
root |
1.1 |
~rxvt_img (); |
26 |
|
|
|
27 |
|
|
Pixmap steal () |
28 |
|
|
{ |
29 |
root |
1.6 |
shared = true; |
30 |
|
|
return pm; |
31 |
root |
1.1 |
} |
32 |
|
|
|
33 |
|
|
// inplace |
34 |
root |
1.15 |
void move (int dx, int dy) |
35 |
|
|
{ |
36 |
|
|
x += dx; |
37 |
|
|
y += dy; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
void repeat_mode (int repeat) |
41 |
|
|
{ |
42 |
|
|
this->repeat = repeat; |
43 |
|
|
} |
44 |
|
|
|
45 |
root |
1.8 |
void unshare (); // create a copy of the pixmap if !shared |
46 |
root |
1.1 |
void fill (const rxvt_color &c); |
47 |
|
|
void brightness (double r, double g, double b, double a = 1.); |
48 |
|
|
void contrast (double r, double g, double b, double a = 1.); |
49 |
root |
1.9 |
bool render_pixbuf (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y); |
50 |
root |
1.1 |
|
51 |
|
|
// copy |
52 |
sf-exg |
1.12 |
rxvt_img *blur (int rh, int rv); |
53 |
root |
1.8 |
rxvt_img *clone (); |
54 |
root |
1.15 |
rxvt_img *sub_rect (int x, int y, int width, int height); |
55 |
|
|
rxvt_img *transform (int new_width, int new_height, double matrix[9]); |
56 |
root |
1.1 |
rxvt_img *scale (int new_width, int new_height); |
57 |
root |
1.15 |
rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi); |
58 |
root |
1.14 |
rxvt_img *convert_to (XRenderPictFormat *format, const rxvt_color &bg); |
59 |
sf-exg |
1.13 |
rxvt_img *blend (rxvt_img *img, double factor); |
60 |
root |
1.1 |
}; |
61 |
|
|
|
62 |
|
|
#endif |
63 |
|
|
|
64 |
|
|
#endif |
65 |
|
|
|