ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
Revision: 1.1
Committed: Sun Jun 3 09:59:58 2012 UTC (11 years, 11 months ago) by root
Content type: text/plain
Branch: MAIN
Log Message:
details

File Contents

# User Rev Content
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     argb = gdk_pixbuf_get_has_alpha (pixbuf);
16     depth = gdk_pixbuf_get_bits_per_sample (pixbuf);
17     }
18    
19     rxvt_img::~rxvt_img ()
20     {
21     if (pm)
22     XFreePixmap (s->display->dpy, pm);
23     }
24    
25     void
26     rxvt_img::fill (const rxvt_color &c)
27     {
28     XGCValues gcv;
29     gcv.foreground = c;
30     GC gc = XCreateGC (s->display->dpy, pm, GCForeground, &gcv);
31     XFillRectangle (s->display->dpy, pm, gc, 0, 0, w, h);
32     }
33    
34     rxvt_img *copy ()
35     {
36     Pixmap pm2 = XCreatePixmap (s->display->dpy, pm, w, h, depth);
37     XCopyArea (s->display->dpy, pm, pm2, 0, 0, w, h, 0, 0);
38     return new rxvt_img (s, pm2, format, w, h);
39     }
40    
41     #endif
42