Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXVisual.h
1 /********************************************************************************
2 * *
3 * V i s u a l C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXVISUAL_H
22 #define FXVISUAL_H
23 
24 #ifndef FXID_H
25 #include "FXId.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXWindow;
32 class FXGLContext;
33 class FXGLCanvas;
34 class FXImage;
35 class FXIcon;
36 class FXBitmap;
37 class FXDCWindow;
38 
39 
41 enum {
42  VISUAL_DEFAULT = 0,
43  VISUAL_MONO = 1,
44  VISUAL_GRAY = 2,
45  VISUAL_INDEX = 4,
46  VISUAL_COLOR = 8,
47  VISUAL_BEST = 16,
48  VISUAL_FORCE = 32,
49  VISUAL_OWN_COLORMAP = 64,
50  VISUAL_DOUBLE_BUFFER = 128,
51  VISUAL_STEREO = 256,
52  VISUAL_NO_ACCEL = 512,
53  VISUAL_SWAP_COPY = 1024
54  };
55 
56 
58 class FXAPI FXVisual : public FXId {
59  FXDECLARE(FXVisual)
60  friend class FXApp;
61  friend class FXWindow;
62  friend class FXImage;
63  friend class FXIcon;
64  friend class FXBitmap;
65  friend class FXDCWindow;
66  friend class FXGLCanvas;
67  friend class FXGLContext;
68 protected:
69  void *visual; // Application visual/pixel format
70  FXID colormap; // Color map, if any
71  FXuint maxcolors; // Maximum number of colors
72  FXuint numcolors; // Total number of colors
73  FXuint numred; // Number of reds
74  FXuint numgreen; // Number of greens
75  FXuint numblue; // Number of blues
76  FXuint depth; // Visual depth, significant bits/pixel
77  FXuint flags; // Visual flags
78  FXuint hint; // Hint value
79  FXuchar type; // Visual type
80  FXbool freemap; // We allocated the map
81 #ifndef WIN32
82 protected:
83  void *scrollgc; // Scrolling GC
84  void *gc; // Drawing GC
85  FXPixel rpix[16][256]; // Mapping from red -> pixel
86  FXPixel gpix[16][256]; // Mapping from green -> pixel
87  FXPixel bpix[16][256]; // Mapping from blue -> pixel
88  FXPixel lut[256]; // Color lookup table
89 protected:
90  void setuptruecolor();
91  void setupdirectcolor();
92  void setuppseudocolor();
93  void setupstaticcolor();
94  void setupgrayscale();
95  void setupstaticgray();
96  void setuppixmapmono();
97  void setupcolormap();
98  void* setupgc(FXbool);
99 #endif
100 protected:
101  FXVisual();
102 private:
103  FXVisual(const FXVisual&);
104  FXVisual &operator=(const FXVisual&);
105 public:
106 
108  enum {
109  Unknown,
113  Color
114  };
115 
116 public:
117 
119  FXVisual(FXApp* a,FXuint flgs=VISUAL_DEFAULT,FXuint hnt=32);
120 
122  FXuchar getType() const { return type; }
123 
125  void* getVisual() const { return visual; }
126 
128  virtual void create();
129 
131  virtual void detach();
132 
134  virtual void destroy();
135 
137  void setFlags(FXuint flgs){ flags=flgs; }
138 
140  FXuint getFlags() const { return flags; }
141 
143  void setHint(FXuint hnt){ hint=hnt; }
144 
146  FXuint getHint() const { return hint; }
147 
149  FXuint getDepth() const { return depth; }
150 
152  FXuint getNumColors() const { return numcolors; }
153 
155  FXuint getNumRed() const { return numred; }
156 
158  FXuint getNumGreen() const { return numgreen; }
159 
161  FXuint getNumBlue() const { return numblue; }
162 
164  FXPixel getPixel(FXColor clr);
165 
167  FXColor getColor(FXPixel pix);
168 
170  void setMaxColors(FXuint maxcols);
171 
173  FXuint getMaxColors() const { return maxcolors; }
174 
176  virtual void save(FXStream& store) const;
177 
179  virtual void load(FXStream& store);
180 
182  virtual ~FXVisual();
183  };
184 
185 }
186 
187 #endif
FXuint getHint() const
Get hints.
Definition: FXVisual.h:146
void setFlags(FXuint flgs)
Change option flags.
Definition: FXVisual.h:137
Gray scale color.
Definition: FXVisual.h:112
A Bitmap is a rectangular array of pixels.
Definition: FXBitmap.h:55
FXuint getNumRed() const
Get number of reds.
Definition: FXVisual.h:155
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
FXuint getNumBlue() const
Get number of blues.
Definition: FXVisual.h:161
FXuint getFlags() const
Get option flags.
Definition: FXVisual.h:140
The Application object is the central point of a FOX user-interface.
Definition: FXApp.h:134
Monochrome 1 bit/pixel.
Definition: FXVisual.h:111
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
FXuint getNumGreen() const
Get number of greens.
Definition: FXVisual.h:158
FXuchar getType() const
Get visual type.
Definition: FXVisual.h:122
Encapsulates server side resource.
Definition: FXId.h:34
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
GL Context.
Definition: FXGLContext.h:32
Undetermined visual type.
Definition: FXVisual.h:110
GLCanvas, an area drawn by another object.
Definition: FXGLCanvas.h:42
void setHint(FXuint hnt)
Change hints.
Definition: FXVisual.h:143
Visual describes pixel format of a drawable.
Definition: FXVisual.h:58
FXuint getNumColors() const
Get number of colors.
Definition: FXVisual.h:152
FXuint getMaxColors() const
Get maximum number of colors.
Definition: FXVisual.h:173
Window Device Context.
Definition: FXDCWindow.h:48
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
FXuint getDepth() const
Get depth, i.e. number of significant bits in color representation.
Definition: FXVisual.h:149
void * getVisual() const
Get visual or pixel format.
Definition: FXVisual.h:125

Copyright © 1997-2022 Jeroen van der Zijp