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:
Olivier Goffart 2023-06-02 09:57:50 +02:00 committed by Olivier Goffart
parent cb4ef70d33
commit 5599bd44e0
14 changed files with 5 additions and 167 deletions

View file

@ -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;