mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
+ Vastly improved blur Annotation.
This commit is contained in:
@@ -35,23 +35,30 @@
|
|||||||
UIGraphicsBeginImageContext(size);
|
UIGraphicsBeginImageContext(size);
|
||||||
[sourceImage drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
[sourceImage drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
||||||
self.scaledImage = UIGraphicsGetImageFromCurrentImageContext();
|
self.scaledImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||||
|
self.imageLayer.shouldRasterize = YES;
|
||||||
|
self.imageLayer.rasterizationScale = 1;
|
||||||
|
self.imageLayer.magnificationFilter = kCAFilterNearest;
|
||||||
self.imageLayer.contents = (id)self.scaledImage.CGImage;
|
self.imageLayer.contents = (id)self.scaledImage.CGImage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UIGraphicsEndImageContext();
|
UIGraphicsEndImageContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)layoutSubviews {
|
- (void)layoutSubviews {
|
||||||
[super layoutSubviews];
|
[super layoutSubviews];
|
||||||
|
|
||||||
|
[CATransaction begin];
|
||||||
|
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
|
||||||
|
|
||||||
self.imageLayer.frame = self.imageFrame;
|
self.imageLayer.frame = self.imageFrame;
|
||||||
self.imageLayer.masksToBounds = YES;
|
self.imageLayer.masksToBounds = YES;
|
||||||
|
|
||||||
|
[CATransaction commit];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
-(BOOL)resizable {
|
||||||
// Only override drawRect: if you perform custom drawing.
|
return YES;
|
||||||
// An empty implementation adversely affects performance during animation.
|
|
||||||
- (void)drawRect:(CGRect)rect
|
|
||||||
{
|
|
||||||
// Drawing code
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -162,6 +162,8 @@
|
|||||||
self.currentAnnotation.frame = CGRectMake(self.panStart.x, self.panStart.y, bla.x - self.panStart.x, bla.y - self.panStart.y);
|
self.currentAnnotation.frame = CGRectMake(self.panStart.x, self.panStart.y, bla.x - self.panStart.x, bla.y - self.panStart.y);
|
||||||
self.currentAnnotation.movedDelta = CGSizeMake(bla.x - self.panStart.x, bla.y - self.panStart.y);
|
self.currentAnnotation.movedDelta = CGSizeMake(bla.x - self.panStart.x, bla.y - self.panStart.y);
|
||||||
self.currentAnnotation.imageFrame = [self.view convertRect:self.imageView.frame toView:self.currentAnnotation];
|
self.currentAnnotation.imageFrame = [self.view convertRect:self.imageView.frame toView:self.currentAnnotation];
|
||||||
|
[self.currentAnnotation setNeedsLayout];
|
||||||
|
[self.currentAnnotation layoutIfNeeded];
|
||||||
} else {
|
} else {
|
||||||
self.currentAnnotation = nil;
|
self.currentAnnotation = nil;
|
||||||
self.isDrawing = NO;
|
self.isDrawing = NO;
|
||||||
@@ -183,6 +185,8 @@
|
|||||||
self.currentAnnotation.frame = annotationFrame;
|
self.currentAnnotation.frame = annotationFrame;
|
||||||
self.currentAnnotation.imageFrame = [self.view convertRect:self.imageView.frame toView:self.currentAnnotation];
|
self.currentAnnotation.imageFrame = [self.view convertRect:self.imageView.frame toView:self.currentAnnotation];
|
||||||
|
|
||||||
|
[self.currentAnnotation setNeedsLayout];
|
||||||
|
[self.currentAnnotation layoutIfNeeded];
|
||||||
|
|
||||||
[gestureRecognizer setTranslation:CGPointZero inView:self.view];
|
[gestureRecognizer setTranslation:CGPointZero inView:self.view];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user