1 | initial version |
again, it's only a simple maths problem.
assuming, your screen is SW, SH, and the desired rect size is RW,RH, then the center of the screen is:
(SW/2, SH/2)
and the rectangle coords are
(SW/2 - RW/2, SH/2 - RH/2) and (SW/2 + RW/2, SH/2 + RH/2)
2 | No.2 Revision |
again, it's only a simple maths problem.
assuming, your screen is SW, SH, and the desired rect size is RW,RH, then the center of the screen is:
(SW/2, SH/2)
and the rectangle coords are
tl : (SW/2 - RW/2, SH/2 - RH/2) and br : (SW/2 + RW/2, SH/2 + RH/2)