IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5700


Ignore:
Timestamp:
Dec 5, 2005, 3:55:45 PM (21 years ago)
Author:
eugene
Message:

adding no-X version of JPEG, other features

Location:
trunk/Ohana/src/kii
Files:
8 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kii/Makefile

    r5242 r5700  
    5050$(ODIR)/EraseOverlay.$(ARCH).o            $(ODIR)/PaintOverlay.$(ARCH).o       \
    5151$(ODIR)/LoadOverlay.$(ARCH).o             $(ODIR)/SaveOverlay.$(ARCH).o        \
    52 $(ODIR)/DrawOverlay.$(ARCH).o             $(ODIR)/CSaveOverlay.$(ARCH).o        \
    53 $(ODIR)/PaintTickmarks.$(ARCH).o          $(ODIR)/LoadTickmarks.$(ARCH).o
     52$(ODIR)/DrawOverlay.$(ARCH).o             $(ODIR)/CSaveOverlay.$(ARCH).o       \
     53$(ODIR)/PaintTickmarks.$(ARCH).o          $(ODIR)/LoadTickmarks.$(ARCH).o      \
     54$(ODIR)/bDrawColormap.$(ARCH).o           $(ODIR)/bDrawOverlay.$(ARCH).o       \
     55$(ODIR)/bDrawFuncs.$(ARCH).o              $(ODIR)/bDrawRotFont.$(ARCH).o       \
     56$(ODIR)/RotFont.$(ARCH).o
     57
    5458
    5559POBJ = \
     
    5761$(PDIR)/NewPicture.$(ARCH).o              $(PDIR)/Center.$(ARCH).o             \
    5862$(PDIR)/PositionPictures.$(ARCH).o        $(PDIR)/StatusBox.$(ARCH).o          \
    59 $(PDIR)/cursor.$(ARCH).o                                                        \
    6063$(PDIR)/CursorOps.$(ARCH).o               $(PDIR)/Resize.$(ARCH).o              \
    6164$(PDIR)/Remap8.$(ARCH).o                  $(PDIR)/Remap24.$(ARCH).o             \
    6265$(PDIR)/Remap.$(ARCH).o                   $(PDIR)/Remap32.$(ARCH).o             \
    63 $(PDIR)/Remap16.$(ARCH).o
     66$(PDIR)/Remap16.$(ARCH).o                 $(PDIR)/JPEGit24.$(ARCH).o            \
     67$(PDIR)/cursor.$(ARCH).o
    6468
    6569SOBJ = \
     
    7579$(SDIR)/LoadFont.$(ARCH).o                $(SDIR)/TopWindow.$(ARCH).o          \
    7680$(SDIR)/MakeColormap.$(ARCH).o            $(SDIR)/Ximage.$(ARCH).o             \
    77 $(SDIR)/MakeCursor.$(ARCH).o              $(SDIR)/CheckVisual.$(ARCH).o
     81$(SDIR)/MakeCursor.$(ARCH).o              $(SDIR)/CheckVisual.$(ARCH).o        \
     82$(SDIR)/args.$(ARCH).o
    7883
    7984ZOBJ = \
  • trunk/Ohana/src/kii/button/ButtonFunctions.c

    r2466 r5700  
    1212  Remap (graphic, layout, &layout[0].matrix);
    1313  CreateZoom (layout, graphic, 0, 0);
     14  Refresh (graphic, layout, 0);
     15  XFlush (graphic[0].display);
    1416  return (TRUE);
    1517}
     
    2224  Remap (graphic, layout, &layout[0].matrix);
    2325  CreateZoom (layout, graphic, 0, 0);
     26  Refresh (graphic, layout, 0);
     27  XFlush (graphic[0].display);
    2428  return (TRUE);
    2529}
     
    3236  Remap (graphic, layout, &layout[0].matrix);
    3337  CreateZoom (layout, graphic, 0, 0);
     38  Refresh (graphic, layout, 0);
     39  XFlush (graphic[0].display);
    3440  return (TRUE);
    3541}
  • trunk/Ohana/src/kii/button/PSit.c

    r2466 r5700  
    2727  }
    2828 
     29  if (!USE_XWINDOW) {
     30    fprintf (stderr, "PS not working yet\n");
     31    return (TRUE);
     32  }
     33
    2934  scale = MIN ((500.0/(double)layout[0].picture.dx), (700.0/(double)layout[0].picture.dy));
    3035  if (!Raw) {
     
    6368
    6469  /******** First we draw the picture itself ********/
     70  /* in !USE_XWINDOW, we'll have to change this to use the JPEG function */
    6571  switch (graphic[0].Nbits) {
    6672  case 8:
     
    107113}
    108114
     115void ConvertPixmap (Layout *layout, File *f) {
     116 
     117  /* set up expansions */
     118  expand = expand_in = expand_out = 1.0;
     119  if (layout[0].expand == 0)
     120    layout[0].expand = 1;
     121  if (layout[0].expand > 0) {
     122    expand = 1 / (1.0*layout[0].expand);
     123    expand_out = layout[0].expand;
     124    expand_in  = 1;
     125  }
     126  if (layout[0].expand < 0) {
     127    expand = fabs((double)layout[0].expand);
     128    expand_out = 1;
     129    expand_in  = -layout[0].expand;
     130  }
     131
     132  dx = layout[0].picture.dx;
     133  dy = layout[0].picture.dy;
     134  DX = layout[0].matrix.Naxis[0];
     135  DY = layout[0].matrix.Naxis[1];
     136
     137  /* X,Y are the image coordinates of the first image pixel */
     138  X = MAX(0.5*(DX - dx*expand) - layout[0].X, 0);
     139  if ((int)X != X)
     140    X = (int) X + 1;
     141  else
     142    X = (int) X;
     143  Y = MAX(0.5*(DY - dy*expand) - layout[0].Y, 0);
     144  if ((int)Y != Y)
     145    Y = (int) Y + 1;
     146  else
     147    Y = (int) Y;
     148
     149  /* Rx,Ry are the screen coordinates of the first image pixel */
     150  Rx = (X + layout[0].X - 0.5*DX)/expand + 0.5*dx;
     151  Ry = (Y + layout[0].Y - 0.5*DY)/expand + 0.5*dy;
     152
     153  i_start = MIN (MAX (Rx, 0), dx - expand_out + 1);
     154  j_start = MIN (MAX (Ry, 0), dy - expand_out + 1);
     155 
     156  if (layout[0].expand > 0) {
     157    i_end = MAX (MIN (i_start + ((int)(expand*(dx-i_start)))/expand, expand_out*(DX-X) + Rx), 0);
     158    j_end = MAX (MIN (j_start + ((int)(expand*(dy-j_start)))/expand, expand_out*(DY-Y) + Ry), 0);
     159  } else {
     160    i_end = MAX (MIN (dx, (DX-X)/expand + Rx), 0);
     161    j_end = MAX (MIN (dy, (DY-Y)/expand + Ry), 0);
     162  }   
     163
     164  dropback = expand_out - (i_end - i_start) % expand_out;
     165  if ((i_end - i_start) % expand_out == 0) dropback = 0;
     166
     167  /* output line buffer */
     168  ALLOCATE (line_buffer, char, dx);
     169
     170  in_pix_ref  = (unsigned char *) (layout[0].matrix.buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0);
     171
     172  /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/
     173
     174  Nchar = 255.0;
     175  Npix = layout[0].Npixels;
     176  frac = Nchar / Npix;
     177
     178  /**** fill in bottom area ****/
     179  out_pix = line_buffer;
     180  for (i = 0; i < dx; i++, out_pix++) {
     181    *out_pix = WHITE;
     182  }
     183  for (j = 0; j < j_start; j++) {
     184    for (i = 0; i < dx; i++) {
     185      fprintf (f, "%02x", val);
     186      if ((Npt % 40) == 0) {
     187        fprintf (f, "\n");
     188      }
     189    }
     190  }
     191 
     192  /*** fill in the image data region ***/
     193  for (j = j_start; j < j_end; j+= expand_out, in_pix_ref += expand_in*DX) {
     194   
     195    /* create one output image line */
     196    in_pix = in_pix_ref;
     197    out_pix = line_buffer;
     198
     199    /**** fill in area to the left of the picture ****/
     200    for (i = 0; i < i_start; i++, out_pix+=3) {
     201      *out_pix = WHITE;
     202    }
     203   
     204    /*** fill in the picture region ***/
     205    for (i = i_start; i < i_end; i+=expand_out, in_pix+=expand_in) {
     206      for (ii = 0; ii < expand_out; ii++, out_pix++) {
     207        *out_pix = *in_pix*frac;
     208      }
     209    }
     210   
     211    /**** fill in area to the right of the picture ****/
     212    for (i = i_end; i < dx; i++, out_pix++) {
     213      *out_pix = WHITE;
     214    }
     215
     216    /* write out the image line expand_out times */
     217    for (j = 0; j < expand_out; j++) {
     218      for (i = 0; i < dx; i++) {
     219        fprintf (f, "%02x", val);
     220        if ((Npt % 40) == 0) {
     221          fprintf (f, "\n");
     222        }
     223      }
     224    }
     225  }
     226
     227  /**** fill in top area ****/
     228  out_pix = line_buffer;
     229  for (i = 0; i < dx; i++, out_pix++) {
     230    *out_pix = WHITE;
     231  }
     232  for (j = j_end; j < dy; j++) {
     233    for (i = 0; i < dx; i++) {
     234      fprintf (f, "%02x", val);
     235      if ((Npt % 40) == 0) {
     236        fprintf (f, "\n");
     237      }
     238    }
     239  }
     240}
     241
    109242void ConvertPixmap8 (Layout *layout, FILE *f) {
    110243
  • trunk/Ohana/src/kii/colorbar/SetColormap.c

    r2466 r5700  
    11# include "Ximage.h"
     2
     3/*** this function uses only private colormaps.  it should try the standard colormap
     4     first to get better control over the smooth greyscales ***/
    25
    36int SetColormap (Graphic *graphic, Layout *layout, char *name) {
     
    710  /* greyscale */
    811  if ((!strcmp (name, "grayscale")) || (!strcmp (name, "greyscale"))) {
     12    fprintf (stderr, "setting greyscale : %d\n", layout[0].Npixels);
    913    for (i = 0; i < layout[0].Npixels; i++) { 
    1014      layout[0].cmap[i].red = 256*(255 - 255*i/layout[0].Npixels);
     
    8488
    8589 store_colors:
     90  if (!USE_XWINDOW) return (TRUE);
    8691  if (graphic[0].visualclass) {
     92    fprintf (stderr, "storing colors\n");
    8793    XStoreColors(graphic[0].display, graphic[0].colormap, layout[0].cmap, layout[0].Npixels);
    8894  } else {
    8995    for (i = 0; i < layout[0].Npixels; i++) {
     96      fprintf (stderr, "%04x %04x %04x  ->  ", layout[0].cmap[i].red, layout[0].cmap[i].green, layout[0].cmap[i].blue);
    9097      if (XAllocColor (graphic[0].display, graphic[0].colormap, &layout[0].cmap[i]) == 0) {
    9198        fprintf (stderr, "error on %d\n", i);
    9299      }
     100      fprintf (stderr, "%04x %04x %04x\n", layout[0].cmap[i].red, layout[0].cmap[i].green, layout[0].cmap[i].blue);
    93101    }
    94102  }
  • trunk/Ohana/src/kii/event/CheckPipe.c

    r5637 r5700  
    8989
    9090  if (!strcmp (buffer, "PSIT")) {
     91    /** this one needs work : ConvertPixmapN fails for !USE_XWINDOW */
    9192    status = PSit (graphic, layout, 0);
    9293    write (layout[0].Ximage, "DONE", 4);
     
    9596
    9697  if (!strcmp (buffer, "PSRW")) {
     98    /** this one needs work : ConvertPixmapN fails for !USE_XWINDOW */
    9799    status = PSit (graphic, layout, 1);
    98100    write (layout[0].Ximage, "DONE", 4);
  • trunk/Ohana/src/kii/include/constants.h

    r3695 r5700  
    2525int DECIMAL_DEG;
    2626int DEBUG;
     27int USE_XWINDOW;
     28int MAP_WINDOW;
    2729
    2830# define EVENT_MASK (long) \
  • trunk/Ohana/src/kii/include/structures.h

    r2466 r5700  
    124124} Layout;
    125125
     126typedef struct {
     127  int dx, dy, ascent;
     128  unsigned char *bits;
     129} RotFont;
     130
     131typedef struct {
     132  RotFont *font;
     133  char name[64];
     134  int size;
     135} FontSet;
    126136
    127137/* this routine is independent of the number of overlays */
  • trunk/Ohana/src/kii/overlay/EraseOverlay.c

    r2906 r5700  
    2424  }
    2525
     26  if (USE_XWINDOW) Refresh (graphic, layout, 0);
     27
    2628  fcntl (layout[0].Ximage, F_SETFL, O_NONBLOCK); 
    27   Refresh (graphic, layout, 0);
    2829  return (TRUE);
    2930}
  • trunk/Ohana/src/kii/overlay/LoadOverlay.c

    r2466 r5700  
    8888  OVERLAY[N] = TRUE;
    8989  /*  Refresh (graphic, layout, 0); */
    90   for (i = 0; i < NOVERLAYS; i++) {
    91     if (OVERLAY[i])
    92       PaintOverlay (graphic, layout, i);
     90  if (USE_XWINDOW) {
     91    for (i = 0; i < NOVERLAYS; i++) {
     92      if (OVERLAY[i])
     93        PaintOverlay (graphic, layout, i);
     94    }
     95    PaintTickmarks (graphic, layout);
     96    XFlush (graphic[0].display);
    9397  }
    94   PaintTickmarks (graphic, layout);
    95   XFlush (graphic[0].display);
    9698  fcntl (layout[0].Ximage, F_SETFL, O_NONBLOCK); 
    9799  return (TRUE);
  • trunk/Ohana/src/kii/overlay/LoadTickmarks.c

    r2466 r5700  
    5555  layout[0].tickmarks.Nobjects = Nobjects;
    5656
    57   Refresh (graphic, layout, 0);
     57  if (USE_XWINDOW) Refresh (graphic, layout, 0);
     58
    5859  fcntl (layout[0].Ximage, F_SETFL, O_NONBLOCK); 
    5960  return (TRUE);
  • trunk/Ohana/src/kii/picture/Center.c

    r2906 r5700  
    2121  }
    2222
    23   Remap (graphic, layout, &layout[0].matrix);
    24   Refresh (graphic, layout, 0);
     23  if (USE_XWINDOW) {
     24    Remap (graphic, layout, &layout[0].matrix);
     25    Refresh (graphic, layout, 0);
     26    XFlush (graphic[0].display);
     27  }
    2528
    2629  fcntl (layout[0].Ximage, F_SETFL, O_NONBLOCK); 
    27   XFlush (graphic[0].display);
    2830  return (TRUE);
    2931}
  • trunk/Ohana/src/kii/picture/JPEGit24.c

    r5637 r5700  
    11# include "Ximage.h"
    22# include "jpeglib.h"
    3 
    4 void JPEGit24 (Graphic *graphic, Layout *layout) {
     3# include <png.h>
     4# include "bDraw.h"
     5
     6# define WHITE_R 255
     7# define WHITE_G 255
     8# define WHITE_B 255
     9
     10int JPEGit24 (Graphic *graphic, Layout *layout) {
    511
    612  struct jpeg_compress_struct cinfo;
     
    814  JSAMPROW row_pointer[1];      /* pointer to JSAMPLE row[s] */
    915  JSAMPLE *image_buffer;        /* Points to data for current line */
    10 
    11   int i, j, ii, jj;
     16  JSAMPLE *line_buffer;         /* Points to data for current line */
     17
     18  int ii, i, j;
    1219  int i_start, i_end, j_start, j_end;
    1320  int dropback, extra;  /* this is a bit of a kludge... */
    1421  int dx, dy, DX, DY;
     22  int status, Nbytes, quality;
     23  int expand_in, expand_out;
    1524  double expand, Rx, Ry, X, Y;
    16   int expand_in, expand_out;
    17   unsigned char *out_pix, *out_pix2, *data;
    18   unsigned char *in_pix,  *in_pix2;
     25  unsigned char *out_pix, *in_pix, *in_pix_ref;
    1926  unsigned char pixel1[256], pixel2[256], pixel3[256];
    20   unsigned char pixvalue1, pixvalue2, pixvalue3;
    21   unsigned long white;
    22   unsigned char white1, white2, white3;
     27  char filename[1024];
    2328  FILE *f;
    2429
     
    3641  f = fopen (filename, "w");
    3742  if (f == (FILE *) NULL) {
    38     fprintf (stderr, "failed to open %s for output\n", filename);
     43    fprintf (stderr, "Kii: failed to open %s for output\n", filename);
    3944    return (TRUE);
    4045  }
     
    5560  jpeg_start_compress (&cinfo, TRUE);
    5661
    57   /* output line buffer */
    58   ALLOCATE (image_buffer, JSAMPLE, 3*layout[0].picture.dx);
    59 
    6062  /** cmap[i].pixel must be defined even if X is not used **/
    6163  for (i = 0; i < 256; i++) { /* set up pixel array */
    62     pixel1[i] = 0x0000ff & (layout[0].cmap[i].pixel >> 0);
    63     pixel2[i] = 0x0000ff & (layout[0].cmap[i].pixel >> 8);
    64     pixel3[i] = 0x0000ff & (layout[0].cmap[i].pixel >> 16);
    65   }
    66   white = layout[0].white;
    67   white1 = 0x0000ff & (white >> 0);
    68   white2 = 0x0000ff & (white >> 8);
    69   white3 = 0x0000ff & (white >> 16);
     64    pixel1[i] = layout[0].cmap[i].red >> 8;
     65    pixel2[i] = layout[0].cmap[i].green >> 8;
     66    pixel3[i] = layout[0].cmap[i].blue >> 8;
     67  }
    7068
    7169  expand = expand_in = expand_out = 1.0;
     
    8583  dx = layout[0].picture.dx;
    8684  dy = layout[0].picture.dy;
    87   DX = layout[0].matrix[0].Naxis[0];
    88   DY = layout[0].matrix[0].Naxis[1];
    89   extra = 4 - (dx * 3) % 4;  /* why is this needed?? */
     85  DX = layout[0].matrix.Naxis[0];
     86  DY = layout[0].matrix.Naxis[1];
    9087
    9188  /* X,Y are the image coordinates of the first image pixel */
     
    119116  if ((i_end - i_start) % expand_out == 0) dropback = 0;
    120117
    121   out_pix = image_buffer;
    122   in_pix  = (unsigned char *) (layout[0].matrix[0].buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0);
     118  /* output line buffer */
     119  ALLOCATE (image_buffer, JSAMPLE, 3*dx*dy);
     120  ALLOCATE (line_buffer, JSAMPLE, 3*dx);
     121
     122  in_pix_ref  = (unsigned char *) (layout[0].matrix.buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0);
    123123
    124124  /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/
    125125
    126   /* we write the jpeg image data one row at a time */
    127 
    128126  /**** fill in bottom area ****/
    129   out_pix = image_buffer;
     127  out_pix = line_buffer;
    130128  for (i = 0; i < dx; i++, out_pix+=3) {
    131129    out_pix[0] = WHITE_R;
     
    134132  }
    135133  for (j = 0; j < j_start; j++) {
    136     row_pointer[0] = image_buffer;
    137     (void) jpeg_write_scanlines (&cinfo, row_pointer, 1);
     134    memcpy (&image_buffer[j*3*dx], line_buffer, 3*dx);
    138135  }
    139136 
    140137  /*** fill in the image data region ***/
    141   for (j = j_start; j < j_end; j+= expand_out, in_pix += expand_in*DX) {
     138  for (j = j_start; j < j_end; j+= expand_out, in_pix_ref += expand_in*DX) {
    142139   
    143140    /* create one output image line */
    144     out_pix = image_buffer;
     141    in_pix = in_pix_ref;
     142    out_pix = line_buffer;
    145143
    146144    /**** fill in area to the left of the picture ****/
     
    152150   
    153151    /*** fill in the picture region ***/
    154     for (i = i_start; i < i_end; i++, in_pix+=expand_in, out_pix+=3) {
    155       out_pix[0] = pixel1[*in_pix];
    156       out_pix[1] = pixel2[*in_pix];
    157       out_pix[2] = pixel3[*in_pix];
     152    for (i = i_start; i < i_end; i+=expand_out, in_pix+=expand_in) {
     153      for (ii = 0; ii < expand_out; ii++, out_pix+=3) {
     154        out_pix[0] = pixel1[*in_pix];
     155        out_pix[1] = pixel2[*in_pix];
     156        out_pix[2] = pixel3[*in_pix];
     157      }
    158158    }
    159159   
     
    167167    /* write out the image line expand_out times */
    168168    for (i = 0; i < expand_out; i++) {
    169       row_pointer[0] = image_buffer;
    170       (void) jpeg_write_scanlines (&cinfo, row_pointer, 1);
     169      memcpy (&image_buffer[(j + i)*3*dx], line_buffer, 3*dx);
    171170    }
    172171  }
    173172
    174173  /**** fill in top area ****/
    175   out_pix = image_buffer;
     174  out_pix = line_buffer;
    176175  for (i = 0; i < dx; i++, out_pix+=3) {
    177176    out_pix[0] = WHITE_R;
     
    179178    out_pix[2] = WHITE_B;
    180179  }
    181   for (j = 0; j < (dy - j_end); j++) {
    182     row_pointer[0] = image_buffer;
     180  for (j = j_end; j < dy; j++) {
     181    memcpy (&image_buffer[j*3*dx], line_buffer, 3*dx);
     182  }
     183
     184
     185  /* I need to write the overlay objects on the jpeg image.
     186     if i can write / overwrite data in jpeg buffer, then do it here,
     187     otherwise i need to create a temporary image buffer, then write the
     188     scanlines to that buffer */
     189
     190  {
     191    int Npalette;
     192    png_color *palette;
     193    bDrawColor white, color;
     194    bDrawBuffer *buffer;
     195
     196    palette = MakePNGPalette (&Npalette);
     197
     198    buffer = bDrawBufferCreate (dx, dy);
     199    bDrawSetBuffer (buffer);
     200    for (i = 0; i < NOVERLAYS; i++) {
     201      if (OVERLAY[i]) bDrawOverlay (layout, i);
     202    }
     203
     204    white = GetColorByName ("white");
     205    for (j = 0; j < dy; j++) {
     206      for (i = 0; i < dx; i++) {
     207        color = buffer[0].pixels[j][i];
     208        if (color == white) continue;
     209        image_buffer[j*3*dx + 3*i + 0] = palette[color].red;
     210        image_buffer[j*3*dx + 3*i + 1] = palette[color].green;
     211        image_buffer[j*3*dx + 3*i + 2] = palette[color].blue;
     212      }
     213    }
     214    bDrawBufferFree (buffer);
     215  }
     216
     217  for (i = 0; i < dy; i++) {
     218    row_pointer[0] = &image_buffer[i*3*dx];
    183219    (void) jpeg_write_scanlines (&cinfo, row_pointer, 1);
    184220  }
     
    190226  return (TRUE);
    191227}
    192 
  • trunk/Ohana/src/kii/picture/NewPicture.c

    r2466 r5700  
    6666  }
    6767
     68  if (!USE_XWINDOW) return (TRUE);
     69
    6870  Remap (graphic, layout, &layout[0].matrix);
    6971  (DEBUG) && fprintf (stderr, "remapped image\n");
    7072  Refresh (graphic, layout, 0);
    71  
    7273  (DEBUG) && fprintf (stderr, "refreshed\n");
    7374  XFlush (graphic[0].display);
  • trunk/Ohana/src/kii/picture/Resize.c

    r2466 r5700  
    2424    return (TRUE);
    2525
    26   /*  graphic[0].dx = MAX(NX,  MIN_WIDTH);
    27   graphic[0].dy = MAX(NY, MIN_HEIGHT); */
    2826  graphic[0].dx = MAX(NX, 50);
    2927  graphic[0].dy = MAX(NY, 50);
    3028
    31   XResizeWindow (graphic[0].display, graphic[0].window, NX, NY);
     29  if (USE_XWINDOW) XResizeWindow (graphic[0].display, graphic[0].window, NX, NY);
    3230
    3331  PositionPictures (layout, graphic);
    34   CreateColorbar (layout, graphic);
    35   CreatePicture (layout, graphic);
    36   Remap (graphic, layout, &layout[0].matrix);
    3732
    38   XClearWindow (graphic[0].display, graphic[0].window);
    39   Refresh (graphic, layout, 1);
     33  if (USE_XWINDOW) {
     34    CreateColorbar (layout, graphic);
     35    CreatePicture (layout, graphic);
     36    Remap (graphic, layout, &layout[0].matrix);
     37    XClearWindow (graphic[0].display, graphic[0].window);
     38    Refresh (graphic, layout, 1);
     39  }
    4040
    4141  return (TRUE);
  • trunk/Ohana/src/kii/setup/CheckVisual.c

    r2890 r5700  
    11# include "Ximage.h"
    22# define NPIXELS 64
    3 # define DEBUG 0
     3# define DEBUG 1
    44
    55/* DirectColor doesn't seem to work, even though it is available:
     
    143143
    144144  if (!def) {
     145    if (DEBUG) fprintf (stderr, "allocated private colormap\n");
    145146    graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone);
    146147  }
  • trunk/Ohana/src/kii/setup/DefineLayout.c

    r5637 r5700  
    11# include "Ximage.h"
     2
     3static char default_colormap[] = "grayscale";
    24
    35void DefineLayout (Layout *layout, Graphic *graphic, int argc, char **argv) {
     
    57  int i, status, N;
    68  struct sockaddr_un Address;
    7   char temp[100];
     9  char temp[100], *temp_name;
    810
    911  /** initiate connection with mana **/
     
    2931 
    3032  /* get the display colors */
    31   MakeColormap (graphic, layout, argc, argv);
     33  if (USE_XWINDOW) {
     34    MakeColormap (graphic, layout, argc, argv);
     35  } else {
     36    temp_name = default_colormap;
     37    if ((N = get_argument (argc, argv, "-cm"))) {
     38      remove_argument (N, &argc, argv);
     39      temp_name = argv[N];
     40    }
     41    layout[0].Npixels = 256;
     42    SetColormap (graphic, layout, temp_name);
     43  }
    3244
    3345  /** set up a bunch of default things **/
     
    5163  ALLOCATE (layout[0].zoom.data, char, 1);      /* allocate so later free will not crash! */
    5264
    53   CreatePicture (layout, graphic);
    54   CreateColorbar (layout, graphic);
    55   CreateZoom (layout, graphic, 0, 0);
     65  if (USE_XWINDOW) {
     66    CreatePicture (layout, graphic);
     67    CreateColorbar (layout, graphic);
     68    CreateZoom (layout, graphic, 0, 0);
     69  }
    5670}
    5771
  • trunk/Ohana/src/kii/setup/SetUpWindow.c

    r2466 r5700  
    2323  NameWindow (graphic, "Ki'i");
    2424
    25   if ((N = get_argument (*argc, argv, "-nomap"))) {
    26     remove_argument(N, argc, argv);
    27   } else {
    28     MapWindow (graphic);
    29   } 
     25  if (MAP_WINDOW) MapWindow (graphic);
    3026}
    3127
  • trunk/Ohana/src/kii/setup/Ximage.c

    r5637 r5700  
    1212
    1313  if (USE_XWINDOW) SetUpDisplay (&graphic, &argc, argv);
    14   if (USE_XWINDOW) SetUpWindow (&graphic, &argc, argv);
     14  if (USE_XWINDOW) {
     15    SetUpWindow (&graphic, &argc, argv);
     16  } else {
     17    graphic.x = 10;
     18    graphic.y = 10;
     19    graphic.dx = 512 + 2*PAD1 + PAD1 + ZOOM_X;
     20    graphic.dy = 512 + 2*PAD1 + PAD2 + COLORPAD;
     21  }
    1522
    1623  DefineLayout (&layout, &graphic, argc, argv);
Note: See TracChangeset for help on using the changeset viewer.