IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40570 for trunk


Ignore:
Timestamp:
Dec 5, 2018, 9:53:01 AM (8 years ago)
Author:
eugene
Message:

add option for reduced opacity (only words for png for now)

Location:
trunk/Ohana/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/include/structures.h

    r40558 r40570  
    137137  double lweight, size;
    138138  double x0, x1, y0, y1;  /* limits for this object */
    139   float alpha;
     139  double alpha;
    140140} Gobjects;
    141141
  • trunk/Ohana/src/kapa2/src/LoadObject.c

    r40165 r40570  
    2424  graph[0].objects[N].dym = graph[0].objects[N].dyp = (float *) NULL;
    2525 
    26   KiiScanMessage (sock, "%d %d %d %d %d %d %d %lf %lf",
     26  KiiScanMessage (sock, "%d %d %d %d %d %d %d %lf %lf %lf",
    2727                  &graph[0].objects[N].Npts, &graph[0].objects[N].style,
    2828                  &graph[0].objects[N].ptype, &graph[0].objects[N].ltype,
    2929                  &graph[0].objects[N].etype, &graph[0].objects[N].ebar,
    30                   &graph[0].objects[N].color,
     30                  &graph[0].objects[N].color, &graph[0].objects[N].alpha,
    3131                  &graph[0].objects[N].lweight, &graph[0].objects[N].size);
    3232 
  • trunk/Ohana/src/kapa2/src/bDrawObjects.c

    r40558 r40570  
    3030 
    3131  int weight = MAX (0, MIN (10, object->lweight));
    32   bDrawSetStyle (buffer, object->color, weight, object->ltype, 1.0);
     32  bDrawSetStyle (buffer, object->color, weight, object->ltype, object->alpha);
    3333 
    3434  switch (object->style) {
  • trunk/Ohana/src/libkapa/src/KapaWindow.c

    r40419 r40570  
    9999  graphdata[0].etype = graphdata[0].ebar = 0;
    100100  graphdata[0].lweight = graphdata[0].size = 1.0;
     101  graphdata[0].alpha = 1.0;
    101102   
    102103  InitCoords (&graphdata[0].coords, "DEC--LIN");
     
    139140 
    140141  /* send kapa the plot details */
    141   KiiSendMessage (fd, "%8d %8d %d %d %d %d %d %f %f ",
     142  KiiSendMessage (fd, "%8d %8d %d %d %d %d %d %f %f %f ",
    142143                  Npts, data[0].style,
    143144                  data[0].ptype, data[0].ltype,
    144145                  data[0].etype, data[0].ebar, data[0].color,
    145                   data[0].lweight, data[0].size);
     146                  data[0].alpha, data[0].lweight, data[0].size);
    146147  KiiSendMessage (fd, "%g %g %g %g ",
    147148                  data[0].xmin, data[0].xmax,
     
    158159                  data[0].ymin, data[0].ymax);
    159160
    160   KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f ",
     161  KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f %f ",
    161162                  data[0].style,
    162163                  data[0].ptype, data[0].ltype,
    163164                  data[0].etype, data[0].ebar, data[0].color,
    164                   data[0].lweight, data[0].size);
     165                  data[0].alpha, data[0].lweight, data[0].size);
    165166
    166167  KiiSendMessage (fd, "%g %g %g %g %g ",
     
    209210                  &data[0].ymin, &data[0].ymax);
    210211
    211   KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf",
     212  KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf %lf",
    212213                  &data[0].style,
    213214                  &data[0].ptype, &data[0].ltype,
    214215                  &data[0].etype, &data[0].ebar, &data[0].color,
    215                   &data[0].lweight, &data[0].size);
     216                  &data[0].alpha, &data[0].lweight, &data[0].size);
    216217
    217218  KiiScanMessage (fd, "%lf %lf %lf %lf %lf",
  • trunk/Ohana/src/libkapa/src/bDrawFuncs.c

    r40558 r40570  
    437437}
    438438
     439// draw points in a pure circle, using symmetry, but only draw a point once
     440void bDrawCirclePoints (bDrawBuffer *buffer, int Xc, int Yc, int x, int y) {
     441
     442  if (x == 0) {
     443    bDrawPoint (buffer, Xc,     Yc + y);
     444    bDrawPoint (buffer, Xc,     Yc - y);
     445    bDrawPoint (buffer, Xc + y, Yc);
     446    bDrawPoint (buffer, Xc - y, Yc);
     447    return;
     448  }
     449
     450  if (x == y) {
     451    bDrawPoint (buffer, Xc + x, Yc + y);
     452    bDrawPoint (buffer, Xc - x, Yc + y);
     453    bDrawPoint (buffer, Xc + x, Yc - y);
     454    bDrawPoint (buffer, Xc - x, Yc - y);
     455    return;
     456  }
     457
     458  bDrawPoint (buffer, Xc + x, Yc + y);
     459  bDrawPoint (buffer, Xc + x, Yc - y);
     460  bDrawPoint (buffer, Xc - x, Yc + y);
     461  bDrawPoint (buffer, Xc - x, Yc - y);
     462  bDrawPoint (buffer, Xc + y, Yc + x);
     463  bDrawPoint (buffer, Xc + y, Yc - x);
     464  bDrawPoint (buffer, Xc - y, Yc + x);
     465  bDrawPoint (buffer, Xc - y, Yc - x);
     466}
     467
     468# define VERSION_A 0
     469# define VERSION_B 0
     470# define VERSION_C 1
     471
     472/* I am using version C, but I really should consider using the algorithm describe in
     473   Bresenham.pdf for an ellipse inside a rectangle (this allows 1/2 int steps for the
     474   radius)
     475 */
     476
     477# if (VERSION_A)
    439478// draw a pure circle 
    440479void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius) {
    441480
    442   int Xc, Yc, Radius;
    443   int x, y, d;
    444 
    445   Xc = ROUND(xc);
    446   Yc = ROUND(yc);
    447   Radius = ROUND(radius);
    448 
    449   x = 0;
    450   y = Radius;
     481  int Xc = ROUND(xc);
     482  int Yc = ROUND(yc);
     483  int Radius = ROUND(radius);
     484
     485  // fprintf (stderr, "radius: %d\n", Radius);
     486
     487  int x = Radius - 1;
     488  int y = 0;
     489  int dx = 1;
     490  int dy = 1;
     491
     492  int err = dx - (Radius << 1);
     493
     494  while (x >= y) {
     495    bDrawCirclePoints (buffer, Xc, Yc, x, y);
     496
     497    if (err <= 0) {
     498      y++;
     499      err += dy;
     500      dy += 2;
     501    }
     502
     503    if (err > 0) {
     504      x--;
     505      dx += 2;
     506      err += dx - (Radius << 1);
     507    }
     508  }
     509  return;
     510}
     511# endif
     512
     513# if (VERSION_B)
     514// draw a pure circle 
     515void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius) {
     516
     517  int Xc = ROUND(xc);
     518  int Yc = ROUND(yc);
     519  int Radius = ROUND(radius);
     520
     521  // fprintf (stderr, "radius: %d\n", Radius);
     522
     523  int x = 0;
     524  int y = Radius;
    451525
    452526  // d = 3 - 2*Radius;
    453   d = 5 - 4*radius;
     527  int d = (5 - 4*radius) / 4;
     528
     529  bDrawCirclePoints (buffer, Xc, Yc, x, y);
     530
     531  while (x < y) {
     532    x++;
     533    if (d < 0) {
     534      d += 2*x + 1;
     535    } else {
     536      y--;
     537      d += 2*(x-y) + 1;
     538    }
     539    bDrawCirclePoints (buffer, Xc, Yc, x, y);
     540  }
     541  return;
     542}
     543# endif
     544
     545# if (VERSION_C)
     546// draw a pure circle 
     547void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius) {
     548
     549  int Xc = ROUND(xc);
     550  int Yc = ROUND(yc);
     551  int Radius = ROUND(radius);
     552
     553  if (Radius == 0) {
     554    bDrawCirclePoints (buffer, Xc, Yc, 0, 0);
     555  }
     556
     557  // fprintf (stderr, "P radius: %f -> %d\n", radius, Radius);
     558
     559  int x = 0;
     560  int y = Radius;
     561
     562  // d = 3 - 2*Radius;
     563  int d = 5 - 4*radius;
    454564
    455565  while (x <= y) {
    456     bDrawPoint (buffer, Xc+x, Yc+y);
    457     bDrawPoint (buffer, Xc+x, Yc-y);
    458     bDrawPoint (buffer, Xc-x, Yc+y);
    459     bDrawPoint (buffer, Xc-x, Yc-y);
    460     bDrawPoint (buffer, Xc+y, Yc+x);
    461     bDrawPoint (buffer, Xc+y, Yc-x);
    462     bDrawPoint (buffer, Xc-y, Yc+x);
    463     bDrawPoint (buffer, Xc-y, Yc-x);
     566    bDrawCirclePoints (buffer, Xc, Yc, x, y);
    464567
    465568    if (d < 0) {
     
    474577  }
    475578}
     579# endif
     580
     581// draw a pure circle 
     582void bDrawCircleLines (bDrawBuffer *buffer, int Xc, int Yc, int x, int ys, int decrementY) {
     583
     584  int y = ys;
     585  if (decrementY) y ++;
     586
     587  if (x == 0) {
     588    if (decrementY) {
     589      bDrawLineHorizontal (buffer, Xc    , Xc + 1, Yc + y);
     590      bDrawLineHorizontal (buffer, Xc    , Xc + 1, Yc - y);
     591    }
     592
     593    // center line
     594    bDrawLineHorizontal (buffer, Xc - y, Xc + y + 1, Yc    );
     595    return;
     596  }
     597
     598  if (x == y) {
     599    bDrawLineHorizontal (buffer, Xc - x, Xc + x + 1, Yc + y);
     600    bDrawLineHorizontal (buffer, Xc - x, Xc + x + 1, Yc - y);
     601    return;
     602  }
     603
     604  // only draw these two lines if we decrement y
     605  if (decrementY) {
     606    bDrawLineHorizontal (buffer, Xc - x, Xc + x + 1, Yc + y);
     607    bDrawLineHorizontal (buffer, Xc - x, Xc + x + 1, Yc - y);
     608  }
     609
     610  // always draw these two lines:
     611  bDrawLineHorizontal (buffer, Xc - y, Xc + y + 1, Yc + x);
     612  bDrawLineHorizontal (buffer, Xc - y, Xc + y + 1, Yc - x);
     613}
    476614
    477615// draw a pure circle 
     
    492630
    493631  while (x <= y) {
    494     bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc+y);
    495     bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc-y);
    496     bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc+x);
    497     bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc-x);
    498 
     632    // bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc+y);
     633    // bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc-y);
     634    // bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc+x);
     635    // bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc-x);
     636
     637    int decrementY = FALSE;
    499638    if (d < 0) {
    500639      // d = d + 4*x + 6;
     
    504643      d = d + 8*(x-y) + 8;
    505644      y--;
    506     }
     645      decrementY = TRUE;
     646    }
     647    bDrawCircleLines (buffer, Xc, Yc, x, y, decrementY);
    507648    x++;
    508649  }
  • trunk/Ohana/src/opihi/lib.data/style_args.c

    r39926 r40570  
    5555    remove_argument (N, argc, argv);
    5656  }
     57  if ((N = get_argument (*argc, argv, "-op"))) {
     58    remove_argument (N, argc, argv);
     59    graphmode[0].alpha = atof(argv[N]);
     60    remove_argument (N, argc, argv);
     61  }
    5762  if ((N = get_argument (*argc, argv, "-c"))) {
    5863    remove_argument (N, argc, argv);
Note: See TracChangeset for help on using the changeset viewer.