FXVisual.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            V i s u a l   C l a s s                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXVisual.h,v 1.41 2006/01/22 17:58:12 fox Exp $                          *
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;                  // Visual flags
00085   FXuint        hint;                   // Depth Hint
00086   FXuint        depth;                  // Visual depth, significant bits/pixel
00087   FXuint        numred;                 // Number of reds
00088   FXuint        numgreen;               // Number of greens
00089   FXuint        numblue;                // Number of blues
00090   FXuint        numcolors;              // Total number of colors
00091   FXuint        maxcolors;              // Maximum number of colors
00092   FXVisualType  type;                   // Visual type
00093   void         *info;                   // Opaque data
00094   void         *visual;                 // Application visual/pixel format
00095   FXID          colormap;               // Color map, if any
00096   FXbool        freemap;                // We allocated the map
00097 #ifndef WIN32
00098 protected:
00099   void         *gc;                     // Drawing GC
00100   void         *scrollgc;               // Scrolling GC
00101   FXPixel       rpix[16][256];          // Mapping from red -> pixel
00102   FXPixel       gpix[16][256];          // Mapping from green -> pixel
00103   FXPixel       bpix[16][256];          // Mapping from blue -> pixel
00104   FXPixel       lut[256];               // Color lookup table
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

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:25 2009 for TnFOX by doxygen v1.4.7