Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

draw_TvDef.h

Go to the documentation of this file.
00001 /**********
00002  *
00003  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
00004  * University of Manchester, UK.  All rights reserved.
00005  * 
00006  * Redistribution and use in source and binary forms, with or without modification, 
00007  * are permitted provided that the following conditions are met:
00008  * 
00009  *   . Redistributions of source code must retain the above copyright notice, 
00010  *     this list of conditions and the following disclaimer.
00011  *    
00012  *   . Redistributions in binary form must reproduce the above copyright notice,
00013  *     this list of conditions and the following disclaimer in the documentation 
00014  *     and/or other materials provided with the distribution.
00015  * 
00016  *   . Neither the name of the University of Manchester nor the names of its
00017  *     contributors may be used to endorse or promote products derived from this 
00018  *     software without specific prior written permission.
00019  * 
00020  * 
00021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
00031  * POSSIBILITY OF SUCH DAMAGE.
00032  *
00033  **********
00034  *
00035  * Program :    TINA
00036  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/draw/draw_TvDef.h,v $
00037  * Date    :  $Date: 2005/07/03 23:43:56 $
00038  * Version :  $Revision: 1.3 $
00039  * CVS Id  :  $Id: draw_TvDef.h,v 1.3 2005/07/03 23:43:56 paul Exp $
00040  *
00041  * Author  : Legacy TINA
00042  *
00043  * Notes :
00044  *        Tv structures etc
00045  *
00046  *********
00047 */
00048 
00049 #ifndef TINATOOL_DRAW_TV_DEF_HDR
00050 #define TINATOOL_DRAW_TV_DEF_HDR
00051 
00052 #include <tina/math/mathDef.h>
00053 #include <tina/image/imgDef.h>
00054 
00055 #define TV_SCREEN_REPAINT 1
00056 #define TV_SCREEN_REPAINT_IF_SMALLER 2
00057 #define TV_SCREEN_NO_REPAINT 3
00058 
00059 #define CMAPLOOKUPCOLORSBASE 256
00060 #define CMAPLOOKUPGREYSBASE 0
00061 #define CMAPLOOKUPNUMBEROFCOLORS 256
00062 #define CMAPLOOKUPNUMBEROFGREYS 256
00063 #define CMAPLOOKUPSIZE (CMAPLOOKUPNUMBEROFGREYS + CMAPLOOKUPNUMBEROFCOLORS)
00064 
00065 #ifndef __STRICT_ANSI__
00066 #define const
00067 #endif /* __STRICT_ANSI__ */
00068 
00069 /* I think this is only used in the graphics libraries: try taking it out PAB
00070 
00071 typedef void *(*voidStarFn) ();
00072 
00073 */
00074 
00075 typedef int Tina_pixel;
00076 typedef struct rgb
00077 {
00078     Ts_id ts_id;                /* Tina structure identifier */
00079     unsigned short red;         /* range: 0 - 256 */
00080     unsigned short green;       /* range: 0 - 256 */
00081     unsigned short blue;        /* range: 0 - 256 */
00082 }       Rgb;
00083 #define RGB_SWAP_STRING "kkk"
00084 
00085 typedef struct tina_color
00086 {
00087     Ts_id ts_id;                /* Tina structure identifier */
00088     Tina_pixel pixel;
00089     unsigned short red;         /* range: 0 - 0XFFFF */
00090     unsigned short green;       /* range: 0 - 0XFFFF */
00091     unsigned short blue;        /* range: 0 - 0XFFFF */
00092 }       Tina_color;
00093 #define TINA_COLOR_SWAP_STRING ".kkk"
00094 
00095 #define TINA_COLOR_ARRAY_CREATE(_size) ((Tina_color *) ralloc((unsigned)(_size) * sizeof (Tina_color)))
00096 #define RGB_ARRAY_CREATE(_size) ((Rgb *) ralloc((unsigned)(_size) * sizeof (Rgb)))
00097 #define TINA_PIXEL_ARRAY_CREATE(_size) ((Tina_pixel *) ralloc((unsigned)(_size) * sizeof (Tina_pixel)))
00098 
00099 typedef enum cmap_model
00100 {
00101     cmap_model_gs, cmap_model_col, cmap_model_rgb, cmap_model_unknown
00102 }       Cmap_model;
00103 
00104 typedef enum cmap_kind
00105 {
00106     cmap_type_dynamic, cmap_type_static, cmap_type_unknown
00107 }       Cmap_kind;
00108 
00109 typedef struct cmap_data_visible
00110 {
00111     Ts_id ts_id;                /* Tina structure identifier */
00112     /* Visible at tv level */
00113     Cmap_model model;           /* cmap_model_gs, cmap_model_col,
00114                                  * cmap_model_rgb */
00115     Cmap_kind type;             /* cmap_type_dynamic, cmap_type_static */
00116     int     ncells;             /* ncells of colormap */
00117     int     nplanes;            /* no of cmap planes */
00118     Tina_pixel base;            /* first used colormap entry */
00119     Tina_pixel std_lut[CMAPLOOKUPSIZE]; /* standard tina LUT */
00120     Tina_pixel overlay_mask;    /* xor mask for overlay */
00121     int     color_bits;         /* number of bits of color */
00122     int     color_lut[CMAPLOOKUPNUMBEROFGREYS]; /* col val look up */
00123 }       Cmap_data_visible;
00124 #define CMAP_DATA_VISIBLE_SWAP_STRING "iiii.0[.].i0[i]"
00125 
00126 typedef struct tv_mouse
00127 {
00128     Ts_id ts_id;                /* Tina structure identifier */
00129     char    name[32];
00130 
00131     char    left_name[32];
00132     void    (*left_down) ();
00133     void    (*left_drag) ();
00134     void    (*left_up) ();
00135 
00136     char    middle_name[32];
00137     void    (*middle_down) ();
00138     void    (*middle_drag) ();
00139     void    (*middle_up) ();
00140 
00141     char    right_name[32];
00142     void    (*right_down) ();
00143     void    (*right_drag) ();
00144     void    (*right_up) ();
00145 }       Tv_mouse;
00146 #define TV_MOUSE_SWAP_STRING "32[c]32[c]www32[c]www32[c]www"
00147 
00148 typedef struct tv_pick
00149 {
00150     Ts_id ts_id;                /* Tina structure identifier */
00151     char    name[32];
00152 
00153     List   *picklist;
00154     void   *(*closest) ();
00155     void    (*highlight) ();
00156     void    (*draw) ();
00157     void    (*func) ();
00158     void    (*free) ();
00159     Bool    do_repaint;
00160 }       Tv_pick;
00161 #define TV_PICK_SWAP_STRING "32[c]pwwwwwi"
00162 
00163 typedef struct tv_draw
00164 {
00165     Ts_id ts_id;                /* Tina structure identifier */
00167     Bool    overlay_on;
00168     int     color;
00169     int     op;
00170     int     linewidth;
00171     int     linestyle;
00172     char    font_name[STRING128];
00173 }       Tv_draw;
00174 #define TV_DRAW_SWAP_STRING "iiiii0[c]"
00175 
00176 typedef struct tv_zbuff
00177 {
00178     Ts_id ts_id;                /* Tina structure identifier */
00179     Imrect *z;
00180     double  zmin, zmax;
00181     Bool    backdraw;
00182     int (*color)();
00183     double (*shade)();
00184 }       Tv_zbuff;
00185 #define TV_ZBUFF_SWAP_STRING "pggi.."
00186 
00187 typedef struct tv
00188 {
00189     Ts_id ts_id;                /* Tina structure identifier */
00190     char    label[32];
00191 
00193     int     clone;
00194 
00196     void   *tv_screen;
00197 
00199     void    (*init) ();
00200 
00202     int     width;
00203     int     height;
00204     float   cx, cy;
00205     float   scalex, scaley;
00206 
00208     int     proj3type;
00209     struct vec3 centre3;
00210     float   radius3;
00211     struct vec3 ex3, ey3, ez3;
00212     float   pscale;
00213     struct vec3 pcentre;
00214     Bool    axis_set;
00215     struct vec3 axis;
00216     struct ipos (*proj3) ();
00217     void    (*ray3) ();
00218     struct vec3 (*backproj3) ();
00219 
00221     struct vec2 centre2;
00222     float   radius2;
00223     struct vec2 ex2, ey2;
00224     struct ipos (*proj2) ();
00225     struct vec2 (*backproj2) ();
00226 
00228     Bool    overlay_on;
00229     Tina_pixel color;
00230     int     op;
00231     int     linewidth;
00232     int     linestyle;
00233     char    font_name[STRING128];
00234 
00236     List   *draw;
00237 
00239     int     activity;
00240 
00242     int     zoomlevel;
00243 
00245     struct tv_mouse mouse;
00246     void    (*mouse_reset) ();
00247 
00249     struct tv_pick pick;
00250     void    (*pick_reset) ();
00251 
00253     Vec2    ul, lr;
00254 
00256     int     paint_mode;
00257     void    (*fulldraw) ();
00258     void    (*skeldraw) ();
00259     void   *drawdata;
00260 
00262     List *movie;
00263 
00265     Bool    backsave;
00266     void    (*backdraw) ();
00267     void   *background;
00268 
00269     /* Colormap info. */
00270             Bool(*cmap_create_fn) ();   /* Function to create & fill
00271                                          * colormap & fill in
00272                                          * cmap_data_visible */
00273     Cmap_data_visible *cmap_data_visible;       /* Visible part of
00274                                                  * Cmap_data (defined in
00275                                                  * tv_screen.h) */
00276 
00277     /* Z-buffer option * */
00278     Tv_zbuff *zbuff;
00279 
00280     /* message function and data associated with tv */
00281     void    (*message_fn) ();
00282     void   *message_data;
00283 
00284     /* name function and data associated with tv */
00285     void    (*header_fn) ();
00286     void   *header_data;
00287 }       Tv;
00288 #define TV_SWAP_STRING "32[c]ipwiiffffitftttftitwwwtfttwwi.iii0[c]piitwtwttiwwppiwp..p.pwpwp"
00289 
00290 typedef struct tv_closest
00291 {
00292     Ts_id ts_id;                /* Tina structure identifier */
00293     Tv *tv;
00294     Ipos pos;
00295     void *ptr;
00296     int type;
00297     float sep;
00298 } Tv_closest;
00299 #define TV_CLOSEST_SWAP_STRING "ptpif"
00300 
00301 #define ZOOM     1
00302 #define ROI      2
00303 #define PICK     3
00304 #define MOUSE    4
00305 #define POLYROI  5
00306 #define POINT    6
00307 #define GLOBAL   7 
00308 
00309 #define ORTH    1
00310 #define PERSP   2
00311 
00312 #define IMZOOM  1
00313 #define ZOOM2   2
00314 #define ZOOM3   3
00315 #define ZOOMAF  4
00316 #define ZOOMGR  5
00317 
00318 #define FULL_PAINT    1
00319 #define SKEL_PAINT    2
00320 #define FULL_REPAINT  3
00321 
00322 #define BAD_STATE     1
00323 #define WAIT_STATE    2
00324 #define LEFT_DOWN     3
00325 #define MIDDLE_DOWN   4
00326 #define RIGHT_DOWN    5
00327 #define LEFT_DRAG     6
00328 #define MIDDLE_DRAG   7
00329 #define RIGHT_DRAG    8
00330 #define LEFT_UP       9
00331 #define MIDDLE_UP     10
00332 #define RIGHT_UP      11
00333 #define MOUSE_NAME    12
00334 #define LEFT_NAME     13
00335 #define MIDDLE_NAME   14
00336 #define RIGHT_NAME    15
00337 
00338 #define PICK_DOMAIN    1
00339 #define PICK_CLOSEST   2
00340 #define PICK_HIGHLIGHT 3
00341 #define PICK_DRAW      4
00342 #define PICK_FUNC      5
00343 #define PICK_FREE      6
00344 #define PICK_NAME      7
00345 #define PICK_REPAINT   8
00346 
00347 /*
00348 #define BKGRND          (CMAPLOOKUPCOLORSBASE )
00349 #define BLACK           (CMAPLOOKUPCOLORSBASE + 1)
00350 #define BLUE            (CMAPLOOKUPCOLORSBASE + 2)
00351 #define RED             (CMAPLOOKUPCOLORSBASE + 3)
00352 #define YELLOW          (CMAPLOOKUPCOLORSBASE + 4)
00353 #define GREEN           (CMAPLOOKUPCOLORSBASE + 5)
00354 #define WHITE           (CMAPLOOKUPCOLORSBASE + 6)
00355 #define AUBERGINE       (CMAPLOOKUPCOLORSBASE + 7)
00356 #define AVOCADO         (CMAPLOOKUPCOLORSBASE + 8)
00357 #define BABY_BLUE       (CMAPLOOKUPCOLORSBASE + 9)
00358 #define BABY_PINK       (CMAPLOOKUPCOLORSBASE + 10)
00359 #define BROWN           (CMAPLOOKUPCOLORSBASE + 11)
00360 #define CHOCOLATE       (CMAPLOOKUPCOLORSBASE + 12)
00361 #define COFFEE          (CMAPLOOKUPCOLORSBASE + 13)
00362 #define CYAN            (CMAPLOOKUPCOLORSBASE + 14)
00363 #define DARK_GREEN      (CMAPLOOKUPCOLORSBASE + 15)
00364 #define DARK_SLATE      (CMAPLOOKUPCOLORSBASE + 16)
00365 #define GOLD            (CMAPLOOKUPCOLORSBASE + 17)
00366 #define HELIOTROPE      (CMAPLOOKUPCOLORSBASE + 18)
00367 #define INDIAN_RED      (CMAPLOOKUPCOLORSBASE + 19)
00368 #define IVORY           (CMAPLOOKUPCOLORSBASE + 20)
00369 #define MAGENTA         (CMAPLOOKUPCOLORSBASE + 21)
00370 #define ORANGE          (CMAPLOOKUPCOLORSBASE + 22)
00371 #define PALE_GREEN      (CMAPLOOKUPCOLORSBASE + 23)
00372 #define PLUM            (CMAPLOOKUPCOLORSBASE + 24)
00373 #define SALMON          (CMAPLOOKUPCOLORSBASE + 25)
00374 #define SLATE           (CMAPLOOKUPCOLORSBASE + 26)
00375 #define VIOLET          (CMAPLOOKUPCOLORSBASE + 27)
00376 #define WHEAT           (CMAPLOOKUPCOLORSBASE + 28)
00377 */
00378 
00379 /*
00380  * define colors for PC but not when MINGW 
00381  */
00382 #ifdef _PCC
00383         #ifndef MINGW
00384         #define TINACOLORSDEFINED 1
00385 /* Tina named colors */
00386 extern __declspec(dllimport) int aubergine;
00387 extern __declspec(dllimport) int avocado;
00388 extern __declspec(dllimport) int baby_blue;
00389 extern __declspec(dllimport) int baby_pink;
00390 extern __declspec(dllimport) int bkgrnd;
00391 extern __declspec(dllimport) int black;
00392 extern __declspec(dllimport) int blue;
00393 extern __declspec(dllimport) int brown;
00394 extern __declspec(dllimport) int chocolate;
00395 extern __declspec(dllimport) int coffee;
00396 extern __declspec(dllimport) int cyan;
00397 extern __declspec(dllimport) int dark_green;
00398 extern __declspec(dllimport) int dark_slate;
00399 extern __declspec(dllimport) int gold;
00400 extern __declspec(dllimport) int green;
00401 extern __declspec(dllimport) int heliotrope;
00402 extern __declspec(dllimport) int indian_red;
00403 extern __declspec(dllimport) int ivory;
00404 extern __declspec(dllimport) int magenta;
00405 extern __declspec(dllimport) int orange;
00406 extern __declspec(dllimport) int pale_green;
00407 extern __declspec(dllimport) int plum;
00408 extern __declspec(dllimport) int red;
00409 extern __declspec(dllimport) int salmon;
00410 extern __declspec(dllimport) int slate;
00411 extern __declspec(dllimport) int violet;
00412 extern __declspec(dllimport) int wheat;
00413 extern __declspec(dllimport) int white;
00414 extern __declspec(dllimport) int yellow;
00415 extern __declspec(dllimport) int ntina_colors;
00416 
00417 extern __declspec(dllimport) int rop_copy;
00418 extern __declspec(dllimport) int rop_null;
00419 extern __declspec(dllimport) int line_solid;
00420 extern __declspec(dllimport) int line_dashed;
00421 extern __declspec(dllimport) int rop_xor;
00422         #endif
00423 #endif
00424 
00425 /* Externs defined in X11/globals.c */
00426 #ifndef TINACOLORSDEFINED
00427 /* Tina named colors */
00428 extern const int aubergine;
00429 extern const int avocado;
00430 extern const int baby_blue;
00431 extern const int baby_pink;
00432 extern const int bkgrnd;
00433 extern const int black;
00434 extern const int blue;
00435 extern const int brown;
00436 extern const int chocolate;
00437 extern const int coffee;
00438 extern const int cyan;
00439 extern const int dark_green;
00440 extern const int dark_slate;
00441 extern const int gold;
00442 extern const int green;
00443 extern const int heliotrope;
00444 extern const int indian_red;
00445 extern const int ivory;
00446 extern const int magenta;
00447 extern const int orange;
00448 extern const int pale_green;
00449 extern const int plum;
00450 extern const int red;
00451 extern const int salmon;
00452 extern const int slate;
00453 extern const int violet;
00454 extern const int wheat;
00455 extern const int white;
00456 extern const int yellow;
00457 extern const int ntina_colors;
00458 
00459 extern const int rop_copy;
00460 extern const int rop_null;
00461 extern const int line_solid;
00462 extern const int line_dashed;
00463 extern const int rop_xor;
00464 #endif
00465 
00466 #define IN_TV(tv, pos) \
00467  (ipos_x(pos) >= 0 && ipos_x(pos) < (tv)->width && \
00468   ipos_y(pos) >= 0 && ipos_y(pos) < (tv)->height)
00469   
00470 typedef struct tv_patch
00471 {
00472     Ts_id ts_id;                /* Tina structure identifier */
00473     int filler1;
00474     double  u[3], v[3];
00475     int     flag[3][3];
00476     Ipos    pos[3][3];
00477     int     z[3][3];
00478     int filler2;
00479     double     g[3][3];
00480 }       Tv_patch;
00481 #define TV_PATCH_SWAP_STRING "3[g]3[g]9[i]9[t]9[i]9[g]"
00482 
00483 /* 3D structures temporarily here */
00484 typedef struct cylinder
00485 {
00486     Ts_id ts_id;                /* Tina structure identifier */
00487     Vec3    centre;
00488     Vec3    ex, ey, ez;
00489     int filler;
00490     double  radius, length;
00491 }       Cylinder;
00492 #define CYLINDER_SWAP_STRING "ttttgg"
00493  
00494 typedef struct quadric
00495 {
00496     Ts_id ts_id;                /* Tina structure identifier */
00497     Vec3    centre;
00498     Mat3    s;
00499     Mat3    g;
00500 }       Quadric;
00501 #define QUADRIC_SWAP_STRING "ttt"
00502  
00503 typedef struct torus
00504 {
00505     Ts_id ts_id;                /* Tina structure identifier */
00506     Vec3    centre;
00507     Vec3    ex, ey, ez;
00508     int filler;
00509     double  r1, r2;
00510 }       Torus;
00511 #define TORUS_SWAP_STRING "ttttgg"
00512 
00513 typedef struct ruled
00514 {
00515     Ts_id ts_id;                /* Tina structure identifier */
00516     Vec3    p1, p2, p3, p4;
00517 }       Ruled;
00518 #define RULED_SWAP_STRING "tttt"
00519  
00520 typedef struct quad3
00521 {
00522     Ts_id ts_id;                /* Tina structure identifier */
00523     Vec3    p1, p2, p3, p4;
00524     Vec3 n;
00525 }       Quad3;
00526 #define QUAD3_SWAP_STRING "ttttt"
00527  
00528 typedef enum {DT_BW, DT_COLOR, DT_ONE_BIT_PER_PIXEL} Dump_type;
00529 #define DUMP_TYPE_SWAP_STRING "iii"
00530 #endif

Generated on Thu Nov 12 02:20:43 2009 for Tools by doxygen 1.3.6