Blanket Alpha Component in GDI +

Is there a way to set an Alpha value that affects all subsequent GDI / GDI + calls? In other words, I want to set transparency for all calls to the object Graphics

.

(I'm looking for something similar to how functions *Transform

affect the object Graphics

they call)

0


a source to share


1 answer


If I don't know anything, there is no way in GDI to do this. Are you looking for some way to change the relative alpha values ​​of all colors used when painting in a GDI context? I don't think that something like this exists.

A better idea might be to cache your colors in your own repository and then when you want to set a global (or scaled) alpha value, you can use that to manipulate those colors. Obviously, if I had more information, I could probably come up with a solution that is more suitable for your environment, but all I can suggest is based only on what is in the question.



Edit

After reading your comment, my suggestion is to turn your drawing code into a function that takes an object Graphics

, location / size (and whatever is appropriate if it doesn't already), and transparency (0 to 1.0). Then you can create your colors in your function based on the provided transparency value.

+1


a source







All Articles