From 46bf112de5122e91d0ea43e3fb6953667645d6d8 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 25 Apr 2019 20:48:53 +0800 Subject: [PATCH] Fix one bug of `sd_colorAtPoint:`, which set the alpha value default to 255, which should be 1 --- SDWebImage/UIImage+Transform.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SDWebImage/UIImage+Transform.m b/SDWebImage/UIImage+Transform.m index 11a41cc5..f2bfb3ef 100644 --- a/SDWebImage/UIImage+Transform.m +++ b/SDWebImage/UIImage+Transform.m @@ -60,7 +60,7 @@ static inline UIColor * SDGetColorFromPixel(Pixel_8888 pixel, CGBitmapInfo bitma // Get alpha info, byteOrder info CGImageAlphaInfo alphaInfo = bitmapInfo & kCGBitmapAlphaInfoMask; CGBitmapInfo byteOrderInfo = bitmapInfo & kCGBitmapByteOrderMask; - CGFloat r = 0, g = 0, b = 0, a = 255.0; + CGFloat r = 0, g = 0, b = 0, a = 1; BOOL byteOrderNormal = NO; switch (byteOrderInfo) { @@ -153,7 +153,7 @@ static inline UIColor * SDGetColorFromPixel(Pixel_8888 pixel, CGBitmapInfo bitma break; case kCGImageAlphaOnly: { // A - a = pixel[0]; + a = pixel[0] / 255.0; } break; default: