00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXVISUAL_H
00025 #define FXVISUAL_H
00026
00027 #ifndef FXID_H
00028 #include "FXId.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00035 enum FXVisualOptions {
00036 VISUAL_DEFAULT = 0,
00037 VISUAL_MONOCHROME = 1,
00038 VISUAL_BEST = 2,
00039 VISUAL_INDEXCOLOR = 4,
00040 VISUAL_GRAYSCALE = 8,
00041 VISUAL_TRUECOLOR = 16,
00042 VISUAL_OWNCOLORMAP = 32,
00043 VISUAL_DOUBLEBUFFER = 64,
00044 VISUAL_STEREO = 128,
00045 VISUAL_NOACCEL = 256,
00046 VISUAL_SWAP_COPY = 512
00047 };
00048
00049
00051 enum FXVisualType {
00052 VISUALTYPE_UNKNOWN,
00053 VISUALTYPE_MONO,
00054 VISUALTYPE_TRUE,
00055 VISUALTYPE_INDEX,
00056 VISUALTYPE_GRAY
00057 };
00058
00059
00060 class FXApp;
00061 class FXEventLoop;
00062 class FXWindow;
00063 class FXGLContext;
00064 class FXGLCanvas;
00065 class FXImage;
00066 class FXIcon;
00067 class FXBitmap;
00068 class FXDCWindow;
00069
00070
00072 class FXAPI FXVisual : public FXId {
00073 FXDECLARE(FXVisual)
00074 friend class FXApp;
00075 friend class FXEventLoop;
00076 friend class FXWindow;
00077 friend class FXImage;
00078 friend class FXIcon;
00079 friend class FXBitmap;
00080 friend class FXDCWindow;
00081 friend class FXGLCanvas;
00082 friend class FXGLContext;
00083 protected:
00084 FXuint flags;
00085 FXuint hint;
00086 FXuint depth;
00087 FXuint numred;
00088 FXuint numgreen;
00089 FXuint numblue;
00090 FXuint numcolors;
00091 FXuint maxcolors;
00092 FXVisualType type;
00093 void *info;
00094 void *visual;
00095 FXID colormap;
00096 FXbool freemap;
00097 #ifndef WIN32
00098 protected:
00099 void *gc;
00100 void *scrollgc;
00101 FXPixel rpix[16][256];
00102 FXPixel gpix[16][256];
00103 FXPixel bpix[16][256];
00104 FXPixel lut[256];
00105 protected:
00106 void* setupgc(FXbool);
00107 void setuptruecolor();
00108 void setupdirectcolor();
00109 void setuppseudocolor();
00110 void setupstaticcolor();
00111 void setupgrayscale();
00112 void setupstaticgray();
00113 void setuppixmapmono();
00114 void setupcolormap();
00115 #endif
00116 protected:
00117 FXVisual();
00118 private:
00119 FXVisual(const FXVisual&);
00120 FXVisual &operator=(const FXVisual&);
00121 public:
00122
00124 FXVisual(FXApp* a,FXuint flgs,FXuint d=32);
00125
00127 FXVisualType getType() const { return type; }
00128
00130 void* getInfo() const { return info; }
00131
00133 void* getVisual() const { return visual; }
00134
00136 virtual void create();
00137
00139 virtual void detach();
00140
00142 virtual void destroy();
00143
00145 FXuint getFlags() const { return flags; }
00146
00148 FXuint getDepth() const { return depth; }
00149
00151 FXuint getNumColors() const { return numcolors; }
00152
00154 FXuint getNumRed() const { return numred; }
00155
00157 FXuint getNumGreen() const { return numgreen; }
00158
00160 FXuint getNumBlue() const { return numblue; }
00161
00163 FXPixel getPixel(FXColor clr);
00164
00166 FXColor getColor(FXPixel pix);
00167
00169 void setMaxColors(FXuint maxcols);
00170
00172 FXuint getMaxColors() const { return maxcolors; }
00173
00175 virtual void save(FXStream& store) const;
00176
00178 virtual void load(FXStream& store);
00179
00181 virtual ~FXVisual();
00182 };
00183
00184 }
00185
00186 #endif