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

gx - operator overloading not working for Color #21549

Open
Linklancien opened this issue May 22, 2024 · 2 comments
Open

gx - operator overloading not working for Color #21549

Linklancien opened this issue May 22, 2024 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@Linklancien
Copy link

Linklancien commented May 22, 2024

Describe the bug

gx - operator overloading not working for Color

Reproduction Steps

import gx
print(gx.rgba(128, 128, 128, 255) - gx.rgba(0, 0, 0, 155))

Expected Behavior

gx - operator have to return 128, 128, 128, 100

Current Behavior

return 128, 128, 128, 255

Possible Solution

mut na := int(a.a) - b.a
if na < 0 {
na = 0
}

Additional Information/Context

No response

V version

V 0.4.6 7a36b44

Environment details (OS name and version, etc.)

windows, Microsoft Windows 10 Famille v19045 64 bits

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@Linklancien Linklancien added the Bug This tag is applied to issues which reports bugs. label May 22, 2024
@Linklancien
Copy link
Author

After reading the code of gx, a thinks it isn't a bug but maybe it nead some comment or else about it in the doc

@spytheman
Copy link
Member

spytheman commented May 29, 2024

We can special case the .a == 255 case, to not modify the alpha, so that the tests for the defined colors (that are fully visible) will continue to work, while the - can be closer to the reverse operation for the + operation.

I do not see the use case for the current behavior 🤔 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants