mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various Fixes
This commit is contained in:
@@ -14,6 +14,51 @@
|
||||
#import "TGMediaPickerPhotoCounterButton.h"
|
||||
#import "TGMediaPickerPhotoStripView.h"
|
||||
|
||||
@implementation TGCameraCornersView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self != nil) {
|
||||
self.contentMode = UIViewContentModeScaleToFill;
|
||||
|
||||
static UIImage *cornersImage = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^
|
||||
{
|
||||
CGSize size = CGSizeMake(50.0, 50.0);
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(50.0, 50.0), false, 0.0f);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGContextSetAlpha(context, 0.5);
|
||||
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
|
||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||
|
||||
CGFloat width = 1.0;
|
||||
CGFloat length = 24.0;
|
||||
CGContextFillRect(context, CGRectMake(0, 0, length, width));
|
||||
CGContextFillRect(context, CGRectMake(0, 0, width, length));
|
||||
|
||||
CGContextFillRect(context, CGRectMake(size.width - length, 0, length, width));
|
||||
CGContextFillRect(context, CGRectMake(size.width - width, 0, width, length));
|
||||
|
||||
CGContextFillRect(context, CGRectMake(0, size.height - width, length, width));
|
||||
CGContextFillRect(context, CGRectMake(0, size.height - length, width, length));
|
||||
|
||||
CGContextFillRect(context, CGRectMake(size.width - length, size.height - width, length, width));
|
||||
CGContextFillRect(context, CGRectMake(size.width - width, size.height - length, width, length));
|
||||
|
||||
cornersImage = [UIGraphicsGetImageFromCurrentImageContext() stretchableImageWithLeftCapWidth:25 topCapHeight:25];
|
||||
UIGraphicsEndImageContext();
|
||||
});
|
||||
|
||||
self.image = cornersImage;
|
||||
self.userInteractionEnabled = false;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface TGCameraMainView ()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user