00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00056 #ifndef __vtkXImageWindow_h
00057 #define __vtkXImageWindow_h
00058 
00059 #include    <X11/Xlib.h>
00060 #include    <X11/Xutil.h>
00061 #include    <X11/cursorfont.h>
00062 #include    <X11/X.h>
00063 #include    <X11/keysym.h>
00064 
00065 #include        "vtkImageWindow.h"
00066 
00067 class VTK_EXPORT vtkXImageWindow : public vtkImageWindow
00068 {
00069 public:
00070   static vtkXImageWindow *New();
00071   vtkTypeMacro(vtkXImageWindow,vtkImageWindow);
00072   void PrintSelf(ostream& os, vtkIndent indent);
00073 
00075   void SetWindowName(char* name);
00076   
00078   vtkGetMacro(NumberOfColors,int);
00079   
00081   vtkGetMacro(VisualDepth,int);
00082   
00084   vtkGetMacro(VisualClass,int);
00085   
00087   Window   GetParentId();
00088   void     SetParentId(Window);
00089   void     SetParentId(void *);
00090   void     SetDisplayId(Display *);
00091   void     SetDisplayId(void *);
00092   void     SetWindowId(Window);
00093   void     SetWindowId(void *);
00094   Window   GetWindowId();
00095   Display *GetDisplayId();
00096   GC       GetGC();
00097 
00099   int     *GetPosition();
00100   void     GetPosition(int* x, int* y) {this->vtkImageWindow::GetPosition(x, y);};
00101   void     SetPosition(int,int);
00102   void     SetPosition(int a[2]) { this->SetPosition(a[0],a[1]); };
00103  
00105   int     *GetSize();
00106   void     GetSize(int* x, int* y) {this->vtkImageWindow::GetSize(x, y);};
00107   void     SetSize(int x, int y);
00108   void     SetSize(int a[2]) { this->SetSize(a[0], a[1]); };
00109   
00111   void *GetGenericDisplayId() {return (void*) this->DisplayId;};
00112   void *GetGenericWindowId() {return (void*) this->WindowId;};
00113   void *GetGenericParentId() {return (void*) this->ParentId;};
00114   void *GetGenericContext() {return (void*) this->Gc;};
00115   void *GetGenericDrawable();
00116 
00119   void SwapBuffers();
00120 
00122   void Frame();
00123 
00125   virtual int      GetDesiredDepth();
00126   
00128   virtual Colormap GetDesiredColormap();
00129 
00131   virtual Visual  *GetDesiredVisual();
00132 
00134   Visual *GetVisualId() {return VisualId;};
00135 
00137   void SetBackgroundColor(float r, float g, float b);
00138 
00140   void EraseWindow();
00141 
00150   unsigned char *GetPixelData(int x1, int y1, int x2, int y2, int);
00151 
00152 
00153 protected:
00154   vtkXImageWindow();
00155   ~vtkXImageWindow();
00156   vtkXImageWindow(const vtkXImageWindow&) {};
00157   void operator=(const vtkXImageWindow&) {};
00158 
00159   
00160   Window               ParentId;
00161   Window        WindowId;
00162   Display             *DisplayId;
00163   Visual              *VisualId;
00164   int                  VisualDepth;
00165   int                  VisualClass;
00166   Colormap             ColorMap;
00167   GC                   Gc;
00168   int                Offset;
00169   XColor               Colors[256];
00170   int                  NumberOfColors;
00171   Pixmap               Drawable;
00172   int                  OwnDisplay;
00173   int                  PixmapWidth;
00174   int                  PixmapHeight;
00175 
00176   
00177   void MakeDefaultWindow();
00178   void GetDefaultVisualInfo(XVisualInfo *info);
00179   Colormap MakeColorMap(Visual *visual);
00180   void AllocateDirectColorMap();
00181   void GetShiftsScalesAndMasks(int &rshift, int &gshift, int &bshift,
00182                 int &rscale, int &gscale, int &bscale,
00183                 unsigned long &rmask, unsigned long &gmask,
00184                 unsigned long &bmask);
00185 };
00186 
00187 #endif
00188 
00189 
00190 
00191 
00192