ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
Revision: 1.2
Committed: Sun Jun 3 10:01:32 2012 UTC (11 years, 11 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.1: +0 -2 lines
Log Message:
details

File Contents

# Content
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