This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converted from: https://github.com/GenerallyHelpfulSoftware/SVGgh/blob/master/SVGgh/SVGRenderer/SVGPathGenerator.m#L1873 | |
extension UIBezierPath { | |
var svgPathString: String { | |
var finalString = "" | |
let cgPath = self.cgPath | |
var currentPoint = CGPoint.zero | |
cgPath.applyWithBlock { (aPathElement) in | |
switch aPathElement.pointee.type { | |
case .moveToPoint: | |
currentPoint = aPathElement.pointee.points[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let preferredTransform = originalVideoTrack.preferredTransform | |
let finalTransform: CGAffineTransform | |
// These if statements were added to handle time lapse videos which use abcd for transforms | |
// and not tx, ty | |
if preferredTransform.a == -1 && preferredTransform.d == -1 { | |
transform = transform.scaledBy(x: -1, y: -1) | |
finalTransform = transform.translatedBy(x: -outputVideoSize.width, y: -outputVideoSize.height) | |
} else if preferredTransform.b == 1 && preferredTransform.c == -1 { | |
transform = transform.rotated(by: CGFloat.pi/2) | |
finalTransform = transform.translatedBy(x: 0, y: -outputVideoSize.width) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)setupButton:(UIButton *)button bounds:(CGRect)bounds cornerRadius:(CGFloat)cornerRadius bgColor:(UIColor *)bgColor | |
{ | |
UIImage *image = [[self class] imageWithFrame:bounds | |
cornerRadius:cornerRadius | |
roundingCorners:UIRectCornerBottomLeft | |
bgColor:bgColor]; | |
[button setBackgroundImage:image forState:UIControlStateNormal]; | |
button.backgroundColor = [UIColor clearColor]; | |
[button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)applyBorderColor:(UIColor *)color toImage:(UIImage*)toImage{ | |
UIGraphicsBeginImageContextWithOptions(toImage.size, NO, toImage.scale); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextTranslateCTM(context, 0, toImage.size.height); | |
CGContextScaleCTM(context, 1.0, -1.0); | |
CGContextSetBlendMode(context, kCGBlendModeNormal); | |
CGRect rect = CGRectMake(0, 0, toImage.size.width, toImage.size.height); | |
// Create gradient |