我正在为特定点缩放形状,如下所示:
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);
当我尝试使用shape.getHeight()
获得新高度时,我得到初始高度
答案 0 :(得分:0)
通过获取affineTransform并计算新的高度,我找到了一个工作。我在上面的代码中添加了以下代码
System.out.println("The new height :"+ shape.getHeight() * shape.getAffineTransform().getScaleX());