本文整理匯總了Java中java.awt.geom.GeneralPath.getBounds2D方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralPath.getBounds2D方法的具體用法?Java GeneralPath.getBounds2D怎麽用?Java GeneralPath.getBounds2D使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.geom.GeneralPath
的用法示例。
在下文中一共展示了GeneralPath.getBounds2D方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGlyphOutlineBounds
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
Rectangle2D getGlyphOutlineBounds(int glyphID, float x, float y) {
Rectangle2D result = null;
if (sgv.invdtx == null) {
result = new Rectangle2D.Float();
result.setRect(strike.getGlyphOutlineBounds(glyphID)); // don't mutate cached rect
} else {
GeneralPath gp = strike.getGlyphOutline(glyphID, 0, 0);
gp.transform(sgv.invdtx);
result = gp.getBounds2D();
}
/* Since x is the logical advance of the glyph to this point.
* Because of the way that Rectangle.union is specified, this
* means that subsequent unioning of a rect including that
* will be affected, even if the glyph is empty. So skip such
* cases. This alone isn't a complete solution since x==0
* may also not be what is wanted. The code that does the
* unioning also needs to be aware to ignore empty glyphs.
*/
if (!result.isEmpty()) {
result.setRect(result.getMinX() + x + dx,
result.getMinY() + y + dy,
result.getWidth(), result.getHeight());
}
return result;
}