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
00034
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
00050
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 FXWindow;
00062 class FXGLContext;
00063 class FXGLCanvas;
00064 class FXImage;
00065 class FXIcon;
00066 class FXBitmap;
00067 class FXDCWindow;
00068
00069
00070
00071 class FXAPI FXVisual : public FXId {
00072 FXDECLARE(FXVisual)
00073 friend class FXApp;
00074 friend class FXWindow;
00075 friend class FXImage;
00076 friend class FXIcon;
00077 friend class FXBitmap;
00078 friend class FXDCWindow;
00079 friend class FXGLCanvas;
00080 friend class FXGLContext;
00081 protected:
00082 FXuint flags;
00083 FXuint hint;
00084 FXuint depth;
00085 FXuint numred;
00086 FXuint numgreen;
00087 FXuint numblue;
00088 FXuint numcolors;
00089 FXuint maxcolors;
00090 FXVisualType type;
00091 void *info;
00092 void *visual;
00093 FXID colormap;
00094 FXbool freemap;
00095 #ifndef WIN32
00096 protected:
00097 void *gc;
00098 void *scrollgc;
00099 FXPixel rpix[16][256];
00100 FXPixel gpix[16][256];
00101 FXPixel bpix[16][256];
00102 FXPixel lut[256];
00103 protected:
00104 void* setupgc(FXbool);
00105 void setuptruecolor();
00106 void setupdirectcolor();
00107 void setuppseudocolor();
00108 void setupstaticcolor();
00109 void setupgrayscale();
00110 void setupstaticgray();
00111 void setuppixmapmono();
00112 void setupcolormap();
00113 #endif
00114 protected:
00115 FXVisual();
00116 private:
00117 FXVisual(const FXVisual&);
00118 FXVisual &operator=(const FXVisual&);
00119 public:
00120
00121
00122 FXVisual(FXApp* a,FXuint flgs,FXuint d=32);
00123
00124
00125 FXVisualType getType() const { return type; }
00126
00127
00128 void* getInfo() const { return info; }
00129
00130
00131 void* getVisual() const { return visual; }
00132
00133
00134 virtual void create();
00135
00136
00137 virtual void detach();
00138
00139
00140 virtual void destroy();
00141
00142
00143 FXuint getFlags() const { return flags; }
00144
00145
00146 FXuint getDepth() const { return depth; }
00147
00148
00149 FXuint getNumColors() const { return numcolors; }
00150
00151
00152 FXuint getNumRed() const { return numred; }
00153
00154
00155 FXuint getNumGreen() const { return numgreen; }
00156
00157
00158 FXuint getNumBlue() const { return numblue; }
00159
00160
00161 FXPixel getPixel(FXColor clr);
00162
00163
00164 FXColor getColor(FXPixel pix);
00165
00166
00167 void setMaxColors(FXuint maxcols);
00168
00169
00170 FXuint getMaxColors() const { return maxcolors; }
00171
00172
00173 virtual void save(FXStream& store) const;
00174
00175
00176 virtual void load(FXStream& store);
00177
00178
00179 virtual ~FXVisual();
00180 };
00181
00182 }
00183
00184 #endif