diff options
| author | nobytesgiven <[email protected]> | 2022-10-26 10:11:14 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-26 09:11:14 +0200 |
| commit | c4abf6835190218b86df3d433a93280a63496c1d (patch) | |
| tree | ce6c39ae9803a81b8ad1531dfbab64ed2c697c63 /src/rtextures.c | |
| parent | 865f823835779905d01d39fde3a4ebc1ea293f6a (diff) | |
| download | raylib-c4abf6835190218b86df3d433a93280a63496c1d.tar.gz raylib-c4abf6835190218b86df3d433a93280a63496c1d.zip | |
fixed blur issue on opaque pictures & added example (#2775)
Co-authored-by: nobytesgiven <[email protected]>
Diffstat (limited to 'src/rtextures.c')
| -rw-r--r-- | src/rtextures.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rtextures.c b/src/rtextures.c index 5e6f344d..343daa18 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -1506,7 +1506,6 @@ void ImageBlurGaussian(Image *image, int blurSize) { ImageAlphaPremultiply(image); Color *pixels = LoadImageColors(*image); - Color *pixelsCopy = LoadImageColors(*image); // Loop switches between pixelsCopy1 and pixelsCopy2 Vector4 *pixelsCopy1 = RL_MALLOC((image->height)*(image->width)*sizeof(Vector4)); @@ -1623,14 +1622,14 @@ void ImageBlurGaussian(Image *image, int blurSize) { // Reverse premultiply for (int i = 0; i < (image->width)*(image->height); i++) { - if (pixelsCopy1[i].w == 0) + if (pixelsCopy1[i].w == 0.0f) { pixels[i].r = 0; pixels[i].g = 0; pixels[i].b = 0; pixels[i].a = 0; } - else if (pixelsCopy1[i].w < 255.0f) + else if (pixelsCopy1[i].w <= 255.0f) { float alpha = (float)pixelsCopy1[i].w/255.0f; pixels[i].r = (unsigned char)((float)pixelsCopy1[i].x/alpha); |
