- Timestamp:
- Dec 5, 2018, 9:53:01 AM (8 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 1 added
- 6 edited
-
kapa2/include/structures.h (modified) (1 diff)
-
kapa2/src/LoadObject.c (modified) (1 diff)
-
kapa2/src/bDrawObjects.c (modified) (1 diff)
-
libkapa/doc/Bresenham.pdf (added)
-
libkapa/src/KapaWindow.c (modified) (4 diffs)
-
libkapa/src/bDrawFuncs.c (modified) (4 diffs)
-
opihi/lib.data/style_args.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/include/structures.h
r40558 r40570 137 137 double lweight, size; 138 138 double x0, x1, y0, y1; /* limits for this object */ 139 floatalpha;139 double alpha; 140 140 } Gobjects; 141 141 -
trunk/Ohana/src/kapa2/src/LoadObject.c
r40165 r40570 24 24 graph[0].objects[N].dym = graph[0].objects[N].dyp = (float *) NULL; 25 25 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", 27 27 &graph[0].objects[N].Npts, &graph[0].objects[N].style, 28 28 &graph[0].objects[N].ptype, &graph[0].objects[N].ltype, 29 29 &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, 31 31 &graph[0].objects[N].lweight, &graph[0].objects[N].size); 32 32 -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r40558 r40570 30 30 31 31 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); 33 33 34 34 switch (object->style) { -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r40419 r40570 99 99 graphdata[0].etype = graphdata[0].ebar = 0; 100 100 graphdata[0].lweight = graphdata[0].size = 1.0; 101 graphdata[0].alpha = 1.0; 101 102 102 103 InitCoords (&graphdata[0].coords, "DEC--LIN"); … … 139 140 140 141 /* 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 ", 142 143 Npts, data[0].style, 143 144 data[0].ptype, data[0].ltype, 144 145 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); 146 147 KiiSendMessage (fd, "%g %g %g %g ", 147 148 data[0].xmin, data[0].xmax, … … 158 159 data[0].ymin, data[0].ymax); 159 160 160 KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f ",161 KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f %f ", 161 162 data[0].style, 162 163 data[0].ptype, data[0].ltype, 163 164 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); 165 166 166 167 KiiSendMessage (fd, "%g %g %g %g %g ", … … 209 210 &data[0].ymin, &data[0].ymax); 210 211 211 KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf ",212 KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf %lf", 212 213 &data[0].style, 213 214 &data[0].ptype, &data[0].ltype, 214 215 &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); 216 217 217 218 KiiScanMessage (fd, "%lf %lf %lf %lf %lf", -
trunk/Ohana/src/libkapa/src/bDrawFuncs.c
r40558 r40570 437 437 } 438 438 439 // draw points in a pure circle, using symmetry, but only draw a point once 440 void 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) 439 478 // draw a pure circle 440 479 void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius) { 441 480 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 515 void 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; 451 525 452 526 // 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 547 void 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; 454 564 455 565 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); 464 567 465 568 if (d < 0) { … … 474 577 } 475 578 } 579 # endif 580 581 // draw a pure circle 582 void 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 } 476 614 477 615 // draw a pure circle … … 492 630 493 631 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; 499 638 if (d < 0) { 500 639 // d = d + 4*x + 6; … … 504 643 d = d + 8*(x-y) + 8; 505 644 y--; 506 } 645 decrementY = TRUE; 646 } 647 bDrawCircleLines (buffer, Xc, Yc, x, y, decrementY); 507 648 x++; 508 649 } -
trunk/Ohana/src/opihi/lib.data/style_args.c
r39926 r40570 55 55 remove_argument (N, argc, argv); 56 56 } 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 } 57 62 if ((N = get_argument (*argc, argv, "-c"))) { 58 63 remove_argument (N, argc, argv);
Note:
See TracChangeset
for help on using the changeset viewer.
