You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
909 B
25 lines
909 B
// |
|
// SVRadialGradientLayer.m |
|
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD |
|
// |
|
// Copyright (c) 2014-2019 Tobias Tiemerding. All rights reserved. |
|
// |
|
|
|
#import "SVRadialGradientLayer.h" |
|
|
|
@implementation SVRadialGradientLayer |
|
|
|
- (void)drawInContext:(CGContextRef)context { |
|
size_t locationsCount = 2; |
|
CGFloat locations[2] = {0.0f, 1.0f}; |
|
CGFloat colors[8] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f}; |
|
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); |
|
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount); |
|
CGColorSpaceRelease(colorSpace); |
|
|
|
float radius = MIN(self.bounds.size.width , self.bounds.size.height); |
|
CGContextDrawRadialGradient (context, gradient, self.gradientCenter, 0, self.gradientCenter, radius, kCGGradientDrawsAfterEndLocation); |
|
CGGradientRelease(gradient); |
|
} |
|
|
|
@end
|
|
|