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

gpui: Fix SVG color render, when color have alpha #20537

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

huacnlee
Copy link
Contributor

@huacnlee huacnlee commented Nov 12, 2024

Release Notes:

  • N/A

Demo

Before After
image image

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 12, 2024
@huacnlee huacnlee changed the title gpui: Fix SVG color render, when color have alpha. gpui: Fix SVG color render, when color have alpha Nov 12, 2024
@@ -116,6 +116,7 @@ env_logger.workspace = true
rand.workspace = true
util = { workspace = true, features = ["test-support"] }
http_client = { workspace = true, features = ["test-support"] }
reqwest_client = { workspace = true }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to add this to gpui example, to let remote image works.

pixel[0] = (pixel[0] as f32 / a) as u8;
pixel[1] = (pixel[1] as f32 / a) as u8;
pixel[2] = (pixel[2] as f32 / a) as u8;
swap_rgba_pa_to_bgra(pixel);
Copy link
Contributor Author

@huacnlee huacnlee Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is extracted this code into swap_rgba_pa_to_bgra method to color.rs and fix divide 0 issue.

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant