From 34ef5709efcd1289fa40734a860089a1b98ed69e Mon Sep 17 00:00:00 2001 From: Maicon Date: Sat, 24 Jan 2026 20:28:28 +0000 Subject: [PATCH] Reverting as requested --- src/rtextures.c | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/rtextures.c b/src/rtextures.c index 18dab23a8..a57f9037d 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -2990,9 +2990,9 @@ Color *LoadImageColors(Image image) { unsigned short pixel = ((unsigned short *)image.data)[i]; - pixels[i].r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255.0f/31)); - pixels[i].g = (unsigned char)((float)((pixel & 0b0000011111000000) >> 6)*(255.0f/31)); - pixels[i].b = (unsigned char)((float)((pixel & 0b0000000000111110) >> 1)*(255.0f/31)); + pixels[i].r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255/31)); + pixels[i].g = (unsigned char)((float)((pixel & 0b0000011111000000) >> 6)*(255/31)); + pixels[i].b = (unsigned char)((float)((pixel & 0b0000000000111110) >> 1)*(255/31)); pixels[i].a = (unsigned char)((pixel & 0b0000000000000001)*255); } break; @@ -3000,9 +3000,9 @@ Color *LoadImageColors(Image image) { unsigned short pixel = ((unsigned short *)image.data)[i]; - pixels[i].r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255.0f/31)); - pixels[i].g = (unsigned char)((float)((pixel & 0b0000011111100000) >> 5)*(255.0f/63)); - pixels[i].b = (unsigned char)((float)(pixel & 0b0000000000011111)*(255.0f/31)); + pixels[i].r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255/31)); + pixels[i].g = (unsigned char)((float)((pixel & 0b0000011111100000) >> 5)*(255/63)); + pixels[i].b = (unsigned char)((float)(pixel & 0b0000000000011111)*(255/31)); pixels[i].a = 255; } break; @@ -3010,10 +3010,10 @@ Color *LoadImageColors(Image image) { unsigned short pixel = ((unsigned short *)image.data)[i]; - pixels[i].r = (unsigned char)((float)((pixel & 0b1111000000000000) >> 12)*(255.0f/15)); - pixels[i].g = (unsigned char)((float)((pixel & 0b0000111100000000) >> 8)*(255.0f/15)); - pixels[i].b = (unsigned char)((float)((pixel & 0b0000000011110000) >> 4)*(255.0f/15)); - pixels[i].a = (unsigned char)((float)(pixel & 0b0000000000001111)*(255.0f/15)); + pixels[i].r = (unsigned char)((float)((pixel & 0b1111000000000000) >> 12)*(255/15)); + pixels[i].g = (unsigned char)((float)((pixel & 0b0000111100000000) >> 8)*(255/15)); + pixels[i].b = (unsigned char)((float)((pixel & 0b0000000011110000) >> 4)*(255/15)); + pixels[i].a = (unsigned char)((float)(pixel & 0b0000000000001111)*(255/15)); } break; case PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: @@ -3234,9 +3234,9 @@ Color GetImageColor(Image image, int x, int y) { unsigned short pixel = ((unsigned short *)image.data)[y*image.width + x]; - color.r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255.0f/31)); - color.g = (unsigned char)((float)((pixel & 0b0000011111000000) >> 6)*(255.0f/31)); - color.b = (unsigned char)((float)((pixel & 0b0000000000111110) >> 1)*(255.0f/31)); + color.r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255/31)); + color.g = (unsigned char)((float)((pixel & 0b0000011111000000) >> 6)*(255/31)); + color.b = (unsigned char)((float)((pixel & 0b0000000000111110) >> 1)*(255/31)); color.a = (unsigned char)((pixel & 0b0000000000000001)*255); } break; @@ -3244,9 +3244,9 @@ Color GetImageColor(Image image, int x, int y) { unsigned short pixel = ((unsigned short *)image.data)[y*image.width + x]; - color.r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255.0f/31)); - color.g = (unsigned char)((float)((pixel & 0b0000011111100000) >> 5)*(255.0f/63)); - color.b = (unsigned char)((float)(pixel & 0b0000000000011111)*(255.0f/31)); + color.r = (unsigned char)((float)((pixel & 0b1111100000000000) >> 11)*(255/31)); + color.g = (unsigned char)((float)((pixel & 0b0000011111100000) >> 5)*(255/63)); + color.b = (unsigned char)((float)(pixel & 0b0000000000011111)*(255/31)); color.a = 255; } break; @@ -3254,10 +3254,10 @@ Color GetImageColor(Image image, int x, int y) { unsigned short pixel = ((unsigned short *)image.data)[y*image.width + x]; - color.r = (unsigned char)((float)((pixel & 0b1111000000000000) >> 12)*(255.0f/15)); - color.g = (unsigned char)((float)((pixel & 0b0000111100000000) >> 8)*(255.0f/15)); - color.b = (unsigned char)((float)((pixel & 0b0000000011110000) >> 4)*(255.0f/15)); - color.a = (unsigned char)((float)(pixel & 0b0000000000001111)*(255.0f/15)); + color.r = (unsigned char)((float)((pixel & 0b1111000000000000) >> 12)*(255/15)); + color.g = (unsigned char)((float)((pixel & 0b0000111100000000) >> 8)*(255/15)); + color.b = (unsigned char)((float)((pixel & 0b0000000011110000) >> 4)*(255/15)); + color.a = (unsigned char)((float)(pixel & 0b0000000000001111)*(255/15)); } break; case PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: @@ -5203,26 +5203,26 @@ Color GetPixelColor(void *srcPtr, int format) case PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: color = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1] }; break; case PIXELFORMAT_UNCOMPRESSED_R5G6B5: { - color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255.0f/31); - color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 5) & 0b0000000000111111)*255.0f/63); - color.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255.0f/31); + color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255/31); + color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 5) & 0b0000000000111111)*255/63); + color.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255/31); color.a = 255; } break; case PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: { - color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255.0f/31); - color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 6) & 0b0000000000011111)*255.0f/31); - color.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255.0f/31); + color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255/31); + color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 6) & 0b0000000000011111)*255/31); + color.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255/31); color.a = (((unsigned short *)srcPtr)[0] & 0b0000000000000001)? 255 : 0; } break; case PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: { - color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 12)*255.0f/15); - color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 8) & 0b0000000000001111)*255.0f/15); - color.b = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 4) & 0b0000000000001111)*255.0f/15); - color.a = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000001111)*255.0f/15); + color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 12)*255/15); + color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 8) & 0b0000000000001111)*255/15); + color.b = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 4) & 0b0000000000001111)*255/15); + color.a = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000001111)*255/15); } break; case PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: color = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1], ((unsigned char *)srcPtr)[2], ((unsigned char *)srcPtr)[3] }; break; @@ -5602,4 +5602,4 @@ static Vector4 *LoadImageDataNormalized(Image image) return pixels; } -#endif // SUPPORT_MODULE_RTEXTURES +#endif // SUPPORT_MODULE_RTEXTURES \ No newline at end of file