From 74fd0e7ca4faaa428c248a9ae714e2e7371e6ed4 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 3 Jul 2018 00:57:58 +0200 Subject: [PATCH] Added function: ImageColorReplace() --- release/include/raylib.h | 1 + release/libs/win32/mingw32/libraylib.a | Bin 1118066 -> 1118620 bytes src/raylib.h | 1 + src/textures.c | 30 +++++++++++++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/release/include/raylib.h b/release/include/raylib.h index 96bf2443..43000318 100644 --- a/release/include/raylib.h +++ b/release/include/raylib.h @@ -937,6 +937,7 @@ RLAPI void ImageColorInvert(Image *image); RLAPI void ImageColorGrayscale(Image *image); // Modify image color: grayscale RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100) RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255) +RLAPI void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color // Image generation functions RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color diff --git a/release/libs/win32/mingw32/libraylib.a b/release/libs/win32/mingw32/libraylib.a index 675b11eae0c6d57d500ade67dc112c44bb35fe77..e5a6a9bca0432526a764b89559373ce4bc8cfc97 100644 GIT binary patch delta 23879 zcmeI)d03R?{y*@01{z_8RR=XiMVXRviA}(?(j>DYj~ObNM5<4#6_w#(X-{xigu45M+|M=x~jlO(;?(JFT zW<~~on3q0xQToglMoL<0r^J|;_!#TguYZq;N$!-CB1w*0Dc93VEiJ0=hf&`Hp5u5% zy&uuJEx@S%Q+iGdF#d#VdM*n%f7jpHPAO+Q%r7`ke;W2G&ePXB-%c6l_w@gD z{r|fD=XwTQy)sq3J&gJs><^4()Z3B#fyptqQGciM4=uo`$7}gV7Vy{gKfgENU)TSS z+_m-B=db7g`Q3p2+W*h*7oflP|G)PC^LYmT|9Jif5ALOY`(gZEp&s-3nJW1A9>(t# z{ztj-yDR(OEWr5vQ}aJrfbsvhHovg|&z%EReLg~r0iUUm^Y}2%=j52%sQ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-h-3re@;M#ut~APRyH} zn4Xr}-MlKyYqrBL(GMOnU{GRudRm&w$;&GlV-brQSCE&V1gD#AJzihuqT8UtJC8hZ}`J;0Rr%W7QlvgymAg3&^aEeq@%$^=^Ye%Y?uEWCU?PBzBK^k;{Ae{fugxUisTZ0WdyQHklP-7sAK_>$7mmeJp`6jB#Ys46oL VMtIvgQ!?Z(!42#(JA1vw{{z7ARwn=e diff --git a/src/raylib.h b/src/raylib.h index 96bf2443..43000318 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -937,6 +937,7 @@ RLAPI void ImageColorInvert(Image *image); RLAPI void ImageColorGrayscale(Image *image); // Modify image color: grayscale RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100) RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255) +RLAPI void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color // Image generation functions RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color diff --git a/src/textures.c b/src/textures.c index 81bbbf3c..f2dc7ca3 100644 --- a/src/textures.c +++ b/src/textures.c @@ -1901,6 +1901,36 @@ void ImageColorBrightness(Image *image, int brightness) image->data = processed.data; } + +// Modify image color: replace color +void ImageColorReplace(Image *image, Color color, Color replace) +{ + Color *pixels = GetImageData(*image); + + for (int y = 0; y < image->height; y++) + { + for (int x = 0; x < image->width; x++) + { + if ((pixels[y*image->width + x].r == color.r) && + (pixels[y*image->width + x].g == color.g) && + (pixels[y*image->width + x].b == color.b) && + (pixels[y*image->width + x].a == color.a)) + { + pixels[y*image->width + x].r = replace.r; + pixels[y*image->width + x].g = replace.g; + pixels[y*image->width + x].b = replace.b; + pixels[y*image->width + x].a = replace.a; + } + } + } + + Image processed = LoadImageEx(pixels, image->width, image->height); + ImageFormat(&processed, image->format); + UnloadImage(*image); + free(pixels); + + image->data = processed.data; +} #endif // SUPPORT_IMAGE_MANIPULATION #if defined(SUPPORT_IMAGE_GENERATION)