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

Linux Cross Reference
Tina5/tina-libs/tina/image/imgSeq_frame.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-libs/tina/image/imgSeq_frame.c,v $
 37  * Date    :  $Date: 2007/02/15 01:52:29 $
 38  * Version :  $Revision: 1.9 $
 39  * CVS Id  :  $Id: imgSeq_frame.c,v 1.9 2007/02/15 01:52:29 paul Exp $
 40  *
 41  * Notes :
 42  */
 43 
 44 /** 
 45  *  @file
 46  *  @brief Rotines to manipulate the list of images stored in the global sequence
 47  *  data structure. 
 48  *
 49  */
 50 
 51 #include "imgSeq_frame.h"
 52 
 53 #if HAVE_CONFIG_H
 54 #include <config.h>
 55 #endif
 56 
 57 #include <stdio.h>
 58 #include <tina/image/imgDef.h>
 59 #include <tina/image/imgPro.h>
 60 
 61 /* all these functions can be found unmodified in seq_vars.c and seq_edit_seq.c */
 62 
 63 /* adds pointer/copies pointer onto all imrect proplists. I think */
 64 void            seq_addtoall_props(void *ptr, int type, void *copyfunc(), void (*freefunc))
 65 {
 66         List           *lptr = (List *) get_current_seq_start_el();
 67         Imrect         *im = NULL;
 68         void           *cptr = NULL;
 69 
 70         if (lptr == NULL)
 71                 return;
 72 
 73         while (lptr != NULL)
 74         {
 75                 im = (Imrect *) (lptr->to);
 76                 if (copyfunc != NULL)
 77                         cptr = (void *) (*copyfunc) (ptr);
 78                 else
 79                         cptr = ptr;
 80                 im->props = proplist_rm(im->props, type);
 81                 /* warning: argument #4 is incompatible with prototype:
 82         prototype: pointer to function() returning void : "../../../tina/sys/sysLst_prop.h", line 71
 83         argument : pointer to void */
 84                 im->props = proplist_add(im->props, cptr, type, freefunc);
 85                 lptr = lptr->next;
 86         }
 87 }
 88 
 89 /*
 90  * seq_image_get based on old seq_image_get. returns image of current element
 91  * of current sequence Really redundant, but here as an easy fix to
 92  * converting rest of tina code
 93  */
 94 
 95 Imrect         *seq_image_get(void)
 96 {
 97 
 98         List           *lptr = NULL;
 99 
100         if ((lptr = get_current_seq_current_el()) == NULL)
101                 return (NULL);
102 
103         return (lptr->to);
104 }
105 
106 /*
107  * sets image of current el of current sequence see seq_image_get for
108  * comments
109  */
110 
111 void            seq_image_set(Imrect * im)
112 {
113 
114         List           *lptr = NULL;
115 
116         if ((lptr = get_current_seq_current_el()) == NULL)
117                 return;
118 
119         lptr->to = im;
120 
121 }
122 
123 
124 
125 /*
126  * seq_frame_insert inserts a given frame into a given sequence. NB. THIS
127  * function does not work the same way around as the seqoral frame_insert
128  * function.
129  * 
130  * function is used to insert images into a sequence when sequence is loaded in.
131  * Here I assume that the images are loaded in from start to end (rather end
132  * to start as past) and so frame is always inserted at teh end of the
133  * imrects list.
134  * 
135  * When single frames are inserted into an already existant sequence, they are
136  * added after the current image, the display shifts to the new image.
137  */
138 
139 void            seq_frame_insert(Imrect * im_in, Sequence * data)
140 {
141         /*
142                 Low level frame insertion stuff
143         */
144         Imrect         *im2 = NULL;
145         List           *lp = (List *) get_seq_current_el(data);
146         List           *slp = (List *) get_seq_start_el(data);
147         List           *new = NULL;
148 
149         /*
150           if (data == NULL)
151           {
152           if ((data = seq_alloc()) == NULL)
153           {
154           error("can't allocate sequence \n", non_fatal);
155           return;
156           }
157           }
158         */
159 
160         if ((lp == NULL) && (slp == NULL))
161         {
162                 lp = dd_ref_addtostart(lp, (Imrect *) im_in, SEQ);
163                 set_seq_start_el(data, lp);
164                 set_seq_current_el(data, lp);
165                 set_seq_end_el(data, lp);
166                 seq_image_set(im_in);
167         } else if (lp != NULL)
168         {
169                 if ((new = dd_link_alloc(im_in, SEQ)) == NULL)
170                         return;
171 
172                 if (get_seq_current_el(data) == get_seq_end_el(data))
173                 {
174                         set_seq_end_el(data, dd_link_addtoend((List *) get_seq_end_el(data), new));
175                         set_seq_current_el(data, get_seq_end_el(data));
176                 } else
177                 {
178 
179                         im2 = lp->next->to;
180                         dd_link_addafter(lp, new);
181                         set_seq_current_el(data, new);
182                 }
183         }
184         return;
185 }
186 

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