Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rect max;
- for(unsigned l1=0; l1<LINES; ++l1) {
- for(unsigned l2=l1; l2<LINES; ++l2) {
- for(unsigned c1=0; c1<COLS; ++c1) {
- for(unsigned c2=c1; c2<COLS; ++c2) {
- bool rect_noir = true;
- for(unsigned l=l1; rect_noir && l<=l2; ++l) {
- for(unsigned c=c1; rect_noir && c<=c2; ++c) {
- if(im({c,l}) == od::Color::White) {
- rect_noir = false;
- }
- }
- }
- if(rect_noir) {
- unsigned hei = l2 - l1 + 1;
- unsigned wid = c2 - c1 + 1;
- unsigned area = wid * hei;
- if(max.area < area) {
- max.pos.x = c1;
- max.pos.y = l1;
- max.size.wid = wid;
- max.size.hei = hei;
- max.area = area;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment