Expands the image box in the given direction until it hits text, limiting the expansion to the given limit box, returning the result in the expanded box, and returning the increase in area resulting from the expansion.
| 925 | // in the expanded box, and |
| 926 | // returning the increase in area resulting from the expansion. |
| 927 | static int ExpandImageDir(BlobNeighbourDir dir, const TBOX& im_box, |
| 928 | const TBOX& limit_box, |
| 929 | ColPartitionGrid* part_grid, TBOX* expanded_box) { |
| 930 | *expanded_box = im_box; |
| 931 | switch (dir) { |
| 932 | case BND_LEFT: |
| 933 | expanded_box->set_left(ExpandImageLeft(im_box, limit_box.left(), |
| 934 | part_grid)); |
| 935 | break; |
| 936 | case BND_RIGHT: |
| 937 | expanded_box->set_right(ExpandImageRight(im_box, limit_box.right(), |
| 938 | part_grid)); |
| 939 | break; |
| 940 | case BND_ABOVE: |
| 941 | expanded_box->set_top(ExpandImageTop(im_box, limit_box.top(), part_grid)); |
| 942 | break; |
| 943 | case BND_BELOW: |
| 944 | expanded_box->set_bottom(ExpandImageBottom(im_box, limit_box.bottom(), |
| 945 | part_grid)); |
| 946 | break; |
| 947 | default: |
| 948 | return 0; |
| 949 | } |
| 950 | return expanded_box->area() - im_box.area(); |
| 951 | } |
| 952 | |
| 953 | // Expands the image partition into any non-text until it touches text. |
| 954 | // The expansion proceeds in the order of increasing increase in area |
no test coverage detected