IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 27, 2005, 3:23:01 PM (21 years ago)
Author:
eugene
Message:

substantial work to move kii/kapa call into libkapa, unify RotFont, bDraw functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kii/picture/NewPicture.c

    r5700 r5852  
    11# include "Ximage.h"
    2 # define SCAN \
    3   status = read (layout[0].Ximage, buffer, 16); \
    4   buffer[16] = 0; \
    5   sscanf (buffer, "%*s %d", &Nbytes); \
    6   status = read (layout[0].Ximage, buffer, Nbytes); \
    7   buffer[status] = 0; /* make the string easy to parse */ \
    8   (DEBUG) && fprintf (stderr, "buffer: <%s>\n", buffer); \
    92
    103int NewPicture (Graphic *graphic, Layout *layout) {
    114
    125  Header header;
    13   char buffer[1024], *buff;
    14   int status, bytes_left, Nbytes;
     6  char *buff;
     7  int status, bytes_left, socket;
    158 
    16   fits_free_matrix (&layout[0].matrix);
    17   sprintf (buffer, "NCOLOR: %6d ", layout[0].Npixels);
    18   write (layout[0].Ximage, buffer, 16);
     9  socket = layout[0].Ximage;
    1910
    20   fcntl (layout[0].Ximage, F_SETFL, !O_NONBLOCK); 
     11  KiiSendMessage (socket, "%d", layout[0].Npixels);
     12
     13  fcntl (socket, F_SETFL, !O_NONBLOCK); 
    2114
    2215  header.Naxes = 2;
    23   SCAN;
    24   sscanf (buffer, "%d %d %d %d %lf %lf",
    25           &header.Naxis[0], &header.Naxis[1], &header.bitpix,
    26           &header.unsign,   &header.bzero,    &header.bscale);
    2716
    28   SCAN;
    29   sscanf (buffer, "%lf %lf %lf %lf %d", &layout[0].zero, &layout[0].range, &layout[0].min,  &layout[0].max, &header.size);
     17  KiiScanMessage (socket, "%d %d %d %d %lf %lf", &header.Naxis[0], &header.Naxis[1]);
     18  KiiScanMessage (socket, "%d %d %d %d %lf %lf", &header.bitpix, &header.unsign, &header.bzero, &header.bscale);
     19  KiiScanMessage (socket, "%lf %lf",  &layout[0].zero, &layout[0].range);
     20  KiiScanMessage (socket, "%lf %lf %d", &layout[0].min,  &layout[0].max, &header.size);
     21  KiiScanMessage (socket, "%lf %f %f %f %f", &layout[0].coords.crval1, &layout[0].coords.crpix1, &layout[0].coords.cdelt1, &layout[0].coords.pc1_1, &layout[0].coords.pc1_2);
     22  KiiScanMessage (socket, "%lf %f %f %f %f", &layout[0].coords.crval2, &layout[0].coords.crpix2, &layout[0].coords.cdelt2, &layout[0].coords.pc2_1, &layout[0].coords.pc2_2);
     23         
     24  KiiScanMessage (socket, "%s %s %s", layout[0].coords.ctype, layout[0].file, layout[0].buffer_name);
    3025
    31   SCAN;
    32   sscanf (buffer, "%lf %f %f %f %f", &layout[0].coords.crval1, &layout[0].coords.crpix1, &layout[0].coords.cdelt1, &layout[0].coords.pc1_1, &layout[0].coords.pc1_2);
    33          
    34   SCAN;
    35   sscanf (buffer, "%lf %f %f %f %f", &layout[0].coords.crval2, &layout[0].coords.crpix2, &layout[0].coords.cdelt2, &layout[0].coords.pc2_1, &layout[0].coords.pc2_2);
    36          
    37   SCAN;
    38   sscanf (buffer, "%s %s %s", layout[0].coords.ctype, layout[0].file, layout[0].buffer_name);
    39 
     26  fits_free_matrix (&layout[0].matrix);
    4027  fits_create_matrix (&header, &layout[0].matrix);
    4128
    42   fcntl (layout[0].Ximage, F_SETFL, O_NONBLOCK); 
     29  fcntl (socket, F_SETFL, O_NONBLOCK); 
    4330
    4431  status = 1;
     
    4734  layout[0].matrix.size = 0;
    4835  while (bytes_left > 0) {
    49     status = read (layout[0].Ximage, buff, bytes_left);
     36    status = read (socket, buff, bytes_left);
    5037    if (status == 0) {  /* No more pipe */
    5138      fprintf (stderr, "error: pipe closed\n");
     
    5946  }
    6047
    61   (DEBUG) && fprintf (stderr, "read %d bytes\n", layout[0].matrix.size);
     48  if (DEBUG) fprintf (stderr, "read %d bytes\n", layout[0].matrix.size);
    6249  /* it it not obvious this condition should kill kii, but ... */
    6350  if (layout[0].matrix.size != header.size) { 
     
    6956
    7057  Remap (graphic, layout, &layout[0].matrix);
    71   (DEBUG) && fprintf (stderr, "remapped image\n");
     58  if (DEBUG) fprintf (stderr, "remapped image\n");
    7259  Refresh (graphic, layout, 0);
    73   (DEBUG) && fprintf (stderr, "refreshed\n");
     60  if (DEBUG) fprintf (stderr, "refreshed\n");
    7461  XFlush (graphic[0].display);
    7562
Note: See TracChangeset for help on using the changeset viewer.