Ask Your Question

Revision history [back]

click to hide/show revision 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)

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)