ITADN

Weighted averaging of colors

#475Closedfacelessuser 创建于 2025-06-05
T: feature
F
facelessusercommented
We already have an average command that can return the mean of multiple colors. This can basically be used to mix multiple colors at 50%, and it also uses alpha premultiplication to give better results. Weights should be added to the API to allow specifying general weights for each color, allowing more control of mixing and increasing its usefulness. We have a prototype working. Here is normal averaging. ![Image](https://github.com/user-attachments/assets/9f61b3d9-1ec7-4ed8-9e37-d3daa3c1c69c) Here we average the colors with a weighting which sets the blue weight to zero: ![Image](https://github.com/user-attachments/assets/7f83ae50-d9cd-407e-a727-295c152b578b) A couple of things need to be decided. We restrict weights to such that negative weights become zero. Do we do the same for above 1? If we track the total, we can normalize whatever the values are as they will scale relative to each other. Maybe we can even do some sort of incremental averaging 🤔. We also would need to do extensive testing to ensure this works well with various opacity cases.
关闭于 2025-06-06 2 条评论