Skip to content

Conversation

@DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Sep 3, 2025

I'm not planning to merge this even with an approval, without some more discussion.
Just exploring what this would look like practically.

See the discussion in #121 (review).

@nicoburns
Copy link
Contributor

It may make sense to make ImageFormat a custom bit field where "is_premul" has a dedicated bit

@DJMcNab
Copy link
Member Author

DJMcNab commented Sep 4, 2025

It may make sense to make ImageFormat a custom bit field where "is_premul" has a dedicated bit

I think the ergonomics of that are pretty poor (you lose exhaustive matching), but I can see the appeal.

Fwiw, as it stands, the least significant bit is effectively the "is_premul" bit.

@sagudev
Copy link
Contributor

sagudev commented Sep 4, 2025

Alternative approach:

enum ImageFormat {
    Rgba8(AlphaType),
    Bgra8(AlphaType),
}

pros:

  1. keeps orthogonality of types

cons:

  1. ergonomics (nested type)

And TBH I think the ergonomics of nested type (easiness of use) is bothering me, so I am not really sure that this alternative approach is anyway better.

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.

3 participants