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

Linux Cross Reference
Tina4/src/file/edges/edges_w.c

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

  1 /**@(#)
  2   */
  3 #include <stdio.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/file.h>
  7 #include <tina/math.h>
  8 #include <tina/mathfuncs.h>
  9 #include <tina/vision.h>
 10 #include <tina/visionfuncs.h>
 11 
 12 extern Bool fclose_2(FILE * stream, const char *pathname);
 13 extern FILE *fopen_2(const char *pathname, const char *mode);
 14 
 15 /* ARGSUSED Quieten Lint */
 16 void    edge_write(Edgel * edge, int type, Edge_fp * efp)
 17 {
 18     float   buffer[4];
 19 
 20     buffer[0] = vec2_y(edge->pos);
 21     buffer[1] = vec2_x(edge->pos);
 22     buffer[2] = edge->contrast;
 23     buffer[3] = edge->orient;
 24     (void) fwrite((char *) buffer, sizeof(float), 4, efp->fp);
 25     efp->count++;
 26 }
 27 
 28 void    edges_write_stream(FILE * stream, Imrect * er)
 29 {
 30     Edge_fp efp =
 31     {Edge_fp_id};
 32 
 33     efp.fp = stream;
 34     efp.count = 0;
 35 
 36     (void) fwrite((char *) &efp.count, sizeof(int), 1, stream);
 37     er_apply_to_all_edges(er, edge_write, (void *) &efp);
 38     (void) fseek(stream, (long) 0, 0);
 39     (void) fwrite((char *) &efp.count, sizeof(int), 1, stream);
 40 }
 41 
 42 void    edges_write_file(char *pathname, Imrect * er)
 43 {
 44     FILE   *stream = fopen_2(pathname, "w");
 45 
 46     if (stream)
 47     {
 48         edges_write_stream(stream, er);
 49         (void) fclose_2(stream, pathname);
 50     }
 51 }
 52 

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