Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transparency does not work for text #396

Closed
doutriaux1 opened this issue Mar 27, 2019 · 11 comments
Closed

transparency does not work for text #396

doutriaux1 opened this issue Mar 27, 2019 · 11 comments
Assignees
Labels
Milestone

Comments

@doutriaux1
Copy link
Contributor

doutriaux1 commented Mar 27, 2019

import vcs
  
x = vcs.init()

fa = vcs.createfillarea()
fa.x = [.4,.6,.6,.4]
fa.y = [.4,.4,.6,.6]
fa.color="red"

x.plot(fa)

txt = vcs.createtext()
txt.string = "TRANSPARENT STRING"
txt.angle = -45
txt.x = .5
txt.y = .5
txt.halign="center"
txt.valign = "half"
txt.color = "blue"
txt.height = 35
x.plot(txt)

x.png("transp_text")
@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 27, 2019

transp_text

@doutriaux1 doutriaux1 added the bug label Mar 27, 2019
@doutriaux1 doutriaux1 added this to the 8.2 milestone Mar 27, 2019
@scottwittenburg
Copy link
Collaborator

scottwittenburg commented Mar 29, 2019

@doutriaux1 I must be missing something here. Which property on the txt is supposed to set the transparency?

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 29, 2019

the color

@scottwittenburg
Copy link
Collaborator

scottwittenburg commented Mar 29, 2019

But then how does setting the color to "blue" do that?

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 29, 2019

oh sorry probably was a bad copy/paste job 😆
use

txt.color = [0,0,100,50]

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 29, 2019

BTW

txt.color = [0,0,100,0]

Does make it go away

@scottwittenburg
Copy link
Collaborator

scottwittenburg commented Mar 29, 2019

Ah, gotcha.

I've played with it now, and it seems that VTK expects a floating point number between 0 and 1. If you try with 0.5, you'll see it's working. So it's just a matter of knowing what the user is expected to input and mapping that into [0.0, 1.0] properly.

Looks like the rest of the color components are expected to be given by the user in the range [0, 100]?

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 29, 2019

in isofill test double check but i'm pretty sure the opacity is sent from user in the 0-100 range as well

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 29, 2019

let's ,make it uniform

@scottwittenburg
Copy link
Collaborator

scottwittenburg commented Mar 29, 2019

I'll put together a PR for it.

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Mar 29, 2019

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants