IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15925


Ignore:
Timestamp:
Dec 24, 2007, 5:47:04 PM (18 years ago)
Author:
eugene
Message:

lots of work to add in multiple channels, blinking, working to 3D colors

Location:
branches/eam_branch_20071222/Ohana/src/kapa2
Files:
2 added
39 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071222/Ohana/src/kapa2/Makefile

    r13484 r15925  
    7777$(SRC)/bDrawOverlay.$(ARCH).o             $(SRC)/ButtonFunctions.$(ARCH).o    \
    7878$(SRC)/PSimage.$(ARCH).o                  $(SRC)/PSPixmap.$(ARCH).o           \
    79 $(SRC)/PSOverlay.$(ARCH).o
     79$(SRC)/PSOverlay.$(ARCH).o                $(SRC)/SetChannel.$(ARCH).o
    8080
    8181OBJ  =  $(KAPA)
  • branches/eam_branch_20071222/Ohana/src/kapa2/include/buttons.h

    r13320 r15925  
    4747   0x80, 0xef, 0x03, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4848   0x00, 0x00, 0x00, 0x00};
    49 #define puns_width 25
    50 #define puns_height 25
    51 static char puns_bits[] = {
     49#define heat_width 25
     50#define heat_height 25
     51static char heat_bits[] = {
    5252   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xd8, 0x01,
    5353   0x00, 0x0c, 0x37, 0x00, 0xf8, 0xc9, 0x6f, 0x00, 0x0c, 0xde, 0xf0, 0x00,
  • branches/eam_branch_20071222/Ohana/src/kapa2/include/constants.h

    r13479 r15925  
    99 | StructureNotifyMask \
    1010 | PointerMotionMask)
     11
     12# define NCHANNELS 3
     13# define NPIXELS_DYNAMIC 128
     14# define NPIXELS_STATIC 1024
    1115
    1216# define PAD1  3
  • branches/eam_branch_20071222/Ohana/src/kapa2/include/prototypes.h

    r14590 r15925  
    140140
    141141int           Center              PROTO(());
    142 void          Remap               PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix));
     142void          Remap               PROTO((Graphic *graphic, KapaImageWidget *image));
    143143void          Remap8              PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix));
    144144void          Remap16             PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix));
     
    147147int           LoadPicture         PROTO((int sock));
    148148
    149 KapaImageWidget *InitImage        PROTO(());
     149KapaImageWidget *InitImageWidget  PROTO(());
     150int           InitImageChannel    PROTO((KapaImageChannel *channel));
    150151void          FreeImage           PROTO((KapaImageWidget *image));
    151152void          SetImageSize        PROTO((Section *section));
     
    179180/* Button Functions */
    180181int           greycolors          PROTO((Graphic *graphic, KapaImageWidget *image));
    181 int           puns                PROTO((Graphic *graphic, KapaImageWidget *image));
     182int           heat                PROTO((Graphic *graphic, KapaImageWidget *image));
    182183int           rainbow             PROTO((Graphic *graphic, KapaImageWidget *image));
    183184int           Recenter            PROTO((Graphic *graphic, KapaImageWidget *image));
  • branches/eam_branch_20071222/Ohana/src/kapa2/include/structures.h

    r15906 r15925  
    22/**************** Graphic carries X info around ****************/
    33typedef struct {
    4   Display       *display;
    5   int            screen;
     4  Display       *display;     // X display pointer
     5  int            screen;      // X screen number
    66  int            depth;
    77  Window         window;
    88  Visual        *visual;
    9   int            visualclass;
    10   int            Nbits;
     9  int            visualclass; // is visual dynamic? (XXX change name?)
     10  int            Nbits;       // pixel depth in bits (8, 16, 24, 32)
    1111  GC             gc;
    1212  XFontStruct   *font;
     
    1414  int            x,  y;
    1515  unsigned int   dx, dy;
    16   XColor         cmap[1024];
     16  XColor        *cmap;
    1717  Colormap       colormap;
    18   unsigned long  fore;
    19   unsigned long  back;
    20   unsigned long  *color;
    21   unsigned long  pixels[1024];
    22   unsigned long  overlay_color[NOVERLAYS];
    23   int Npixels;
     18  unsigned long *color;      // graph plotting colors
    2419  int Ncolors;
     20
     21  unsigned long *pixels;     // image pixel colors
     22  int Npixels;                // number of pixels
     23
     24  unsigned long  fore;        // basic foreground color
     25  unsigned long  back;        // basic background color
     26
     27  unsigned long  overlay_color[NOVERLAYS]; // image plotting colors
    2528} Graphic;
    2629
     
    125128} KapaGraphWidget;
    126129
     130typedef struct {
     131  // data associated with this image element
     132  Matrix   matrix;         /* data for picture */
     133  double   zero, range;    /* zero, range for picture to cmap */
     134  double   max, min;       /* zero, range for data to z-value */
     135  double   start, slope;   /* zero, range for cmap to pixels */
     136  Coords   coords;
     137  char     file[1024];     /* name of file */
     138  char     name[1024];     /* name of buffer */
     139} KapaImageChannel;
     140
    127141// a single image in the display window
    128142typedef struct {
     
    139153  Button   grey_button;
    140154  Button   rainbow_button;
    141   Button    puns_button;
     155  Button   heat_button;
    142156  Button   overlay_button[NOVERLAYS];
    143157
     
    149163  int      DecimalDegrees;
    150164
    151   // data associated with this image element
     165  double   X, Y;           /* image pixel at screen center */
     166  int      expand;         /* zoomscale */
     167  double   x, y, z;        /* last pointer coords */
     168
    152169  Overlay  overlay[NOVERLAYS];
    153170  Overlay  tickmarks;
    154   Matrix   matrix;         /* data for picture */
    155   double   X, Y;           /* image pixel at screen center */
    156   int      expand;         /* zoomscale */
    157   double   zero, range;    /* zero, range for picture to cmap */
    158   double   max, min;       /* zero, range for data to z-value */
    159   double   start, slope;   /* zero, range for cmap to pixels */
    160   double   x, y, z;        /* last pointer coords */
    161   Coords   coords;
    162   char     file[1024];     /* name of file */
    163   char     name[1024];  /* name of buffer */
     171
     172  unsigned short   *pixmap;   // lookup table for image pixel value to pixel index
     173  KapaImageChannel *image;
     174  KapaImageChannel channel[NCHANNELS];
    164175} KapaImageWidget;
    165176
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/ButtonFunctions.c

    r13331 r15925  
    22
    33static char *GREY = "greyscale";
    4 static char *PUNS = "Puns";
     4static char *HEAT = "Heat";
    55static char *RAINBOW = "Rainbow";
    66
     
    1818  SetColormap (name);
    1919  CreateColorbar (image, graphic);
    20   Remap (graphic, image, &image[0].matrix);
     20  Remap (graphic, image);
    2121  CreateZoom (image, graphic, 0, 0);
    2222  Refresh ();
     
    2525}
    2626
    27 int puns (Graphic *graphic, KapaImageWidget *image) {
     27int heat (Graphic *graphic, KapaImageWidget *image) {
    2828  char *name;
    29   name = PUNS;
     29  name = HEAT;
    3030  SetColormap (name);
    3131  CreateColorbar (image, graphic);
    32   Remap (graphic, image, &image[0].matrix);
     32  Remap (graphic, image);
    3333  CreateZoom (image, graphic, 0, 0);
    3434  Refresh ();
     
    4242  SetColormap (name);
    4343  CreateColorbar (image, graphic);
    44   Remap (graphic, image, &image[0].matrix);
     44  Remap (graphic, image);
    4545  CreateZoom (image, graphic, 0, 0);
    4646  Refresh ();
     
    5454  image[0].Y = 0;
    5555 
    56   Remap (graphic, image, &image[0].matrix);
     56  Remap (graphic, image);
    5757  Refresh ();
    5858  FlushDisplay (graphic[0].display);
     
    6464
    6565  image[0].expand = 1;
    66   Remap (graphic, image, &image[0].matrix);
     66  Remap (graphic, image);
    6767  Refresh ();
    6868  FlushDisplay (graphic[0].display);
     
    7777  image[0].expand = 1;
    7878 
    79   Remap (graphic, image, &image[0].matrix);
     79  Remap (graphic, image);
    8080  Refresh ();
    8181  FlushDisplay (graphic[0].display);
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CSaveOverlay.c

    r13479 r15925  
    2424  for (i = 0; i < image[0].overlay[N].Nobjects; i++) {
    2525    if (image[0].overlay[N].objects[i].type == KII_OVERLAY_LINE) {
    26       XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].coords);
     26      XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].image[0].coords);
    2727      x1 = image[0].overlay[N].objects[i].x + image[0].overlay[N].objects[i].dx;
    2828      y1 = image[0].overlay[N].objects[i].y + image[0].overlay[N].objects[i].dy;
    29       XY_to_RD (&ra1, &dec1, x1, y1, &image[0].coords);
     29      XY_to_RD (&ra1, &dec1, x1, y1, &image[0].image[0].coords);
    3030      dra = (ra1 - ra);
    3131      ddec = (dec1 - dec);
    3232    } else {
    33       XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].coords);
     33      XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].image[0].coords);
    3434      x1 = image[0].overlay[N].objects[i].x;
    3535      y1 = image[0].overlay[N].objects[i].y + image[0].overlay[N].objects[i].dy;
    36       XY_to_RD (&ra1, &dec1, x1, y1, &image[0].coords);
     36      XY_to_RD (&ra1, &dec1, x1, y1, &image[0].image[0].coords);
    3737      ddec = fabs (dec1 - dec);
    3838      x1 = image[0].overlay[N].objects[i].x + image[0].overlay[N].objects[i].dx;
    3939      y1 = image[0].overlay[N].objects[i].y;
    40       XY_to_RD (&ra1, &dec1, x1, y1, &image[0].coords);
     40      XY_to_RD (&ra1, &dec1, x1, y1, &image[0].image[0].coords);
    4141      dra = cos (dec*RAD_DEG) * fabs (ra1 - ra);
    4242    }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Center.c

    r13479 r15925  
    1616  if (image == NULL) return (TRUE);
    1717
    18   image[0].X = 0.5*image[0].matrix.Naxis[0] - X;
    19   image[0].Y = 0.5*image[0].matrix.Naxis[1] - Y;
     18  image[0].X = 0.5*image[0].image[0].matrix.Naxis[0] - X;
     19  image[0].Y = 0.5*image[0].image[0].matrix.Naxis[1] - Y;
    2020  if ((zoom != 0) && (zoom != -1)) {
    2121    image[0].expand = zoom;
     
    2323
    2424  if (USE_XWINDOW) {
    25     Remap (graphic, image, &image[0].matrix);
     25    Remap (graphic, image);
    2626    Refresh ();
    2727    XFlush (graphic[0].display);
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CheckButtons.c

    r13320 r15925  
    11# include "Ximage.h"
    2 # define PAD_X 10
    3 # define PAD_Y 10
    4 # define NPLANES 1
    5 # define NPIXELS 255
    62
    73/******** Here we test the Buttons specific to this program  *******/
     
    2117    button = &image[0].rainbow_button;
    2218
    23   if (InButton (event, &image[0].puns_button))
    24     button = &image[0].puns_button;
     19  if (InButton (event, &image[0].heat_button))
     20    button = &image[0].heat_button;
    2521
    2622  if (InButton (event, &image[0].PS_button))
     
    3935}
    4036
    41 
    4237/* To define a button, you must:
    4338
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CheckPipe.c

    r14590 r15925  
    268268  }
    269269
     270  if (!strcmp (word, "CHAN")) {
     271    status = SetChannel (sock);
     272    KiiSendCommand (sock, 4, "DONE");
     273    FINISHED (status);
     274  }
     275
    270276  if (!strcmp (word, "SAVE")) {
    271277    status = SaveOverlay (sock);
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CheckVisual.c

    r15906 r15925  
    11# include "Ximage.h"
    2 # define NPIXELS 64
    32
    43/* DirectColor doesn't seem to work, even though it is available:
     
    1110
    1211  int i, Nfound, N;
    13   int col, def, dyn;
     12  int isColor, isDefault, isDynamic;
    1413  XVisualInfo *visual_list, visual_temp;
    1514  unsigned long planes[3];
     
    2019    fprintf (stderr, "DirectColor: %d\n", DirectColor);
    2120    fprintf (stderr, "PseudoColor: %d\n", PseudoColor);
    22     fprintf (stderr, "TrueColor: %d\n", TrueColor);
    23     fprintf (stderr, "GrayScale: %d\n", GrayScale);
     21    fprintf (stderr, "TrueColor:   %d\n", TrueColor);
     22    fprintf (stderr, "GrayScale:   %d\n", GrayScale);
    2423    fprintf (stderr, "StaticColor: %d\n", StaticColor);
    25     fprintf (stderr, "StaticGray: %d\n", StaticGray);
     24    fprintf (stderr, "StaticGray:  %d\n", StaticGray);
    2625  }
    2726
     
    4241  }
    4342
    44   col = def = dyn = FALSE;
     43  // set these based on selected visual
     44  isColor = isDefault = isDynamic = FALSE;
     45
     46  // attempt to select the most desirable type of visual: Default as PseudoColor (XXX is it still true?)
    4547  if (DEBUG) fprintf (stderr, "default visual class is %d\n", visual_list[i].class);
    46   switch (visual_list[i].class) {
    47   case PseudoColor:
    48     col = def = dyn = TRUE;
     48  if (visual_list[i].class == PseudoColor) {
     49    isColor = isDefault = isDynamic = TRUE;
    4950    graphic[0].visual = visual_list[i].visual;
    5051    graphic[0].visualclass = TRUE;
    5152    goto test_pixels;
    52     break;
    53   default:
    54     break;
    5553  }
    5654
    57   for (i = 0; i < Nfound; i++) {
    58     switch (visual_list[i].class) {
    59     case PseudoColor:
    60       if (DEBUG) fprintf (stderr, "selected visual class is %d\n", visual_list[i].class);
    61       col = dyn = TRUE;
    62       if (graphic[0].visual == visual_list[i].visual) {
    63         def = TRUE;
    64       } else {
    65         graphic[0].visual = visual_list[i].visual;
    66       }
    67       graphic[0].visualclass = TRUE;
    68       goto test_pixels;
    69       break;
    70     default:
    71       break;
    72     }
     55  // attempt to select the most desirable type of visual: PseudoColor (XXX is it still true?)
     56  for (i = 0; (i < Nfound) && (visual_list[i].class != PseudoColor); i++);
     57  if (i != Nfound) {
     58    isColor = isDynamic = TRUE;
     59    if (DEBUG) fprintf (stderr, "selected visual class is %d\n", visual_list[i].class);
     60    isDefault = (graphic[0].visual == visual_list[i].visual);
     61    graphic[0].visual = visual_list[i].visual;
     62    graphic[0].visualclass = TRUE;
     63    goto test_pixels;
    7364  }
    7465
    75   for (i = 0; i < Nfound; i++) {
    76     switch (visual_list[i].class) {
    77     case GrayScale:
    78       if (DEBUG) fprintf (stderr, "selected visual class is %d\n", visual_list[i].class);
    79       dyn = TRUE;
    80       if (graphic[0].visual == visual_list[i].visual) {
    81         def = TRUE;
    82       } else {
    83         graphic[0].visual = visual_list[i].visual;
    84       }
    85       graphic[0].visualclass = TRUE;
    86       goto test_pixels;
    87       break;
    88     default:
    89       break;
    90     }
     66  // attempt to select the most desirable type of visual: GrayScale (XXX is it still true?)
     67  for (i = 0; (i < Nfound) && (visual_list[i].class != GrayScale); i++);
     68  if (i != Nfound) {
     69    isDynamic = TRUE;
     70    if (DEBUG) fprintf (stderr, "selected visual class is %d\n", visual_list[i].class);
     71    isDefault = (graphic[0].visual == visual_list[i].visual);
     72    graphic[0].visual = visual_list[i].visual;
     73    graphic[0].visualclass = TRUE;
     74    goto test_pixels;
    9175  }
    9276
     77  // attempt to select the most desirable type of visual: TrueColor (XXX is it still true?)
    9378  for (i = 0; (i < Nfound) && (visual_list[i].class != TrueColor); i++);
    9479  if (i != Nfound) {
    95     col = TRUE;
     80    isColor = TRUE;
    9681    if (DEBUG) fprintf (stderr, "visual class is %d\n", visual_list[i].class);
    97     if (graphic[0].visual == visual_list[i].visual) {
    98       def = TRUE;
    99     } else {
    100       graphic[0].visual = visual_list[i].visual;
    101     }
     82    isDefault = (graphic[0].visual == visual_list[i].visual);
     83    graphic[0].visual = visual_list[i].visual;
    10284    graphic[0].visualclass = FALSE;
    10385    goto test_pixels;
    10486  }
    10587
     88  // attempt to select the most desirable type of visual: TrueColor (XXX is it still true?)
    10689  for (i = 0; (i < Nfound) && (visual_list[i].class != StaticColor); i++);
    10790  if (i != Nfound) {
    10891    if (DEBUG) fprintf (stderr, "visual class is %d\n", visual_list[i].class);
    109     if (graphic[0].visual == visual_list[i].visual) {
    110       def = TRUE;
    111     } else {
    112       graphic[0].visual = visual_list[i].visual;
    113     }
     92    isDefault = (graphic[0].visual == visual_list[i].visual);
     93    graphic[0].visual = visual_list[i].visual;
    11494    graphic[0].visualclass = FALSE;
    11595    goto test_pixels;
    11696  }
    11797
     98  // attempt to select the most desirable type of visual: TrueColor (XXX is it still true?)
    11899  for (i = 0; (i < Nfound) && (visual_list[i].class != StaticGray); i++);
    119100  if (i != Nfound) {
    120101    if (DEBUG) fprintf (stderr, "visual class is %d\n", visual_list[i].class);
    121     if (graphic[0].visual == visual_list[i].visual) {
    122       def = TRUE;
    123     } else {
    124       graphic[0].visual = visual_list[i].visual;
    125     }
     102    isDefault = (graphic[0].visual == visual_list[i].visual);
     103    graphic[0].visual = visual_list[i].visual;
    126104    graphic[0].visualclass = FALSE;
    127105    goto test_pixels;
     
    136114  /* NEED TO ADD A COUPLE LINES DEFINING THE VARIOUS HARD COLORS (BLACK, WHITE, AND THE OVERLAYS) */
    137115
     116  // allow user to force a private colormap
    138117  if ((N = get_argument (*argc, argv, "-private"))) {
    139118    remove_argument(N, argc, argv);
    140     def = FALSE;
     119    isDefault = FALSE;
    141120  }
    142121
    143   if (!def) {
     122  // allocate a private colormap, if needed
     123  if (!isDefault) {
    144124    if (DEBUG) fprintf (stderr, "allocated private colormap\n");
    145125    graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone);
    146126  }
    147127
    148   if (dyn) {
    149     /* allocate color cells  */
    150     for (graphic[0].Npixels = NPIXELS;
    151          ((graphic[0].Npixels >= 16) &&
    152           !XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels));
    153          graphic[0].Npixels -= 4) {
     128  if (isDynamic) {
     129    /* allocate color cells */
     130    ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_DYNAMIC);
     131    ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_DYNAMIC);
     132    for (graphic[0].Npixels = NPIXELS_DYNAMIC; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) {
    154133      if (DEBUG) fprintf (stderr, "trying %d colors\n", (int) graphic[0].Npixels);
     134      if (XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels)) {
     135        break;
     136      }
    155137    }
    156138
     139    /* insufficient cells, can we make a private colormap? */
     140    if (graphic[0].Npixels < 16) {
     141      if (!isDefault) {
     142        fprintf (stderr, "can't allocate enough cells in private colormap\n");
     143        exit (0);
     144      }
     145      if (DEBUG) fprintf (stderr, "can't allocate enough cells, using private colormap\n");
     146      graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone);
    157147
    158     /* make private colormap  */
    159     if (graphic[0].Npixels < 16) {
    160       // fprintf (stderr, "can't allocate enough cells, using private colormap\n");
    161       graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone);
    162       for (graphic[0].Npixels = NPIXELS;
    163            ((graphic[0].Npixels >= 16) &&
    164             !XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels));
    165            graphic[0].Npixels -= 4);
     148      for (graphic[0].Npixels = NPIXELS_DYNAMIC; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) {
     149        if (DEBUG) fprintf (stderr, "trying %d colors\n", (int) graphic[0].Npixels);
     150        if (XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels)) {
     151          break;
     152        }
     153      }
    166154
    167155      if ((N = get_argument (*argc, argv, "-colorcount"))) {
    168         fprintf (stderr, "kii can grab %d colors\n", (int) graphic[0].Npixels);
     156        fprintf (stderr, "kapa can grab %d colors\n", graphic[0].Npixels);
    169157        exit (0);
    170158      }
     
    174162      }
    175163    }
    176   }
    177 
    178   if (!dyn) {
    179     graphic[0].Npixels = 1024;
    180     // fprintf (stderr, "can't use dynamic colors, color scrollbar inactive\n");
    181     // fprintf (stderr, " this can be avoided by using a dynamic visual class\n");
    182     // fprintf (stderr, " (see Kii help page for details)\n");
     164  } else {
     165    // XXX allocate the unsigned long *pixels here and above
     166    ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_STATIC);
     167    ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_STATIC);
     168    graphic[0].Npixels = NPIXELS_STATIC;
    183169  }
    184170
    185171  if ((N = get_argument (*argc, argv, "-colorcount"))) {
    186     fprintf (stderr, "kii can grab %d colors\n", (int) graphic[0].Npixels);
     172    fprintf (stderr, "kii can grab %d colors\n", graphic[0].Npixels);
    187173    exit (0);
    188174  }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CreateZoom16.c

    r13479 r15925  
    3131  dy = image[0].zoom.dy;
    3232
    33   if (image[0].matrix.size == 0) {  /* create a test pattern */
     33  if (image[0].image[0].matrix.size == 0) {  /* create a test pattern */
    3434    REALLOCATE (image[0].zoom.data, char, 2*dy*dx);
    3535    bzero (image[0].zoom.data, image[0].zoom.dx*image[0].zoom.dy);
     
    4848  // define the color transform parameters
    4949  MaxValue = graphic[0].Npixels - 1;
    50   if (image[0].range != 0.0) {
    51     slope = graphic[0].Npixels / image[0].range;
    52     start = graphic[0].Npixels * image[0].zero / image[0].range;
     50  if (image[0].image[0].range != 0.0) {
     51    slope = graphic[0].Npixels / image[0].image[0].range;
     52    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    5353  } else {
    5454    slope = 1.0;
    55     start = image[0].zero;
     55    start = image[0].image[0].zero;
    5656  }
    5757
     
    6161  expand_in  = 1;
    6262
    63   DX = image[0].matrix.Naxis[0];
    64   DY = image[0].matrix.Naxis[1];
     63  DX = image[0].image[0].matrix.Naxis[0];
     64  DY = image[0].image[0].matrix.Naxis[1];
    6565  Rx = x - expand*(int)(0.5*(dx + 1)) + 1;
    6666  Ry = y - expand*(int)(0.5*(dy + 1)) + 1;
     
    7474
    7575  data = out_pix = (unsigned char *) image[0].zoom.data;
    76   imdata  = (float *) image[0].matrix.buffer;
     76  imdata  = (float *) image[0].image[0].matrix.buffer;
    7777  in_pix  = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)];
    7878
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CreateZoom24.c

    r13479 r15925  
    3232  extra = 4 - (dx * 3) % 4;
    3333
    34   if (image[0].matrix.size == 0) {  /* create a test pattern */
     34  if (image[0].image[0].matrix.size == 0) {  /* create a test pattern */
    3535    REALLOCATE (image[0].zoom.data, char, dy*(3*dx+extra));
    3636    bzero (image[0].zoom.data, image[0].zoom.dx*image[0].zoom.dy);
     
    5252  // define the color transform parameters
    5353  MaxValue = graphic[0].Npixels - 1;
    54   if (image[0].range != 0.0) {
    55     slope = graphic[0].Npixels / image[0].range;
    56     start = graphic[0].Npixels * image[0].zero / image[0].range;
     54  if (image[0].image[0].range != 0.0) {
     55    slope = graphic[0].Npixels / image[0].image[0].range;
     56    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    5757  } else {
    5858    slope = 1.0;
    59     start = image[0].zero;
     59    start = image[0].image[0].zero;
    6060  }
    6161
     
    6565  expand_in  = 1;
    6666
    67   DX = image[0].matrix.Naxis[0];
    68   DY = image[0].matrix.Naxis[1];
     67  DX = image[0].image[0].matrix.Naxis[0];
     68  DY = image[0].image[0].matrix.Naxis[1];
    6969  Rx = x - expand*(int)(0.5*(dx + 1)) + 1;
    7070  Ry = y - expand*(int)(0.5*(dy + 1)) + 1;
     
    7878
    7979  data = out_pix = (unsigned char *) image[0].zoom.data;
    80   imdata  = (float *) image[0].matrix.buffer;
     80  imdata  = (float *) image[0].image[0].matrix.buffer;
    8181  in_pix  = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)];
    8282
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CreateZoom32.c

    r13479 r15925  
    2626  unsigned long back;
    2727
    28   if (image[0].matrix.size == 0) {  /* create a test pattern */
     28  if (image[0].image[0].matrix.size == 0) {  /* create a test pattern */
    2929    REALLOCATE (image[0].zoom.data, char, 4*image[0].zoom.dx*image[0].zoom.dy);
    3030    image[0].zoom.pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0,
     
    4040  // define the color transform parameters
    4141  MaxValue = graphic[0].Npixels - 1;
    42   if (image[0].range != 0.0) {
    43     slope = graphic[0].Npixels / image[0].range;
    44     start = graphic[0].Npixels * image[0].zero / image[0].range;
     42  if (image[0].image[0].range != 0.0) {
     43    slope = graphic[0].Npixels / image[0].image[0].range;
     44    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    4545  } else {
    4646    slope = 1.0;
    47     start = image[0].zero;
     47    start = image[0].image[0].zero;
    4848  }
    4949
     
    5555  dx = image[0].zoom.dx;
    5656  dy = image[0].zoom.dy;
    57   DX = image[0].matrix.Naxis[0];
    58   DY = image[0].matrix.Naxis[1];
     57  DX = image[0].image[0].matrix.Naxis[0];
     58  DY = image[0].image[0].matrix.Naxis[1];
    5959  Rx = x - expand*(int)(0.5*(dx + 1)) + 1;
    6060  Ry = y - expand*(int)(0.5*(dy + 1)) + 1;
     
    6868
    6969  out_pix = (unsigned int *) image[0].zoom.data;
    70   imdata  = (float *) image[0].matrix.buffer;
     70  imdata  = (float *) image[0].image[0].matrix.buffer;
    7171  in_pix  = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)];
    7272
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CreateZoom8.c

    r14590 r15925  
    2626  unsigned long back;
    2727
    28   if (image[0].matrix.size == 0) {  /* create a test pattern */
     28  if (image[0].image[0].matrix.size == 0) {  /* create a test pattern */
    2929    REALLOCATE (image[0].zoom.data, char, image[0].zoom.dx*image[0].zoom.dy);
    3030    bzero (image[0].zoom.data, image[0].zoom.dx*image[0].zoom.dy);
     
    4141  // define the color transform parameters
    4242  MaxValue = graphic[0].Npixels - 1;
    43   if (image[0].range != 0.0) {
    44     slope = graphic[0].Npixels / image[0].range;
    45     start = graphic[0].Npixels * image[0].zero / image[0].range;
     43  if (image[0].image[0].range != 0.0) {
     44    slope = graphic[0].Npixels / image[0].image[0].range;
     45    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    4646  } else {
    4747    slope = 1.0;
    48     start = image[0].zero;
     48    start = image[0].image[0].zero;
    4949  }
    5050
     
    5656  dx = image[0].zoom.dx;
    5757  dy = image[0].zoom.dy;
    58   DX = image[0].matrix.Naxis[0];
    59   DY = image[0].matrix.Naxis[1];
     58  DX = image[0].image[0].matrix.Naxis[0];
     59  DY = image[0].image[0].matrix.Naxis[1];
    6060  Rx = x - expand*(int)(0.5*(dx + 1)) + 1;
    6161  Ry = y - expand*(int)(0.5*(dy + 1)) + 1;
     
    6969
    7070  out_pix = (unsigned char *) image[0].zoom.data;
    71   imdata  = (float *) image[0].matrix.buffer;
     71  imdata  = (float *) image[0].image[0].matrix.buffer;
    7272  in_pix  = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)];
    7373
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/CursorOps.c

    r13320 r15925  
    1313  }
    1414 
    15   *x1 = expand*(x2 - image[0].picture.x - 0.5*image[0].picture.dx) + 0.5*image[0].matrix.Naxis[0] - image[0].X;
    16   *y1 = expand*(y2 - image[0].picture.y - 0.5*image[0].picture.dy) + 0.5*image[0].matrix.Naxis[1] - image[0].Y;
     15  *x1 = expand*(x2 - image[0].picture.x - 0.5*image[0].picture.dx) + 0.5*image[0].image[0].matrix.Naxis[0] - image[0].X;
     16  *y1 = expand*(y2 - image[0].picture.y - 0.5*image[0].picture.dy) + 0.5*image[0].image[0].matrix.Naxis[1] - image[0].Y;
    1717 
    1818}
     
    3131  }
    3232 
    33   *x1 = (x2 - 0.5*image[0].matrix.Naxis[0] + image[0].X) * expand + image[0].picture.x + 0.5*image[0].picture.dx;
    34   *y1 = (y2 - 0.5*image[0].matrix.Naxis[1] + image[0].Y) * expand + image[0].picture.y + 0.5*image[0].picture.dy;
     33  *x1 = (x2 - 0.5*image[0].image[0].matrix.Naxis[0] + image[0].X) * expand + image[0].picture.x + 0.5*image[0].picture.dx;
     34  *y1 = (y2 - 0.5*image[0].image[0].matrix.Naxis[1] + image[0].Y) * expand + image[0].picture.y + 0.5*image[0].picture.dy;
    3535 
    3636}
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/DragColorbar.c

    r13320 r15925  
    1515  Y = mouse_event[0].y;
    1616  Npix = graphic[0].Npixels;
    17   slope = image[0].slope;
    18   start = image[0].start;
     17  slope = image[0].image[0].slope;
     18  start = image[0].image[0].start;
    1919  oldfrac_x = oldfrac_y = 10;
    2020 
     
    6363      case ButtonPress:
    6464      case ButtonRelease:
    65         image[0].start = start;
    66         image[0].slope = slope;
     65        image[0].image[0].start = start;       
     66        image[0].image[0].slope = slope;
    6767        return;
    6868        break;
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Image.c

    r13479 r15925  
    22# include "buttons.h"
    33
     4int InitImageChannel (KapaImageChannel *channel) {
     5
     6  /** set up a bunch of default things **/
     7  channel->zero = 0;
     8  channel->range = 1;
     9  channel->start = 0;
     10  channel->slope = 1;
     11
     12  channel->coords.Npolyterms = 0;
     13  channel->matrix.size = 0; /* a flag to show there is no data in the matrix */
     14  ALLOCATE (channel->matrix.buffer, char, 1);  /* allocate so later free will not crash! */
     15
     16  return (TRUE);
     17}
     18
    419/* initialization for things not specific to X */
    5 KapaImageWidget *InitImage () {
     20KapaImageWidget *InitImageWidget () {
    621
    722  int i;
     
    1429  memset (image, 0, sizeof(KapaImageWidget));
    1530
    16   /** set up a bunch of default things **/
    17   image[0].X = image[0].Y = 0;
    18   image[0].expand = 1;
    19   image[0].zero = 0;
    20   image[0].range = 1;
    21   image[0].start = 0;
    22   image[0].slope = 1;
    23   image[0].location = 4;
     31  for (i = 0; i < NCHANNELS; i++) {
     32    InitImageChannel (&image[0].channel[i]);
     33  }
     34  image[0].image = &image[0].channel[0];
    2435
    25   image[0].coords.Npolyterms = 0;
    2636  for (i = 0; i < NOVERLAYS; i++) {
    2737    image[0].overlay[i].Nobjects = 0;
     
    3040    image[0].overlay[i].color = graphic[0].overlay_color[i];
    3141  }
    32   image[0].matrix.size = 0; /* a flag to show there is no data in the matrix */
     42
     43  image[0].X = 0.0;
     44  image[0].Y = 0.0;
     45  image[0].expand = 1;
     46  image[0].location = 4;
    3347
    3448  image[0].MovePointer = TRUE;
    3549  image[0].DecimalDegrees  = TRUE;
    36   ALLOCATE (image[0].matrix.buffer, char, 1);  /* allocate so later free will not crash! */
    3750  ALLOCATE (image[0].picture.data, char, 1);   /* allocate so later free will not crash! */
    3851  ALLOCATE (image[0].cmapbar.data, char, 1);   /* allocate so later free will not crash! */
     
    4861  InitButtonFunc (&image[0].rainbow_button, rainbow);
    4962
    50   InitButtonSize (&image[0].puns_button, puns_width, puns_height, puns_bits);
    51   InitButtonFunc (&image[0].puns_button, puns);
     63  InitButtonSize (&image[0].heat_button, heat_width, heat_height, heat_bits);
     64  InitButtonFunc (&image[0].heat_button, heat);
    5265
    5366  InitButtonSize (&image[0].recenter_button, recenter_width, recenter_height, recenter_bits);
     
    131144    DrawButton (graphic, &image[0].grey_button);
    132145    DrawButton (graphic, &image[0].rainbow_button);
    133     DrawButton (graphic, &image[0].puns_button);
     146    DrawButton (graphic, &image[0].heat_button);
    134147    DrawButton (graphic, &image[0].hms_button);
    135148
     
    152165    free (image[0].overlay[i].objects);
    153166  }
    154   free (image[0].matrix.buffer);
     167  free (image[0].image[0].matrix.buffer);
    155168  free (image[0].picture.data);
    156169  free (image[0].cmapbar.data);
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/InterpretKeys.c

    r15906 r15925  
    6161      if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor;
    6262      Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image);
    63       XY_to_RD (&R, &D, X, Y, &image[0].coords);
     63      XY_to_RD (&R, &D, X, Y, &image[0].image[0].coords);
    6464
    65       DX = image[0].matrix.Naxis[0];
    66       DY = image[0].matrix.Naxis[1];
     65      DX = image[0].image[0].matrix.Naxis[0];
     66      DY = image[0].image[0].matrix.Naxis[1];
    6767
    6868      if (X < 0) goto off_image;
     
    7070      if (X >= DX) goto off_image;
    7171      if (Y >= DY) goto off_image;
    72       imdata = (float *) image[0].matrix.buffer;
     72      imdata = (float *) image[0].image[0].matrix.buffer;
    7373      Z      = imdata[DX*(int)(Y) + (int)(X)];
    7474    }
     
    8989  switch (keysym) {
    9090
     91    case XK_F1:
     92      image[0].image = &image[0].channel[0];
     93      Reorient (graphic, image, image[0].X, image[0].Y, 0);
     94      break;
     95
     96    case XK_F2:
     97      image[0].image = &image[0].channel[1];
     98      Reorient (graphic, image, image[0].X, image[0].Y, 0);
     99      break;
     100
     101    case XK_F3:
     102      image[0].image = &image[0].channel[2];
     103      Reorient (graphic, image, image[0].X, image[0].Y, 0);
     104      break;
     105
    91106    case XK_KP_Home:
    92107    case XK_Home:
     
    103118    case XK_Return:
    104119      Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image);
    105       X = 0.5*image[0].matrix.Naxis[0] - X;
    106       Y = 0.5*image[0].matrix.Naxis[1] - Y;
     120      X = 0.5*image[0].image[0].matrix.Naxis[0] - X;
     121      Y = 0.5*image[0].image[0].matrix.Naxis[1] - Y;
    107122      Reorient (graphic, image, X, Y, 0);
    108123      break;
     
    133148
    134149    case XK_KP_Add:
    135       image[0].zero += 0.1*image[0].range;
     150      image[0].image[0].zero += 0.1*image[0].image[0].range;
    136151      Reorient (graphic, image, image[0].X, image[0].Y, 0);
    137152      break;
    138153    case XK_KP_Subtract:
    139       image[0].zero -= 0.1*image[0].range;
     154      image[0].image[0].zero -= 0.1*image[0].image[0].range;
    140155      Reorient (graphic, image, image[0].X, image[0].Y, 0);
    141156      break;
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/InterpretPresses.c

    r14590 r15925  
    3636      Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image);
    3737
    38       XY_to_RD (&R, &D, X, Y, &image[0].coords);
     38      XY_to_RD (&R, &D, X, Y, &image[0].image[0].coords);
    3939
    40       DX = image[0].matrix.Naxis[0];
    41       DY = image[0].matrix.Naxis[1];
     40      DX = image[0].image[0].matrix.Naxis[0];
     41      DY = image[0].image[0].matrix.Naxis[1];
    4242
    4343      if (X < 0) goto off_image;
     
    4545      if (X >= DX) goto off_image;
    4646      if (Y >= DY) goto off_image;
    47       imdata = (float *) image[0].matrix.buffer;
     47      imdata = (float *) image[0].image[0].matrix.buffer;
    4848      Z      = imdata[DX*(int)(Y) + (int)(X)];
    4949    }
     
    102102
    103103  Screen_to_Image (&X, &Y, (double)mouse_event[0].x, (double)mouse_event[0].y, image);
    104   X = 0.5*image[0].matrix.Naxis[0] - X;
    105   Y = 0.5*image[0].matrix.Naxis[1] - Y;
     104  X = 0.5*image[0].image[0].matrix.Naxis[0] - X;
     105  Y = 0.5*image[0].image[0].matrix.Naxis[1] - Y;
    106106
    107107  switch (mouse_event[0].button) {
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/JPEGit24.c

    r14590 r15925  
    8484  // define the color transform parameters
    8585  MaxValue = graphic[0].Npixels - 1;
    86   if (image[0].range != 0.0) {
    87     slope = graphic[0].Npixels / image[0].range;
    88     start = graphic[0].Npixels * image[0].zero / image[0].range;
     86  if (image[0].image[0].range != 0.0) {
     87    slope = graphic[0].Npixels / image[0].image[0].range;
     88    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    8989  } else {
    9090    slope = 1.0;
    91     start = image[0].zero;
     91    start = image[0].image[0].zero;
    9292  }
    9393
     
    108108  dx = image[0].picture.dx;
    109109  dy = image[0].picture.dy;
    110   DX = image[0].matrix.Naxis[0];
    111   DY = image[0].matrix.Naxis[1];
     110  DX = image[0].image[0].matrix.Naxis[0];
     111  DY = image[0].image[0].matrix.Naxis[1];
    112112
    113113  /* X,Y are the image coordinates of the first image pixel */
     
    145145  ALLOCATE (line_buffer, JSAMPLE, 3*dx);
    146146
    147   imdata = (float *) image[0].matrix.buffer;
     147  imdata = (float *) image[0].image[0].matrix.buffer;
    148148  in_pix_ref = &imdata[DX*(int)MAX(Y,0) + (int)MAX(X,0)];
    149149
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/LoadOverlay.c

    r15620 r15925  
    1414  section = GetActiveSection();
    1515  if (section->image == NULL) {
    16     section->image = InitImage ();
     16    section->image = InitImageWidget ();
    1717    SetSectionSizes (section);
    1818  }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/LoadPicture.c

    r15589 r15925  
    1313  section = GetActiveSection();
    1414  if (section->image == NULL) {
    15     section->image = InitImage ();
     15    section->image = InitImageWidget ();
    1616    SetSectionSizes (section);
    1717  }
     
    2424  KiiScanMessage (sock, "%d %d %d %d %lf %lf", &header.Naxis[0], &header.Naxis[1]);
    2525  KiiScanMessage (sock, "%d %d %d %d %lf %lf", &header.bitpix, &header.unsign, &header.bzero, &header.bscale);
    26   KiiScanMessage (sock, "%lf %lf %s %s",  &image[0].zero, &image[0].range, image[0].name, image[0].file);
    27   KiiScanMessage (sock, "%lf %lf %d", &image[0].min,  &image[0].max, &header.size);
    28   KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].coords.crval1, &image[0].coords.crpix1, &image[0].coords.cdelt1, &image[0].coords.pc1_1, &image[0].coords.pc1_2);
    29   KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].coords.crval2, &image[0].coords.crpix2, &image[0].coords.cdelt2, &image[0].coords.pc2_1, &image[0].coords.pc2_2);
    30   KiiScanMessage (sock, "%s", image[0].coords.ctype);
     26  KiiScanMessage (sock, "%lf %lf %s %s",  &image[0].image[0].zero, &image[0].image[0].range, image[0].image[0].name, image[0].image[0].file);
     27  KiiScanMessage (sock, "%lf %lf %d", &image[0].image[0].min,  &image[0].image[0].max, &header.size);
     28  KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].image[0].coords.crval1, &image[0].image[0].coords.crpix1, &image[0].image[0].coords.cdelt1, &image[0].image[0].coords.pc1_1, &image[0].image[0].coords.pc1_2);
     29  KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].image[0].coords.crval2, &image[0].image[0].coords.crpix2, &image[0].image[0].coords.cdelt2, &image[0].image[0].coords.pc2_1, &image[0].image[0].coords.pc2_2);
     30  KiiScanMessage (sock, "%s", image[0].image[0].coords.ctype);
    3131
    32   gfits_free_matrix (&image[0].matrix);
    33   gfits_create_matrix (&header, &image[0].matrix);
     32  gfits_free_matrix (&image[0].image[0].matrix);
     33  gfits_create_matrix (&header, &image[0].image[0].matrix);
    3434
    3535  fcntl (sock, F_SETFL, O_NONBLOCK); 
    3636
    3737  status = 1;
    38   buff = image[0].matrix.buffer;
     38  buff = image[0].image[0].matrix.buffer;
    3939  bytes_left = header.size;
    40   image[0].matrix.size = 0;
     40  image[0].image[0].matrix.size = 0;
    4141  while (bytes_left > 0) {
    4242    status = read (sock, buff, bytes_left);
     
    4646    }
    4747    if (status != -1) { /* pipe has data */
    48       image[0].matrix.size += status;
     48      image[0].image[0].matrix.size += status;
    4949      bytes_left -= status;
    5050      buff = (char *)(buff + status);
     
    5454  fcntl (sock, F_SETFL, !O_NONBLOCK); 
    5555
    56   if (DEBUG) fprintf (stderr, "read %d bytes\n", image[0].matrix.size);
     56  if (DEBUG) fprintf (stderr, "read %d bytes\n", image[0].image[0].matrix.size);
    5757  /* it it not obvious this condition should kill kii, but ... */
    58   if (image[0].matrix.size != header.size) { 
    59     fprintf (stderr, "error: expected %d bytes, but got only %d\n", header.size, image[0].matrix.size);
     58  if (image[0].image[0].matrix.size != header.size) { 
     59    fprintf (stderr, "error: expected %d bytes, but got only %d\n", header.size, image[0].image[0].matrix.size);
    6060    return (FALSE);
    6161  }
     
    6363  if (!USE_XWINDOW) return (TRUE);
    6464
    65   Remap (graphic, image, &image[0].matrix);
     65  Remap (graphic, image);
    6666  if (DEBUG) fprintf (stderr, "remapped image\n");
    6767  Refresh ();
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/LoadTickmarks.c

    r13479 r15925  
    1111  section = GetActiveSection();
    1212  if (section->image == NULL) {
    13     section->image = InitImage ();
     13    section->image = InitImageWidget ();
    1414    SetSectionSizes (section);
    1515  }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/MakeColormap.c

    r13320 r15925  
    11# include "Ximage.h"
    2 # define NPIXELS 64
    32
    43static char default_cmap[] = "grayscale";
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/PSPixmap.c

    r13331 r15925  
    1313  /* start at the last line, print lines in decending order */
    1414  buff = (unsigned char *)image[0].picture.data + image[0].picture.dx*(image[0].picture.dy - 1);
    15   slope = image[0].slope;
    16   start = image[0].start;
     15  slope = image[0].image[0].slope;
     16  start = image[0].image[0].start;
    1717  back  = graphic[0].back;
    1818
     
    4646  /* start at the last line, print lines in decending order */
    4747  buff = (unsigned short *)image[0].picture.data + image[0].picture.dx*(image[0].picture.dy - 1);
    48   slope = image[0].slope;
    49   start = image[0].start;
     48  slope = image[0].image[0].slope;
     49  start = image[0].image[0].start;
    5050  back  = graphic[0].back;
    5151
     
    8383  /* start at the last line, print lines in decending order */
    8484  buff = (unsigned char *)&image[0].picture.data[(dy - 1)*(3*dx + extra)];
    85   slope = image[0].slope;
    86   start = image[0].start;
     85  slope = image[0].image[0].slope;
     86  start = image[0].image[0].start;
    8787  back  = graphic[0].back;
    8888
     
    123123  /* start at the last line, print lines in decending order */
    124124  buff = (unsigned int *)image[0].picture.data + image[0].picture.dx*(image[0].picture.dy - 1);
    125   slope = image[0].slope;
    126   start = image[0].start;
     125  slope = image[0].image[0].slope;
     126  start = image[0].image[0].start;
    127127  back  = graphic[0].back;
    128128
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Remap.c

    r13320 r15925  
    11# include "Ximage.h"
    22
    3 void Remap (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) {
     3void Remap (Graphic *graphic, KapaImageWidget *image) {
    44
    55  switch (graphic[0].Nbits) {
    66  case 8:
    7     Remap8 (graphic, image, matrix);
     7    Remap8  (graphic, image, &image->image->matrix);
    88    break;
    99  case 16:
    10     Remap16 (graphic, image, matrix);
     10    Remap16 (graphic, image, &image->image->matrix);
    1111    break;
    1212  case 24:
    13     Remap24 (graphic, image, matrix);
     13    Remap24 (graphic, image, &image->image->matrix);
    1414    break;
    1515  case 32:
    16     Remap32 (graphic, image, matrix);
     16    Remap32 (graphic, image, &image->image->matrix);
    1717    break;
    1818  }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Remap16.c

    r13479 r15925  
    3838  // define the color transform parameters
    3939  MaxValue = graphic[0].Npixels - 1;
    40   if (image[0].range != 0.0) {
    41     slope = graphic[0].Npixels / image[0].range;
    42     start = graphic[0].Npixels * image[0].zero / image[0].range;
     40  if (image[0].image[0].range != 0.0) {
     41    slope = graphic[0].Npixels / image[0].image[0].range;
     42    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    4343  } else {
    4444    slope = 1.0;
    45     start = image[0].zero;
     45    start = image[0].image[0].zero;
    4646  }
    4747
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Remap24.c

    r13479 r15925  
    4040  // define the color transform parameters
    4141  MaxValue = graphic[0].Npixels - 1;
    42   if (image[0].range != 0.0) {
    43     slope = graphic[0].Npixels / image[0].range;
    44     start = graphic[0].Npixels * image[0].zero / image[0].range;
     42  if (image[0].image[0].range != 0.0) {
     43    slope = graphic[0].Npixels / image[0].image[0].range;
     44    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    4545  } else {
    4646    slope = 1.0;
    47     start = image[0].zero;
     47    start = image[0].image[0].zero;
    4848  }
    4949
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Remap32.c

    r15906 r15925  
    3939  // define the color transform parameters
    4040  MaxValue = graphic[0].Npixels - 1;
    41   if (image[0].range != 0.0) {
    42     slope = graphic[0].Npixels / image[0].range;
    43     start = graphic[0].Npixels * image[0].zero / image[0].range;
     41  if (image[0].image[0].range != 0.0) {
     42    slope = graphic[0].Npixels / image[0].image[0].range;
     43    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    4444  } else {
    4545    slope = 1.0;
    46     start = image[0].zero;
     46    start = image[0].image[0].zero;
    4747  }
    4848
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Remap8.c

    r13479 r15925  
    3333  // define the color transform parameters
    3434  MaxValue = graphic[0].Npixels - 1;
    35   if (image[0].range != 0.0) {
    36     slope = graphic[0].Npixels / image[0].range;
    37     start = graphic[0].Npixels * image[0].zero / image[0].range;
     35  if (image[0].image[0].range != 0.0) {
     36    slope = graphic[0].Npixels / image[0].image[0].range;
     37    start = graphic[0].Npixels * image[0].image[0].zero / image[0].image[0].range;
    3838  } else {
    3939    slope = 1.0;
    40     start = image[0].zero;
     40    start = image[0].image[0].zero;
    4141  }
    4242
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/Reorient.c

    r13320 r15925  
    3838  }
    3939
    40   Remap (graphic, image, &image[0].matrix);
     40  Remap (graphic, image);
    4141  Refresh ();
    4242 
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/SetColormap.c

    r15906 r15925  
    11# include "Ximage.h"
    22
    3 /*** this function uses only private colormaps.  it should try the standard colormap
    4      first to get better control over the smooth greyscales ***/
    5 
    6 /** red,green,blue are values in range 0x0000 to 0xffff **/
     3# define SETVALUE(VAR,VALUE,MINVAL,MAXVAL) { \
     4  float tmp = (VALUE); \
     5  if (tmp < MINVAL) { \
     6    VAR = MINVAL; \
     7  } else if (tmp > MAXVAL) { \
     8    VAR = MAXVAL; \
     9  } else { \
     10    VAR = tmp; \
     11  } }   
    712
    813int SetColormap (char *name) {
    914
    10   int i;
    11   float scale;
     15  int i, ref1, ref2;
     16  float scale, blueRef, redRef, greenRef;
    1217  Graphic *graphic;
    1318
    1419  graphic = GetGraphic();
    1520
     21  // red,green,blue are values in range 0x0000 to 0xffff
     22  scale = 0xffff / (graphic[0].Npixels - 1);
     23
    1624  /* greyscale */
    17   if ((!strcmp (name, "grayscale")) || (!strcmp (name, "greyscale"))) {
    18 
    19     scale = 0xffff / graphic[0].Npixels;
    20 
     25  if ((!strcasecmp (name, "grayscale")) || (!strcasecmp (name, "greyscale"))) {
    2126    for (i = 0; i < graphic[0].Npixels; i++) { 
    22       graphic[0].cmap[i].red   = 0xffff - i*scale;
    23       graphic[0].cmap[i].green = 0xffff - i*scale;
    24       graphic[0].cmap[i].blue  = 0xffff - i*scale;
     27      SETVALUE (graphic[0].cmap[i].red,   0xffff - i*scale, 0, 0xffff);
     28      SETVALUE (graphic[0].cmap[i].green, 0xffff - i*scale, 0, 0xffff);
     29      SETVALUE (graphic[0].cmap[i].blue,  0xffff - i*scale, 0, 0xffff);
    2530      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    2631    }
     
    2833  }
    2934  /* -grayscale */
    30   if ((!strcmp (name, "-grayscale")) || (!strcmp (name, "-greyscale"))) {
     35  if ((!strcasecmp (name, "-grayscale")) || (!strcasecmp (name, "-greyscale"))) {
    3136    for (i = 0; i < graphic[0].Npixels; i++) { 
    32       graphic[0].cmap[i].red = 256*(255*i/graphic[0].Npixels);
    33       graphic[0].cmap[i].green = 256*(255*i/graphic[0].Npixels);
    34       graphic[0].cmap[i].blue = 256*(255*i/graphic[0].Npixels);
     37      SETVALUE (graphic[0].cmap[i].red,   i*scale, 0, 0xffff);
     38      SETVALUE (graphic[0].cmap[i].green, i*scale, 0, 0xffff);
     39      SETVALUE (graphic[0].cmap[i].blue,  i*scale, 0, 0xffff);
    3540      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    3641    }
     
    3843  }
    3944  /* heat */
    40   if (!strcmp (name, "Puns")) {
     45  if (!strcasecmp (name, "Heat")) {
     46    greenRef = 0.25*graphic[0].Npixels*scale*2.0;
     47    blueRef  = 0.50*graphic[0].Npixels*scale*2.0;
    4148    for (i = 0; i < (int)(0.25*graphic[0].Npixels); i++) { 
     49      SETVALUE (graphic[0].cmap[i].red,   2*i*scale, 0, 0xffff);
    4250      graphic[0].cmap[i].green = 0;
    43       graphic[0].cmap[i].blue = 0;
    44       graphic[0].cmap[i].red = MIN (256*255, 256*255*2*i/(1.0*graphic[0].Npixels)); 
     51      graphic[0].cmap[i].blue  = 0;
    4552      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    4653    }
    47     for (i = (int)(0.25*graphic[0].Npixels); i < (int)(0.50*graphic[0].Npixels); i++) { 
    48       graphic[0].cmap[i].red = MIN (256*255, 256*255*2*i/(1.0*graphic[0].Npixels));
    49       graphic[0].cmap[i].green = MIN (256*255, 256*255*2*(i/(1.0*graphic[0].Npixels) - 0.25));
     54    for (i = 0.25*graphic[0].Npixels; i < 0.50*graphic[0].Npixels; i++) { 
     55      SETVALUE (graphic[0].cmap[i].red,   2*i*scale,            0, 0xffff);
     56      SETVALUE (graphic[0].cmap[i].green, 2*i*scale - greenRef, 0, 0xffff);
    5057      graphic[0].cmap[i].blue = 0;
    5158      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    5259    }
    5360    for (i = (int)(0.50*graphic[0].Npixels); i < (int)(0.75*graphic[0].Npixels); i++) { 
    54       graphic[0].cmap[i].red = 256*255;
    55       graphic[0].cmap[i].green = MIN (256*255, 256*255*2*(i/(1.0*graphic[0].Npixels) - 0.25));
    56       graphic[0].cmap[i].blue = MIN (256*255, 256*255*2*(i/(1.0*graphic[0].Npixels) - 0.50));
     61      graphic[0].cmap[i].red = 0xffff;
     62      SETVALUE (graphic[0].cmap[i].green, 2*i*scale - greenRef, 0, 0xffff);
     63      SETVALUE (graphic[0].cmap[i].blue,  2*i*scale - blueRef,  0, 0xffff);
    5764      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    5865    }
    5966    for (i = (int)(0.75*graphic[0].Npixels); i < graphic[0].Npixels; i++) { 
    60       graphic[0].cmap[i].red = 256*255;
    61       graphic[0].cmap[i].green = 256*255;
    62       graphic[0].cmap[i].blue = MIN (256*255, 256*255*2*(i/(1.0*graphic[0].Npixels) - 0.50));
     67      graphic[0].cmap[i].red   = 0xffff;
     68      graphic[0].cmap[i].green = 0xffff;
     69      SETVALUE (graphic[0].cmap[i].blue,  2*i*scale - blueRef,  0, 0xffff);
    6370      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    6471    }
     
    6673  }
    6774  /* rainbow */
    68   if (!strcmp (name, "Rainbow")) {
     75  if (!strcasecmp (name, "Rainbow")) {
     76    redRef   = 0.25*graphic[0].Npixels*scale*4.0;
     77    greenRef = 0.50*graphic[0].Npixels*scale*4.0;
     78    blueRef  = 0.50*graphic[0].Npixels*scale*4.0;
    6979    for (i = 0; i < (int)(0.25*graphic[0].Npixels); i++) { 
    70       graphic[0].cmap[i].red = 0;
     80      graphic[0].cmap[i].red   = 0;
    7181      graphic[0].cmap[i].green = 0;
    72       graphic[0].cmap[i].blue = 256*(255*4*(i/(1.0*graphic[0].Npixels))); 
     82      SETVALUE (graphic[0].cmap[i].blue,  4*i*scale,           0, 0xffff);
    7383      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    7484    }
    7585    for (i = (int)(0.25*graphic[0].Npixels); i < (int)(0.50*graphic[0].Npixels); i++) { 
    76       graphic[0].cmap[i].red = 256*(255*4*((i/(1.0*graphic[0].Npixels)) - 0.25));
     86      SETVALUE (graphic[0].cmap[i].red,   4*i*scale - redRef,  0, 0xffff);
    7787      graphic[0].cmap[i].green = 0;
    78       graphic[0].cmap[i].blue = 256*(255*4*(0.50 - (i/(1.0*graphic[0].Npixels))));
     88      SETVALUE (graphic[0].cmap[i].blue,  blueRef - 4*i*scale, 0, 0xffff);
    7989      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    8090    }
    8191    for (i = (int)(0.50*graphic[0].Npixels); i < (int)(0.75*graphic[0].Npixels); i++) { 
    82       graphic[0].cmap[i].red = 256*255;
    83       graphic[0].cmap[i].green = 256*(255*4*((i/(1.0*graphic[0].Npixels)) - 0.50));
     92      graphic[0].cmap[i].red  = 0xffff;
     93      SETVALUE (graphic[0].cmap[i].green,  4*i*scale - greenRef, 0, 0xffff);
    8494      graphic[0].cmap[i].blue = 0;
    8595      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    8696    }
     97    blueRef  = 0.75*graphic[0].Npixels*scale*4.0;
    8798    for (i = (int)(0.75*graphic[0].Npixels); i < graphic[0].Npixels; i++) { 
    88       graphic[0].cmap[i].red = 256*255;
    89       graphic[0].cmap[i].green = 256*255;
    90       graphic[0].cmap[i].blue = 256*(255*4*((i/(1.0*graphic[0].Npixels)) - 0.75));
     99      graphic[0].cmap[i].red   = 0xffff;
     100      graphic[0].cmap[i].green = 0xffff;
     101      SETVALUE (graphic[0].cmap[i].blue,  4*i*scale - blueRef, 0, 0xffff);
    91102      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    92103    }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/SetImageData.c

    r14590 r15925  
    1111  section = GetActiveSection();
    1212  if (section->image == NULL) {
    13     section->image = InitImage ();
     13    section->image = InitImageWidget ();
    1414    SetSectionSizes (section);
    1515  }
     
    1818  // get image data from client
    1919  KiiScanMessage (sock, "%lf %lf %s",
    20                   &image[0].zero,
    21                   &image[0].range,
    22                   image[0].name,
    23                   image[0].file);
     20                  &image[0].image[0].zero,
     21                  &image[0].image[0].range,
     22                  image[0].image[0].name,
     23                  image[0].image[0].file);
    2424
    2525  // XXX when we go to 32bit, this should remap the image
     
    3737  section = GetActiveSection();
    3838  if (section->image == NULL) {
    39     section->image = InitImage ();
     39    section->image = InitImageWidget ();
    4040    SetSectionSizes (section);
    4141  }
     
    4343
    4444  KiiSendMessage (sock, "%g %g %s %s",
    45                   image[0].zero,
    46                   image[0].range,
    47                   image[0].name,
    48                   image[0].file);
     45                  image[0].image[0].zero,
     46                  image[0].image[0].range,
     47                  image[0].image[0].name,
     48                  image[0].image[0].file);
    4949
    5050  return (TRUE);
     
    6161  section = GetActiveSection();
    6262  if (section->image == NULL) {
    63     section->image = InitImage ();
     63    section->image = InitImageWidget ();
    6464    SetSectionSizes (section);
    6565  }
     
    6767 
    6868  KiiScanMessage (sock, "%f %f %f %f",
    69                   &image[0].coords.pc1_1, &image[0].coords.pc2_2,
    70                   &image[0].coords.pc1_2, &image[0].coords.pc2_1);
     69                  &image[0].image[0].coords.pc1_1, &image[0].image[0].coords.pc2_2,
     70                  &image[0].image[0].coords.pc1_2, &image[0].image[0].coords.pc2_1);
    7171
    72   KiiScanMessage (sock, "%s", image[0].coords.ctype);
     72  KiiScanMessage (sock, "%s", image[0].image[0].coords.ctype);
    7373
    7474  KiiScanMessage (sock, "%lf %lf %f %f %f %f",
    75                   &image[0].coords.crval1,
    76                   &image[0].coords.crval2,
    77                   &image[0].coords.crpix1,
    78                   &image[0].coords.crpix2,
    79                   &image[0].coords.cdelt1,
    80                   &image[0].coords.cdelt2);
     75                  &image[0].image[0].coords.crval1,
     76                  &image[0].image[0].coords.crval2,
     77                  &image[0].image[0].coords.crpix1,
     78                  &image[0].image[0].coords.crpix2,
     79                  &image[0].image[0].coords.cdelt1,
     80                  &image[0].image[0].coords.cdelt2);
    8181
    8282  return (TRUE); 
     
    9090  section = GetActiveSection();
    9191  if (section->image == NULL) {
    92     section->image = InitImage ();
     92    section->image = InitImageWidget ();
    9393    SetSectionSizes (section);
    9494  }
     
    9696
    9797  KiiSendMessage (sock, "%g %g %g %g",
    98                   image[0].coords.pc1_1, image[0].coords.pc2_2,
    99                   image[0].coords.pc1_2, image[0].coords.pc2_1);
     98                  image[0].image[0].coords.pc1_1, image[0].image[0].coords.pc2_2,
     99                  image[0].image[0].coords.pc1_2, image[0].image[0].coords.pc2_1);
    100100
    101   KiiSendMessage (sock, "%s", image[0].coords.ctype);
     101  KiiSendMessage (sock, "%s", image[0].image[0].coords.ctype);
    102102
    103103  KiiSendMessage (sock, "%g %g %g %g %g %g",
    104                   image[0].coords.crval1,
    105                   image[0].coords.crval2,
    106                   image[0].coords.crpix1,
    107                   image[0].coords.crpix2,
    108                   image[0].coords.cdelt1,
    109                   image[0].coords.cdelt2);
     104                  image[0].image[0].coords.crval1,
     105                  image[0].image[0].coords.crval2,
     106                  image[0].image[0].coords.crpix1,
     107                  image[0].image[0].coords.crpix2,
     108                  image[0].image[0].coords.cdelt1,
     109                  image[0].image[0].coords.cdelt2);
    110110
    111111  return (TRUE);
     
    120120  section = GetActiveSection();
    121121  if (section->image == NULL) {
    122     section->image = InitImage ();
     122    section->image = InitImageWidget ();
    123123    SetSectionSizes (section);
    124124  }
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/SetImageSize.c

    r14590 r15925  
    4040      }
    4141      if (USE_XWINDOW) CreatePicture (image, graphic);
    42       Remap (graphic, image, &image[0].matrix);
     42      Remap (graphic, image);
    4343      return;
    4444
     
    104104      image[0].rainbow_button.y = image[0].PS_button.y;
    105105
    106       image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
    107       image[0].puns_button.y = image[0].PS_button.y;
    108 
    109       image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1;
     106      image[0].heat_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
     107      image[0].heat_button.y = image[0].PS_button.y;
     108
     109      image[0].recenter_button.x = image[0].heat_button.x + image[0].heat_button.dx + PAD1;
    110110      image[0].recenter_button.y = image[0].PS_button.y;
    111111      break;
     
    172172      image[0].rainbow_button.y = image[0].PS_button.y;
    173173
    174       image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
    175       image[0].puns_button.y = image[0].PS_button.y;
    176 
    177       image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1;
     174      image[0].heat_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
     175      image[0].heat_button.y = image[0].PS_button.y;
     176
     177      image[0].recenter_button.x = image[0].heat_button.x + image[0].heat_button.dx + PAD1;
    178178      image[0].recenter_button.y = image[0].PS_button.y;
    179179      break;
     
    238238      image[0].rainbow_button.y = image[0].PS_button.y;
    239239
    240       image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
    241       image[0].puns_button.y = image[0].PS_button.y;
    242 
    243       image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1;
     240      image[0].heat_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
     241      image[0].heat_button.y = image[0].PS_button.y;
     242
     243      image[0].recenter_button.x = image[0].heat_button.x + image[0].heat_button.dx + PAD1;
    244244      image[0].recenter_button.y = image[0].PS_button.y;
    245245      break;
     
    304304      image[0].rainbow_button.y = image[0].PS_button.y;
    305305
    306       image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
    307       image[0].puns_button.y = image[0].PS_button.y;
    308 
    309       image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1;
     306      image[0].heat_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1;
     307      image[0].heat_button.y = image[0].PS_button.y;
     308
     309      image[0].recenter_button.x = image[0].heat_button.x + image[0].heat_button.dx + PAD1;
    310310      image[0].recenter_button.y = image[0].PS_button.y;
    311311      break;
     
    321321    CreateZoom (image, graphic, 0, 0);
    322322  }
    323   Remap (graphic, image, &image[0].matrix);
     323  Remap (graphic, image);
    324324
    325325  return;
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/SetToolbox.c

    r13479 r15925  
    1717  section = GetActiveSection();
    1818  if (section->image == NULL) {
    19     section->image = InitImage ();
     19    section->image = InitImageWidget ();
    2020  }
    2121  section->image->location = location;
     
    2424  if (!USE_XWINDOW) return;
    2525
    26   Remap (graphic, section->image, &section->image->matrix);
     26  Remap (graphic, section->image);
    2727  if (DEBUG) fprintf (stderr, "remapped image\n");
    2828  Refresh ();
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/StatusBox.c

    r13320 r15925  
    66
    77  if (image[0].MovePointer) {
    8     x = 0.5*image[0].matrix.Naxis[0];
    9     y = 0.5*image[0].matrix.Naxis[1];
     8    x = 0.5*image[0].image[0].matrix.Naxis[0];
     9    y = 0.5*image[0].image[0].matrix.Naxis[1];
    1010    z = -1;
    1111    image[0].x = x;
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/UpdatePointer.c

    r13479 r15925  
    1919  if (image[0].MovePointer && InPicture ((XButtonEvent *)event, &image[0].picture)) {
    2020
    21     data = (float *) image[0].matrix.buffer;
     21    data = (float *) image[0].image[0].matrix.buffer;
    2222    Screen_to_Image (&x, &y, (double)event[0].x, (double)event[0].y, image);
    2323
    2424    z = -1;
    2525    if (x < 0) goto skip;
    26     if (x >= image[0].matrix.Naxis[0]) goto skip;
     26    if (x >= image[0].image[0].matrix.Naxis[0]) goto skip;
    2727    if (y < 0) goto skip;
    28     if (y >= image[0].matrix.Naxis[1]) goto skip;
    29     z = data[(int)(y)*image[0].matrix.Naxis[0] + (int)(x)];
     28    if (y >= image[0].image[0].matrix.Naxis[1]) goto skip;
     29    z = data[(int)(y)*image[0].image[0].matrix.Naxis[0] + (int)(x)];
    3030
    3131  skip:
     
    4747 
    4848  if (InPicture ((XButtonEvent *)event, &image[0].cmapbar)) {
    49     z = image[0].zero  + image[0].range * (event[0].x - image[0].cmapbar.x) / image[0].cmapbar.dx;
     49    z = image[0].image[0].zero  + image[0].image[0].range * (event[0].x - image[0].cmapbar.x) / image[0].cmapbar.dx;
    5050    textpad = graphic[0].font[0].ascent;
    5151    XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);
  • branches/eam_branch_20071222/Ohana/src/kapa2/src/UpdateStatusBox.c

    r14498 r15925  
    77  char line[100];
    88
    9   XY_to_RD (&ra, &dec, x, y, &image[0].coords);
     9  XY_to_RD (&ra, &dec, x, y, &image[0].image[0].coords);
    1010
    1111  textpad = graphic[0].font[0].ascent;
     
    2626   
    2727    bzero (line, 100);
    28     sprintf (line, "%-25s", image[0].file);
     28    sprintf (line, "%-25s", image[0].image[0].file);
    2929    XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc,
    3030                 image[0].text_x + PAD1, image[0].text_y + 5*textpad + 5*PAD1, line, strlen(line));
    3131   
    3232    bzero (line, 100);
    33     sprintf (line, "(%s)                                          ", image[0].name);
     33    sprintf (line, "(%s)                                          ", image[0].image[0].name);
    3434    XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc,
    3535                 image[0].text_x + PAD1, image[0].text_y + 6*textpad + 6*PAD1, line, 25);
Note: See TracChangeset for help on using the changeset viewer.