~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/covira/front.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* front.c
  2  *
  3  * @(#) front tv functionality
  4  *
  5  */
  6 
  7 #include <tina/all_tina.h>
  8 #include <tina/brain.h>
  9 #include <tina/brainfuncs.h>
 10 
 11 static Tv *front_tv = NULL;
 12 static Ipos front_pos;
 13 
 14 /******************************************************************************/
 15 
 16 Tv *front_tv_get(void)
 17 {
 18     return front_tv;
 19 }
 20 
 21 void front_tv_set(Tv * tv)
 22 {
 23     front_tv = tv;
 24 }
 25 
 26 /******************************************************************************/
 27 
 28 static int yold = -1;
 29 
 30 Bool front_changed(void)
 31 {
 32     if (ims_y_get() == yold)
 33         return (false);
 34     else
 35         return (true);
 36 }
 37 
 38 /******************************************************************************/
 39 
 40 static void front_backdraw(Tv * tv)
 41 {
 42     Imrect *im_front, *im_scale;
 43 
 44     yold = ims_y_get();
 45     if ((im_front = ims_yslice()) != NULL)
 46     {
 47         double scale = ims_zscale_get();
 48         im_scale = imf_scale(im_front, 0.0, 255.0);
 49         im_free(im_front);
 50         tv_camera2_roi_stretch(tv, im_scale->region, scale);
 51         tv_imrect2(tv, im_scale);
 52         im_free(im_scale);
 53     }
 54 }
 55 
 56 
 57 static void front_fulldraw(Tv * tv)
 58 {
 59     double x = ims_x_get();
 60     double y = ims_z_get();
 61 
 62     tv_save_draw(tv);
 63     tv_set_linewidth(tv, 2);
 64     ims_all_strings_front_draw3(tv);
 65     tv_reset_draw(tv);
 66 
 67     tv_set_overlay(tv);
 68     front_pos = tv_proj2(tv, vec2(x, y));
 69     tv_crosshair(tv, front_pos);
 70     tv_reset_draw(tv);
 71 }
 72 
 73 /******************************************************************************/
 74 
 75 static void front_crosshair_down_proc(Tv * tv, Ipos pos)
 76 {
 77     tv_set_overlay(tv);
 78     tv_crosshair(tv, front_pos);
 79     front_pos = pos;
 80     tv_crosshair(tv, front_pos);
 81 }
 82 
 83 static void front_crosshair_drag_proc(Tv * tv, Ipos pos)
 84 {
 85     tv_crosshair(tv, front_pos);
 86     front_pos = pos;
 87     tv_crosshair(tv, front_pos);
 88 }
 89 
 90 static void front_crosshair_up_proc(Tv * tv, Ipos pos)
 91 {
 92     Vec2 v = tv_backproj2(tv, pos);
 93 
 94     tv_crosshair(tv, front_pos);
 95     tv_reset_draw(tv);
 96 
 97     ims_x_set(vec2_x(v));
 98     ims_z_set(vec2_y(v));
 99     redraw_all();
100 }
101 
102 /******************************************************************************/
103 
104 static void front_voi_import_proc(Tv * tv, Ipos pos)
105 {
106     Vec2 v = tv_backproj2(tv, pos);
107 
108     ims_voi_mark();
109     ims_x_set(vec2_x(v));
110     ims_z_set(vec2_y(v));
111     ims_voi_import();
112 
113     redraw_all();
114 }
115 
116 static void front_voi_empty_proc(Tv * tv, Ipos pos)
117 {
118     Vec2 v = tv_backproj2(tv, pos);
119 
120     ims_x_set(vec2_x(v));
121     ims_z_set(vec2_y(v));
122     ims_voi_empty();
123 
124     redraw_all();
125 }
126 
127 /******************************************************************************/
128 
129 Tv_mouse front_cursor_mouse(void)
130 {
131     return mouse_define(
132                         LEFT_DOWN, front_crosshair_down_proc,
133                         LEFT_DRAG, front_crosshair_drag_proc,
134                         LEFT_UP, front_crosshair_up_proc,
135                         MIDDLE_DOWN, front_voi_import_proc,
136                         RIGHT_DOWN, front_voi_empty_proc,
137                         NULL);
138 }
139 
140 /* Create the frontal window. ************************************************ */
141 
142 void create_front_display(void)
143 {
144     front_tv = display_create("Frontal (Working X-Axis)", 560, 60, 256, 256);
145     tv_set_backdraw(front_tv, front_backdraw);
146     tv_set_fulldraw(front_tv, front_fulldraw);
147     tv_set_activity(front_tv, MOUSE);
148     tv_set_mouse(front_tv, front_cursor_mouse());
149 }
150 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.