浏览代码

REVIEWED: ImageAlphaClear(), minor optimization

pull/1274/head
raysan5 5 年前
父节点
当前提交
40bc6afdbd
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. +2
    -1
      src/textures.c

+ 2
- 1
src/textures.c 查看文件

@ -1107,8 +1107,9 @@ void ImageAlphaClear(Image *image, Color color, float threshold)
if ((image->data == NULL) || (image->width == 0) || (image->height == 0)) return; if ((image->data == NULL) || (image->width == 0) || (image->height == 0)) return;
Color *pixels = GetImageData(*image); Color *pixels = GetImageData(*image);
unsigned char thresholdValue = (unsigned char)(threshold*255.0f);
for (int i = 0; i < image->width*image->height; i++) if (pixels[i].a <= p">(unsigned char)(threshold*255.0f)) pixels[i] = color;
for (int i = 0; i < image->width*image->height; i++) if (pixels[i].a <= n">thresholdValue) pixels[i] = color;
RL_FREE(image->data); RL_FREE(image->data);
int format = image->format; int format = image->format;

正在加载...
取消
保存