| 1 |
root |
1.1 |
#include "../config.h" |
| 2 |
|
|
#include "rxvt.h" |
| 3 |
|
|
|
| 4 |
|
|
#if HAVE_IMG |
| 5 |
|
|
|
| 6 |
|
|
rxvt_img::rxvt_img (rxvt_screen *screen, Pixmap *pm, XRenderPictFormat *format, int width, int height) |
| 7 |
|
|
: s(screen), pm(pixmap) w(width), h(height), format(format) |
| 8 |
|
|
{ |
| 9 |
|
|
} |
| 10 |
|
|
|
| 11 |
|
|
rxvt_img::rxvt_img (rxvt_screen *screen, GdkPixbuf *pixbuf, |
| 12 |
|
|
int x, int y, int width, int height) |
| 13 |
|
|
: s(screen), w(width), h(height) |
| 14 |
|
|
{ |
| 15 |
|
|
} |
| 16 |
|
|
|
| 17 |
|
|
rxvt_img::~rxvt_img () |
| 18 |
|
|
{ |
| 19 |
|
|
if (pm) |
| 20 |
|
|
XFreePixmap (s->display->dpy, pm); |
| 21 |
|
|
} |
| 22 |
|
|
|
| 23 |
|
|
void |
| 24 |
|
|
rxvt_img::fill (const rxvt_color &c) |
| 25 |
|
|
{ |
| 26 |
|
|
XGCValues gcv; |
| 27 |
|
|
gcv.foreground = c; |
| 28 |
|
|
GC gc = XCreateGC (s->display->dpy, pm, GCForeground, &gcv); |
| 29 |
|
|
XFillRectangle (s->display->dpy, pm, gc, 0, 0, w, h); |
| 30 |
|
|
} |
| 31 |
|
|
|
| 32 |
|
|
rxvt_img *copy () |
| 33 |
|
|
{ |
| 34 |
|
|
Pixmap pm2 = XCreatePixmap (s->display->dpy, pm, w, h, depth); |
| 35 |
|
|
XCopyArea (s->display->dpy, pm, pm2, 0, 0, w, h, 0, 0); |
| 36 |
|
|
return new rxvt_img (s, pm2, format, w, h); |
| 37 |
|
|
} |
| 38 |
|
|
|
| 39 |
|
|
#endif |
| 40 |
|
|
|