From d230259e4250e8686d10e544d6a17890ea9e6159 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 13 Feb 2023 11:41:56 +0100 Subject: [PATCH] =?UTF-8?q?-=20A=C3=B1adido=20getEntry(r,g,b)=20a=20system?= =?UTF-8?q?palette?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/common/systempalette.cpp | 6 ++++++ source/common/systempalette.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/source/common/systempalette.cpp b/source/common/systempalette.cpp index af80ec0..03241fa 100644 --- a/source/common/systempalette.cpp +++ b/source/common/systempalette.cpp @@ -41,6 +41,12 @@ namespace SystemPalette return numEntries++; } + // Versión de getEntry para obtener el color con los componentes R, G y B + uint8_t getEntry(const uint8_t r, const uint8_t g, const uint8_t b) + { + return getEntry( (r<<24) + (g<<16) + (b<<8) + 255 ); + } + // Dado un índice, devolvemos su color uint32_t getRGBA(const uint8_t entry) { diff --git a/source/common/systempalette.h b/source/common/systempalette.h index de6ff42..9e473b9 100644 --- a/source/common/systempalette.h +++ b/source/common/systempalette.h @@ -9,6 +9,9 @@ namespace SystemPalette // Obtenemos el índice de la paleta para el color especificado. Si no existe se crea. uint8_t getEntry(const uint32_t color); + // Versión de getEntry para obtener el color con los componentes R, G y B + uint8_t getEntry(const uint8_t r, const uint8_t g, const uint8_t b); + // Dado un índice, devolvemos su color uint32_t getRGBA(const uint8_t entry); }