My app creates an XML file that’s used by another app. In their spec, they use the following format for color values: “rgb(100,100,100,0)” – where the first three are RGB values, and the fourth is transparency. “Transparency” is the word they use in their spec, and so I built my app around that. Then when I tested it, the transparency behaved in the opposite way (what I thought would be fully transparent was fully opaque, and vice-versa). In practice, that fourth number is Opacity, not transparency.
What it should be:
Transparency = 255 //fully transparent
Transparency = 0 //Fully opaque
What it is:
Transparency = 0 //fully transparent
Transparency = 255 //Fully opaque
I have no control over what terminology they use. I do have freedom to call these controls whatever I want in my app, and in the interest of clarity and to minimize end user confusion I want to change it to behave as Opacity controls, not Transparency controls. Because that’s what they are.
In my app, I use Graphics.transparency to preview what the object will look like and it works fine, but obviously for that to work, it’s outputting a value that’s the opposite of what I want. I need to invert the number that’s generated so that it’s correct. That is, if you set the Opacity to 255, it has to output 0. If you set Opacity to 0 it has to output 255, and everything in between. Is there a built in function or some simple way to invert the value so when I export it, the other app matches what my preview shows?
Some of this is done inside the paint event, so you can see in realtime the setting you’re making with the slider. So I don’t want something too complex so I don’t bog anything down.