[英]AffineTransform.rotate() - how do I xlate, rotate, and scale at the same time?
[英]Retrieve new width and height of BufferedImage bounds after a AffineTransform.rotate()
我正在開發一種圖像編輯器,其中包括將其他元素作為特征來捕捉。 捕捉通過使用圖像的寬度和高度來實現。
但是,在AffineTransform.rotate()之后,圖像的寬度和高度不再是渲染圖像的實際邊界,因此捕捉失敗。
確定包圍旋轉圖像的矩形區域的寬度和高度的最佳方法是什么?
對於int
:
affineTransform.createTransformedShape(new Rectangle(width, height))
.getBounds();
對於double
:
affineTransform.createTransformedShape(
new Rectangle2D.Double(width, height)).getBounds2D();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.