Fix one bug of `sd_colorAtPoint:`, which set the alpha value default to 255, which should be 1

This commit is contained in:
DreamPiggy 2019-04-25 20:48:53 +08:00
parent feed2e5abd
commit 46bf112de5
1 changed files with 2 additions and 2 deletions

View File

@ -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: