Merges the blobs from start to end, not including end, and deletes the blobs between start and end.
| 890 | // Merges the blobs from start to end, not including end, and deletes |
| 891 | // the blobs between start and end. |
| 892 | void TWERD::MergeBlobs(int start, int end) { |
| 893 | if (start >= blobs.size() - 1) return; // Nothing to do. |
| 894 | TESSLINE* outline = blobs[start]->outlines; |
| 895 | for (int i = start + 1; i < end && i < blobs.size(); ++i) { |
| 896 | TBLOB* next_blob = blobs[i]; |
| 897 | // Take the outlines from the next blob. |
| 898 | if (outline == NULL) { |
| 899 | blobs[start]->outlines = next_blob->outlines; |
| 900 | outline = blobs[start]->outlines; |
| 901 | } else { |
| 902 | while (outline->next != NULL) |
| 903 | outline = outline->next; |
| 904 | outline->next = next_blob->outlines; |
| 905 | next_blob->outlines = NULL; |
| 906 | } |
| 907 | // Delete the next blob and move on. |
| 908 | delete next_blob; |
| 909 | blobs[i] = NULL; |
| 910 | } |
| 911 | // Remove dead blobs from the vector. |
| 912 | for (int i = start + 1; i < end && start + 1 < blobs.size(); ++i) { |
| 913 | blobs.remove(start + 1); |
| 914 | } |
| 915 | } |
| 916 | |
| 917 | #ifndef GRAPHICS_DISABLED |
| 918 | void TWERD::plot(ScrollView* window) { |
no test coverage detected