I once asked my math tutor this, he gave me a formula which calculates the x and y position from a single incrementing value.. If only I remembered what it was.
Top row: x
Bottom row: x+h
Left column: y
Right column: y+k
Let say that you are in the upper left corner. [x][y]
You proceed right over all columns to the upper right corner. [x][y+k]
Top row: x+1
Then you go down to lower right corner, from [x+1][y+k] to [x+h][y+k]
Right column: y+k-1
Leftwards to lower left, from [x+h][y+k-1] to [x+h][y]
Bottom row: x+h-1
Upwards, from [x+h-1][y] to [x+1][y].
Left column: y+1
Notice how after completion of whole edge, the range was reduced by one?
How after completion of a circle the upper left corner is now at [x+1][y+1]?
That you can repeat the circle, until you are done?