neteja clang-tidy: enums uint8_t, includes, naming i altres

This commit is contained in:
2026-05-16 23:48:07 +02:00
parent a903343385
commit 0647eceab7
41 changed files with 300 additions and 288 deletions
+13 -12
View File
@@ -5,6 +5,7 @@
#include <algorithm> // Para max, min
#include <array> // Para array
#include <cstdint> // Para std::uint8_t
#include <cstdlib> // Para size_t, abs
#include <string> // Para string
#include <vector> // Para vector
@@ -48,11 +49,11 @@ struct Color {
b(blue),
a(alpha) {}
[[nodiscard]] constexpr auto INVERSE() const -> Color {
[[nodiscard]] constexpr auto inverse() const -> Color {
return Color(MAX_COLOR_VALUE - r, MAX_COLOR_VALUE - g, MAX_COLOR_VALUE - b, a);
}
[[nodiscard]] constexpr auto LIGHTEN(int amount = DEFAULT_LIGHTEN_AMOUNT) const -> Color {
[[nodiscard]] constexpr auto lighten(int amount = DEFAULT_LIGHTEN_AMOUNT) const -> Color {
return Color(
std::min(static_cast<int>(MAX_COLOR_VALUE), r + amount),
std::min(static_cast<int>(MAX_COLOR_VALUE), g + amount),
@@ -60,7 +61,7 @@ struct Color {
a);
}
[[nodiscard]] constexpr auto DARKEN(int amount = DEFAULT_DARKEN_AMOUNT) const -> Color {
[[nodiscard]] constexpr auto darken(int amount = DEFAULT_DARKEN_AMOUNT) const -> Color {
return Color(
std::max(static_cast<int>(MIN_COLOR_VALUE), r - amount),
std::max(static_cast<int>(MIN_COLOR_VALUE), g - amount),
@@ -72,14 +73,14 @@ struct Color {
static auto fromHex(const std::string& hex_str) -> Color;
// Conversiones de formato de color
[[nodiscard]] constexpr static auto RGB_TO_HSV(Color color) -> HSV;
[[nodiscard]] constexpr static auto HSV_TO_RGB(HSV hsv) -> Color;
[[nodiscard]] constexpr static auto rgbToHsv(Color color) -> HSV;
[[nodiscard]] constexpr static auto hsvToRgb(HSV hsv) -> Color;
[[nodiscard]] constexpr auto IS_EQUAL_TO(const Color& other) const -> bool {
[[nodiscard]] constexpr auto isEqualTo(const Color& other) const -> bool {
return r == other.r && g == other.g && b == other.b && a == other.a;
}
[[nodiscard]] constexpr auto APPROACH_TO(const Color& target, int step = DEFAULT_APPROACH_STEP) const -> Color {
[[nodiscard]] constexpr auto approachTo(const Color& target, int step = DEFAULT_APPROACH_STEP) const -> Color {
auto approach_component = [step](Uint8 current, Uint8 target_val) -> Uint8 {
if (std::abs(current - target_val) <= step) {
return target_val;
@@ -96,7 +97,7 @@ struct Color {
}
// Interpolación lineal hacia otro color (t=0.0: this, t=1.0: target)
[[nodiscard]] constexpr auto LERP(const Color& target, float t) const -> Color {
[[nodiscard]] constexpr auto lerp(const Color& target, float t) const -> Color {
// Asegurar que t esté en el rango [0.0, 1.0]
t = std::clamp(t, 0.0F, 1.0F);
@@ -113,12 +114,12 @@ struct Color {
}
// Sobrecarga para aceptar componentes RGBA directamente
[[nodiscard]] constexpr auto LERP(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha, float t) const -> Color {
return LERP(Color(red, green, blue, alpha), t);
[[nodiscard]] constexpr auto lerp(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha, float t) const -> Color {
return lerp(Color(red, green, blue, alpha), t);
}
// Convierte el color a un entero de 32 bits en formato RGBA
[[nodiscard]] constexpr auto TO_UINT32() const -> Uint32 {
[[nodiscard]] constexpr auto toUint32() const -> Uint32 {
return (static_cast<Uint32>(r) << 24) |
(static_cast<Uint32>(g) << 16) |
(static_cast<Uint32>(b) << 8) |
@@ -127,7 +128,7 @@ struct Color {
};
// --- Enum ColorCycleStyle: define estilos de ciclo de color ---
enum class ColorCycleStyle {
enum class ColorCycleStyle : std::uint8_t {
SUBTLE_PULSE, // Variación leve en brillo (por defecto)
HUE_WAVE, // Variación suave en tono (sin verde)
VIBRANT, // Cambios agresivos en tono y brillo