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

Location:
trunk/Ohana/src/kii/picture
Files:
5 edited

Legend:

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

    r2466 r5852  
    44
    55  int i, j, extra;
    6   char *c;
     6  unsigned char *c;
    77  unsigned int *l;
    88  unsigned int start, start1, start2, start3;
     
    1313  case 8:
    1414    REALLOCATE (layout[0].picture.data, char, layout[0].picture.dx*layout[0].picture.dy);
    15     c = layout[0].picture.data;
     15    c = (unsigned char *) layout[0].picture.data;
    1616    for (i = 0; i < (layout[0].picture.dx*layout[0].picture.dy); i++, c++)
    1717      *c = start;
     
    2222  case 16:
    2323    REALLOCATE (layout[0].picture.data, char, 2*layout[0].picture.dy*layout[0].picture.dx);
    24     c = layout[0].picture.data;
     24    c = (unsigned char *) layout[0].picture.data;
    2525    start1 = 0x0000ff & (start);
    2626    start2 = 0x0000ff & (start >> 8);
  • trunk/Ohana/src/kii/picture/JPEGit24.c

    r5700 r5852  
    11# include "Ximage.h"
    22# include "jpeglib.h"
    3 # include <png.h>
    4 # include "bDraw.h"
    53
    64# define WHITE_R 255
     
    1816  int ii, i, j;
    1917  int i_start, i_end, j_start, j_end;
    20   int dropback, extra;  /* this is a bit of a kludge... */
     18  int dropback;  /* this is a bit of a kludge... */
    2119  int dx, dy, DX, DY;
    2220  int status, Nbytes, quality;
     
    194192    bDrawBuffer *buffer;
    195193
    196     palette = MakePNGPalette (&Npalette);
     194    palette = KapaPNGPalette (&Npalette);
    197195
    198196    buffer = bDrawBufferCreate (dx, dy);
     
    202200    }
    203201
    204     white = GetColorByName ("white");
     202    white = KapaColorByName ("white");
    205203    for (j = 0; j < dy; j++) {
    206204      for (i = 0; i < dx; i++) {
  • 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
  • trunk/Ohana/src/kii/picture/Remap8.c

    r5386 r5852  
    6868  if ((i_end - i_start) % expand_out == 0) dropback = 0;
    6969
    70   out_pix = layout[0].picture.data;
    71   in_pix  = (unsigned char *) (matrix[0].buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0);
     70  out_pix = (unsigned char *) layout[0].picture.data;
     71  in_pix  = (unsigned char *) matrix[0].buffer + DX*(int)MAX(Y,0) + (int)MAX(X,0);
    7272
    7373  /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/
  • trunk/Ohana/src/kii/picture/Resize.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); \
    9 
    102
    113int Resize (Graphic *graphic, Layout *layout) {
    124 
    13   int status, Nbytes;
    145  unsigned int NX, NY;
    15   char buffer[128];
    166
    17   SCAN;
    18   sscanf (buffer, "%d %d", &NX, &NY);
     7  KiiScanMessage (layout[0].Ximage, "%d %d", &NX, &NY);
    198
    209  NX += ZOOM_X + 3*PAD1 + 25;
Note: See TracChangeset for help on using the changeset viewer.