IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5611


Ignore:
Timestamp:
Nov 27, 2005, 9:22:01 PM (21 years ago)
Author:
eugene
Message:

fixed up RotFont stuff

Location:
trunk/Ohana/src/kapa
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa/graph/DrawObjects.c

    r4769 r5611  
    2727int DrawObjectN (Layout *layout, Gobjects *object) {
    2828 
    29   static unsigned char dash[2] = {5,10};
    30   static unsigned char dot[2] = {3,3};
     29  static char dash[2] = {5,10};
     30  static char dot[2] = {3,3};
    3131  int lweight;
    3232 
  • trunk/Ohana/src/kapa/graph/DrawRotString.c

    r5610 r5611  
    11# include "Ximage.h"
    2 # include "alphabet.h"
    3 
     2
     3# define NROTCHARS 256
    44# define XPROC(x,y) (scale*(cs*((x) - x0) - sn*((y) - y0)) + X0)
    55# define YPROC(x,y) (scale*(cs*((y) - y0) + sn*((x) - x0)) + Y0)
     
    88int DrawRotText (int x, int y, char *string, int pos, double angle) {
    99
    10   char *c, *bitmap, basefont[64];
     10  unsigned char *bitmap;
     11  char *currentname, basename[64], *c;
    1112  int i, dy, dx, N, X, Y, code;
    12   int dX, Xoff, dY, Yoff, YoffBase, basesize;
    13   double cs, sn;
     13  int dX, Xoff, dY, Yoff, YoffBase;
     14  int currentsize, basesize;
     15  double cs, sn, currentscale;
     16  RotFont *currentfont;
     17
     18  currentname = GetRotFont (&currentsize);
     19  currentfont = GetRotFontData (&currentscale);
     20  strcpy (basename, currentname);
     21  basesize = currentsize;
    1422
    1523  /* strip leading whitespace */
     
    2129  sn = sin(angle*RAD_DEG);
    2230  dX = RotStrlen (c);
    23   dY = activefont[65].ascent;
     31  dY = currentfont[65].ascent;
    2432
    2533  /* apply appropriate offset */
     
    3947  code = FALSE;
    4048
    41   strcpy (basefont, currentname);
    42   basesize = currentsize;
    43 
    4449  YoffBase = Yoff;
    4550  /* draw characters one-by-one */
    4651  for (i = 0; i < strlen(c); i++) {
    4752    N = (int)(c[i]);
    48     if ((N < 0) || (N >= NROT)) continue;
     53    if ((N < 0) || (N >= NROTCHARS)) continue;
    4954
    5055    /* check for special characters */
     
    5257      if (N == 94) {
    5358        SetRotFont (currentname, (int)(0.8*currentsize));
    54         Yoff -= 0.5*activescale*dY;
     59        currentfont = GetRotFontData (&currentscale);
     60        Yoff -= 0.5*currentscale*dY;
    5561        continue;
    5662      }
    5763      if (N == 95) {
    5864        SetRotFont (currentname, (int)(0.8*currentsize));
    59         Yoff += 0.5*activescale*dY;
     65        currentfont = GetRotFontData (&currentscale);
     66        Yoff += 0.5*currentscale*dY;
    6067        continue;
    6168      }
    6269      if (N == 124) {
    6370        SetRotFont (currentname, basesize);
     71        currentfont = GetRotFontData (&currentscale);
    6472        Yoff = YoffBase;
    6573        continue;
     
    7280        if (c[i+1] == 'h') {
    7381          SetRotFont ("helvetica", currentsize);
     82          currentfont = GetRotFontData (&currentscale);
    7483        }
    7584        if (c[i+1] == 't') {
    7685          SetRotFont ("times", currentsize);
     86          currentfont = GetRotFontData (&currentscale);
    7787        }
    7888        if (c[i+1] == 'c') {
    7989          SetRotFont ("courier", currentsize);
     90          currentfont = GetRotFontData (&currentscale);
    8091        }
    8192        if (c[i+1] == 's') {
    8293          SetRotFont ("symbol", currentsize);
     94          currentfont = GetRotFontData (&currentscale);
    8395        }
    8496        i++;
     
    88100    code = FALSE;
    89101
    90     bitmap = activefont[N].bits;
    91     dx = activefont[N].dx;
    92     dy = activefont[N].dy;
    93     X = x + (int)(Xoff*cs - Yoff*sn) + (int)(activescale*activefont[N].ascent*sn);
    94     Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(activescale*activefont[N].ascent*cs);
    95     DrawRotBitmap (X, Y, dx, dy, bitmap, TRUE, angle, activescale);
    96     Xoff += 1 + (int)(activescale*dx + 0.5);
     102    bitmap = currentfont[N].bits;
     103    dx = currentfont[N].dx;
     104    dy = currentfont[N].dy;
     105    X = x + (int)(Xoff*cs - Yoff*sn) + (int)(currentscale*currentfont[N].ascent*sn);
     106    Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(currentscale*currentfont[N].ascent*cs);
     107    DrawRotBitmap (X, Y, dx, dy, bitmap, TRUE, angle, currentscale);
     108    Xoff += 1 + (int)(currentscale*dx + 0.5);
    97109  }
    98   SetRotFont (basefont, basesize);
     110  SetRotFont (basename, basesize);
    99111  return (TRUE);
    100112}
    101113
    102 int DrawRotBitmap (int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale) {
     114int DrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) {
    103115
    104116  int ii, jj, byte_line, byte, bit, flag;
  • trunk/Ohana/src/kapa/graph/PSRotFont.c

    r5610 r5611  
    11# include "Ximage.h"
    2 # include "alphabet.h"
     2# define NROTCHARS 256
    33
    44/* writes commands to print string at location and angle using
     
    66void PSRotText (FILE *f, int x, int y, char *string, int pos, double angle) {
    77
    8   char *c, *segment, basefont[64];
     8  char *c, *segment, basename[64], *currentname;
    99  int i, N, code;
    1010  int dX, dY, Xoff, Yoff, X, Y, Nseg, NSEG, YoffBase;
    11   double cs, sn, fscale;
    12   int basesize;
    13    
     11  double cs, sn, fscale, currentscale;
     12  int basesize, currentsize;
     13  RotFont *currentfont;
     14 
     15  currentname = GetRotFont (&currentsize);
     16  currentfont = GetRotFontData (&currentscale);
     17  strcpy (basename, currentname);
     18  basesize = currentsize;
     19
    1420  /* strip off leading whitespace */
    1521  for (c = string; (*c == ' ') || (*c == '\t'); c++);
     
    2430  if (!strcmp (currentname, "symbol")) fscale = 1.2;
    2531  dX = fscale*RotStrlen (c);
    26   dY = activefont[65].ascent;
     32  dY = currentfont[65].ascent;
    2733 
    2834  /* apply appropriate offset */
     
    4450  Y = y - Xoff*sn + Yoff*cs;
    4551
    46   basesize = currentsize;
    47   strcpy (basefont, currentname);
    48 
    49   PSSetFont (f, currentsize);
     52  PSSetFont (f, currentname, currentsize);
    5053  fprintf (f, "gsave\n");
    5154  fprintf (f, " %d %d moveto %f rotate\n", X, Y, -angle);
     
    6164  for (i = 0; i < strlen (c); i++) {
    6265    N = (int)(c[i]);
    63     if ((N < 0) || (N >= NROT)) continue;
     66    if ((N < 0) || (N >= NROTCHARS)) continue;
    6467
    6568    /* check for special characters */
     
    6972        PSDumpRotSegment (f, segment, &Nseg);
    7073        SetRotFont (currentname, (int)(0.8*currentsize));
    71         Yoff = 0.75*activescale*dY;
     74        currentfont = GetRotFontData (&currentscale);
     75        Yoff = 0.75*currentscale*dY;
    7276        fprintf (f, "0 %d rmoveto\n", Yoff);
    7377        YoffBase += Yoff;
    74         PSSetFont (f, currentsize);
     78        PSSetFont (f, currentname, currentsize);
    7579        continue;
    7680      }
     
    7983        PSDumpRotSegment (f, segment, &Nseg);
    8084        SetRotFont (currentname, (int)(0.8*currentsize));
    81         Yoff = -0.5*activescale*dY;
     85        currentfont = GetRotFontData (&currentscale);
     86        Yoff = -0.5*currentscale*dY;
    8287        fprintf (f, "0 %d rmoveto\n", Yoff);
    8388        YoffBase += Yoff;
    84         PSSetFont (f, currentsize);
     89        PSSetFont (f, currentname, currentsize);
    8590        continue;
    8691      }
     
    8994        PSDumpRotSegment (f, segment, &Nseg);
    9095        SetRotFont (currentname, basesize);
     96        currentfont = GetRotFontData (&currentscale);
    9197        fprintf (f, "0 %d rmoveto\n", -YoffBase);
    9298        YoffBase = 0;
    93         PSSetFont (f, currentsize);
     99        PSSetFont (f, currentname, currentsize);
    94100        continue;
    95101      }
     
    118124        if (c[i+1] == 'h') {
    119125          SetRotFont ("helvetica", currentsize);
    120           PSSetFont (f, currentsize);
     126          currentfont = GetRotFontData (&currentscale);
     127          PSSetFont (f, currentname, currentsize);
    121128        }
    122129        if (c[i+1] == 't') {
    123130          SetRotFont ("times", currentsize);
    124           PSSetFont (f, currentsize);
     131          currentfont = GetRotFontData (&currentscale);
     132          PSSetFont (f, currentname, currentsize);
    125133        }
    126134        if (c[i+1] == 'c') {
    127135          SetRotFont ("courier", currentsize);
    128           PSSetFont (f, currentsize);
     136          currentfont = GetRotFontData (&currentscale);
     137          PSSetFont (f, currentname, currentsize);
    129138        }
    130139        if (c[i+1] == 's') {
    131140          SetRotFont ("symbol", currentsize);
    132           PSSetFont (f, currentsize);
     141          currentfont = GetRotFontData (&currentscale);
     142          PSSetFont (f, currentname, currentsize);
    133143        }
    134144        i++;
     
    144154  fprintf (f, "stroke grestore\n");
    145155  free (segment);
    146   SetRotFont (basefont, basesize);
     156  SetRotFont (basename, basesize);
    147157}
    148158
     
    154164}
    155165
    156 void PSSetFont (FILE *f, int size) {
    157   if (!strcmp (currentname, "times"))
     166void PSSetFont (FILE *f, char *name, int size) {
     167  if (!strcmp (name, "times"))
    158168    fprintf (f, "/Times-Roman findfont %d scalefont setfont\n", size);
    159   if (!strcmp (currentname, "helvetica"))
     169  if (!strcmp (name, "helvetica"))
    160170    fprintf (f, "/Helvetica findfont %d scalefont setfont\n", size);
    161   if (!strcmp (currentname, "courier"))
     171  if (!strcmp (name, "courier"))
    162172    fprintf (f, "/Courier findfont %d scalefont setfont\n", size);
    163   if (!strcmp (currentname, "symbol"))
     173  if (!strcmp (name, "symbol"))
    164174    fprintf (f, "/Symbol findfont %d scalefont setfont\n", size);
    165175}
  • trunk/Ohana/src/kapa/graph/RotFont.c

    r5610 r5611  
    11# include "Ximage.h"
    22# include "alphabet.h"
    3 # define NROT 256
    43 
     4static int Nrotfonts;
     5static FontSet *RotFonts;
     6
     7static char currentname[64];
     8static int  currentsize;
     9static double currentscale;
     10static RotFont *currentfont;
     11
    512void InitRotFonts () {
    613
     
    916  Nhardwired = sizeof (HardwiredFonts) / sizeof (FontSet);
    1017 
    11   Nallfonts = Nhardwired;
    12   ALLOCATE (AllFonts, FontSet, Nallfonts);
     18  Nrotfonts = Nhardwired;
     19  ALLOCATE (RotFonts, FontSet, Nrotfonts);
    1320 
    1421  for (i = 0; i < Nhardwired; i++) {
    15     AllFonts[i] = HardwiredFonts[i];
     22    RotFonts[i] = HardwiredFonts[i];
    1623  }
    1724
    18   activefont = AllFonts[DEFFONT].font;
    19   activescale = 1.0;
    20   strcpy (currentname, AllFonts[DEFFONT].name);
    21   currentsize = AllFonts[DEFFONT].size;
     25  currentfont = RotFonts[DEFFONT].font;
     26  currentscale = 1.0;
     27  strcpy (currentname, RotFonts[DEFFONT].name);
     28  currentsize = RotFonts[DEFFONT].size;
    2229}
    2330
     
    2936  dsize = 10000;
    3037  bsize = 10000;
    31   for (i = 0; i < Nallfonts; i++) {
    32     if (!strcasecmp (AllFonts[i].name, name)) {
     38  for (i = 0; i < Nrotfonts; i++) {
     39    if (!strcasecmp (RotFonts[i].name, name)) {
    3340      good = i;
    34       nsize = abs (AllFonts[i].size - size);
     41      nsize = abs (RotFonts[i].size - size);
    3542      if (nsize < dsize) {
    3643        match = i;
    3744        dsize = nsize;
    3845      }
    39       msize = AllFonts[i].size - size;
     46      msize = RotFonts[i].size - size;
    4047      if ((msize < bsize) && (msize >= 0)) {
    4148        bigger = i;
     
    4855  if (bigger != -1) match = bigger;
    4956  if (match != -1) {
    50     activefont = AllFonts[match].font;
    51     activescale = (double) size / AllFonts[match].size;
     57    currentfont = RotFonts[match].font;
     58    currentscale = (double) size / RotFonts[match].size;
    5259    currentsize = size;
    5360    strcpy (currentname, name);
     
    6774}
    6875
     76RotFont *GetRotFontData (double *scale) {
     77  *scale = currentscale;
     78  return (currentfont);
     79}
     80
    6981int RotStrlen (char *c) {
    7082
     
    7284  double scale;
    7385 
    74   scale = activescale;
     86  scale = currentscale;
    7587
    7688  /* find string length */
     
    94106      }
    95107      if (N == 124) { /* normal-script */
    96         scale = activescale;
     108        scale = currentscale;
    97109        continue;
    98110      }
     
    107119    }
    108120    code = FALSE;
    109     dX += scale*activefont[N].dx + 1;
     121    dX += scale*currentfont[N].dx + 1;
    110122  }
    111123  return (dX);
  • trunk/Ohana/src/kapa/graph/bDrawRotFont.c

    r5610 r5611  
    11# include "Ximage.h"
    22# include "bDraw.h"
    3 # include "alphabet.h"
    4 
     3
     4# define NROTCHARS 256
    55# define XPROC(x,y) (scale*(cs*((x) - x0) - sn*((y) - y0)) + X0)
    66# define YPROC(x,y) (scale*(cs*((y) - y0) + sn*((x) - x0)) + Y0)
     
    1212int bDrawRotText (int x, int y, char *string, int pos, double angle) {
    1313
    14   char *c, *bitmap, basefont[64];
     14  unsigned char *bitmap;
     15  char *currentname, basename[64], *c;
    1516  int i, dy, dx, N, X, Y, code;
    16   int dX, Xoff, dY, Yoff, YoffBase, basesize;
    17   double cs, sn;
    18 
    19   // return (TRUE);
     17  int dX, Xoff, dY, Yoff, YoffBase;
     18  int currentsize, basesize;
     19  double cs, sn, currentscale;
     20  RotFont *currentfont;
     21
    2022  white = GetColorByName ("white");
    2123  black = GetColorByName ("black");
     24
     25  currentname = GetRotFont (&currentsize);
     26  currentfont = GetRotFontData (&currentscale);
     27  strcpy (basename, currentname);
     28  basesize = currentsize;
    2229
    2330  /* strip leading whitespace */
     
    2936  sn = sin(angle*RAD_DEG);
    3037  dX = RotStrlen (c);
    31   dY = activefont[65].ascent;
     38  dY = currentfont[65].ascent;
    3239
    3340  /* apply appropriate offset */
     
    4754  code = FALSE;
    4855
    49   strcpy (basefont, currentname);
    50   basesize = currentsize;
    51 
    5256  YoffBase = Yoff;
    5357  /* draw characters one-by-one */
    5458  for (i = 0; i < strlen(c); i++) {
    5559    N = (int)(c[i]);
    56     if ((N < 0) || (N >= NROT)) continue;
     60    if ((N < 0) || (N >= NROTCHARS)) continue;
    5761
    5862    /* check for special characters */
     
    6064      if (N == 94) {
    6165        SetRotFont (currentname, (int)(0.8*currentsize));
    62         Yoff -= 0.5*activescale*dY;
     66        currentfont = GetRotFontData (&currentscale);
     67        Yoff -= 0.5*currentscale*dY;
    6368        continue;
    6469      }
    6570      if (N == 95) {
    6671        SetRotFont (currentname, (int)(0.8*currentsize));
    67         Yoff += 0.5*activescale*dY;
     72        currentfont = GetRotFontData (&currentscale);
     73        Yoff += 0.5*currentscale*dY;
    6874        continue;
    6975      }
    7076      if (N == 124) {
    7177        SetRotFont (currentname, basesize);
     78        currentfont = GetRotFontData (&currentscale);
    7279        Yoff = YoffBase;
    7380        continue;
     
    8087        if (c[i+1] == 'h') {
    8188          SetRotFont ("helvetica", currentsize);
     89          currentfont = GetRotFontData (&currentscale);
    8290        }
    8391        if (c[i+1] == 't') {
    8492          SetRotFont ("times", currentsize);
     93          currentfont = GetRotFontData (&currentscale);
    8594        }
    8695        if (c[i+1] == 'c') {
    8796          SetRotFont ("courier", currentsize);
     97          currentfont = GetRotFontData (&currentscale);
    8898        }
    8999        if (c[i+1] == 's') {
    90100          SetRotFont ("symbol", currentsize);
     101          currentfont = GetRotFontData (&currentscale);
    91102        }
    92103        i++;
     
    96107    code = FALSE;
    97108
    98     bitmap = activefont[N].bits;
    99     dx = activefont[N].dx;
    100     dy = activefont[N].dy;
    101     X = x + (int)(Xoff*cs - Yoff*sn) + (int)(activescale*activefont[N].ascent*sn);
    102     Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(activescale*activefont[N].ascent*cs);
    103     bDrawRotBitmap (X, Y, dx, dy, bitmap, TRUE, angle, activescale);
    104     Xoff += 1 + (int)(activescale*dx + 0.5);
     109    bitmap = currentfont[N].bits;
     110    dx = currentfont[N].dx;
     111    dy = currentfont[N].dy;
     112    X = x + (int)(Xoff*cs - Yoff*sn) + (int)(currentscale*currentfont[N].ascent*sn);
     113    Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(currentscale*currentfont[N].ascent*cs);
     114    bDrawRotBitmap (X, Y, dx, dy, bitmap, TRUE, angle, currentscale);
     115    Xoff += 1 + (int)(currentscale*dx + 0.5);
    105116  }
    106   SetRotFont (basefont, basesize);
     117  SetRotFont (basename, basesize);
    107118  return (TRUE);
    108119}
    109120
    110 int bDrawRotBitmap (int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale) {
     121int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) {
    111122
    112123  int ii, jj, byte_line, byte, bit, flag;
  • trunk/Ohana/src/kapa/include/alphabet.h

    r5610 r5611  
    1 typedef struct {
    2   int dx, dy, ascent;
    3   char *bits;
    4 } RotFont;
    5 
    6 typedef struct {
    7   RotFont *font;
    8   char name[64];
    9   int size;
    10 } FontSet;
    11 
    121# include "../rotfont/times8.h"
    132# include "../rotfont/times12.h"
     
    6251
    6352/* put these as static in RotFont.c with accessor functions */
    64 int Nallfonts;
    65 FontSet *AllFonts;
    66 RotFont *activefont;
    67 double activescale;
    68 
    69 char currentname[64];
    70 int  currentsize;
    7153# define NROT 256
  • trunk/Ohana/src/kapa/include/bDraw.h

    r5610 r5611  
    3939void bDrawTriFill (int x1, int y1, int x2, int y2, int x3, int y3);
    4040int bDrawRotText (int x, int y, char *string, int pos, double angle);
    41 int bDrawRotBitmap (int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale);
     41int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale);
  • trunk/Ohana/src/kapa/include/prototypes.h

    r4769 r5611  
    6464int           remove_argument     PROTO((int, int *, char **));
    6565
     66RotFont *GetRotFontData (double *scale);
    6667int SetRotFont PROTO((char *name, int size));
    6768void InitRotFonts PROTO(());
    6869int DrawRotText PROTO((int x, int y, char *string, int pos, double angle));
    69 int DrawRotBitmap PROTO((int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale));
     70int DrawRotBitmap PROTO((int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale));
    7071char *GetRotFont PROTO((int *size));
    7172int RotStrlen PROTO((char *c));
    7273void PSRotText PROTO((FILE *f, int x, int y, char *string, int pos, double angle));
    7374void PSDumpRotSegment PROTO((FILE *f, char *segment, int *Nseg));
    74 void PSSetFont PROTO((FILE *f, int size));
     75void PSSetFont PROTO((FILE *f, char *name, int size));
    7576void MakeGC ();
    7677
  • trunk/Ohana/src/kapa/include/structures.h

    r4769 r5611  
    5656  int    width;
    5757  int    height;
    58   char *bits;
     58  unsigned char *bits;
    5959} Icon;
    6060
     
    111111} Axis;
    112112
     113typedef struct {
     114  int dx, dy, ascent;
     115  unsigned char *bits;
     116} RotFont;
     117
     118typedef struct {
     119  RotFont *font;
     120  char name[64];
     121  int size;
     122} FontSet;
    113123
    114124/******** Here we define the Layout struct specific to this program  *******/
  • trunk/Ohana/src/kapa/setup/MakeColormap.c

    r5610 r5611  
    99 */
    1010
     11/* the three columns here are : (opihi name) : (X11 name) : (PostScript coordinate) */
    1112# define NGRAPHCOLORS 23
    12 static char GRAPHCOLORS[NGRAPHCOLORS][2][15] = {
    13 {"black",    "0.00 0.00 0.00"},
    14 {"white",    "1.00 1.00 1.00"},
    15 {"red",      "1.00 0.00 0.00"},
    16 {"pink",     "1.00 0.75 0.80"},
    17 {"orange",   "1.00 0.65 0.00"},
    18 {"yellow",   "1.00 1.00 0.00"},
    19 {"wheat",    "0.96 0.87 0.70"},
    20 {"gold",     "1.00 0.84 0.00"},
    21 {"green",    "0.00 1.00 0.00"},
    22 {"darkgreen","0.00 0.40 0.00"},
    23 {"blue",     "0.00 0.00 1.00"},
    24 {"skyblue",  "0.53 0.81 0.92"},
    25 {"indigo",   "0.56 0.16 0.87"},
    26 {"violet",   "1.00 0.00 0.00"},
    27 {"grey10",   "0.10 0.10 0.10"},
    28 {"grey20",   "0.20 0.20 0.20"},
    29 {"grey30",   "0.30 0.30 0.30"},
    30 {"grey40",   "0.40 0.40 0.40"},
    31 {"grey50",   "0.50 0.50 0.50"},
    32 {"grey60",   "0.60 0.60 0.60"},
    33 {"grey70",   "0.70 0.70 0.70"},
    34 {"grey80",   "0.80 0.80 0.80"},
    35 {"grey90",   "0.90 0.90 0.90"}};
     13static char GRAPHCOLORS[NGRAPHCOLORS][3][16] = {
     14{"black",        "black",        "0.00 0.00 0.00"},
     15{"white",        "white",        "1.00 1.00 1.00"},
     16{"red",          "red",          "1.00 0.00 0.00"},
     17{"pink",         "pink",         "1.00 0.75 0.80"},
     18{"orange",       "orange",       "1.00 0.65 0.00"},
     19{"yellow",       "yellow",       "1.00 1.00 0.00"},
     20{"wheat",        "wheat",        "0.96 0.87 0.70"},
     21{"gold",         "gold",         "1.00 0.84 0.00"},
     22{"green",        "green",        "0.00 1.00 0.00"},
     23{"darkgreen",    "darkgreen",    "0.00 0.40 0.00"},
     24{"blue",         "blue",         "0.00 0.00 1.00"},
     25{"skyblue",      "skyblue",      "0.53 0.81 0.92"},
     26{"indigo",       "mediumpurple", "0.57 0.44 0.86"},
     27{"violet",       "darkviolet",   "0.58 0.00 0.88"},
     28{"grey10",       "grey10",       "0.10 0.10 0.10"},
     29{"grey20",       "grey20",       "0.20 0.20 0.20"},
     30{"grey30",       "grey30",       "0.30 0.30 0.30"},
     31{"grey40",       "grey40",       "0.40 0.40 0.40"},
     32{"grey50",       "grey50",       "0.50 0.50 0.50"},
     33{"grey60",       "grey60",       "0.60 0.60 0.60"},
     34{"grey70",       "grey70",       "0.70 0.70 0.70"},
     35{"grey80",       "grey80",       "0.80 0.80 0.80"},
     36{"grey90",       "grey90",       "0.90 0.90 0.90"}};
    3637
    3738int GetColormapSize () {
     
    4041
    4142char *GetRGBString (int N) {
    42   return (GRAPHCOLORS[N][1]);
     43  return (GRAPHCOLORS[N][2]);
    4344}
    4445
     
    5354  /* define the palette */
    5455  for (i = 0; i < NGRAPHCOLORS; i++) {
    55     sscanf (GRAPHCOLORS[i][1], "%f %f %f", &red, &green, &blue);
     56    sscanf (GRAPHCOLORS[i][2], "%f %f %f", &red, &green, &blue);
    5657    palette[i].red = (0xff * red);
    5758    palette[i].green = (0xff * green);
     
    7071
    7172  for (i = 0; i < NGRAPHCOLORS; i++) {
    72     temp_name = XGetDefault (graphic.display, argv[0], GRAPHCOLORS[i][0]);
    73     graphic.color[i] = GetColor (graphic.display, (temp_name == (char *) NULL ? GRAPHCOLORS[i][0] : temp_name), graphic.colormap, graphic.fore);
     73    temp_name = XGetDefault (graphic.display, argv[0], GRAPHCOLORS[i][1]);
     74    graphic.color[i] = GetColor (graphic.display,
     75                                 (temp_name == (char *) NULL ? GRAPHCOLORS[i][1] : temp_name),
     76                                 graphic.colormap, graphic.fore);
    7477  }
    7578}
  • trunk/Ohana/src/kapa/setup/TopWindow.c

    r4769 r5611  
    1111  MakeGC ();
    1212
    13   icon[0].pixmap = XCreateBitmapFromData (graphic.display, graphic.window, icon[0].bits, icon[0].width, icon[0].height);
     13  icon[0].pixmap = XCreateBitmapFromData (graphic.display, graphic.window, (char *) icon[0].bits, icon[0].width, icon[0].height);
    1414
    1515  MakeCursor (DEFAULT_CURSOR);
Note: See TracChangeset for help on using the changeset viewer.