initial commit
[goodguy/history.git] / cinelerra-5.0 / 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 #if defined(HAVE_CONFIG_H)
28 #include "config.h"
29 #endif
30
31 #ifdef HAVE_XFT
32 #include <X11/Xft/Xft.h>
33 #endif
34
35 #ifdef HAVE_GL
36 #include <GL/glx.h>
37 #endif
38
39 #include "bcbitmap.inc"
40 #include "bcpixmap.inc"
41 #include "bcwindowbase.inc"
42 #include "vframe.inc"
43
44 class BC_Pixmap
45 {
46 public:
47         BC_Pixmap(BC_WindowBase *parent_window,
48                 VFrame *frame,
49                 int mode = PIXMAP_OPAQUE,
50                 int icon_offset = 0);
51         BC_Pixmap(BC_WindowBase *parent_window,
52                 int w,
53                 int h);
54         ~BC_Pixmap();
55
56         friend class BC_WindowBase;
57
58         void reset();
59         void resize(int w, int h);
60 // OpenGL for pixmaps doesn't seem to be accelerated so it has been discontinued.
61         void enable_opengl();
62         void copy_area(int x, int y, int w, int h, int x2, int y2);
63 // Draw this pixmap onto the drawable pointed to by pixmap.
64         int write_drawable(Drawable &pixmap,
65                         int dest_x,
66                         int dest_y,
67                         int dest_w = -1,
68                         int dest_h = -1,
69                         int src_x = -1,
70                         int src_y = -1);
71 // Draw the pixmap pointed to by pixmap onto this pixmap.
72         void draw_pixmap(BC_Pixmap *pixmap,
73                 int dest_x = 0,
74                 int dest_y = 0,
75                 int dest_w = -1,
76                 int dest_h = -1,
77                 int src_x = 0,
78                 int src_y = 0);
79 // Draw the vframe pointed to by frame onto this pixmap.
80         void draw_vframe(VFrame *frame,
81                         int dest_x = 0,
82                         int dest_y = 0,
83                         int dest_w = -1,
84                         int dest_h = -1,
85                         int src_x = 0,
86                         int src_y = 0);
87         int get_w();
88         int get_h();
89         int get_w_fixed();
90         int get_h_fixed();
91         Pixmap get_pixmap();
92         Pixmap get_alpha();
93         int use_alpha();
94         int use_opaque();
95
96 private:
97         int initialize(BC_WindowBase *parent_window, int w, int h, int mode);
98
99         BC_WindowBase *parent_window;
100         BC_WindowBase *top_level;
101         Pixmap opaque_pixmap, alpha_pixmap;
102         void *opaque_xft_draw, *alpha_xft_draw;
103 #ifdef HAVE_GL
104         GLXContext glx_pixmap_context;
105         GLXPixmap glx_pixmap;
106 #endif
107         int w, h;
108         int mode;
109 // GC's only used if alpha pixmap
110         GC alpha_gc, copy_gc;
111 };
112
113
114 #endif