00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXVISUAL_H
00022 #define FXVISUAL_H
00023
00024 #ifndef FXID_H
00025 #include "FXId.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00031 class FXWindow;
00032 class FXGLContext;
00033 class FXGLCanvas;
00034 class FXImage;
00035 class FXIcon;
00036 class FXBitmap;
00037 class FXDCWindow;
00038
00039
00041 enum {
00042 VISUAL_DEFAULT = 0,
00043 VISUAL_MONO = 1,
00044 VISUAL_GRAY = 2,
00045 VISUAL_INDEX = 4,
00046 VISUAL_COLOR = 8,
00047 VISUAL_BEST = 16,
00048 VISUAL_FORCE = 32,
00049 VISUAL_OWN_COLORMAP = 64,
00050 VISUAL_DOUBLE_BUFFER = 128,
00051 VISUAL_STEREO = 256,
00052 VISUAL_NO_ACCEL = 512,
00053 VISUAL_SWAP_COPY = 1024
00054 };
00055
00056
00058 class FXAPI FXVisual : public FXId {
00059 FXDECLARE(FXVisual)
00060 friend class FXApp;
00061 friend class FXWindow;
00062 friend class FXImage;
00063 friend class FXIcon;
00064 friend class FXBitmap;
00065 friend class FXDCWindow;
00066 friend class FXGLCanvas;
00067 friend class FXGLContext;
00068 protected:
00069 void *visual;
00070 FXID colormap;
00071 FXuint maxcolors;
00072 FXuint numcolors;
00073 FXuint numred;
00074 FXuint numgreen;
00075 FXuint numblue;
00076 FXuint depth;
00077 FXuint flags;
00078 FXuint hint;
00079 FXuchar type;
00080 FXbool freemap;
00081 #ifndef WIN32
00082 protected:
00083 void *scrollgc;
00084 void *gc;
00085 FXPixel rpix[16][256];
00086 FXPixel gpix[16][256];
00087 FXPixel bpix[16][256];
00088 FXPixel lut[256];
00089 protected:
00090 void setuptruecolor();
00091 void setupdirectcolor();
00092 void setuppseudocolor();
00093 void setupstaticcolor();
00094 void setupgrayscale();
00095 void setupstaticgray();
00096 void setuppixmapmono();
00097 void setupcolormap();
00098 void* setupgc(FXbool);
00099 #endif
00100 protected:
00101 FXVisual();
00102 private:
00103 FXVisual(const FXVisual&);
00104 FXVisual &operator=(const FXVisual&);
00105 public:
00106
00108 enum {
00109 Unknown,
00110 Mono,
00111 Gray,
00112 Index,
00113 Color
00114 };
00115
00116 public:
00117
00119 FXVisual(FXApp* a,FXuint flgs=VISUAL_DEFAULT,FXuint hnt=32);
00120
00122 FXuchar getType() const { return type; }
00123
00125 void* getVisual() const { return visual; }
00126
00128 virtual void create();
00129
00131 virtual void detach();
00132
00134 virtual void destroy();
00135
00137 void setFlags(FXuint flgs){ flags=flgs; }
00138
00140 FXuint getFlags() const { return flags; }
00141
00143 void setHint(FXuint hnt){ hint=hnt; }
00144
00146 FXuint getHint() const { return hint; }
00147
00149 FXuint getDepth() const { return depth; }
00150
00152 FXuint getNumColors() const { return numcolors; }
00153
00155 FXuint getNumRed() const { return numred; }
00156
00158 FXuint getNumGreen() const { return numgreen; }
00159
00161 FXuint getNumBlue() const { return numblue; }
00162
00164 FXPixel getPixel(FXColor clr);
00165
00167 FXColor getColor(FXPixel pix);
00168
00170 void setMaxColors(FXuint maxcols);
00171
00173 FXuint getMaxColors() const { return maxcolors; }
00174
00176 virtual void save(FXStream& store) const;
00177
00179 virtual void load(FXStream& store);
00180
00182 virtual ~FXVisual();
00183 };
00184
00185 }
00186
00187 #endif