I am scalling a shape for a specific point as follows :
我按照以下方式为特定点绘制形状:
AffineTransform t = shape.getAffineTransform();
AffineTransform translatAffine =AffineTransform.getTranslateInstance(-cx, -cy);
AffineTransform scaleAffine= AffineTransform.getScaleInstance(sx,sy);
scaleAffine.concatenate(translatAffine);
translatAffine = scaleAffine;
scaleAffine =AffineTransform.getTranslateInstance(cx, cy);
scaleAffine.concatenate(translatAffine);
translatAffine = scaleAffine;
scaleAffine= new AffineTransform(t);
translatAffine.concatenate(scaleAffine);
shape.setAffineTransform(translatAffine);
When I try to get the new height with shape.getHeight()
, I get the initial height
当我尝试使用shape.getHeight()获取新高度时,我得到初始高度
1 个解决方案
#1
0
I found a work a round by getting the affineTransform and calculating the new height. I added the follwing line to the code above
通过获取affineTransform并计算新的高度,我找到了一个工作。我在上面的代码中添加了以下行
System.out.println("The new height :"+ shape.getHeight() * shape.getAffineTransform().getScaleX());
#1
0
I found a work a round by getting the affineTransform and calculating the new height. I added the follwing line to the code above
通过获取affineTransform并计算新的高度,我找到了一个工作。我在上面的代码中添加了以下行
System.out.println("The new height :"+ shape.getHeight() * shape.getAffineTransform().getScaleX());