123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- #import "StyleDIY.h"
- #import <AVFoundation/AVFoundation.h>
- @implementation StyleDIY
- #pragma mark -模仿qq界面
- + (LBXScanViewStyle*)qqStyle
- {
-
-
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
-
-
- style.centerUpOffset = 44;
-
-
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Outer;
-
-
- style.photoframeLineW = 6;
-
-
- style.photoframeAngleW = 24;
-
-
- style.photoframeAngleH = 24;
-
-
- style.anmiationStyle = LBXScanViewAnimationStyle_LineMove;
-
-
- style.animationImage = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_light_green"];
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- #pragma mark --模仿支付宝
- + (LBXScanViewStyle*)ZhiFuBaoStyle
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
- style.centerUpOffset = 60;
- style.xScanRetangleOffset = 30;
-
- if ([UIScreen mainScreen].bounds.size.height <= 480 )
- {
-
- style.centerUpOffset = 40;
- style.xScanRetangleOffset = 20;
- }
-
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Inner;
- style.photoframeLineW = 2.0;
- style.photoframeAngleW = 16;
- style.photoframeAngleH = 16;
-
- style.isNeedShowRetangle = NO;
- style.anmiationStyle = LBXScanViewAnimationStyle_NetGrid;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
-
- UIImage *imgFullNet = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_full_net"];
- style.animationImage = imgFullNet;
-
- return style;
- }
- #pragma mark -无边框,内嵌4个角
- + (LBXScanViewStyle*)InnerStyle
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
- style.centerUpOffset = 44;
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Inner;
- style.photoframeLineW = 3;
- style.photoframeAngleW = 18;
- style.photoframeAngleH = 18;
- style.isNeedShowRetangle = NO;
-
- style.anmiationStyle = LBXScanViewAnimationStyle_LineMove;
-
-
- UIImage *imgLine = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_light_green"];
- style.animationImage = imgLine;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- #pragma mark -无边框,内嵌4个角
- + (LBXScanViewStyle*)weixinStyle
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
-
- style.centerUpOffset = 44;
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Inner;
- style.photoframeLineW = 2;
- style.photoframeAngleW = 18;
- style.photoframeAngleH = 18;
- style.isNeedShowRetangle = YES;
- style.anmiationStyle = LBXScanViewAnimationStyle_LineMove;
- style.colorAngle = [UIColor colorWithRed:0./255 green:200./255. blue:20./255. alpha:1.0];
-
-
- UIImage *imgLine = [UIImage imageNamed:@"CodeScan.bundle/qrcode_Scan_weixin_Line"];
- style.animationImage = imgLine;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- #pragma mark -框内区域识别
- + (LBXScanViewStyle*)recoCropRect
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
-
- style.centerUpOffset = 44;
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_On;
- style.photoframeLineW = 6;
- style.photoframeAngleW = 24;
- style.photoframeAngleH = 24;
- style.isNeedShowRetangle = YES;
- style.anmiationStyle = LBXScanViewAnimationStyle_NetGrid;
-
- style.xScanRetangleOffset = 80;
-
-
- UIImage *imgPartNet = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_part_net"];
- style.animationImage = imgPartNet;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- #pragma mark -4个角在矩形框线上,网格动画
- + (LBXScanViewStyle*)OnStyle
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
- style.centerUpOffset = 44;
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_On;
- style.photoframeLineW = 6;
- style.photoframeAngleW = 24;
- style.photoframeAngleH = 24;
- style.isNeedShowRetangle = YES;
- style.anmiationStyle = LBXScanViewAnimationStyle_NetGrid;
-
-
- UIImage *imgPartNet = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_part_net"];
- style.animationImage = imgPartNet;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- #pragma mark -自定义4个角及矩形框颜色
- + (LBXScanViewStyle*)changeColor
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
-
- style.centerUpOffset = 44;
-
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_On;
-
- style.photoframeLineW = 6;
-
- style.photoframeAngleW = 24;
-
- style.photoframeAngleH = 24;
-
- style.isNeedShowRetangle = YES;
-
- style.anmiationStyle = LBXScanViewAnimationStyle_NetGrid;
-
- style.animationImage = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_part_net"];;
-
- style.colorAngle = [UIColor colorWithRed:65./255. green:174./255. blue:57./255. alpha:1.0];
-
- style.colorRetangleLine = [UIColor colorWithRed:247/255. green:202./255. blue:15./255. alpha:1.0];
-
- style.notRecoginitonArea = [UIColor colorWithRed:247./255. green:202./255 blue:15./255 alpha:0.2];
-
- return style;
- }
- #pragma mark -改变扫码区域位置
- + (LBXScanViewStyle*)changeSize
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
-
-
- style.centerUpOffset = 60;
-
- style.xScanRetangleOffset = 100;
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_On;
- style.photoframeLineW = 6;
- style.photoframeAngleW = 24;
- style.photoframeAngleH = 24;
- style.isNeedShowRetangle = YES;
- style.anmiationStyle = LBXScanViewAnimationStyle_LineMove;
-
-
- UIImage *imgLine = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_light_green"];
- style.animationImage = imgLine;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- #pragma mark -非正方形,可以用在扫码条形码界面
- + (UIImage*) createImageWithColor: (UIColor*) color
- {
- CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
- UIGraphicsBeginImageContext(rect.size);
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGContextSetFillColorWithColor(context, [color CGColor]);
- CGContextFillRect(context, rect);
- UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return theImage;
- }
- + (LBXScanViewStyle*)notSquare
- {
-
- LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
- style.centerUpOffset = 44;
- style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Inner;
- style.photoframeLineW = 4;
- style.photoframeAngleW = 28;
- style.photoframeAngleH = 16;
- style.isNeedShowRetangle = NO;
-
- style.anmiationStyle = LBXScanViewAnimationStyle_LineStill;
- style.animationImage = [[self class] createImageWithColor:[UIColor redColor]];
-
-
- style.whRatio = 4.3/2.18;
-
- style.xScanRetangleOffset = 30;
-
- style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
-
- return style;
- }
- @end
|