PageRenderTime 185ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 1ms

/ChatSecureCore/Classes/Utilities/OTRImages.m

https://github.com/chrisballinger/ChatSecure-iOS
Objective C | 699 lines | 557 code | 102 blank | 40 comment | 9 complexity | 5c7bc5e64b4fef71f9ee54997d9fb979 MD5 | raw file
Possible License(s): GPL-3.0
  1. //
  2. // OTRstatusImage.m
  3. // Off the Record
  4. //
  5. // Created by David on 3/19/13.
  6. // Copyright (c) 2013 Chris Ballinger. All rights reserved.
  7. //
  8. #import "OTRImages.h"
  9. #import "OTRUtilities.h"
  10. #import "OTRColors.h"
  11. @import BBlock;
  12. @import JSQMessagesViewController;
  13. #import "OTRComposingImageView.h"
  14. #import "NSString+ChatSecure.h"
  15. @import OTRAssets;
  16. NSString *const OTRWarningImageKey = @"OTRWarningImageKey";
  17. NSString *const OTRWarningCircleImageKey = @"OTRWarningCircleImageKey";
  18. NSString *const OTRFacebookActivityImageKey = @"OTRFacebookActivityImageKey";
  19. NSString *const OTRTwitterImageKey = @"OTRTwitterImageKey";
  20. NSString *const OTRCheckmarkImageKey = @"OTRCeckmarkImageKey";
  21. NSString *const OTRErrorImageKey = @"OTRErrorImageKey";
  22. NSString *const OTRWifiImageKey = @"OTRWifiImageKey";
  23. NSString *const OTRMicrophoneImageKey = @"OTRMicrophoneImageKey";
  24. NSString *const OTRDuckDuckGoImageKey = @"OTRMicrophoneImageKey";
  25. @implementation OTRImages
  26. + (NSCache *)imageCache{
  27. static NSCache *imageCache = nil;
  28. static dispatch_once_t predicate;
  29. dispatch_once(&predicate, ^{
  30. imageCache = [[NSCache alloc] init];
  31. });
  32. return imageCache;
  33. }
  34. + (UIImage *)mirrorImage:(UIImage *)image {
  35. return [UIImage imageWithCGImage:image.CGImage
  36. scale:image.scale
  37. orientation:UIImageOrientationUpMirrored];
  38. }
  39. + (UIImage *)image:(UIImage *)image maskWithColor:(UIColor *)maskColor
  40. {
  41. CGRect imageRect = CGRectMake(0.0f, 0.0f, image.size.width, image.size.height);
  42. UIGraphicsBeginImageContextWithOptions(imageRect.size, NO, image.scale);
  43. CGContextRef ctx = UIGraphicsGetCurrentContext();
  44. CGContextScaleCTM(ctx, 1.0f, -1.0f);
  45. CGContextTranslateCTM(ctx, 0.0f, -(imageRect.size.height));
  46. CGContextClipToMask(ctx, imageRect, image.CGImage);
  47. CGContextSetFillColorWithColor(ctx, maskColor.CGColor);
  48. CGContextFillRect(ctx, imageRect);
  49. UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
  50. UIGraphicsEndImageContext();
  51. return newImage;
  52. }
  53. + (UIImage *)circleWithRadius:(CGFloat)radius
  54. {
  55. return [self circleWithRadius:radius lineWidth:0 lineColor:nil fillColor:nil];
  56. }
  57. + (UIImage *)circleWithRadius:(CGFloat)radius lineWidth:(CGFloat)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor
  58. {
  59. if (!fillColor) {
  60. fillColor = [UIColor blackColor];
  61. }
  62. if (!lineColor) {
  63. lineColor = [UIColor blackColor];
  64. }
  65. return [UIImage imageForSize:CGSizeMake(radius*2+lineWidth, radius*2+lineWidth) opaque:NO withDrawingBlock:^{
  66. UIBezierPath* ovalPath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(lineWidth/2.0, lineWidth/2.0, radius*2.0, radius*2.0)];
  67. [fillColor setFill];
  68. [ovalPath fill];
  69. [lineColor setStroke];
  70. ovalPath.lineWidth = lineWidth;
  71. [ovalPath stroke];
  72. }];
  73. }
  74. + (UIView *)typingBubbleView
  75. {
  76. UIImageView * bubbleImageView = nil;
  77. UIImage * bubbleImage = nil;
  78. bubbleImage = [UIImage imageNamed:@"bubble-min-tailless" inBundle:[OTRAssets resourcesBundle] compatibleWithTraitCollection:nil];
  79. bubbleImage = [self image:bubbleImage maskWithColor:[OTRColors bubbleLightGrayColor]];
  80. bubbleImage = [self mirrorImage:bubbleImage];
  81. CGPoint center = CGPointMake((bubbleImage.size.width / 2.0f), bubbleImage.size.height / 2.0f);
  82. UIEdgeInsets capInsets = UIEdgeInsetsMake(center.y, center.x, center.y, center.x);
  83. bubbleImage = [bubbleImage resizableImageWithCapInsets:capInsets
  84. resizingMode:UIImageResizingModeStretch];
  85. bubbleImageView = [[OTRComposingImageView alloc] initWithImage:bubbleImage];
  86. CGRect rect = bubbleImageView.frame;
  87. rect.size.width = 60;
  88. bubbleImageView.frame = rect;
  89. return bubbleImageView;
  90. }
  91. + (UIImage *)twitterImage
  92. {
  93. return [UIImage imageWithIdentifier:OTRTwitterImageKey forSize:CGSizeMake(100, 100) andDrawingBlock:^{
  94. UIColor* color = [UIColor colorWithRed: 0.147 green: 0.595 blue: 0.848 alpha: 1];
  95. //// Bezier Drawing
  96. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  97. [bezierPath moveToPoint: CGPointMake(99.71, 19.55)];
  98. [bezierPath addCurveToPoint: CGPointMake(88.03, 22.75) controlPoint1: CGPointMake(96.07, 21.17) controlPoint2: CGPointMake(92.15, 22.26)];
  99. [bezierPath addCurveToPoint: CGPointMake(96.98, 11.49) controlPoint1: CGPointMake(92.23, 20.23) controlPoint2: CGPointMake(95.46, 16.24)];
  100. [bezierPath addCurveToPoint: CGPointMake(84.06, 16.43) controlPoint1: CGPointMake(93.05, 13.82) controlPoint2: CGPointMake(88.69, 15.52)];
  101. [bezierPath addCurveToPoint: CGPointMake(69.21, 10) controlPoint1: CGPointMake(80.35, 12.47) controlPoint2: CGPointMake(75.06, 10)];
  102. [bezierPath addCurveToPoint: CGPointMake(48.87, 30.36) controlPoint1: CGPointMake(57.98, 10) controlPoint2: CGPointMake(48.87, 19.11)];
  103. [bezierPath addCurveToPoint: CGPointMake(49.4, 35) controlPoint1: CGPointMake(48.87, 31.95) controlPoint2: CGPointMake(49.05, 33.51)];
  104. [bezierPath addCurveToPoint: CGPointMake(7.48, 13.73) controlPoint1: CGPointMake(32.5, 34.15) controlPoint2: CGPointMake(17.51, 26.04)];
  105. [bezierPath addCurveToPoint: CGPointMake(4.73, 23.96) controlPoint1: CGPointMake(5.73, 16.73) controlPoint2: CGPointMake(4.73, 20.23)];
  106. [bezierPath addCurveToPoint: CGPointMake(13.77, 40.91) controlPoint1: CGPointMake(4.73, 31.02) controlPoint2: CGPointMake(8.32, 37.25)];
  107. [bezierPath addCurveToPoint: CGPointMake(4.56, 38.36) controlPoint1: CGPointMake(10.44, 40.8) controlPoint2: CGPointMake(7.3, 39.88)];
  108. [bezierPath addCurveToPoint: CGPointMake(4.56, 38.61) controlPoint1: CGPointMake(4.56, 38.44) controlPoint2: CGPointMake(4.56, 38.53)];
  109. [bezierPath addCurveToPoint: CGPointMake(20.87, 58.58) controlPoint1: CGPointMake(4.56, 48.48) controlPoint2: CGPointMake(11.57, 56.71)];
  110. [bezierPath addCurveToPoint: CGPointMake(15.52, 59.29) controlPoint1: CGPointMake(19.17, 59.04) controlPoint2: CGPointMake(17.37, 59.29)];
  111. [bezierPath addCurveToPoint: CGPointMake(11.69, 58.93) controlPoint1: CGPointMake(14.21, 59.29) controlPoint2: CGPointMake(12.93, 59.16)];
  112. [bezierPath addCurveToPoint: CGPointMake(30.69, 73.06) controlPoint1: CGPointMake(14.28, 67.01) controlPoint2: CGPointMake(21.79, 72.9)];
  113. [bezierPath addCurveToPoint: CGPointMake(5.43, 81.78) controlPoint1: CGPointMake(23.73, 78.52) controlPoint2: CGPointMake(14.96, 81.78)];
  114. [bezierPath addCurveToPoint: CGPointMake(0.58, 81.49) controlPoint1: CGPointMake(3.79, 81.78) controlPoint2: CGPointMake(2.17, 81.68)];
  115. [bezierPath addCurveToPoint: CGPointMake(31.76, 90.64) controlPoint1: CGPointMake(9.58, 87.27) controlPoint2: CGPointMake(20.27, 90.64)];
  116. [bezierPath addCurveToPoint: CGPointMake(89.62, 32.72) controlPoint1: CGPointMake(69.17, 90.64) controlPoint2: CGPointMake(89.62, 59.62)];
  117. [bezierPath addCurveToPoint: CGPointMake(89.57, 30.08) controlPoint1: CGPointMake(89.62, 31.83) controlPoint2: CGPointMake(89.6, 30.96)];
  118. [bezierPath addCurveToPoint: CGPointMake(99.71, 19.55) controlPoint1: CGPointMake(93.54, 27.21) controlPoint2: CGPointMake(96.99, 23.63)];
  119. [bezierPath closePath];
  120. bezierPath.miterLimit = 4;
  121. [color setFill];
  122. [bezierPath fill];
  123. }];
  124. }
  125. + (UIImage *)facebookActivityImage
  126. {
  127. return [UIImage imageWithIdentifier:OTRFacebookActivityImageKey forSize:CGSizeMake(267, 267) andDrawingBlock:^{
  128. UIColor* color = [UIColor colorWithRed: 0.181 green: 0.272 blue: 0.529 alpha: 1];
  129. //// Bezier 2 Drawing
  130. UIBezierPath* bezier2Path = [UIBezierPath bezierPath];
  131. [bezier2Path moveToPoint: CGPointMake(182.41, 262.31)];
  132. [bezier2Path addLineToPoint: CGPointMake(182.41, 162.5)];
  133. [bezier2Path addLineToPoint: CGPointMake(215.91, 162.5)];
  134. [bezier2Path addLineToPoint: CGPointMake(220.92, 123.61)];
  135. [bezier2Path addLineToPoint: CGPointMake(182.41, 123.61)];
  136. [bezier2Path addLineToPoint: CGPointMake(182.41, 98.78)];
  137. [bezier2Path addCurveToPoint: CGPointMake(201.68, 79.84) controlPoint1: CGPointMake(182.41, 87.52) controlPoint2: CGPointMake(185.54, 79.84)];
  138. [bezier2Path addLineToPoint: CGPointMake(222.28, 79.83)];
  139. [bezier2Path addLineToPoint: CGPointMake(222.28, 45.05)];
  140. [bezier2Path addCurveToPoint: CGPointMake(192.27, 43.51) controlPoint1: CGPointMake(218.72, 44.57) controlPoint2: CGPointMake(206.49, 43.51)];
  141. [bezier2Path addCurveToPoint: CGPointMake(142.24, 94.93) controlPoint1: CGPointMake(162.57, 43.51) controlPoint2: CGPointMake(142.24, 61.64)];
  142. [bezier2Path addLineToPoint: CGPointMake(142.24, 123.61)];
  143. [bezier2Path addLineToPoint: CGPointMake(108.66, 123.61)];
  144. [bezier2Path addLineToPoint: CGPointMake(108.66, 162.5)];
  145. [bezier2Path addLineToPoint: CGPointMake(142.24, 162.5)];
  146. [bezier2Path addLineToPoint: CGPointMake(142.24, 262.31)];
  147. [bezier2Path addLineToPoint: CGPointMake(182.41, 262.31)];
  148. [bezier2Path closePath];
  149. bezier2Path.miterLimit = 4;
  150. [color setFill];
  151. [bezier2Path fill];
  152. }];
  153. }
  154. + (UIImage *)duckduckgoImage
  155. {
  156. return [UIImage imageWithIdentifier:OTRDuckDuckGoImageKey forSize:CGSizeMake(100, 100) andDrawingBlock:^{
  157. //// General Declarations
  158. CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
  159. CGContextRef context = UIGraphicsGetCurrentContext();
  160. //// Color Declarations
  161. UIColor* gradientColor = [UIColor colorWithRed: 0.82 green: 0.267 blue: 0.153 alpha: 1];
  162. UIColor* gradientColor2 = [UIColor colorWithRed: 0.898 green: 0.322 blue: 0.145 alpha: 1];
  163. UIColor* gradientColor3 = [UIColor colorWithRed: 0.38 green: 0.463 blue: 0.725 alpha: 1];
  164. UIColor* gradientColor4 = [UIColor colorWithRed: 0.224 green: 0.29 blue: 0.624 alpha: 1];
  165. UIColor* fillColor = [UIColor colorWithRed: 0.835 green: 0.843 blue: 0.847 alpha: 1];
  166. UIColor* fillColor2 = [UIColor colorWithRed: 1 green: 1 blue: 1 alpha: 1];
  167. UIColor* fillColor3 = [UIColor colorWithRed: 0.176 green: 0.31 blue: 0.557 alpha: 1];
  168. UIColor* fillColor4 = [UIColor colorWithRed: 0.992 green: 0.824 blue: 0.039 alpha: 1];
  169. UIColor* fillColor5 = [UIColor colorWithRed: 0.396 green: 0.737 blue: 0.275 alpha: 1];
  170. UIColor* fillColor6 = [UIColor colorWithRed: 0.263 green: 0.635 blue: 0.267 alpha: 1];
  171. //// Gradient Declarations
  172. CGFloat linearGradient3082Locations[] = {0, 1};
  173. CGGradientRef linearGradient3082 = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)@[(id)gradientColor.CGColor, (id)gradientColor2.CGColor], linearGradient3082Locations);
  174. CGFloat linearGradient3084Locations[] = {0.01, 0.69};
  175. CGGradientRef linearGradient3084 = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)@[(id)gradientColor3.CGColor, (id)gradientColor4.CGColor], linearGradient3084Locations);
  176. //// duck
  177. {
  178. //// g3
  179. {
  180. //// path10 Drawing
  181. UIBezierPath* path10Path = UIBezierPath.bezierPath;
  182. [path10Path moveToPoint: CGPointMake(93.75, 50)];
  183. [path10Path addCurveToPoint: CGPointMake(50, 93.75) controlPoint1: CGPointMake(93.75, 74.16) controlPoint2: CGPointMake(74.16, 93.75)];
  184. [path10Path addCurveToPoint: CGPointMake(6.25, 50) controlPoint1: CGPointMake(25.84, 93.75) controlPoint2: CGPointMake(6.25, 74.16)];
  185. [path10Path addCurveToPoint: CGPointMake(50, 6.25) controlPoint1: CGPointMake(6.25, 25.84) controlPoint2: CGPointMake(25.84, 6.25)];
  186. [path10Path addCurveToPoint: CGPointMake(93.75, 50) controlPoint1: CGPointMake(74.16, 6.25) controlPoint2: CGPointMake(93.75, 25.84)];
  187. [path10Path closePath];
  188. [path10Path moveToPoint: CGPointMake(100, 50)];
  189. [path10Path addCurveToPoint: CGPointMake(50, 100) controlPoint1: CGPointMake(100, 77.61) controlPoint2: CGPointMake(77.61, 100)];
  190. [path10Path addCurveToPoint: CGPointMake(0, 50) controlPoint1: CGPointMake(22.39, 100) controlPoint2: CGPointMake(0, 77.61)];
  191. [path10Path addCurveToPoint: CGPointMake(50, 0) controlPoint1: CGPointMake(0, 22.39) controlPoint2: CGPointMake(22.39, 0)];
  192. [path10Path addCurveToPoint: CGPointMake(100, 50) controlPoint1: CGPointMake(77.61, 0) controlPoint2: CGPointMake(100, 22.39)];
  193. [path10Path closePath];
  194. [path10Path moveToPoint: CGPointMake(95.87, 50)];
  195. [path10Path addCurveToPoint: CGPointMake(50, 4.13) controlPoint1: CGPointMake(95.87, 24.67) controlPoint2: CGPointMake(75.33, 4.13)];
  196. [path10Path addCurveToPoint: CGPointMake(4.13, 50) controlPoint1: CGPointMake(24.67, 4.13) controlPoint2: CGPointMake(4.13, 24.67)];
  197. [path10Path addCurveToPoint: CGPointMake(50, 95.87) controlPoint1: CGPointMake(4.13, 75.33) controlPoint2: CGPointMake(24.67, 95.87)];
  198. [path10Path addCurveToPoint: CGPointMake(95.87, 50) controlPoint1: CGPointMake(75.33, 95.87) controlPoint2: CGPointMake(95.87, 75.33)];
  199. [path10Path closePath];
  200. path10Path.miterLimit = 4;
  201. CGContextSaveGState(context);
  202. [path10Path addClip];
  203. CGContextDrawLinearGradient(context, linearGradient3082,
  204. CGPointMake(50, 100),
  205. CGPointMake(50, -0),
  206. kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
  207. CGContextRestoreGState(context);
  208. //// g12
  209. {
  210. //// g14
  211. {
  212. //// g16
  213. {
  214. //// g18
  215. {
  216. //// g20
  217. {
  218. //// g28
  219. {
  220. CGContextSaveGState(context);
  221. CGContextBeginTransparencyLayer(context, NULL);
  222. //// Clip g
  223. UIBezierPath* gPath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(6.05, 6, 87.9, 87.8)];
  224. [gPath addClip];
  225. //// path30 Drawing
  226. UIBezierPath* path30Path = UIBezierPath.bezierPath;
  227. [path30Path moveToPoint: CGPointMake(67.57, 113.86)];
  228. [path30Path addCurveToPoint: CGPointMake(53.97, 84.55) controlPoint1: CGPointMake(66.06, 106.91) controlPoint2: CGPointMake(57.29, 91.2)];
  229. [path30Path addCurveToPoint: CGPointMake(48.83, 62.49) controlPoint1: CGPointMake(50.65, 77.9) controlPoint2: CGPointMake(47.31, 68.53)];
  230. [path30Path addCurveToPoint: CGPointMake(46.86, 52.42) controlPoint1: CGPointMake(49.11, 61.39) controlPoint2: CGPointMake(45.95, 53.01)];
  231. [path30Path addCurveToPoint: CGPointMake(58.59, 50.86) controlPoint1: CGPointMake(53.91, 47.82) controlPoint2: CGPointMake(55.77, 52.92)];
  232. [path30Path addCurveToPoint: CGPointMake(62.53, 49.97) controlPoint1: CGPointMake(60.05, 49.79) controlPoint2: CGPointMake(62.02, 51.74)];
  233. [path30Path addCurveToPoint: CGPointMake(55.18, 27.74) controlPoint1: CGPointMake(64.34, 43.63) controlPoint2: CGPointMake(60.01, 32.57)];
  234. [path30Path addCurveToPoint: CGPointMake(48.45, 24.65) controlPoint1: CGPointMake(53.6, 26.16) controlPoint2: CGPointMake(51.18, 25.18)];
  235. [path30Path addCurveToPoint: CGPointMake(43.3, 20.56) controlPoint1: CGPointMake(47.4, 23.21) controlPoint2: CGPointMake(45.7, 21.83)];
  236. [path30Path addCurveToPoint: CGPointMake(31.81, 16.76) controlPoint1: CGPointMake(40.63, 19.14) controlPoint2: CGPointMake(34.82, 17.26)];
  237. [path30Path addCurveToPoint: CGPointMake(28.36, 17.15) controlPoint1: CGPointMake(29.72, 16.42) controlPoint2: CGPointMake(29.25, 17)];
  238. [path30Path addCurveToPoint: CGPointMake(33.9, 19.28) controlPoint1: CGPointMake(29.19, 17.22) controlPoint2: CGPointMake(33.13, 19.17)];
  239. [path30Path addCurveToPoint: CGPointMake(29.44, 19.91) controlPoint1: CGPointMake(33.13, 19.8) controlPoint2: CGPointMake(30.88, 19.26)];
  240. [path30Path addCurveToPoint: CGPointMake(28.18, 22.07) controlPoint1: CGPointMake(28.71, 20.23) controlPoint2: CGPointMake(28.17, 21.48)];
  241. [path30Path addCurveToPoint: CGPointMake(42.51, 23.74) controlPoint1: CGPointMake(32.29, 21.65) controlPoint2: CGPointMake(38.71, 22.05)];
  242. [path30Path addCurveToPoint: CGPointMake(32.92, 25.51) controlPoint1: CGPointMake(39.49, 24.09) controlPoint2: CGPointMake(34.9, 24.47)];
  243. [path30Path addCurveToPoint: CGPointMake(26.16, 44.06) controlPoint1: CGPointMake(27.18, 28.53) controlPoint2: CGPointMake(24.65, 35.59)];
  244. [path30Path addCurveToPoint: CGPointMake(36.44, 93.61) controlPoint1: CGPointMake(27.67, 52.5) controlPoint2: CGPointMake(34.32, 83.32)];
  245. [path30Path addCurveToPoint: CGPointMake(27.67, 112.35) controlPoint1: CGPointMake(38.55, 103.89) controlPoint2: CGPointMake(31.9, 110.53)];
  246. [path30Path addLineToPoint: CGPointMake(32.21, 112.65)];
  247. [path30Path addLineToPoint: CGPointMake(30.7, 115.98)];
  248. [path30Path addCurveToPoint: CGPointMake(42.17, 114.77) controlPoint1: CGPointMake(36.13, 116.58) controlPoint2: CGPointMake(42.17, 114.77)];
  249. [path30Path addCurveToPoint: CGPointMake(32.81, 119.3) controlPoint1: CGPointMake(40.97, 118.09) controlPoint2: CGPointMake(32.81, 119.3)];
  250. [path30Path addCurveToPoint: CGPointMake(43.08, 118.09) controlPoint1: CGPointMake(32.81, 119.3) controlPoint2: CGPointMake(36.74, 120.51)];
  251. [path30Path addCurveToPoint: CGPointMake(53.36, 114.16) controlPoint1: CGPointMake(49.43, 115.67) controlPoint2: CGPointMake(53.36, 114.16)];
  252. [path30Path addLineToPoint: CGPointMake(56.38, 122.02)];
  253. [path30Path addLineToPoint: CGPointMake(62.12, 116.28)];
  254. [path30Path addLineToPoint: CGPointMake(64.54, 122.32)];
  255. [path30Path addCurveToPoint: CGPointMake(67.57, 113.86) controlPoint1: CGPointMake(64.55, 122.32) controlPoint2: CGPointMake(69.08, 120.81)];
  256. [path30Path closePath];
  257. path30Path.miterLimit = 4;
  258. [fillColor setFill];
  259. [path30Path fill];
  260. //// path32 Drawing
  261. UIBezierPath* path32Path = UIBezierPath.bezierPath;
  262. [path32Path moveToPoint: CGPointMake(69.39, 112.45)];
  263. [path32Path addCurveToPoint: CGPointMake(55.8, 83.13) controlPoint1: CGPointMake(67.89, 105.5) controlPoint2: CGPointMake(59.12, 89.78)];
  264. [path32Path addCurveToPoint: CGPointMake(50.66, 61.08) controlPoint1: CGPointMake(52.47, 76.48) controlPoint2: CGPointMake(49.15, 67.12)];
  265. [path32Path addCurveToPoint: CGPointMake(51.86, 54.89) controlPoint1: CGPointMake(50.94, 59.98) controlPoint2: CGPointMake(50.94, 55.49)];
  266. [path32Path addCurveToPoint: CGPointMake(61.23, 52.67) controlPoint1: CGPointMake(58.9, 50.29) controlPoint2: CGPointMake(58.4, 54.74)];
  267. [path32Path addCurveToPoint: CGPointMake(64.36, 48.56) controlPoint1: CGPointMake(62.69, 51.61) controlPoint2: CGPointMake(63.86, 50.32)];
  268. [path32Path addCurveToPoint: CGPointMake(57.01, 26.32) controlPoint1: CGPointMake(66.18, 42.21) controlPoint2: CGPointMake(61.84, 31.16)];
  269. [path32Path addCurveToPoint: CGPointMake(50.28, 23.23) controlPoint1: CGPointMake(55.44, 24.75) controlPoint2: CGPointMake(53.01, 23.76)];
  270. [path32Path addCurveToPoint: CGPointMake(45.15, 19.14) controlPoint1: CGPointMake(49.24, 21.8) controlPoint2: CGPointMake(47.54, 20.42)];
  271. [path32Path addCurveToPoint: CGPointMake(29.84, 16.73) controlPoint1: CGPointMake(40.63, 16.74) controlPoint2: CGPointMake(35.03, 15.79)];
  272. [path32Path addCurveToPoint: CGPointMake(33.33, 18.63) controlPoint1: CGPointMake(30.67, 16.8) controlPoint2: CGPointMake(32.57, 18.52)];
  273. [path32Path addCurveToPoint: CGPointMake(29.12, 21.06) controlPoint1: CGPointMake(32.17, 19.42) controlPoint2: CGPointMake(29.1, 19.32)];
  274. [path32Path addCurveToPoint: CGPointMake(41.55, 22.99) controlPoint1: CGPointMake(33.24, 20.65) controlPoint2: CGPointMake(37.75, 21.3)];
  275. [path32Path addCurveToPoint: CGPointMake(33.74, 25.12) controlPoint1: CGPointMake(38.53, 23.33) controlPoint2: CGPointMake(35.72, 24.07)];
  276. [path32Path addCurveToPoint: CGPointMake(28, 42.64) controlPoint1: CGPointMake(28, 28.14) controlPoint2: CGPointMake(26.49, 34.18)];
  277. [path32Path addCurveToPoint: CGPointMake(38.27, 92.2) controlPoint1: CGPointMake(29.51, 51.11) controlPoint2: CGPointMake(36.16, 81.92)];
  278. [path32Path addCurveToPoint: CGPointMake(29.51, 110.93) controlPoint1: CGPointMake(40.39, 102.47) controlPoint2: CGPointMake(33.74, 109.12)];
  279. [path32Path addLineToPoint: CGPointMake(34.05, 111.23)];
  280. [path32Path addLineToPoint: CGPointMake(32.54, 114.56)];
  281. [path32Path addCurveToPoint: CGPointMake(44.02, 113.35) controlPoint1: CGPointMake(37.97, 115.16) controlPoint2: CGPointMake(44.02, 113.35)];
  282. [path32Path addCurveToPoint: CGPointMake(34.65, 117.88) controlPoint1: CGPointMake(42.81, 116.68) controlPoint2: CGPointMake(34.65, 117.88)];
  283. [path32Path addCurveToPoint: CGPointMake(44.92, 116.67) controlPoint1: CGPointMake(34.65, 117.88) controlPoint2: CGPointMake(38.58, 119.09)];
  284. [path32Path addCurveToPoint: CGPointMake(55.2, 112.75) controlPoint1: CGPointMake(51.27, 114.25) controlPoint2: CGPointMake(55.2, 112.75)];
  285. [path32Path addLineToPoint: CGPointMake(58.22, 120.6)];
  286. [path32Path addLineToPoint: CGPointMake(63.97, 114.86)];
  287. [path32Path addLineToPoint: CGPointMake(66.39, 120.9)];
  288. [path32Path addCurveToPoint: CGPointMake(69.39, 112.45) controlPoint1: CGPointMake(66.38, 120.91) controlPoint2: CGPointMake(70.91, 119.39)];
  289. [path32Path closePath];
  290. path32Path.miterLimit = 4;
  291. [fillColor2 setFill];
  292. [path32Path fill];
  293. //// path34 Drawing
  294. UIBezierPath* path34Path = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(34.7, 39.9, 6.3, 6.3)];
  295. [fillColor3 setFill];
  296. [path34Path fill];
  297. //// path36 Drawing
  298. UIBezierPath* path36Path = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(38.45, 41.2, 1.6, 1.6)];
  299. [fillColor2 setFill];
  300. [path36Path fill];
  301. //// path38 Drawing
  302. UIBezierPath* path38Path = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(56.3, 38.45, 5.5, 5.5)];
  303. [fillColor3 setFill];
  304. [path38Path fill];
  305. //// path40 Drawing
  306. UIBezierPath* path40Path = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(59.55, 39.6, 1.4, 1.4)];
  307. [fillColor2 setFill];
  308. [path40Path fill];
  309. //// path47 Drawing
  310. UIBezierPath* path47Path = UIBezierPath.bezierPath;
  311. [path47Path moveToPoint: CGPointMake(38.73, 33.87)];
  312. [path47Path addCurveToPoint: CGPointMake(34.02, 34.25) controlPoint1: CGPointMake(38.73, 33.87) controlPoint2: CGPointMake(36.34, 32.79)];
  313. [path47Path addCurveToPoint: CGPointMake(31.78, 37.2) controlPoint1: CGPointMake(31.7, 35.71) controlPoint2: CGPointMake(31.78, 37.2)];
  314. [path47Path addCurveToPoint: CGPointMake(33.84, 33.1) controlPoint1: CGPointMake(31.78, 37.2) controlPoint2: CGPointMake(30.55, 34.45)];
  315. [path47Path addCurveToPoint: CGPointMake(38.73, 33.87) controlPoint1: CGPointMake(37.13, 31.75) controlPoint2: CGPointMake(38.73, 33.87)];
  316. [path47Path closePath];
  317. path47Path.miterLimit = 4;
  318. CGContextSaveGState(context);
  319. [path47Path addClip];
  320. CGContextDrawLinearGradient(context, linearGradient3084,
  321. CGPointMake(31.55, 34.93),
  322. CGPointMake(38.73, 34.93),
  323. kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
  324. CGContextRestoreGState(context);
  325. //// path54 Drawing
  326. UIBezierPath* path54Path = UIBezierPath.bezierPath;
  327. [path54Path moveToPoint: CGPointMake(60.69, 33.65)];
  328. [path54Path addCurveToPoint: CGPointMake(57.63, 32.69) controlPoint1: CGPointMake(60.69, 33.65) controlPoint2: CGPointMake(58.97, 32.67)];
  329. [path54Path addCurveToPoint: CGPointMake(54.14, 33.93) controlPoint1: CGPointMake(54.89, 32.72) controlPoint2: CGPointMake(54.14, 33.93)];
  330. [path54Path addCurveToPoint: CGPointMake(58.11, 31.63) controlPoint1: CGPointMake(54.14, 33.93) controlPoint2: CGPointMake(54.6, 31.05)];
  331. [path54Path addCurveToPoint: CGPointMake(60.69, 33.65) controlPoint1: CGPointMake(60.01, 31.94) controlPoint2: CGPointMake(60.69, 33.65)];
  332. [path54Path closePath];
  333. path54Path.miterLimit = 4;
  334. CGContextSaveGState(context);
  335. [path54Path addClip];
  336. CGContextDrawLinearGradient(context, linearGradient3084,
  337. CGPointMake(54.14, 32.74),
  338. CGPointMake(60.69, 32.74),
  339. kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
  340. CGContextRestoreGState(context);
  341. CGContextEndTransparencyLayer(context);
  342. CGContextRestoreGState(context);
  343. }
  344. }
  345. }
  346. }
  347. }
  348. //// path56 Drawing
  349. UIBezierPath* path56Path = UIBezierPath.bezierPath;
  350. [path56Path moveToPoint: CGPointMake(47.55, 55.31)];
  351. [path56Path addCurveToPoint: CGPointMake(56.34, 49.53) controlPoint1: CGPointMake(47.86, 53.39) controlPoint2: CGPointMake(52.83, 49.75)];
  352. [path56Path addCurveToPoint: CGPointMake(63.89, 48.66) controlPoint1: CGPointMake(59.86, 49.31) controlPoint2: CGPointMake(60.96, 49.36)];
  353. [path56Path addCurveToPoint: CGPointMake(76.49, 45.1) controlPoint1: CGPointMake(66.83, 47.96) controlPoint2: CGPointMake(74.39, 46.07)];
  354. [path56Path addCurveToPoint: CGPointMake(81.21, 49.07) controlPoint1: CGPointMake(78.59, 44.14) controlPoint2: CGPointMake(87.47, 45.58)];
  355. [path56Path addCurveToPoint: CGPointMake(65.98, 54.93) controlPoint1: CGPointMake(78.5, 50.59) controlPoint2: CGPointMake(71.2, 53.37)];
  356. [path56Path addCurveToPoint: CGPointMake(55.87, 56) controlPoint1: CGPointMake(60.77, 56.49) controlPoint2: CGPointMake(57.6, 53.44)];
  357. [path56Path addCurveToPoint: CGPointMake(61.82, 61.41) controlPoint1: CGPointMake(54.49, 58.04) controlPoint2: CGPointMake(55.59, 60.83)];
  358. [path56Path addCurveToPoint: CGPointMake(79.18, 60.05) controlPoint1: CGPointMake(70.23, 62.19) controlPoint2: CGPointMake(78.3, 57.62)];
  359. [path56Path addCurveToPoint: CGPointMake(67.01, 65.6) controlPoint1: CGPointMake(80.08, 62.48) controlPoint2: CGPointMake(71.96, 65.51)];
  360. [path56Path addCurveToPoint: CGPointMake(50.62, 61.3) controlPoint1: CGPointMake(62.07, 65.69) controlPoint2: CGPointMake(52.11, 62.34)];
  361. [path56Path addCurveToPoint: CGPointMake(47.55, 55.31) controlPoint1: CGPointMake(49.13, 60.26) controlPoint2: CGPointMake(47.13, 57.84)];
  362. [path56Path closePath];
  363. path56Path.miterLimit = 4;
  364. [fillColor4 setFill];
  365. [path56Path fill];
  366. }
  367. }
  368. //// tie
  369. {
  370. //// path102 Drawing
  371. UIBezierPath* path102Path = UIBezierPath.bezierPath;
  372. [path102Path moveToPoint: CGPointMake(51.35, 81.53)];
  373. [path102Path addCurveToPoint: CGPointMake(39.34, 77.79) controlPoint1: CGPointMake(51.35, 81.53) controlPoint2: CGPointMake(39.54, 75.23)];
  374. [path102Path addCurveToPoint: CGPointMake(40.72, 91.58) controlPoint1: CGPointMake(39.14, 80.35) controlPoint2: CGPointMake(39.34, 90.79)];
  375. [path102Path addCurveToPoint: CGPointMake(51.95, 86.46) controlPoint1: CGPointMake(42.1, 92.36) controlPoint2: CGPointMake(51.95, 86.46)];
  376. [path102Path addLineToPoint: CGPointMake(51.35, 81.53)];
  377. [path102Path closePath];
  378. path102Path.miterLimit = 4;
  379. [fillColor5 setFill];
  380. [path102Path fill];
  381. //// path104 Drawing
  382. UIBezierPath* path104Path = UIBezierPath.bezierPath;
  383. [path104Path moveToPoint: CGPointMake(55.88, 81.14)];
  384. [path104Path addCurveToPoint: CGPointMake(65.73, 75.43) controlPoint1: CGPointMake(55.88, 81.14) controlPoint2: CGPointMake(63.96, 75.03)];
  385. [path104Path addCurveToPoint: CGPointMake(66.32, 89.02) controlPoint1: CGPointMake(67.5, 75.83) controlPoint2: CGPointMake(67.9, 88.42)];
  386. [path104Path addCurveToPoint: CGPointMake(55.5, 85.82) controlPoint1: CGPointMake(64.74, 89.61) controlPoint2: CGPointMake(55.5, 85.82)];
  387. [path104Path addLineToPoint: CGPointMake(55.88, 81.14)];
  388. [path104Path closePath];
  389. path104Path.miterLimit = 4;
  390. [fillColor5 setFill];
  391. [path104Path fill];
  392. //// path106 Drawing
  393. UIBezierPath* path106Path = UIBezierPath.bezierPath;
  394. [path106Path moveToPoint: CGPointMake(48.49, 82.2)];
  395. [path106Path addCurveToPoint: CGPointMake(49.67, 88.5) controlPoint1: CGPointMake(48.49, 86.33) controlPoint2: CGPointMake(47.9, 88.11)];
  396. [path106Path addCurveToPoint: CGPointMake(55.97, 87.72) controlPoint1: CGPointMake(51.44, 88.9) controlPoint2: CGPointMake(54.79, 88.5)];
  397. [path106Path addCurveToPoint: CGPointMake(55.78, 80.62) controlPoint1: CGPointMake(57.16, 86.93) controlPoint2: CGPointMake(56.17, 81.61)];
  398. [path106Path addCurveToPoint: CGPointMake(48.49, 82.2) controlPoint1: CGPointMake(55.38, 79.64) controlPoint2: CGPointMake(48.49, 80.43)];
  399. [path106Path closePath];
  400. path106Path.miterLimit = 4;
  401. [fillColor6 setFill];
  402. [path106Path fill];
  403. //// tiepath Drawing
  404. UIBezierPath* tiepathPath = UIBezierPath.bezierPath;
  405. [tiepathPath moveToPoint: CGPointMake(49.24, 81.28)];
  406. [tiepathPath addCurveToPoint: CGPointMake(50.42, 87.58) controlPoint1: CGPointMake(49.24, 85.42) controlPoint2: CGPointMake(48.65, 87.19)];
  407. [tiepathPath addCurveToPoint: CGPointMake(56.73, 86.8) controlPoint1: CGPointMake(52.19, 87.98) controlPoint2: CGPointMake(55.54, 87.58)];
  408. [tiepathPath addCurveToPoint: CGPointMake(56.53, 79.7) controlPoint1: CGPointMake(57.91, 86.01) controlPoint2: CGPointMake(56.92, 80.7)];
  409. [tiepathPath addCurveToPoint: CGPointMake(49.24, 81.28) controlPoint1: CGPointMake(56.13, 78.72) controlPoint2: CGPointMake(49.24, 79.51)];
  410. [tiepathPath closePath];
  411. tiepathPath.miterLimit = 4;
  412. [fillColor5 setFill];
  413. [tiepathPath fill];
  414. }
  415. }
  416. //// Cleanup
  417. CGGradientRelease(linearGradient3082);
  418. CGGradientRelease(linearGradient3084);
  419. CGColorSpaceRelease(colorSpace);
  420. }];
  421. }
  422. + (UIImage *)xmppServerImageWithName:(NSString *)name
  423. {
  424. if ([name isEqualToString:@"dukgo"]) {
  425. return [self duckduckgoImage];
  426. }
  427. else {
  428. return [UIImage imageNamed:name inBundle:[OTRAssets resourcesBundle] compatibleWithTraitCollection:nil];
  429. }
  430. }
  431. +(UIImage *)warningImage
  432. {
  433. return [self warningImageWithColor:[OTRColors warnColor]];
  434. }
  435. + (UIImage *)warningImageWithColor:(UIColor *)color;
  436. {
  437. if (!color) {
  438. color = [UIColor blackColor];
  439. }
  440. NSString *identifier = [NSString stringWithFormat:@"%@-%@",OTRWarningImageKey,[color description]];
  441. return [UIImage imageWithIdentifier:identifier forSize:CGSizeMake(92.0, 92.0) andDrawingBlock:^{
  442. //// Bezier Drawing
  443. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  444. [bezierPath moveToPoint: CGPointMake(76.52, 86.78)];
  445. [bezierPath addLineToPoint: CGPointMake(15.48, 86.78)];
  446. [bezierPath addCurveToPoint: CGPointMake(2.43, 80.68) controlPoint1: CGPointMake(9.34, 86.78) controlPoint2: CGPointMake(4.71, 84.61)];
  447. [bezierPath addCurveToPoint: CGPointMake(3.67, 66.32) controlPoint1: CGPointMake(0.16, 76.74) controlPoint2: CGPointMake(0.6, 71.64)];
  448. [bezierPath addLineToPoint: CGPointMake(34.19, 13.47)];
  449. [bezierPath addCurveToPoint: CGPointMake(46, 5.22) controlPoint1: CGPointMake(37.26, 8.15) controlPoint2: CGPointMake(41.45, 5.22)];
  450. [bezierPath addCurveToPoint: CGPointMake(57.81, 13.47) controlPoint1: CGPointMake(50.54, 5.22) controlPoint2: CGPointMake(54.74, 8.15)];
  451. [bezierPath addLineToPoint: CGPointMake(88.33, 66.32)];
  452. [bezierPath addCurveToPoint: CGPointMake(89.56, 80.68) controlPoint1: CGPointMake(91.4, 71.64) controlPoint2: CGPointMake(91.84, 76.74)];
  453. [bezierPath addCurveToPoint: CGPointMake(76.52, 86.78) controlPoint1: CGPointMake(87.29, 84.61) controlPoint2: CGPointMake(82.66, 86.78)];
  454. [bezierPath closePath];
  455. [bezierPath moveToPoint: CGPointMake(52.23, 68.18)];
  456. [bezierPath addCurveToPoint: CGPointMake(46.48, 62.44) controlPoint1: CGPointMake(52.23, 65.01) controlPoint2: CGPointMake(49.65, 62.44)];
  457. [bezierPath addCurveToPoint: CGPointMake(40.74, 68.18) controlPoint1: CGPointMake(43.31, 62.44) controlPoint2: CGPointMake(40.74, 65.01)];
  458. [bezierPath addCurveToPoint: CGPointMake(46.48, 73.92) controlPoint1: CGPointMake(40.74, 71.35) controlPoint2: CGPointMake(43.31, 73.92)];
  459. [bezierPath addCurveToPoint: CGPointMake(52.23, 68.18) controlPoint1: CGPointMake(49.65, 73.92) controlPoint2: CGPointMake(52.23, 71.35)];
  460. [bezierPath closePath];
  461. [bezierPath moveToPoint: CGPointMake(52.38, 33.61)];
  462. [bezierPath addCurveToPoint: CGPointMake(46.48, 27.72) controlPoint1: CGPointMake(52.38, 30.36) controlPoint2: CGPointMake(49.74, 27.72)];
  463. [bezierPath addCurveToPoint: CGPointMake(40.59, 33.61) controlPoint1: CGPointMake(43.23, 27.72) controlPoint2: CGPointMake(40.59, 30.36)];
  464. [bezierPath addLineToPoint: CGPointMake(41.98, 54.55)];
  465. [bezierPath addLineToPoint: CGPointMake(42, 54.55)];
  466. [bezierPath addCurveToPoint: CGPointMake(46.48, 58.68) controlPoint1: CGPointMake(42.2, 56.86) controlPoint2: CGPointMake(44.12, 58.68)];
  467. [bezierPath addCurveToPoint: CGPointMake(50.92, 55.06) controlPoint1: CGPointMake(48.67, 58.68) controlPoint2: CGPointMake(50.5, 57.13)];
  468. [bezierPath addCurveToPoint: CGPointMake(50.97, 54.55) controlPoint1: CGPointMake(50.95, 54.9) controlPoint2: CGPointMake(50.95, 54.72)];
  469. [bezierPath addLineToPoint: CGPointMake(51.01, 54.55)];
  470. [bezierPath addLineToPoint: CGPointMake(52.38, 33.61)];
  471. [bezierPath closePath];
  472. bezierPath.miterLimit = 4;
  473. [color setFill];
  474. [bezierPath fill];
  475. }];
  476. }
  477. + (UIImage *)circleWarningWithColor:(UIColor *)color
  478. {
  479. if (!color) {
  480. color = [UIColor blackColor];
  481. }
  482. NSString *identifier = [NSString stringWithFormat:@"%@-%@",OTRWarningCircleImageKey,color.description];
  483. return [UIImage imageWithIdentifier:identifier forSize:CGSizeMake(60, 60) andDrawingBlock:^{
  484. //// Color Declarations
  485. //// Bezier Drawing
  486. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  487. [bezierPath moveToPoint: CGPointMake(30, 1)];
  488. [bezierPath addCurveToPoint: CGPointMake(1, 30) controlPoint1: CGPointMake(13.98, 1) controlPoint2: CGPointMake(1, 13.98)];
  489. [bezierPath addCurveToPoint: CGPointMake(30, 59) controlPoint1: CGPointMake(1, 46.02) controlPoint2: CGPointMake(13.98, 59)];
  490. [bezierPath addCurveToPoint: CGPointMake(59, 30) controlPoint1: CGPointMake(46.02, 59) controlPoint2: CGPointMake(59, 46.02)];
  491. [bezierPath addCurveToPoint: CGPointMake(30, 1) controlPoint1: CGPointMake(59, 13.98) controlPoint2: CGPointMake(46.02, 1)];
  492. [bezierPath closePath];
  493. [bezierPath moveToPoint: CGPointMake(29.36, 6.59)];
  494. [bezierPath addCurveToPoint: CGPointMake(30, 6.59) controlPoint1: CGPointMake(29.57, 6.57) controlPoint2: CGPointMake(29.78, 6.59)];
  495. [bezierPath addCurveToPoint: CGPointMake(36.32, 12.56) controlPoint1: CGPointMake(33.49, 6.59) controlPoint2: CGPointMake(36.32, 9.26)];
  496. [bezierPath addLineToPoint: CGPointMake(34.82, 33.8)];
  497. [bezierPath addLineToPoint: CGPointMake(34.79, 33.8)];
  498. [bezierPath addCurveToPoint: CGPointMake(34.73, 34.31) controlPoint1: CGPointMake(34.77, 33.98) controlPoint2: CGPointMake(34.76, 34.14)];
  499. [bezierPath addCurveToPoint: CGPointMake(30, 37.98) controlPoint1: CGPointMake(34.28, 36.4) controlPoint2: CGPointMake(32.34, 37.98)];
  500. [bezierPath addCurveToPoint: CGPointMake(25.21, 33.8) controlPoint1: CGPointMake(27.47, 37.98) controlPoint2: CGPointMake(25.43, 36.15)];
  501. [bezierPath addLineToPoint: CGPointMake(25.18, 33.8)];
  502. [bezierPath addLineToPoint: CGPointMake(23.68, 12.56)];
  503. [bezierPath addCurveToPoint: CGPointMake(29.36, 6.59) controlPoint1: CGPointMake(23.68, 9.46) controlPoint2: CGPointMake(26.18, 6.9)];
  504. [bezierPath closePath];
  505. [bezierPath moveToPoint: CGPointMake(30, 41.79)];
  506. [bezierPath addCurveToPoint: CGPointMake(36.13, 47.6) controlPoint1: CGPointMake(33.4, 41.79) controlPoint2: CGPointMake(36.13, 44.38)];
  507. [bezierPath addCurveToPoint: CGPointMake(30, 53.41) controlPoint1: CGPointMake(36.13, 50.82) controlPoint2: CGPointMake(33.4, 53.41)];
  508. [bezierPath addCurveToPoint: CGPointMake(23.87, 47.6) controlPoint1: CGPointMake(26.6, 53.41) controlPoint2: CGPointMake(23.87, 50.82)];
  509. [bezierPath addCurveToPoint: CGPointMake(30, 41.79) controlPoint1: CGPointMake(23.87, 44.38) controlPoint2: CGPointMake(26.6, 41.79)];
  510. [bezierPath closePath];
  511. bezierPath.miterLimit = 4;
  512. bezierPath.usesEvenOddFillRule = YES;
  513. [color setFill];
  514. [bezierPath fill];
  515. }];
  516. }
  517. + (UIImage *)checkmarkWithColor:(UIColor *)color
  518. {
  519. if (!color) {
  520. color = [UIColor blackColor];
  521. }
  522. NSString *identifier = [NSString stringWithFormat:@"%@-%@",OTRCheckmarkImageKey,[color description]];
  523. return [UIImage imageWithIdentifier:identifier forSize:CGSizeMake(100, 100) andDrawingBlock:^{
  524. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  525. [bezierPath moveToPoint: CGPointMake(50, 0)];
  526. [bezierPath addCurveToPoint: CGPointMake(0, 50) controlPoint1: CGPointMake(22.33, 0) controlPoint2: CGPointMake(0, 22.33)];
  527. [bezierPath addCurveToPoint: CGPointMake(50, 100) controlPoint1: CGPointMake(0, 77.67) controlPoint2: CGPointMake(22.33, 100)];
  528. [bezierPath addCurveToPoint: CGPointMake(100, 50) controlPoint1: CGPointMake(77.67, 100) controlPoint2: CGPointMake(100, 77.67)];
  529. [bezierPath addCurveToPoint: CGPointMake(50, 0) controlPoint1: CGPointMake(100, 22.33) controlPoint2: CGPointMake(77.67, 0)];
  530. [bezierPath closePath];
  531. [bezierPath moveToPoint: CGPointMake(79.89, 33.33)];
  532. [bezierPath addLineToPoint: CGPointMake(47.78, 73.44)];
  533. [bezierPath addCurveToPoint: CGPointMake(43.89, 75.44) controlPoint1: CGPointMake(46.78, 74.67) controlPoint2: CGPointMake(45.44, 75.33)];
  534. [bezierPath addCurveToPoint: CGPointMake(43.56, 75.44) controlPoint1: CGPointMake(43.78, 75.44) controlPoint2: CGPointMake(43.67, 75.44)];
  535. [bezierPath addCurveToPoint: CGPointMake(39.78, 73.89) controlPoint1: CGPointMake(42.11, 75.44) controlPoint2: CGPointMake(40.78, 74.89)];
  536. [bezierPath addLineToPoint: CGPointMake(20.56, 55)];
  537. [bezierPath addCurveToPoint: CGPointMake(20.56, 47.33) controlPoint1: CGPointMake(18.44, 52.89) controlPoint2: CGPointMake(18.44, 49.44)];
  538. [bezierPath addCurveToPoint: CGPointMake(28.22, 47.33) controlPoint1: CGPointMake(22.67, 45.22) controlPoint2: CGPointMake(26.11, 45.22)];
  539. [bezierPath addLineToPoint: CGPointMake(43.11, 62)];
  540. [bezierPath addLineToPoint: CGPointMake(71.44, 26.56)];
  541. [bezierPath addCurveToPoint: CGPointMake(79.11, 25.67) controlPoint1: CGPointMake(73.33, 24.22) controlPoint2: CGPointMake(76.78, 23.78)];
  542. [bezierPath addCurveToPoint: CGPointMake(79.89, 33.33) controlPoint1: CGPointMake(81.33, 27.56) controlPoint2: CGPointMake(81.78, 31)];
  543. [bezierPath closePath];
  544. bezierPath.miterLimit = 4;
  545. [color setFill];
  546. [bezierPath fill];
  547. }];
  548. }
  549. + (UIImage *)errorWithColor:(UIColor *)color
  550. {
  551. if (!color) {
  552. color = [UIColor blackColor];
  553. }
  554. NSString *identifier = [NSString stringWithFormat:@"%@-%@",OTRErrorImageKey,[color description]];
  555. return [UIImage imageWithIdentifier:identifier forSize:CGSizeMake(100, 100) andDrawingBlock:^{
  556. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  557. [bezierPath moveToPoint: CGPointMake(50, 0)];
  558. [bezierPath addCurveToPoint: CGPointMake(0, 50) controlPoint1: CGPointMake(22.33, 0) controlPoint2: CGPointMake(0, 22.33)];
  559. [bezierPath addCurveToPoint: CGPointMake(50, 100) controlPoint1: CGPointMake(0, 77.67) controlPoint2: CGPointMake(22.33, 100)];
  560. [bezierPath addCurveToPoint: CGPointMake(100, 50) controlPoint1: CGPointMake(77.67, 100) controlPoint2: CGPointMake(100, 77.67)];
  561. [bezierPath addCurveToPoint: CGPointMake(50, 0) controlPoint1: CGPointMake(100, 22.33) controlPoint2: CGPointMake(77.67, 0)];
  562. [bezierPath closePath];
  563. [bezierPath moveToPoint: CGPointMake(75.89, 69)];
  564. [bezierPath addCurveToPoint: CGPointMake(75.78, 76.67) controlPoint1: CGPointMake(78, 71.11) controlPoint2: CGPointMake(77.89, 74.56)];
  565. [bezierPath addCurveToPoint: CGPointMake(72, 78.22) controlPoint1: CGPointMake(74.78, 77.67) controlPoint2: CGPointMake(73.33, 78.22)];
  566. [bezierPath addCurveToPoint: CGPointMake(68.11, 76.56) controlPoint1: CGPointMake(70.56, 78.22) controlPoint2: CGPointMake(69.11, 77.67)];
  567. [bezierPath addLineToPoint: CGPointMake(50, 57.78)];
  568. [bezierPath addLineToPoint: CGPointMake(31.89, 76.56)];
  569. [bezierPath addCurveToPoint: CGPointMake(28, 78.22) controlPoint1: CGPointMake(30.78, 77.67) controlPoint2: CGPointMake(29.44, 78.22)];
  570. [bezierPath addCurveToPoint: CGPointMake(24.22, 76.67) controlPoint1: CGPointMake(26.67, 78.22) controlPoint2: CGPointMake(25.33, 77.67)];
  571. [bezierPath addCurveToPoint: CGPointMake(24.11, 69) controlPoint1: CGPointMake(22.11, 74.56) controlPoint2: CGPointMake(22, 71.11)];
  572. [bezierPath addLineToPoint: CGPointMake(42.44, 50)];
  573. [bezierPath addLineToPoint: CGPointMake(24.11, 31)];
  574. [bezierPath addCurveToPoint: CGPointMake(24.22, 23.33) controlPoint1: CGPointMake(22, 28.89) controlPoint2: CGPointMake(22.11, 25.44)];
  575. [bezierPath addCurveToPoint: CGPointMake(31.89, 23.44) controlPoint1: CGPointMake(26.33, 21.22) controlPoint2: CGPointMake(29.78, 21.33)];
  576. [bezierPath addLineToPoint: CGPointMake(50, 42.22)];
  577. [bezierPath addLineToPoint: CGPointMake(68.11, 23.56)];
  578. [bezierPath addCurveToPoint: CGPointMake(75.78, 23.44) controlPoint1: CGPointMake(70.22, 21.44) controlPoint2: CGPointMake(73.67, 21.33)];
  579. [bezierPath addCurveToPoint: CGPointMake(75.89, 31.11) controlPoint1: CGPointMake(77.89, 25.56) controlPoint2: CGPointMake(78, 29)];
  580. [bezierPath addLineToPoint: CGPointMake(57.56, 50)];
  581. [bezierPath addLineToPoint: CGPointMake(75.89, 69)];
  582. [bezierPath closePath];
  583. bezierPath.miterLimit = 4;
  584. [color setFill];
  585. [bezierPath fill];
  586. }];
  587. }
  588. + (UIImage *)wifiWithColor:(UIColor *)color
  589. {
  590. if (!color) {
  591. color = [UIColor blackColor];
  592. }
  593. NSString *identifier = [NSString stringWithFormat:@"%@-%@",OTRWifiImageKey,color];
  594. return [UIImage imageWithIdentifier:identifier forSize:CGSizeMake(100, 100) andDrawingBlock:^{
  595. UIBezierPath* bezierPath = [UIBezierPath bezierPath];
  596. [bezierPath moveToPoint: CGPointMake(50, 15.69)];
  597. [bezierPath addCurveToPoint: CGPointMake(0, 35.77) controlPoint1: CGPointMake(30.38, 15.69) controlPoint2: CGPoi