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