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

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

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

  1 /* trans.c
  2  *
  3  * @(#) trans tv functionality
  4  *
  5  */
  6 #include <tina/all_tina.h>
  7 #include <tina/brain.h>
  8 #include <tina/brainfuncs.h>
  9 
 10 static Tv *trans_tv = NULL;
 11 static Ipos trans_pos;
 12 
 13 /******************************************************************************/
 14 
 15 Tv *trans_tv_get(void)
 16 {
 17     return (trans_tv);
 18 }
 19 
 20 void trans_tv_set(Tv * tv)
 21 {
 22     trans_tv = tv;
 23 }
 24 
 25 /******************************************************************************/
 26 
 27 static int zold = -1;
 28 
 29 Bool trans_changed(void)
 30 {
 31     if (ims_z_get() == zold)
 32         return (false);
 33     else
 34         return (true);
 35 }
 36 
 37 /******************************************************************************/
 38 
 39 static void trans_backdraw(Tv * tv)
 40 {
 41     Imrect *im, *im_scale;
 42 
 43     zold = ims_z_get();
 44     if ((im = ims_image_get()) != NULL)
 45     {
 46         im_scale = imf_scale(im, 0.0, 255.0);
 47         tv_camera2_roi(tv, im_scale->region);
 48         tv_imrect2(tv, im_scale);
 49         im_free(im_scale);
 50     }
 51 }
 52 
 53 static void trans_fulldraw(Tv * tv)
 54 {
 55     tv_set_overlay(tv);
 56     trans_pos = tv_proj2(tv, vec2(ims_x_get(), ims_y_get()));
 57     tv_crosshair(tv, trans_pos);
 58     tv_reset_draw(tv);
 59 }
 60 
 61 /******************************************************************************/
 62 
 63 static void trans_crosshair_down_proc(Tv * tv, Ipos pos)
 64 {
 65     tv_set_overlay(tv);
 66     tv_crosshair(tv, trans_pos);
 67     trans_pos = pos;
 68     tv_crosshair(tv, trans_pos);
 69 }
 70 
 71 static void trans_crosshair_drag_proc(Tv * tv, Ipos pos)
 72 {
 73     tv_crosshair(tv, trans_pos);
 74     trans_pos = pos;
 75     tv_crosshair(tv, trans_pos);
 76 }
 77 
 78 static void trans_crosshair_up_proc(Tv * tv, Ipos pos)
 79 {
 80     Vec2 v = tv_backproj2(tv, pos);
 81 
 82     tv_crosshair(tv, trans_pos);
 83     tv_reset_draw(tv);
 84 
 85     ims_x_set(vec2_x(v));
 86     ims_y_set(vec2_y(v));
 87 
 88     redraw_all();
 89 }
 90 
 91 /******************************************************************************/
 92 
 93 Tv_mouse trans_cursor_mouse(void)
 94 {
 95     return mouse_define(
 96                         LEFT_DOWN, trans_crosshair_down_proc,
 97                         LEFT_DRAG, trans_crosshair_drag_proc,
 98                         LEFT_UP, trans_crosshair_up_proc,
 99                         NULL);
100 }
101 
102 /* Create trans window. ****************************************************** */
103 
104 void create_trans_display(void)
105 {
106     trans_tv = display_create("Transverse", 20, 60, 256, 256);
107     tv_set_backdraw(trans_tv, trans_backdraw);
108     tv_set_fulldraw(trans_tv, trans_fulldraw);
109     tv_set_activity(trans_tv, MOUSE);
110     tv_set_mouse(trans_tv, trans_cursor_mouse());
111 }
112 

~ [ 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.