09-16-2012, 08:58 AM
I've... been having shortcuts since forever?
This is how I do it:
Start with minimal X and maximalX equal to clicked X, minimal Y and maximal Y equal to clicked Y.
Until a turn passes without any size change,
- assume no changes will occur
- Iterare over the current width (minimal X to maximal X),
-- check each column up and down if the next pixel is of the background colour - if not, adjust minimal and maximal Y values (take a note that a change occured)
- Iterare over the current height (minimal Y to maximal Y),
-- check each row left and right if the next pixel is of the background colour - if not, adjust minimal and maximal X values (take a note that a change occured)
Hope this helps?
This is how I do it:
Start with minimal X and maximalX equal to clicked X, minimal Y and maximal Y equal to clicked Y.
Until a turn passes without any size change,
- assume no changes will occur
- Iterare over the current width (minimal X to maximal X),
-- check each column up and down if the next pixel is of the background colour - if not, adjust minimal and maximal Y values (take a note that a change occured)
- Iterare over the current height (minimal Y to maximal Y),
-- check each row left and right if the next pixel is of the background colour - if not, adjust minimal and maximal X values (take a note that a change occured)
Hope this helps?