improve delays created by vicon drawing locks, reset_cache segv fix, gang track toolt...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcpixmap.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef BCPIXMAP_H
23 #define BCPIXMAP_H
24
25 #include <X11/Xlib.h>
26
27 #ifdef HAVE_XFT
28 #include <X11/Xft/Xft.h>
29 #endif
30
31 #ifdef HAVE_GL
32 #include <GL/glx.h>
33 #endif
34
35 #include "bcbitmap.inc"
36 #include "bcpixmap.inc"
37 #include "bcwindowbase.inc"
38 #include "vframe.inc"
39
40 class BC_Pixmap
41 {
42 public:
43         BC_Pixmap(BC_WindowBase *parent_window,
44                 VFrame *frame,
45                 int mode = PIXMAP_OPAQUE,
46                 int icon_offset = 0);
47         BC_Pixmap(BC_WindowBase *parent_window,
48                 int w,
49                 int h);
50         ~BC_Pixmap();
51
52         friend class BC_WindowBase;
53
54         void reset();
55         void resize(int w, int h);
56 // OpenGL for pixmaps doesn't seem to be accelerated so it has been discontinued.
57         void enable_opengl();
58         void copy_area(int x, int y, int w, int h, int x2, int y2);
59 // Draw this pixmap onto the drawable pointed to by pixmap.
60         int write_drawable(Drawable &pixmap,
61                         int dest_x,
62                         int dest_y,
63                         int dest_w = -1,
64                         int dest_h = -1,
65                         int src_x = -1,
66                         int src_y = -1);
67 // Draw the pixmap pointed to by pixmap onto this pixmap.
68         void draw_pixmap(BC_Pixmap *pixmap,
69                 int dest_x = 0,
70                 int dest_y = 0,
71                 int dest_w = -1,
72                 int dest_h = -1,
73                 int src_x = 0,
74                 int src_y = 0);
75 // Draw the vframe pointed to by frame onto this pixmap.
76         void draw_vframe(VFrame *frame,
77                         int dest_x = 0,
78                         int dest_y = 0,
79                         int dest_w = -1,
80                         int dest_h = -1,
81                         int src_x = 0,
82                         int src_y = 0);
83         int get_w();
84         int get_h();
85         int get_w_fixed();
86         int get_h_fixed();
87         Pixmap get_pixmap();
88         Pixmap get_alpha();
89         int use_alpha();
90         int use_opaque();
91
92 private:
93         int initialize(BC_WindowBase *parent_window, int w, int h, int mode);
94
95         BC_WindowBase *parent_window;
96         BC_WindowBase *top_level;
97         Pixmap opaque_pixmap, alpha_pixmap;
98         void *opaque_xft_draw, *alpha_xft_draw;
99 #ifdef HAVE_GL
100         GLXContext glx_pixmap_context;
101         GLXPixmap glx_pixmap;
102 #endif
103         int w, h;
104         int mode;
105 // GC's only used if alpha pixmap
106         GC alpha_gc, copy_gc;
107 };
108
109
110 #endif