| 726 | **********************************************************************/ |
| 727 | |
| 728 | void TO_ROW::add_blob( //constructor |
| 729 | BLOBNBOX *blob, //first blob |
| 730 | float top, //corrected top |
| 731 | float bottom, //of row |
| 732 | float row_size //ideal |
| 733 | ) { |
| 734 | float allowed; //allowed expansion |
| 735 | float available; //expansion |
| 736 | BLOBNBOX_IT it = &blobs; //list of blobs |
| 737 | |
| 738 | it.add_to_end (blob); |
| 739 | allowed = row_size + y_min - y_max; |
| 740 | if (allowed > 0) { |
| 741 | available = top > y_max ? top - y_max : 0; |
| 742 | if (bottom < y_min) |
| 743 | //total available |
| 744 | available += y_min - bottom; |
| 745 | if (available > 0) { |
| 746 | available += available; //do it gradually |
| 747 | if (available < allowed) |
| 748 | available = allowed; |
| 749 | if (bottom < y_min) |
| 750 | y_min -= (y_min - bottom) * allowed / available; |
| 751 | if (top > y_max) |
| 752 | y_max += (top - y_max) * allowed / available; |
| 753 | } |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | |
| 758 | /********************************************************************** |
no test coverage detected