我有一个图像文件,我必须作为StringJSON中的字段传递.我将转换图像文件
byte [] array = Files.readAllBytes (Paths.get (file.getPath ()));
并将此字节数组写入文件 new String (array)
在我再次获取它并解析此JSON文件后,我得到一个包含我的字节数组的字符串.现在如何从这一行获取我的数组字节并创建与原始图像完全相同的图像?
我有一些矩形,我逐个指定旋转((javafx.scene.shape.Rectangle) shape).rotateProperty().bind(rotate);
例如,45度

我的矩形围绕其中心旋转.请告诉我如何让敌人围绕他们的共同中心做几个直角.

this.rotate.addListener((obs, old, fresh) -> {
for (VObject vObject : children ) {
vObject.rotate.set(this.rotate.get());
}
});
这是我添加旋转的方式.如何指定角度
更新:我使用了下面的建议,现在我为每个矩形单独设置旋转.(选择仍然有点不对)
this.rotate.addListener((obs, old, fresh) -> {
Rotate groupRotate = new Rotate(rotate.get(),
this.x.getValue().doubleValue() + this.width.getValue().doubleValue() / 2 ,
this.y.getValue().doubleValue() + this.height.getValue().doubleValue() / 2);
for (VObject vObject : children ) {
vObject.getShape().getTransforms().clear();
vObject.getShape().getTransforms().add(groupRotate);
}
});
Run Code Online (Sandbox Code Playgroud)
我可以在不转动坐标轴的情况下将旋转设置为矩形吗?