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

Linux Cross Reference
Tina6/tina-tools/tinatool/tlbase/tlbaseView_display.c

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

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/tlbase/tlbaseView_display.c,v $
 37  * Date    :  $Date: 2007/02/15 01:55:50 $
 38  * Version :  $Revision: 1.6 $
 39  * CVS Id  :  $Id: tlbaseView_display.c,v 1.6 2007/02/15 01:55:50 paul Exp $
 40  *
 41  * Author  :  Legacy TINA
 42  *
 43  * Notes : Sequential display of images
 44  *         author: a.lacey
 45  *         date  : 9-2-93;  version 1.0
 46  *         4.12.95; version 2.0
 47  *********
 48 */
 49 
 50 #if HAVE_CONFIG_H
 51 #include <config.h>
 52 #endif
 53 
 54 
 55 #include <stdio.h>
 56 #include <math.h>
 57 #include <ctype.h>
 58 #include <signal.h>
 59 #include <sys/signal.h>
 60 #include <sys/time.h>
 61 #include <unistd.h>
 62 
 63 #include <tina/sys/sysDef.h>
 64 #include <tina/sys/sysPro.h>
 65 #include <tina/image/imgDef.h>
 66 #include <tina/image/imgPro.h>
 67 #include <tinatool/draw/drawDef.h>
 68 #include <tinatool/draw/drawPro.h>
 69 #include <tinatool/tlbase/tlbase_SeqDef.h>
 70 #include <tinatool/tlbase/tlbaseSeq_image.h>
 71 #include <tinatool/tlbase/tlbaseSeq_view.h>
 72 
 73 #include "tlbaseView_display.h"
 74 
 75 void       timer_handler_install(long length)
 76 {
 77 #ifndef MINGW
 78    void      timer_handler(int a);
 79    struct    itimerval  ivalue;
 80    struct    sigaction  action;
 81    long      secs, usecs;
 82 
 83    secs = (long)floor((double)(length/1000000));
 84    usecs = (long)(length - (secs*1000000));
 85    
 86    ivalue.it_interval.tv_sec = secs;
 87    ivalue.it_interval.tv_usec = usecs;
 88    ivalue.it_value.tv_sec = secs;
 89    ivalue.it_value.tv_usec = usecs;
 90 
 91    if (setitimer(ITIMER_REAL, &ivalue, NULL) !=0)
 92       error("timer_handler_install: failure to set timer\n", warning); 
 93  
 94    action.sa_handler = timer_handler;
 95    action.sa_flags = 0x0;
 96    
 97    if (sigaction(SIGALRM, &action, NULL) != 0)
 98       error("timer_handler_install: failure to set timer\n", warning);  
 99 #endif   
100 }
101 
102 
103 void       timer_handler_uninstall()
104 {
105 #ifndef MINGW
106    struct    itimerval  ivalue;
107 
108    ivalue.it_interval.tv_sec = 0;
109    ivalue.it_interval.tv_usec = 0;
110    ivalue.it_value.tv_sec = 0;
111    ivalue.it_value.tv_usec = 0;
112 
113    setitimer(ITIMER_REAL, &ivalue, NULL);
114    signal(SIGALRM, SIG_DFL);
115 #endif   
116 }
117 
118 void       timer_handler(int a)
119 {
120     /* Do n'out */
121 }
122 
123 
124 void        play_seq(Sequence *data, Tv *tv)
125 {
126   int    count, loop_times=1; 
127   long int seq_delay = 4;
128   List   *ptr, *end;
129   int    format = SINGLE;
130 
131 
132   if (tv == NULL || tv->movie == NULL)
133     return;
134 
135   if (loop_times < 1)
136     {
137       error(" loop too small, set to 1", warning);
138       loop_times = 1;
139     }
140 
141   if (format == SINGLE)
142     count = 1;
143   else
144     count = loop_times;
145     
146   timer_handler_install(seq_delay);
147    
148   while (count != 0)
149     {
150       for(ptr = tv->movie; ptr != NULL; ptr = ptr->next)
151         {
152           tv_show_picture(tv, ptr->to);
153           tv_flush(tv);
154           end = ptr;
155           pause();
156         }
157 
158       if (format == BANDF)
159         {
160           for (ptr = end; ptr != NULL; ptr= ptr->last)
161             {
162               tv_show_picture(tv, ptr->to);
163               tv_flush(tv);
164               pause();
165             }
166 
167         }
168 
169       count--;
170     } 
171     
172   timer_handler_uninstall();
173 }
174         
175 
176 
177 
178 void        make_seq(Sequence *data, Tv *stv)
179 {
180 
181   List  *im_tp;
182   int      i, w;
183 
184   i = 0;
185   w = get_end_frame(data) - (data->offset);
186 
187   if (w < 1)
188     return;
189 
190   im_tp = get_seq_current_el(data);
191 
192   if (im_tp == NULL)
193     return;
194 
195 /*
196   set_current_el(im_tp);
197 */
198   seq_image_set(im_tp->to);
199 
200   tv_start_movie(stv);
201         
202   while ((im_tp != NULL) && (i < w))
203     {
204       tv_free_background(stv);
205       tv_repaint(stv);
206       seq_show_bits();
207       tv_make_movie(stv);
208 
209       set_seq_current_el(data, im_tp->next);
210       im_tp = get_seq_current_el(data);
211 
212       if (im_tp != NULL)
213         if (im_tp->to != NULL)
214           seq_image_set(im_tp->to);
215 
216       i++;      
217     }   
218         
219   set_seq_current_el(data, get_seq_start_el(data));
220 }
221 
222 

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