-
Notifications
You must be signed in to change notification settings - Fork 565
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
fix(RimeWithWeasel): blend_colors algorithm, fix issue like rime#1405 #1481
Conversation
這樣 * 2 不會溢出麼? |
原來的代碼就有錯吧。 |
若兩個疊加的顏色都是半透明,則疊加後的透光率爲 0.5 * 0.5 = 0.25,因此 Alpha = 0.75。得這麼算。 |
dword 中只有低8位(不大于0xff)有数据离溢出还远着吧 |
忘记引入Alpha的时候哪抄的计算,但是结果是如issue那种情况发生,这次干脆强化前景色的Alpha为主这样 |
不是!RGBA 各佔 8 位!超出範圍,有效數值就取模了! 試試這個算法:有能力的話請優化:
|
改之前的 Alpha 算法溢出了。所以顏色變淺。 |
改了,目前这个计算方法,试验了下 |
厲害。同意。 squirrel 的算法只能混合不透明的顏色。考慮 Alpha 值的話,確實 RGB 也需要加權。 |
fix #1405