Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CImgProc::isRepeatable(BYTE ** picture, CPoint p)
- {
- int maxElem = 0;
- for (int y = -1; y <= 1; ++y)
- {
- maxElem = max(maxElem, picture[p.y + y][p.x + 1]);
- }
- if (maxElem > 0)
- {
- maxElem = 0;
- for (int y = -1; y <= 1; ++y)
- {
- maxElem = max(maxElem, picture[p.y + y][p.x - 1]);
- }
- maxElem = maxElem > 0 && picture[p.y - 1][p.x] == 0 && picture[p.y + 1][p.x] == 0 ? 1 : 0;
- }
- if (maxElem > 0)
- return true;
- else
- maxElem = 0;
- for (int x = -1; x <= 1; ++x)
- {
- maxElem = max(maxElem, picture[p.y + 1][p.x + x]);
- }
- if (maxElem > 0)
- {
- maxElem = 0;
- for (int x = -1; x <= 1; ++x)
- {
- maxElem = max(maxElem, picture[p.y - 1][p.x + x]);
- }
- maxElem = maxElem > 0 && picture[p.y][p.x + 1] == 0 && picture[p.y][p.x - 1] == 0 ? 1 : 0;
- }
- if (maxElem > 0)
- return true;
- else
- maxElem = 0;
- if (picture[p.y + 1][p.x + 1] > 0 && picture[p.y + 1][p.x] == 0 && picture[p.y][p.x + 1] == 0)
- {
- for (int y = -1; y <= 1; ++y)
- {
- maxElem = max(maxElem, picture[p.y + y][p.x - 1]);
- }
- for (int x = -1; x <= 1; ++x)
- {
- maxElem = max(maxElem, picture[p.y - 1][p.x + x]);
- }
- }
- if (maxElem > 0)
- return true;
- else
- maxElem = 0;
- if (picture[p.y - 1][p.x + 1] > 0 && picture[p.y - 1][p.x] == 0 && picture[p.y][p.x + 1] == 0)
- {
- for (int y = -1; y <= 1; ++y)
- {
- maxElem = max(maxElem, picture[p.y + y][p.x - 1]);
- }
- for (int x = -1; x <= 1; ++x)
- {
- maxElem = max(maxElem, picture[p.y + 1][p.x + x]);
- }
- }
- if (maxElem > 0)
- return true;
- else
- maxElem = 0;
- if (picture[p.y - 1][p.x - 1] > 0 && picture[p.y - 1][p.x] == 0 && picture[p.y][p.x - 1] == 0)
- {
- for (int y = -1; y <= 1; ++y)
- {
- maxElem = max(maxElem, picture[p.y + y][p.x + 1]);
- }
- for (int x = -1; x <= 1; ++x)
- {
- maxElem = max(maxElem, picture[p.y + 1][p.x + x]);
- }
- }
- if (maxElem > 0)
- return true;
- else
- maxElem = 0;
- if (picture[p.y + 1][p.x - 1] > 0 && picture[p.y + 1][p.x] == 0 && picture[p.y][p.x - 1] == 0)
- {
- for (int y = -1; y <= 1; ++y)
- {
- maxElem = max(maxElem, picture[p.y + y][p.x + 1]);
- }
- for (int x = -1; x <= 1; ++x)
- {
- maxElem = max(maxElem, picture[p.y - 1][p.x + x]);
- }
- }
- return maxElem > 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement