diff --git a/Yep/Extensions/UIImage+Yep.swift b/Yep/Extensions/UIImage+Yep.swift index 6aee8d66..cf2faa8a 100644 --- a/Yep/Extensions/UIImage+Yep.swift +++ b/Yep/Extensions/UIImage+Yep.swift @@ -300,15 +300,12 @@ extension UIImage { extension UIImage { func renderAtSize(size: CGSize) -> UIImage { - UIGraphicsBeginImageContext(size) - //let scale: CGFloat = self.scale - - //UIGraphicsBeginImageContextWithOptions(self.size, false, scale) + UIGraphicsBeginImageContextWithOptions(size, false, 0) // key let context = UIGraphicsGetCurrentContext() - self.drawInRect(CGRect(origin: CGPointZero, size: size)) + drawInRect(CGRect(origin: CGPointZero, size: size)) let cgImage = CGBitmapContextCreateImage(context) @@ -319,9 +316,7 @@ extension UIImage { return image } - func maskWithImage(maskImage: UIImage) -> UIImage { - //UIGraphicsBeginImageContext(size) let scale = UIScreen.mainScreen().scale UIGraphicsBeginImageContextWithOptions(self.size, false, scale) @@ -332,6 +327,9 @@ extension UIImage { transform = CGAffineTransformConcat(transform, CGAffineTransformMakeTranslation(0.0, self.size.height)) CGContextConcatCTM(context, transform) +// CGContextSetAllowsAntialiasing(context, true) +// CGContextSetShouldAntialias(context, true) + let drawRect = CGRect(origin: CGPointZero, size: self.size) CGContextClipToMask(context, drawRect, maskImage.CGImage) @@ -341,7 +339,7 @@ extension UIImage { let roundImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() - + return roundImage } @@ -350,7 +348,7 @@ extension UIImage { let scale = UIScreen.mainScreen().scale let orientation: UIImageOrientation = tailDirection == .Left ? .Up : .UpMirrored var maskImage = UIImage(CGImage: UIImage(named: "left_tail_image_bubble")!.CGImage, scale: scale, orientation: orientation)! - maskImage = maskImage.resizableImageWithCapInsets(UIEdgeInsets(top: 25, left: 26, bottom: 20, right: 20), resizingMode: UIImageResizingMode.Stretch) + maskImage = maskImage.resizableImageWithCapInsets(UIEdgeInsets(top: 25, left: 27, bottom: 20, right: 20), resizingMode: UIImageResizingMode.Stretch) maskImage = maskImage.renderAtSize(size) let bubbleImage = self.fixRotation().cropToAspectRatio(size.width / size.height).resizeToTargetSize(size).maskWithImage(maskImage) @@ -359,15 +357,15 @@ extension UIImage { } // func maskWithImage(maskImage: UIImage) -> UIImage { -// //UIGraphicsBeginImageContext(size) -// +// +// let scale = UIScreen.mainScreen().scale +// // let colorSpace = CGColorSpaceCreateDeviceRGB() // let bitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedLast.rawValue) -// let context = CGBitmapContextCreate(nil, Int(maskImage.size.width), Int(maskImage.size.height), 8, 0, colorSpace, bitmapInfo) +// let context = CGBitmapContextCreate(nil, Int(maskImage.size.width * scale), Int(maskImage.size.height * scale), 8, 0, colorSpace, bitmapInfo) // -//// var transform = CGAffineTransformConcat(CGAffineTransformIdentity, CGAffineTransformMakeScale(1.0, -1.0)) -//// transform = CGAffineTransformConcat(transform, CGAffineTransformMakeTranslation(0.0, self.size.height)) -//// CGContextConcatCTM(context, transform) +// CGContextSetAllowsAntialiasing(context, true) +// CGContextSetShouldAntialias(context, true) // // let drawRect = CGRect(origin: CGPointZero, size: self.size) // @@ -376,9 +374,8 @@ extension UIImage { // CGContextDrawImage(context, drawRect, self.CGImage) // // let cgImage = CGBitmapContextCreateImage(context)! +// let roundImage = UIImage(CGImage: cgImage)! // -// //UIGraphicsEndImageContext() -// -// return UIImage(CGImage: cgImage)! +// return roundImage // } } diff --git a/Yep/Images.xcassets/left_tail_image_bubble.imageset/Contents.json b/Yep/Images.xcassets/left_tail_image_bubble.imageset/Contents.json index f8f69a16..a442e89c 100644 --- a/Yep/Images.xcassets/left_tail_image_bubble.imageset/Contents.json +++ b/Yep/Images.xcassets/left_tail_image_bubble.imageset/Contents.json @@ -14,7 +14,7 @@ "bottom" : 20, "top" : 25, "right" : 20, - "left" : 26 + "left" : 27 } } } diff --git a/Yep/Images.xcassets/left_tail_image_bubble.imageset/left_tail_image_bubble.pdf b/Yep/Images.xcassets/left_tail_image_bubble.imageset/left_tail_image_bubble.pdf index 906e35d1..29e55f99 100644 Binary files a/Yep/Images.xcassets/left_tail_image_bubble.imageset/left_tail_image_bubble.pdf and b/Yep/Images.xcassets/left_tail_image_bubble.imageset/left_tail_image_bubble.pdf differ