math to center an image on a screen?
Given a screen of dimensions (w,h) and a photo of dimensi开发者_Python百科on (ww,hh) how do I calculate the x,y point on screen to place the upper left corner of the image so the image is centered?
Thanks!
x = (w - ww) / 2;
y = (h - hh) / 2;
x = (w/2) - (ww/2)
y = (h/2) - (hh/2)
精彩评论