本文整理汇总了Java中edu.uci.ics.jung.visualization.FourPassImageShaper类的典型用法代码示例。如果您正苦于以下问题:Java FourPassImageShaper类的具体用法?Java FourPassImageShaper怎么用?Java FourPassImageShaper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FourPassImageShaper类属于edu.uci.ics.jung.visualization包,在下文中一共展示了FourPassImageShaper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getShape
import edu.uci.ics.jung.visualization.FourPassImageShaper; //导入依赖的package包/类
/**
* get the shape from the image. If not available, get
* the shape from the delegate VertexShapeFunction
*/
public Shape getShape(Vertex v) {
Icon icon = getIcon(v);
if (icon != null && icon instanceof ImageIcon) {
Image image = ((ImageIcon) icon).getImage();
Shape shape = (Shape) shapeMap.get(image);
if (shape == null) {
shape = FourPassImageShaper.getShape(image, 30);
if(shape.getBounds().getWidth() > 0 &&
shape.getBounds().getHeight() > 0) {
// don't cache a zero-sized shape, wait for the image
// to be ready
int width = image.getWidth(null);
int height = image.getHeight(null);
AffineTransform transform = AffineTransform
.getTranslateInstance(-width / 2, -height / 2);
shape = transform.createTransformedShape(shape);
shapeMap.put(image, shape);
}
}
return shape;
} else {
return delegate.getShape(v);
}
}
开发者ID:markus1978,项目名称:clickwatch,代码行数:30,代码来源:VertexIconAndShapeFunction.java
示例2: getShape
import edu.uci.ics.jung.visualization.FourPassImageShaper; //导入依赖的package包/类
public Shape getShape(Vertex v) {
Icon icon = (Icon) iconMap.get(v);
if (icon != null && icon instanceof ImageIcon) {
Image image = ((ImageIcon) icon).getImage();
Shape shape = (Shape) shapeMap.get(image);
if (shape == null) {
if (shapeImages) {
shape = FourPassImageShaper.getShape(image, 30);
} else {
shape = new Rectangle2D.Float(0, 0,
image.getWidth(null), image.getHeight(null));
}
if(shape.getBounds().getWidth() > 0 &&
shape.getBounds().getHeight() > 0) {
int width = image.getWidth(null);
int height = image.getHeight(null);
AffineTransform transform =
AffineTransform.getTranslateInstance(-width / 2, -height / 2);
shape = transform.createTransformedShape(shape);
shapeMap.put(image, shape);
}
}
return shape;
} else {
return delegate.getShape(v);
}
}
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:31,代码来源:VertexImageShaperDemo.java
注:本文中的edu.uci.ics.jung.visualization.FourPassImageShaper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论