Skip to content

Commit

Permalink
Fix problem with text transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
scottwittenburg committed Mar 29, 2019
1 parent e607721 commit 3eddf08
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions tests/test_vcs_text_transparency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import basevcstest
import vcs

class VCSTestTextTransparency(basevcstest.VCSBaseTest):
def testTransparentText(self):
fa = self.x.createfillarea()
fa.x = [.4,.6,.6,.4]
fa.y = [.4,.4,.6,.6]
fa.color="red"

self.x.plot(fa)

txt = self.x.createtext()
txt.string = "TRANSPARENT STRING"
txt.angle = -45
txt.x = .5
txt.y = .5
txt.halign="center"
txt.valign = "half"
txt.color = [0, 0, 100, 30]
txt.height = 35
self.x.plot(txt)

self.checkImage("test_vcs_text_transparency.png")
2 changes: 1 addition & 1 deletion vcs/vcs2vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ def prepTextProperty(p, winSize, to="default", tt="default", cmap=None,
else:
c = colorIndex
p.SetColor([C / 100. for C in c[:3]])
p.SetOpacity(c[-1])
p.SetOpacity(c[-1] / 100.)
bcolorIndex = tt.backgroundcolor if tt.backgroundcolor else 255
if isinstance(bcolorIndex, int):
bc = cmap.index[bcolorIndex]
Expand Down

0 comments on commit 3eddf08

Please sign in to comment.