3 #include "bcwindowbase.h"
6 BC_Pixmap::BC_Pixmap(BC_WindowBase *parent_window,
11 BC_Bitmap *opaque_bitmap, *alpha_bitmap, *mask_bitmap;
17 opaque_bitmap = new BC_Bitmap(parent_window,
20 parent_window->get_color_model(),
22 opaque_bitmap->set_bg_color(parent_window->get_bg_color());
23 opaque_bitmap->read_frame(frame,
32 alpha_bitmap = new BC_Bitmap(parent_window,
38 alpha_bitmap->read_frame(frame,
45 initialize(parent_window,
52 opaque_bitmap->write_drawable(opaque_pixmap,
66 alpha_bitmap->write_drawable(alpha_pixmap,
76 XFreeGC(top_level->display, copy_gc);
78 XSetClipMask(top_level->display, alpha_gc, alpha_pixmap);
82 BC_Pixmap::BC_Pixmap(BC_WindowBase *parent_window, int w, int h)
84 initialize(parent_window, w, h, PIXMAP_OPAQUE);
88 BC_Pixmap::~BC_Pixmap()
92 XFreePixmap(top_level->display, opaque_pixmap);
97 XFreeGC(top_level->display, alpha_gc);
98 XFreePixmap(top_level->display, alpha_pixmap);
102 int BC_Pixmap::initialize(BC_WindowBase *parent_window, int w, int h, int mode)
104 //printf("BC_Pixmap::initialize 1\n");
105 unsigned long gcmask = GCGraphicsExposures | GCForeground | GCBackground | GCFunction;
107 gcvalues.graphics_exposures = 0; // prevent expose events for every redraw
108 gcvalues.foreground = 0;
109 gcvalues.background = 1;
110 gcvalues.function = GXcopy;
112 //printf("BC_Pixmap::initialize 1\n");
115 this->parent_window = parent_window;
117 top_level = parent_window->top_level;
119 //printf("BC_Pixmap::initialize 1\n");
122 opaque_pixmap = XCreatePixmap(top_level->display,
126 top_level->default_depth);
129 //printf("BC_Pixmap::initialize 1\n");
132 alpha_pixmap = XCreatePixmap(top_level->display,
138 //printf("BC_Pixmap::initialize 1\n");
139 alpha_gc = XCreateGC(top_level->display,
144 //printf("BC_Pixmap::initialize 1\n");
145 copy_gc = XCreateGC(top_level->display,
151 //printf("BC_Pixmap::initialize 2\n");
155 void BC_Pixmap::resize(int w, int h)
157 Pixmap new_pixmap = XCreatePixmap(top_level->display,
161 top_level->default_depth);
162 XCopyArea(top_level->display,
174 XFreePixmap(top_level->display, opaque_pixmap);
175 opaque_pixmap = new_pixmap;
179 void BC_Pixmap::copy_area(int x, int y, int w, int h, int x2, int y2)
181 XCopyArea(top_level->display,
193 int BC_Pixmap::write_drawable(Drawable &pixmap,
201 //printf("BC_Pixmap::write_drawable 1\n");
216 XSetClipOrigin(top_level->display, alpha_gc, dest_x - src_x, dest_y - src_y);
217 XCopyArea(top_level->display,
231 XCopyArea(top_level->display,
242 //printf("BC_Pixmap::write_drawable 2\n");
247 void BC_Pixmap::draw_vframe(VFrame *frame,
255 parent_window->draw_vframe(frame,
267 void BC_Pixmap::draw_pixmap(BC_Pixmap *pixmap,
275 pixmap->write_drawable(this->opaque_pixmap,
294 int BC_Pixmap::get_w()
299 int BC_Pixmap::get_h()
304 int BC_Pixmap::get_w_fixed()
309 int BC_Pixmap::get_h_fixed()
314 Pixmap BC_Pixmap::get_pixmap()
316 return opaque_pixmap;
319 Pixmap BC_Pixmap::get_alpha()
324 int BC_Pixmap::use_opaque()
329 int BC_Pixmap::use_alpha()
331 return mode == PIXMAP_ALPHA;