Permalink
Browse files

Draw SSHUDView's vingette with CoreGraphics

  • Loading branch information...
1 parent 4065cf8 commit 4554f2c65af117402d3d326322389072f1304f47 @soffes committed Sep 22, 2012
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
@@ -42,9 +42,6 @@
B23F160B1547C73D00638372 /* SSAddressBarTextFieldReload@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50800151BA6C000E94614 /* SSAddressBarTextFieldReload@2x.png */; };
B23F160C1547C73D00638372 /* SSAddressBarTextFieldStop.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50801151BA6C000E94614 /* SSAddressBarTextFieldStop.png */; };
B23F160D1547C73D00638372 /* SSAddressBarTextFieldStop@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50802151BA6C000E94614 /* SSAddressBarTextFieldStop@2x.png */; };
- B23F160E1547C73D00638372 /* SSVignetteiPad.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50804151BA6C000E94614 /* SSVignetteiPad.png */; };
- B23F160F1547C73D00638372 /* SSVignetteiPhone.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50805151BA6C000E94614 /* SSVignetteiPhone.png */; };
- B23F16101547C73D00638372 /* SSVignetteiPhone@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50806151BA6C000E94614 /* SSVignetteiPhone@2x.png */; };
B23F16111547C73D00638372 /* UISegmentBarButton.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50807151BA6C000E94614 /* UISegmentBarButton.png */; };
B23F16121547C73D00638372 /* UISegmentBarButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50808151BA6C000E94614 /* UISegmentBarButton@2x.png */; };
B23F16131547C73D00638372 /* UISegmentBarButtonHighlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = B2C50809151BA6C000E94614 /* UISegmentBarButtonHighlighted.png */; };
@@ -303,9 +300,6 @@
B2C50800151BA6C000E94614 /* SSAddressBarTextFieldReload@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSAddressBarTextFieldReload@2x.png"; sourceTree = "<group>"; };
B2C50801151BA6C000E94614 /* SSAddressBarTextFieldStop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSAddressBarTextFieldStop.png; sourceTree = "<group>"; };
B2C50802151BA6C000E94614 /* SSAddressBarTextFieldStop@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSAddressBarTextFieldStop@2x.png"; sourceTree = "<group>"; };
- B2C50804151BA6C000E94614 /* SSVignetteiPad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSVignetteiPad.png; sourceTree = "<group>"; };
- B2C50805151BA6C000E94614 /* SSVignetteiPhone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSVignetteiPhone.png; sourceTree = "<group>"; };
- B2C50806151BA6C000E94614 /* SSVignetteiPhone@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSVignetteiPhone@2x.png"; sourceTree = "<group>"; };
B2C50807151BA6C000E94614 /* UISegmentBarButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = UISegmentBarButton.png; sourceTree = "<group>"; };
B2C50808151BA6C000E94614 /* UISegmentBarButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "UISegmentBarButton@2x.png"; sourceTree = "<group>"; };
B2C50809151BA6C000E94614 /* UISegmentBarButtonHighlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = UISegmentBarButtonHighlighted.png; sourceTree = "<group>"; };
@@ -656,9 +650,6 @@
B2C50800151BA6C000E94614 /* SSAddressBarTextFieldReload@2x.png */,
B2C50801151BA6C000E94614 /* SSAddressBarTextFieldStop.png */,
B2C50802151BA6C000E94614 /* SSAddressBarTextFieldStop@2x.png */,
- B2C50804151BA6C000E94614 /* SSVignetteiPad.png */,
- B2C50805151BA6C000E94614 /* SSVignetteiPhone.png */,
- B2C50806151BA6C000E94614 /* SSVignetteiPhone@2x.png */,
B2C50807151BA6C000E94614 /* UISegmentBarButton.png */,
B2C50808151BA6C000E94614 /* UISegmentBarButton@2x.png */,
B2C50809151BA6C000E94614 /* UISegmentBarButtonHighlighted.png */,
@@ -875,9 +866,6 @@
B23F160B1547C73D00638372 /* SSAddressBarTextFieldReload@2x.png in Resources */,
B23F160C1547C73D00638372 /* SSAddressBarTextFieldStop.png in Resources */,
B23F160D1547C73D00638372 /* SSAddressBarTextFieldStop@2x.png in Resources */,
- B23F160E1547C73D00638372 /* SSVignetteiPad.png in Resources */,
- B23F160F1547C73D00638372 /* SSVignetteiPhone.png in Resources */,
- B23F16101547C73D00638372 /* SSVignetteiPhone@2x.png in Resources */,
B23F16111547C73D00638372 /* UISegmentBarButton.png in Resources */,
B23F16121547C73D00638372 /* UISegmentBarButton@2x.png in Resources */,
B23F16131547C73D00638372 /* UISegmentBarButtonHighlighted.png in Resources */,
View
@@ -7,6 +7,7 @@
//
#import "SSHUDWindow.h"
+#import "SSDrawingUtilities.h"
#import "UIImage+SSToolkitAdditions.h"
static SSHUDWindow *kHUDWindow = nil;
@@ -51,14 +52,10 @@ - (void)drawRect:(CGRect)rect {
if (_hidesVignette) {
return;
}
-
- NSString *imageName = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? @"SSVignetteiPad.png" : @"SSVignetteiPhone.png";
- UIImage *image = [UIImage imageNamed:imageName bundleName:kSSToolkitBundleName];
-
- CGSize screenSize = [[UIScreen mainScreen] bounds].size;
- [image drawInRect:CGRectMake(roundf((screenSize.width - image.size.width) / 2.0f),
- roundf((screenSize.height - image.size.height) / 2.0f),
- image.size.width, image.size.height)];
+
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGGradientRef gradient = SSCreateGradientWithColors(@[[UIColor colorWithWhite:0.0f alpha:0.1f], [UIColor colorWithWhite:0.0f alpha:0.5f]]);
+ CGContextDrawRadialGradient(context, gradient, self.center, 0.0f, self.center, fmaxf(self.bounds.size.width, self.bounds.size.height) / 2.0f, kCGGradientDrawsAfterEndLocation);
hiessu
hiessu Nov 25, 2012 Contributor

self.center should be replaced by centerPoint

CGPoint centerPoint  = CGPointMake(self.bounds.size.width / 2.0 , self.bounds.size.height / 2.0);
CGContextDrawRadialGradient(context, gradient, centerPoint, 0.0f, centerPoint, fmaxf(self.bounds.size.width, self.bounds.size.height) / 2.0f, kCGGradientDrawsAfterEndLocation);
soffes
soffes Nov 25, 2012 Owner

You're right. Can you send me a pull request with this change?

soffes
soffes Nov 26, 2012 Owner

Thanks!

}
@end

0 comments on commit 4554f2c

Please sign in to comment.