`
253317239
  • 浏览: 6841 次
  • 性别: Icon_minigender_1
  • 来自: 鄂尔多斯
文章分类
社区版块
存档分类
最新评论

gmf中用fillShape()加了阴影后,怎么把框置到内部!!

阅读更多
我在做Eclipse插件过程中,需要在已经有的UML类图中添加阴影效果,以显现立体效果。加了阴影效果后,graphic的图表框确还在外边。怎么把外边的框添加到阴影的里边去(不是阴影的外部)?我的UML效果图是:(见附件)
我的添加阴影的方法是:protected void fillShape(Graphics graphics)
         {
/** don't modify the r directly */
Rectangle r = getBounds();

Rectangle.SINGLETON.setBounds(r);
Rectangle.SINGLETON.y -= 1;
Rectangle.SINGLETON.width += 1;
Rectangle.SINGLETON.height += 1;

int shadowDepth = 10;
int rectangleWidth = r.width - shadowDepth;
int rectangleHeight = r.height -shadowDepth;

Color foreground = graphics.getForegroundColor();
Color background = graphics.getBackgroundColor(), shadow = ColorUtilities.darker(foreground);

int x = r.x + shadowDepth;
int y = r.y + shadowDepth;

/**
* trace shadow
*/
for (int i = shadowDepth - 1; i >= 0; i--)
{
shadow = lighter(background, i, shadowDepth);
graphics.setBackgroundColor(shadow);
graphics.fillRectangle(x, y, rectangleWidth, rectangleHeight);
if (i > 0)
{
x--;
if (fillBottom)
y--;
}
}
graphics.setBackgroundColor(background);
graphics.setForegroundColor(foreground);
graphics.fillRectangle(x, y, rectangleWidth, rectangleHeight);
}
  • 描述: 不显示outline但显示ComparterOutline的类图
  • 大小: 9.8 KB
  • 描述: 选中时的效果,显示了外边的NodeFigure
  • 大小: 143.7 KB
  • 描述: 显示选中第一个CompartMent的区域。
  • 大小: 194.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics