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

Use color for color. #63

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Conversation

waywardmonkeys
Copy link
Contributor

@waywardmonkeys waywardmonkeys commented Nov 23, 2024

Color functionality is now provided by the color crate.

@waywardmonkeys waywardmonkeys force-pushed the use-color branch 2 times, most recently from f165bcf to 304ab8c Compare November 23, 2024 05:44
@waywardmonkeys
Copy link
Contributor Author

waywardmonkeys commented Nov 23, 2024

Some of these will be resolved in color and some here in this crate:

@waywardmonkeys waywardmonkeys force-pushed the use-color branch 3 times, most recently from 0b9d293 to 63060d0 Compare November 23, 2024 06:45
@waywardmonkeys
Copy link
Contributor Author

I've done more work here updating most of the gradient code, adding a feature to disable the legacy color code, and adding some more comments.

There are some FIXME(color) comments in the code to help point to things that need resolution in conjunction with the list in a comment above.

src/brush.rs Outdated Show resolved Hide resolved
@waywardmonkeys
Copy link
Contributor Author

I think I will remove the legacy code instead, and export a type alias Color that is the same as AlphaColor<Srgb> as that would simplify updating Vello.

@waywardmonkeys waywardmonkeys force-pushed the use-color branch 2 times, most recently from 52da6e8 to c65c325 Compare November 24, 2024 05:47
@tomcur
Copy link
Member

tomcur commented Nov 25, 2024

(Just a note: with color becoming 32-bit per channel, maybe peniko::Image::alpha should become f32.)

peniko/src/image.rs

Lines 37 to 50 in d825bdf

pub struct Image {
/// Blob containing the image data.
pub data: Blob<u8>,
/// Pixel format of the image.
pub format: Format,
/// Width of the image.
pub width: u32,
/// Height of the image.
pub height: u32,
/// Extend mode.
pub extend: Extend,
/// An additional alpha multiplier to use with the image.
pub alpha: u8,
}

src/lib.rs Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
@waywardmonkeys waywardmonkeys force-pushed the use-color branch 2 times, most recently from ab4783e to 117742c Compare November 27, 2024 05:38
@waywardmonkeys waywardmonkeys force-pushed the use-color branch 2 times, most recently from e4a2477 to 0fef133 Compare November 27, 2024 06:50
@waywardmonkeys
Copy link
Contributor Author

This is now rebased on top of #65 and includes the changes needed for the MSRV bump. The MSRV bump ended up being much simpler once the old peniko::Color was gone along with the changes in #65, so it didn't add significant noise to this PR.

@waywardmonkeys waywardmonkeys marked this pull request as ready for review November 27, 2024 06:51
@waywardmonkeys
Copy link
Contributor Author

(Just a note: with color becoming 32-bit per channel, maybe peniko::Image::alpha should become f32.)

I did this in #65 as it let me simplify some of the MSRV issues.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Some initial thoughts on the changelog. 😈

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@waywardmonkeys waywardmonkeys force-pushed the use-color branch 2 times, most recently from a3cb839 to 0d5c2da Compare November 27, 2024 10:38
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

I have not tried running the code with Vello or anything like that, but the code changes look fine to me.

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -77,7 +91,11 @@ impl Brush {
/// This is useful for methods that would like to accept brushes by reference. Defining
/// the type as `impl<Into<BrushRef>>` allows accepting types like `&LinearGradient`
/// directly without cloning or allocating.
#[derive(Copy, Clone, PartialEq, Debug)]
#[cfg_attr(
target_pointer_width = "32",
Copy link
Member

Choose a reason for hiding this comment

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

🙃

Color functionality is now provided by the `color` crate.
@waywardmonkeys waywardmonkeys added this pull request to the merge queue Nov 27, 2024
Merged via the queue into linebender:main with commit cb75a00 Nov 27, 2024
15 checks passed
@waywardmonkeys waywardmonkeys deleted the use-color branch November 27, 2024 13:47
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.

4 participants