00001 
00002 #ifndef  __JBXL_GRAPHIC_DATA_H_
00003 #define  __JBXL_GRAPHIC_DATA_H_
00004 
00005 
00015 #include "gheader.h"
00016 #include "matrix.h"
00017 
00018 
00020 
00021 
00027 typedef struct {
00028     int    xs;          
00029     int    ys;          
00030     int    zs;          
00031     int    state;       
00032     uByte* gp;          
00033 } BSGraph;
00034 
00035 
00042 typedef struct {
00043     int    xs;          
00044     int    ys;          
00045     int    zs;          
00046     int    state;       
00047     sWord* gp;          
00048 } WSGraph;
00049 
00050 
00056 typedef struct {
00057     int    xs;          
00058     int    ys;          
00059     int    zs;          
00060     int    state;       
00061     int*   gp;          
00062 } ISGraph;
00063 
00064 
00070 typedef struct {
00071     int    xs;          
00072     int    ys;          
00073     int    zs;          
00074     int    state;       
00075     double* gp;         
00076 } FSGraph;
00077 
00078 
00084 typedef struct {
00085     int    xs;          
00086     int    ys;          
00087     int    zs;          
00088     int    state;       
00089     vector *gp;         
00090 } VSGraph;
00091 
00092 
00098 typedef struct {
00099     int    xs;          
00100     int    ys;          
00101     int    zs;          
00102     int    depth;       
00103     int    state;       
00104     unsigned char *gp;  
00105 } MSGraph;
00106 
00107 
00113 typedef struct {
00114     int    xmin;        
00115     int    xmax;        
00116     int    ymin;        
00117     int    ymax;        
00118     int    zmin;        
00119     int    zmax;        
00120     int    misc;        
00121 } IRBound;
00122 
00123 
00124 typedef struct {
00125     double xmin;
00126     double xmax;
00127     double ymin;
00128     double ymax;
00129     double zmin;
00130     double zmax;
00131     int    misc;
00132 } DRBound;
00133 
00134 
00135 extern  int     ZeroBase;
00136 extern  double  RZxy;
00137 extern  int     ChkRZxy;
00138 
00139 
00140 WSGraph B2WSGraph(BSGraph vp);
00141 WSGraph I2WSGraph(ISGraph vp);
00142 WSGraph F2WSGraph(FSGraph vp);
00143 ISGraph W2ISGraph(WSGraph vp);
00144 FSGraph W2FSGraph(WSGraph vp);
00145 WSGraph V2WSGraph(VSGraph vp);
00146 FSGraph V2FSGraph(VSGraph vp);
00147 
00148 BSGraph make_BSGraph(int xs, int ys, int zs);
00149 WSGraph make_WSGraph(int xs, int ys, int zs);
00150 FSGraph make_FSGraph(int xs, int ys, int zs);
00151 ISGraph make_ISGraph(int xs, int ys, int zs);
00152 VSGraph make_VSGraph(int xs, int ys, int zs);
00153 MSGraph make_MSGraph(int xs, int ys, int zs, int depth);
00154 
00155 BSGraph* new_BSGraph(int xs, int ys, int zs);
00156 WSGraph* new_WSGraph(int xs, int ys, int zs);
00157 FSGraph* new_FSGraph(int xs, int ys, int zs);
00158 ISGraph* new_ISGraph(int xs, int ys, int zs);
00159 VSGraph* new_VSGraph(int xs, int ys, int zs);
00160 MSGraph* new_MSGraph(int xs, int ys, int zs, int depth);
00161 
00162 WSGraph zoom_WSGraph(WSGraph vp, int zm, int mode);
00163 WSGraph grab_WSGraph(WSGraph vp, int x1, int y1, int x2, int y2);
00164 void    copy_WSGraph(WSGraph src, WSGraph dst);
00165 
00166 int     chk_RZxy(void);
00167 void    set_RZxy(double rzm);
00168 void    init_IRBound(IRBound* rb);
00169 void    init_DRBound(DRBound* rb);
00170 #define unset_RZxy()    {ChkRZxy=OFF;}
00171 
00172 void    free_CmnHead(CmnHead* hd);      
00173 void    init_CmnHead(CmnHead* hd);
00174 
00175 
00176 #define  free_Graph(v)   {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=0; (v)->state=JBXL_NORMAL;}}    
00177 #define  free_WSGraph(v) {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=0; (v)->state=JBXL_NORMAL;}}
00178 #define  free_BSGraph(v) {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=0; (v)->state=JBXL_NORMAL;}}
00179 #define  free_FSGraph(v) {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=0; (v)->state=JBXL_NORMAL;}}
00180 #define  free_ISGraph(v) {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=0; (v)->state=JBXL_NORMAL;}}
00181 #define  free_VSGraph(v) {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=0; (v)->state=JBXL_NORMAL;}}
00182 #define  free_MSGraph(v) {if((v)!=NULL){if((v)->gp)free((v)->gp); (v)->gp=NULL; (v)->xs=(v)->ys=(v)->zs=(v)->depth=0; (v)->state=JBXL_NORMAL;}}
00183 
00184 #define  del_Graph(v)    {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}}
00185 #define  del_WSGraph(v)  {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}} 
00186 #define  del_BSGraph(v)  {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}}
00187 #define  del_FSGraph(v)  {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}}
00188 #define  del_ISGraph(v)  {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}}
00189 #define  del_VSGraph(v)  {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}}
00190 #define  del_MSGraph(v)  {if((v)!=NULL && *(v)!=NULL) {if((*(v))->gp)free((*(v))->gp); free((*(v)); *(v)=NULL}}
00191 
00192 #define  Lx(v, i)           ((v).gp[(i)])                                   
00193 #define  Px(v, i, j)        ((v).gp[(i)+(v).xs*(j)])                        
00194 #define  Vx(v, i, j, k)     ((v).gp[(i)+(v).xs*(j)+(v).xs*(v).ys*(k)])      
00195 
00196 #define  pLx(v, i)          ((v)->gp[(i)])                                  
00197 #define  pPx(v, i, j)       ((v)->gp[(i)+(v)->xs*(j)])                      
00198 #define  pVx(v, i, j, k)    ((v)->gp[(i)+(v)->xs*(j)+(v)->xs*(v)->ys*(k)])  
00199 
00200 #define  Lxt(v, i)          ((v).gp[((i)-1)])                               
00201 #define  Pxt(v, i, j)       ((v).gp[((i)-1)+(v).xs*((j)-1)])
00202 #define  Vxt(v, i, j, k)    ((v).gp[((i)-1)+(v).xs*((j)-1)+(v).xs*(v).ys*((k)-1)])
00203 
00204 #define  pLxt(v, i)         ((v)->gp[((i)-1)])                               
00205 #define  pPxt(v, i, j)      ((v)->gp[((i)-1)+(v)->xs*((j)-1)])
00206 #define  pVxt(v, i, j, k)   ((v)->gp[((i)-1)+(v)->xs*((j)-1)+(v)->xs*(v).ys->((k)-1)])
00207 
00208 
00209 #endif      // __JBXL_GRAPHIC_DATA_H_
00210