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
00039
00040
00041
00042
00043
00044
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
00068
00069
00070
00071
00072
00073
00074
00075 typedef int Tina_pixel;
00076 typedef struct rgb
00077 {
00078 Ts_id ts_id;
00079 unsigned short red;
00080 unsigned short green;
00081 unsigned short blue;
00082 } Rgb;
00083 #define RGB_SWAP_STRING "kkk"
00084
00085 typedef struct tina_color
00086 {
00087 Ts_id ts_id;
00088 Tina_pixel pixel;
00089 unsigned short red;
00090 unsigned short green;
00091 unsigned short blue;
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;
00112
00113 Cmap_model model;
00114
00115 Cmap_kind type;
00116 int ncells;
00117 int nplanes;
00118 Tina_pixel base;
00119 Tina_pixel std_lut[CMAPLOOKUPSIZE];
00120 Tina_pixel overlay_mask;
00121 int color_bits;
00122 int color_lut[CMAPLOOKUPNUMBEROFGREYS];
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;
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;
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;
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;
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;
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
00270 Bool(*cmap_create_fn) ();
00271
00272
00273 Cmap_data_visible *cmap_data_visible;
00274
00275
00276
00277
00278 Tv_zbuff *zbuff;
00279
00280
00281 void (*message_fn) ();
00282 void *message_data;
00283
00284
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;
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
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 #ifdef _PCC
00383 #ifndef MINGW
00384 #define TINACOLORSDEFINED 1
00385
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
00426 #ifndef TINACOLORSDEFINED
00427
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;
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
00484 typedef struct cylinder
00485 {
00486 Ts_id ts_id;
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;
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;
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;
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;
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