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

AGS4: Full 8-bit alpha transparency #2549

Open
messengerbag opened this issue Oct 11, 2024 · 1 comment
Open

AGS4: Full 8-bit alpha transparency #2549

messengerbag opened this issue Oct 11, 2024 · 1 comment

Comments

@messengerbag
Copy link

Problem
Transparency is provided in AGS primarily in the form of a .Transparency property on a number of elements. This property is in the range of [0, 100]. Internally this is converted to an alpha value of [0, 255] (in the reverse direction). This means that there is a loss of precision going in either direction.

#2525 proposes to add the ability to set alpha values for "RawDrawing" operations. That is a more complicated task, but it will also create inconsistency between this API and the existing .Transparency properties.

Suggested change
Add an .Alpha property to any entity that currently has .Transparency. This will allow users to set transparency using the [0, 255] alpha range. .Transparency can then be deprecated (either by removing it unless backwards script compatibility is set, or just marking it as out of date in the manual).

Open question
There are some functions that take a [0, 100] transparency parameter, namely DrawingSurface.DrawImage and DrawingSurface.DrawSurface (are there others?). Ideally these should be updated to use alpha, but this is hard to do in a way that doesn't introduce bugs in existing scripts. Note that this problem also applies to #2525.

@ivan-mogilko
Copy link
Contributor

There are some functions that take a [0, 100] transparency parameter, namely DrawingSurface.DrawImage and DrawingSurface.DrawSurface (are there others?). Ideally these should be updated to use alpha, but this is hard to do in a way that doesn't introduce bugs in existing scripts.

In the past similar change was done couple of times by placing old variants of functions or properties under the script API switch.

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

2 participants