mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 04:18:14 +00:00
Remove Color::opaque
It is not a right name and i don't think it is a so common operation
This commit is contained in:
parent
cb4ef70d33
commit
5599bd44e0
14 changed files with 5 additions and 167 deletions
|
|
@ -204,7 +204,6 @@ fn gen_corelib(
|
|||
"slint_color_brighter",
|
||||
"slint_color_darker",
|
||||
"slint_color_transparentize",
|
||||
"slint_color_opaque",
|
||||
"slint_color_mix",
|
||||
"slint_color_with_alpha",
|
||||
"slint_image_size",
|
||||
|
|
@ -295,7 +294,6 @@ fn gen_corelib(
|
|||
(
|
||||
vec!["Color", "slint_color_brighter", "slint_color_darker",
|
||||
"slint_color_transparentize",
|
||||
"slint_color_opaque",
|
||||
"slint_color_mix",
|
||||
"slint_color_with_alpha",],
|
||||
vec![],
|
||||
|
|
@ -350,7 +348,6 @@ fn gen_corelib(
|
|||
"slint_color_brighter",
|
||||
"slint_color_darker",
|
||||
"slint_color_transparentize",
|
||||
"slint_color_opaque",
|
||||
"slint_color_mix",
|
||||
"slint_color_with_alpha",
|
||||
"slint_image_size",
|
||||
|
|
|
|||
|
|
@ -141,20 +141,7 @@ public:
|
|||
///
|
||||
/// The reference is the opacity's normalized value as `u8` and \a factor is
|
||||
/// clamped to be between `0.0` and `1.0` before applying it.
|
||||
///
|
||||
/// For _increasing_ the opacity, see Brush::opaque(float) and
|
||||
/// Brush::with_alpha(float).
|
||||
inline Brush transparentize(float factor) const;
|
||||
/// Returns a new version of this brush with the opacity increased by \a factor,
|
||||
/// meaning the new opacity will be scaled up by `1.0 + factor`.
|
||||
///
|
||||
/// The reference is the opacity's normalized value as `u8` and \a factor is
|
||||
/// changed to be at least `0.0` before applying it, and thus the current
|
||||
/// value cannot be decreased.
|
||||
///
|
||||
/// For _decreasing_ the opacity, see Brush::transparentize(float)
|
||||
/// and Brush::with_alpha(float).
|
||||
inline Brush opaque(float factor) const;
|
||||
|
||||
/// Returns a new version of this brush with the related color's opacities
|
||||
/// set to \a alpha.
|
||||
|
|
@ -249,7 +236,7 @@ inline Brush Brush::transparentize(float factor) const
|
|||
switch (data.tag) {
|
||||
case Tag::SolidColor:
|
||||
cbindgen_private::types::slint_color_transparentize(&data.solid_color._0, factor,
|
||||
&result.data.solid_color._0);
|
||||
&result.data.solid_color._0);
|
||||
break;
|
||||
case Tag::LinearGradient:
|
||||
for (std::size_t i = 1; i < data.linear_gradient._0.size(); ++i) {
|
||||
|
|
@ -269,30 +256,6 @@ inline Brush Brush::transparentize(float factor) const
|
|||
return result;
|
||||
}
|
||||
|
||||
inline Brush Brush::opaque(float factor) const
|
||||
{
|
||||
Brush result = *this;
|
||||
switch (data.tag) {
|
||||
case Tag::SolidColor:
|
||||
cbindgen_private::types::slint_color_opaque(&data.solid_color._0, factor,
|
||||
&result.data.solid_color._0);
|
||||
break;
|
||||
case Tag::LinearGradient:
|
||||
for (std::size_t i = 1; i < data.linear_gradient._0.size(); ++i) {
|
||||
cbindgen_private::types::slint_color_opaque(&data.linear_gradient._0[i].color, factor,
|
||||
&result.data.linear_gradient._0[i].color);
|
||||
}
|
||||
break;
|
||||
case Tag::RadialGradient:
|
||||
for (std::size_t i = 0; i < data.linear_gradient._0.size(); ++i) {
|
||||
cbindgen_private::types::slint_color_opaque(&data.radial_gradient._0[i].color, factor,
|
||||
&result.data.radial_gradient._0[i].color);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Brush Brush::with_alpha(float alpha) const
|
||||
{
|
||||
Brush result = *this;
|
||||
|
|
|
|||
|
|
@ -152,20 +152,7 @@ public:
|
|||
///
|
||||
/// The reference is the opacity's normalized value as `u8` and \a factor is
|
||||
/// clamped to be between `0.0` and `1.0` before applying it.
|
||||
///
|
||||
/// For _increasing_ the opacity, see Color::opaque(float) and
|
||||
/// Color::with_alpha(float).
|
||||
inline Color transparentize(float factor) const;
|
||||
/// Returns a new version of this color with the opacity increased by \a factor,
|
||||
/// meaning the new opacity will be scaled up by `1.0 + factor`.
|
||||
///
|
||||
/// The reference is the opacity's normalized value as `u8` and \a factor is
|
||||
/// changed to be at least `0.0` before applying it, and thus the current
|
||||
/// value cannot be decreased.
|
||||
///
|
||||
/// For _decreasing_ the opacity, see Color::transparentize(float) and
|
||||
/// Color::with_alpha(float).
|
||||
inline Color opaque(float factor) const;
|
||||
|
||||
/// Returns a new color that is a mix of \a this and \a other, with a proportion
|
||||
/// factor given by \a factor (which will be clamped to be between `0.0` and `1.0`).
|
||||
|
|
@ -190,7 +177,8 @@ public:
|
|||
|
||||
#if !defined(DOXYGEN)
|
||||
// FIXME: we need this to create GradientStop
|
||||
operator const cbindgen_private::types::Color &() const {
|
||||
operator const cbindgen_private::types::Color &() const
|
||||
{
|
||||
return inner;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -222,13 +210,6 @@ inline Color Color::transparentize(float factor) const
|
|||
return result;
|
||||
}
|
||||
|
||||
inline Color Color::opaque(float factor) const
|
||||
{
|
||||
Color result;
|
||||
cbindgen_private::types::slint_color_opaque(&inner, factor, &result.inner);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Color Color::mix(const Color &other, float factor) const
|
||||
{
|
||||
Color result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue