mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Add some color and brush manipulation funcs (#2565)
The added functions enable mixing colors and manipulating the opacity of colors and brushes. They enable the behavior of some of the available functions from SASS and are added for future use for adding the Adwaita style (future PR).
This commit is contained in:
parent
0c64312383
commit
64ad1ce357
14 changed files with 553 additions and 8 deletions
|
@ -2365,6 +2365,27 @@ fn compile_builtin_function_call(
|
|||
let factor = a.next().unwrap();
|
||||
quote!(#x.darker(#factor as f32))
|
||||
}
|
||||
BuiltinFunction::ColorTranslucent => {
|
||||
let x = a.next().unwrap();
|
||||
let factor = a.next().unwrap();
|
||||
quote!(#x.translucent(#factor as f32))
|
||||
}
|
||||
BuiltinFunction::ColorOpaque => {
|
||||
let x = a.next().unwrap();
|
||||
let factor = a.next().unwrap();
|
||||
quote!(#x.opaque(#factor as f32))
|
||||
}
|
||||
BuiltinFunction::ColorMixed => {
|
||||
let x = a.next().unwrap();
|
||||
let y = a.next().unwrap();
|
||||
let factor = a.next().unwrap();
|
||||
quote!(#x.mixed(&#y.into(), #factor as f32))
|
||||
}
|
||||
BuiltinFunction::ColorWithAlpha => {
|
||||
let x = a.next().unwrap();
|
||||
let alpha = a.next().unwrap();
|
||||
quote!(#x.with_alpha(#alpha as f32))
|
||||
}
|
||||
BuiltinFunction::ImageSize => quote!( #(#a)*.size()),
|
||||
BuiltinFunction::ArrayLength => {
|
||||
quote!(match &#(#a)* { x => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue