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

Linux Cross Reference
Tina4/src/tools/temporal/temp_tool.c

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

  1 /*
  2 
  3   temp_tool.c
  4 
  5   Tinatool for controlling temporal image sequences
  6 
  7   author: a.lacey
  8   date  : 5-2-93; version 1.0
  9           4.12.95 version 2.0
 10 
 11 */
 12 
 13 #include <stdio.h>
 14 #include <tina/sys.h>
 15 #include <tina/sysfuncs.h>
 16 #include <tina/math.h>
 17 #include <tina/mathfuncs.h>
 18 #include <tina/tv.h>
 19 #include <tina/vision.h>
 20 #include <tina/visionfuncs.h>
 21 #include <tina/image.h>
 22 #include <tina/tempdefs.h>
 23 #include <tina/temporal.h>
 24 #include <tina/temppro.h>
 25 
 26 
 27 #define IMAGE_MASK      1
 28 #define TMPEDG_MASK     2
 29 #define TMPCNR_MASK     4
 30 #define TEXT_MASK       8
 31 
 32 
 33 Sequence     *init_seq(Sequence *t)
 34 {
 35   char  *tdata;
 36 
 37   seq_free(t);
 38 
 39   if ((t = seq_alloc(t)) == NULL)
 40     return (NULL);
 41 
 42   t->number = 5;
 43 
 44 
 45   if ((tdata = (char *)getenv("TEMP_SEQ_DIR")) == NULL)
 46     {
 47       error("temp_tool: cannot find TEMP_SEQ_DIR", warning);
 48       strcpy(t->filename, "");
 49     }
 50 
 51   else
 52     strcpy(t->filename, tdata);
 53 
 54   if ((tdata = (char *)getenv("TEMP_DATA_DIR")) == NULL)
 55     {
 56       error("temp_tool: cannot find TEMP_DATA_DIR", warning);
 57       strcpy(t->datafile, "");
 58     }
 59 
 60   else
 61     strcpy(t->datafile, tdata);
 62 
 63   return (t);
 64 }
 65 
 66 
 67         
 68 void      get_image_seq_proc(Sequence *data)
 69 {
 70   get_image_seq(data);
 71 }
 72 
 73 
 74 
 75 
 76 void      save_image_seq_proc(Sequence *data)
 77 {
 78   if(get_current_el() == NULL)
 79     {
 80       error("need sequence first! ", warning);
 81       return;
 82     }
 83 
 84   write_seq(data);
 85 }
 86 
 87 
 88 
 89 void    seq_format(int type)
 90 {
 91   set_seq_format(type);
 92 }
 93 
 94 
 95 
 96 void    tv_choice_proc(int val)
 97 {
 98   tv_set_next(temp_tv());
 99 }
100 
101 
102 
103 void    temp_tv_proc(void)
104 {
105   temp_tv_set(temp_tv_make());
106   tv_set_next(temp_tv());
107 }
108 
109  
110 void    temp_check_proc(int val)
111 {
112     temp_image_on(val & IMAGE_MASK);
113     temp_corners_on(val & TMPCNR_MASK);
114     temp_edges_on(val & TMPEDG_MASK);
115     temp_text_on(val & TEXT_MASK);
116 }
117  
118 
119 void      show_last_proc(Sequence *data)
120 {
121   show_last(data);
122 }
123 
124 
125 void      show_next_proc(Sequence *data)
126 {
127   show_next(data);      
128 }
129 
130 
131 
132 void      show_first_proc(Sequence *data)
133 {
134   show_first(data);
135 }
136 
137 
138 
139 void      show_end_proc(Sequence *data)
140 {
141   show_end(data);
142 }
143 
144 
145 void      goto_frame_proc(Sequence *data)
146 {
147   goto_frame(data);
148 }
149 
150 
151 
152 void      make_seq_proc(Sequence *data)
153 {
154   Tv     *tv_ptr = temp_tv_get();
155 
156   if (tv_ptr == NULL)
157     return;
158 
159   make_seq(data, tv_ptr);
160   return;
161 }
162 
163 
164 
165 void      play_seq_proc(Sequence *data)
166 {
167   Tv     *tv_ptr = temp_tv_get();
168 
169   if (tv_ptr == NULL || tv_ptr->movie == NULL)
170     return;
171 
172   play_seq(data, tv_ptr);
173   return;
174 }
175 
176 
177 
178 void         temp_tool(int x, int y)
179 {
180   Sequence    *temp = NULL;
181   static int   tool = 0;
182 
183   if (tool)
184     {
185       tw_show_tool(tool);
186       return;
187     }
188 
189   if ((temp = init_seq(temp)) == NULL)
190     return;
191 
192   set_temp_ptr(temp);
193 
194   temp_tv_proc();
195   tool = tw_tool("Temporal Tool", x, y);
196 
197   tw_sglobal("Image File:", temp->filename, 40);
198   tw_newrow();
199   tw_sglobal("Data File:", temp->datafile, 40);
200   tw_newrow();
201   tw_iglobal("Number:", &(temp->number), 3);
202   tw_iglobal("  Loop:", &(temp->loop_times), 3);
203   tw_iglobal("  Frame:", &(temp->goto_frame), 3);
204   tw_newrow();
205   
206   tw_iglobal("Start :", &(temp->seq_start), 3);
207   tw_iglobal("  End :", &(temp->seq_end), 3);
208   tw_iglobal("  IF delay :", &(temp->seq_delay), 5);    
209   tw_newrow();
210 
211   tw_choice("Tv List : ", tv_choice_proc, 0, "temporal", NULL);
212   tw_newrow();
213 
214   tw_check("Display : ", temp_check_proc, 1,
215            "image", "edges", "corners", "text",  NULL);
216   tw_newrow();
217 
218   tw_choice("Repeat : ", seq_format, 0, "single", "loop", "b&f",NULL);
219   tw_newrow();
220 
221   tw_button("Input", get_image_seq_proc, temp);
222   tw_button("Output", save_image_seq_proc, temp);
223   tw_newrow();
224         
225   tw_button("Delete", delete_frame, temp);
226   tw_button("Insert", insert_frame, temp);
227   tw_button("Replace", replace_frame, temp);
228   tw_button("Push", push_frame, NULL);
229   tw_newrow();
230 
231   tw_button("First", show_first_proc, temp);
232   tw_button("<", show_last_proc, temp);
233   tw_button(">", show_next_proc, temp);
234   tw_button("Last", show_end_proc, temp);
235   tw_button("Jumpto", goto_frame_proc, temp);
236   tw_button("Make", make_seq_proc, temp);
237   tw_button("Play", play_seq_proc, temp);
238   tw_newrow();
239 
240   tw_end_tool();
241 }
242 
243 
244 

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