From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/HMQRCodeScanner/HMQRCodeScanner/QRCode/HMScannerMaskView.m | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/HMQRCodeScanner/HMQRCodeScanner/QRCode/HMScannerMaskView.m b/screendisplay/Pods/HMQRCodeScanner/HMQRCodeScanner/QRCode/HMScannerMaskView.m new file mode 100755 index 0000000..7f2701a --- /dev/null +++ b/screendisplay/Pods/HMQRCodeScanner/HMQRCodeScanner/QRCode/HMScannerMaskView.m @@ -0,0 +1,42 @@ +// +// HMScannerMaskView.m +// HMQRCodeScanner +// +// Created by ������ on 16/1/3. +// Copyright �� 2016��� itheima. All rights reserved. +// + +#import "HMScannerMaskView.h" + +@implementation HMScannerMaskView + ++ (instancetype)maskViewWithFrame:(CGRect)frame cropRect:(CGRect)cropRect { + + HMScannerMaskView *maskView = [[self alloc] initWithFrame:frame]; + + maskView.backgroundColor = [UIColor clearColor]; + maskView.cropRect = cropRect; + + return maskView; +} + +- (void)setCropRect:(CGRect)cropRect { + _cropRect = cropRect; + + [self setNeedsDisplay]; +} + +- (void)drawRect:(CGRect)rect { + + CGContextRef ctx = UIGraphicsGetCurrentContext(); + + [[UIColor colorWithWhite:0.0 alpha:0.4] setFill]; + CGContextFillRect(ctx, rect); + + CGContextClearRect(ctx, self.cropRect); + + [[UIColor colorWithWhite:0.95 alpha:1.0] setStroke]; + CGContextStrokeRectWithWidth(ctx, CGRectInset(_cropRect, 1, 1), 1); +} + +@end -- Gitblit v1.8.0