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

Add with_alpha_factor to BrushRef/Brush #40

Merged
merged 6 commits into from
Jul 3, 2024
Merged

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Jul 3, 2024

Fixes #27

The key feature is adding alpha to Image. There were also a couple of other papercuts which I've tweaked

Copy link
Contributor

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

LGTM, like seeing the #[must_use] attributes.

@DJMcNab DJMcNab added this pull request to the merge queue Jul 3, 2024
Merged via the queue into linebender:main with commit a7dc3f5 Jul 3, 2024
15 checks passed
@DJMcNab DJMcNab deleted the alpha branch July 3, 2024 09:23
@DJMcNab DJMcNab requested a review from dfrg July 3, 2024 19:23
/// Returns the brush with the alpha component multiplied by the specified
/// factor.
#[must_use]
pub fn with_alpha_factor(&self, alpha: f32) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this one should take self by value and perform the modifications in place. This lets the user decide if they want to clone the full brush.

/// Returns the brush with the alpha component multiplied by the specified
/// factor.
#[must_use]
pub fn with_alpha_factor(&self, alpha: f32) -> Brush {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we make the change suggested above, this one might not be needed. I think it’s probably fine to call to_owned().with_alpha_factor() on a BrushRef.

@dfrg
Copy link
Contributor

dfrg commented Jul 4, 2024

Looks like I was late to the party. I was curious why it wouldn’t let me click approve in the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brush, with alpha.
3 participants