| 570 | } |
| 571 | |
| 572 | void PiuViewDrawRoundContent(PiuView* self, PiuCoordinate x, PiuCoordinate y, PiuDimension w, PiuDimension h, PiuDimension radius, PiuDimension border, PiuVariant variant, PiuColor fillColor, PiuColor strokeColor) |
| 573 | { |
| 574 | cairo_t* cr = (*self)->cairo; |
| 575 | double lx = x, ty = y, rx = x + w, by = y + h, r = radius, t, u = border; |
| 576 | if (variant == 1) |
| 577 | lx += r; |
| 578 | else if (variant == 2) |
| 579 | rx -= r; |
| 580 | if (u > 0) { |
| 581 | double delta = u / 2; |
| 582 | lx += delta; |
| 583 | ty += delta; |
| 584 | rx -= delta; |
| 585 | by -= delta; |
| 586 | r -= delta; |
| 587 | } |
| 588 | t = r * 0.552284749831; |
| 589 | cairo_new_sub_path(cr); |
| 590 | cairo_move_to(cr, lx, ty + r); |
| 591 | cairo_curve_to(cr, lx, ty + r - t, lx + r - t, ty, lx + r, ty); |
| 592 | cairo_line_to(cr, rx - r, ty); |
| 593 | cairo_curve_to(cr, rx - r + t, ty, rx, ty + r - t, rx, ty + r); |
| 594 | cairo_line_to(cr, rx, by - r); |
| 595 | if (variant == 2) |
| 596 | cairo_curve_to(cr, rx, by - r + t, rx + r - t, by, rx + r, by); |
| 597 | else |
| 598 | cairo_curve_to(cr, rx, by - r + t, rx - r + t, by, rx - r, by); |
| 599 | if (variant == 1) { |
| 600 | cairo_line_to(cr, lx - r, by); |
| 601 | cairo_curve_to(cr, lx - r + t, by, lx, by - r + t, lx, by - r); |
| 602 | } |
| 603 | else { |
| 604 | cairo_line_to(cr, lx + r, by); |
| 605 | cairo_curve_to(cr, lx + r - t, by, lx, by - r + t, lx, by - r); |
| 606 | } |
| 607 | cairo_close_path(cr); |
| 608 | cairo_set_source_rgba(cr, ((double)fillColor->r) / 255.0, ((double)fillColor->g) / 255.0, ((double)fillColor->b) / 255.0, ((double)fillColor->a) / 255.0); |
| 609 | cairo_fill_preserve (cr); |
| 610 | cairo_set_source_rgba(cr, ((double)strokeColor->r) / 255.0, ((double)strokeColor->g) / 255.0, ((double)strokeColor->b) / 255.0, ((double)strokeColor->a) / 255.0); |
| 611 | cairo_set_line_width(cr, u); |
| 612 | cairo_stroke (cr); |
| 613 | } |
| 614 | |
| 615 | void PiuViewDrawString(PiuView* self, xsSlot* slot, xsIntegerValue offset, xsIntegerValue length, PiuFont* font, PiuCoordinate x, PiuCoordinate y, PiuDimension w, PiuDimension sw) |
| 616 | { |
no outgoing calls
no test coverage detected