diff options
author | Ansgar Radermacher | 2016-05-23 08:15:36 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-05-24 10:24:47 +0000 |
commit | 43f1fe0aaf1feac44f7ad34e9b874389273a1480 (patch) | |
tree | b63ee77cb7fb4865bf8c09f063e96cb1493a19db /plugins | |
parent | 81d5eeaef515f1fb84872e059f3e65472b4d441f (diff) | |
download | org.eclipse.papyrus-43f1fe0aaf1feac44f7ad34e9b874389273a1480.tar.gz org.eclipse.papyrus-43f1fe0aaf1feac44f7ad34e9b874389273a1480.tar.xz org.eclipse.papyrus-43f1fe0aaf1feac44f7ad34e9b874389273a1480.zip |
Bug 493230 - [Rich text] Comment body in diagram appears as "black box"
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RichTextRenderer.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RichTextRenderer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RichTextRenderer.java index 6c8473b8b9b..ef6bddbd539 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RichTextRenderer.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RichTextRenderer.java @@ -101,23 +101,23 @@ public class RichTextRenderer implements HTMLRenderer { height = getPreferredSize().y; changeBounds = true; } - + // Changing bounds means creating a new image with new width and height, its gc, and the new bounds for the painter if (changeBounds) { gc.dispose(); htmlImage.dispose(); - + htmlImage = getTransparentBackground(Display.getDefault(), width, height); if (htmlImage == null) { htmlImage = new Image(Display.getDefault(), width, height); } gc = new GC(htmlImage); - + bounds = new Rectangle(x, y, width, height); } // Paint and clean up - painter.paintHTML(text != null ? text : "", gc, bounds); + painter.paintHTML(text != null ? text : "", gc, bounds); //$NON-NLS-1$ if (gc != null) { gc.dispose(); } @@ -125,23 +125,23 @@ public class RichTextRenderer implements HTMLRenderer { renderFigure.setImage(htmlImage); } } - + @Override public Point getPreferredSize() { return painter.getPreferredSize(); } - + private Image getTransparentBackground(Display device, int width, int height) { try { Image src = new Image(device, width, height); - ImageData imageData = src.getImageData(); - imageData.transparentPixel = imageData.getPixel(0, 0); - src.dispose(); - return new Image(device, imageData); + ImageData imageData = src.getImageData(); + imageData.alpha = 0; + src.dispose(); + return new Image(device, imageData); } catch (Exception e) { Activator.log.error(e); } - + return null; } } |