Wrong z-order in outline [message #524806] |
Fri, 02 April 2010 15:23 |
Carsten Reckord Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Hi,
We have a Figure with the following (simplified) paint logic, which essentially adds a drop shadow by first filling a rectangle with the
shadow and then painting over it:
public class RectangleWithShadow extends RectangleFigure
{
@Override
protected void fillShape(Graphics graphics)
{
drawShadow(graphics);
super.fillShape(graphics);
}
private void drawShadow(Graphics graphics)
{
final int shadow = EditorConstants.SHADOW_WIDTH;
final Rectangle bounds = getBounds();
graphics.pushState();
graphics.setBackgroundColor(ColorConstants.gray);
graphics.setAlpha(140);
graphics.setClip(new Rectangle(bounds.x, bounds.y, bounds.width+shadow, bounds.height+shadow));
final Rectangle shadowRect = bounds.getCopy().translate(shadow, shadow);
graphics.fillRectangle(shadowRect);
graphics.popState();
}
}
This works fine in the editor itself, however it causes strange effects in the outline view, where some or all of the shadow rectangle is
displayed in front of the figure rather than behind it.
How can this be avoided (without using lines to paint the shadow, like the SchemeBorders do)?
Best regards,
Carsten
|
|
|
Powered by
FUDForum. Page generated in 0.02129 seconds