拉伸时如何计算图像内对象的x和y?
How to calculate x and y of any object inside an image when strech?
假设图像有
Height = 200px;
Width = 100px;
该图像中的一个点
Y axis = 40px
X axis = 30px
现在,如果我调整该图像的大小:
New Height = 300px;
New Width = 150px;
Is there any formula to calculate new Y and X axis of that point?
坐标变化的因素是:
x因子 = newSizeX/OldSizeX = 150/100 = 3/2
yactor = newSizeY/OldSizeY = 300/200 = 3/2
newXcoordinate = oldXCorrdainte*xFactor = 30*3/2 = 45
newY 坐标 = oldXCorrdainte*xFactor = 40*3/2 = 60
假设图像有
Height = 200px;
Width = 100px;
该图像中的一个点
Y axis = 40px
X axis = 30px
现在,如果我调整该图像的大小:
New Height = 300px;
New Width = 150px;
Is there any formula to calculate new Y and X axis of that point?
坐标变化的因素是:
x因子 = newSizeX/OldSizeX = 150/100 = 3/2
yactor = newSizeY/OldSizeY = 300/200 = 3/2
newXcoordinate = oldXCorrdainte*xFactor = 30*3/2 = 45
newY 坐标 = oldXCorrdainte*xFactor = 40*3/2 = 60