| Summary: | GC.drawText does not work in RAP 3.0 M5 if "transparent" (SWT.DRAW_TRANSPARENT) is specified | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Thomas Hendel <hendel> | ||||||||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | ||||||||||||
| Version: | 3.0 | ||||||||||||
| Target Milestone: | 3.0 M6 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows 7 | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
We are using the same method in our Controls Demo Canvas tab and it's working as expected. Is it possible the text to be drown with the background color? Is the text appear if you make it multiline - "myText\nSecond line"? Created attachment 250646 [details]
Code example
Two variants of my paint method - one sets "SWT.DRAW_TRANSPARENT", the second variant avoids this flag.
Created attachment 250647 [details]
Screenshot of first code variant
The text is NOT drawn.
Created attachment 250648 [details]
Screenshot of the second variant
The text is drawn.
I attached a code example and two screenshots. This code is used in a custom widget recording some mouse events (The first three text lines are reports of these events, the additional text is status information about our own browser plugin...) I think, that the problem is the handling of the flag "SWT.DRAW_TRANSPARENT". If I call GC.drawText() in a way, so that is flag is NOT set, then the text is drawn. I think that the text is drawn with the gray background color. Just for the test - change the background color after gc.fillRectangle(rct); to something different than SWT.COLOR_GRAY. Is the text visible now? Indeed :-)! I included the line gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED)); and set "SWT.DRAW_TRANSPARENT" in the first call of GC.drawText(), while the second call does an opaque drawing operation. The result is 1) red text on gray background and 2) blue text on red background I'll attach another sreenshot... Created attachment 250650 [details]
Result after changing the background color
Than I think that this pending change will fix the problem - https://git.eclipse.org/r/#/c/41461/ Fixed with change https://git.eclipse.org/r/#/c/41461/ |
After updating to RAP 3.0 M5 I noticed, that GC.drawText() does not work as expected. I have a "Canvas" based widget that draws an image and a text. In RAP 3.0 M4 everything looked fine, but now (M5) the text is not drawn. I use a call like "gc.drawText("myText", x, y, true);", i.e., transparent text. If I change the last parameter of GC.drawText() from "true" to "false" so that SWT.DRAW_TRANSPARENT is *not* set, then the text appears. As I found out, the JavaScript part (GC.js) has slightly changed from M4 to M5 while the Java implementation looks unchanged.