-------------------------------------------------------------
| 620 | |
| 621 | //------------------------------------------------------------- |
| 622 | void parser::parse_rect(const char** attr) |
| 623 | { |
| 624 | int i; |
| 625 | double x = 0.0; |
| 626 | double y = 0.0; |
| 627 | double w = 0.0; |
| 628 | double h = 0.0; |
| 629 | |
| 630 | m_path.begin_path(); |
| 631 | for(i = 0; attr[i]; i += 2) |
| 632 | { |
| 633 | if(!parse_attr(attr[i], attr[i + 1])) |
| 634 | { |
| 635 | if(strcmp(attr[i], "x") == 0) x = parse_double(attr[i + 1]); |
| 636 | if(strcmp(attr[i], "y") == 0) y = parse_double(attr[i + 1]); |
| 637 | if(strcmp(attr[i], "width") == 0) w = parse_double(attr[i + 1]); |
| 638 | if(strcmp(attr[i], "height") == 0) h = parse_double(attr[i + 1]); |
| 639 | // rx - to be implemented |
| 640 | // ry - to be implemented |
| 641 | } |
| 642 | } |
| 643 | |
| 644 | |
| 645 | if(w != 0.0 && h != 0.0) |
| 646 | { |
| 647 | if(w < 0.0) throw exception("parse_rect: Invalid width: %f", w); |
| 648 | if(h < 0.0) throw exception("parse_rect: Invalid height: %f", h); |
| 649 | |
| 650 | m_path.move_to(x, y); |
| 651 | m_path.line_to(x + w, y); |
| 652 | m_path.line_to(x + w, y + h); |
| 653 | m_path.line_to(x, y + h); |
| 654 | m_path.close_subpath(); |
| 655 | } |
| 656 | m_path.end_path(); |
| 657 | } |
| 658 | |
| 659 | |
| 660 | //------------------------------------------------------------- |
no test coverage detected