Skip to content

Commit

Permalink
Ensure attachment points are displayed okay on transparent backgrounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Nov 24, 2017
1 parent c56e08b commit 18d8e9b
Showing 1 changed file with 10 additions and 8 deletions.
Expand Up @@ -51,6 +51,8 @@
import java.awt.Color;
import java.awt.Font;
import java.awt.Shape;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -453,16 +455,16 @@ private AtomSymbol[] generateAtomSymbols(IAtomContainer container,
maxRadius = r;
}

final Color bg = parameters.get(BasicSceneGenerator.BackgroundColor.class);

for (TextOutline outline : attachNumOutlines) {
ElementGroup group = new ElementGroup();
group.add(new OvalElement(outline.getCenter().getX(),
outline.getCenter().getY(),
2*stroke + maxRadius,
true,
foreground));
group.add(GeneralPath.shapeOf(outline.getOutline(), bg));
double radius = 2*stroke + maxRadius;
Shape shape = new Ellipse2D.Double(outline.getCenter().getX() - radius,
outline.getCenter().getY() - radius,
2*radius,
2*radius);
Area area1 = new Area(shape);
area1.subtract(new Area(outline.getOutline()));
group.add(GeneralPath.shapeOf(area1, foreground));
annotations.add(group);
}

Expand Down

0 comments on commit 18d8e9b

Please sign in to comment.