123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- //
- // FULiveDefine.h
- // FULive
- //
- // Created by L on 2018/8/1.
- // Copyright © 2018年 L. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #import "UIColor+FU.h"
- #import "FURenderKitManager.h"
- #pragma mark - 宏
- #define FUScreenWidth (CGRectGetWidth([UIScreen mainScreen].bounds))
- #define FUScreenHeight (CGRectGetHeight([UIScreen mainScreen].bounds))
- /// 状态栏高度
- #define FUStatusBarHeight (CGRectGetHeight([UIApplication sharedApplication].statusBarFrame))
- #define FUDocumentPath NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject
- #define FUColorFromHexString(aHex) [UIColor colorWithHexColorString:aHex]
- #define FUColorFromHexStringWithAlpha(aHex, aAlpha) [UIColor colorWithHexColorString:aHex alpha:aAlpha]
- #define FUColorFromHex(aHex) [UIColor colorWithHex:aHex]
- #define FUColorFromHexWithAlpha(aHex, aAlpha) [UIColor colorWithHex:aHex alpha:aAlpha]
- #define FULocalizedString(key) NSLocalizedString(key, nil)
- #define FUPicturePixelMaxSize ([FURenderKitManager sharedManager].devicePerformanceLevel == FUDevicePerformanceLevelHigh ? 12746752 : 5760000)
- #define FUStickersPath [FUDocumentPath stringByAppendingPathComponent:@"FUStickers"]
- #define FUStickerIconsPath [FUDocumentPath stringByAppendingPathComponent:@"FUStickerIcons"]
- #define FUStickerBundlesPath [FUDocumentPath stringByAppendingPathComponent:@"FUStickerBundles"]
- #pragma mark - 枚举
- /// 特效模块分组
- typedef NS_ENUM(NSUInteger, FUGroup) {
- FUGroupFace = 0,
- FUGroupBody,
- FUGroupContentService
- };
- /// 特效模块
- typedef NS_ENUM(NSUInteger, FUModule) {
- FUModuleBeauty = 0,
- FUModuleMakeup,
- FUModuleStyle,
- FUModuleSticker,
- FUModuleAnimoji,
- FUModuleHairBeauty,
- FUModuleLightMakeup,
- FUModuleARMask,
- FUModuleHilarious,
- FUModuleFaceFusion,
- FUModuleExpressionRecognition,
- FUModuleMusicFilter,
- FUModuleDistortingMirror,
- FUModuleBodyBeauty,
- FUModuleBodyAvatar,
- FUModuleSegmentation,
- FUModuleGestureRecognition,
- FUModuleGreenScreen,
- FUModuleQualityTicker
- };
- /// AI模型分类
- typedef NS_OPTIONS(NSUInteger, FUAIModelType) {
- FUAIModelTypeFace = 1 << 0, // 人脸
- FUAIModelTypeHuman = 1 << 1, // 人体
- FUAIModelTypeHand = 1 << 2 // 手势
- };
- /// 跟踪部位
- typedef NS_ENUM(NSInteger, FUDetectingParts) {
- FUDetectingPartsFace = 0, // 人脸
- FUDetectingPartsHuman, // 人体
- FUDetectingPartsHand, // 手势
- FUDetectingPartsNone // 不需要跟踪
- };
- /// 子妆容类型
- typedef NS_ENUM(NSUInteger, FUSingleMakeupType) {
- FUSingleMakeupTypeFoundation, // 粉底
- FUSingleMakeupTypeLip, // 口红
- FUSingleMakeupTypeBlusher, // 腮红
- FUSingleMakeupTypeEyebrow, // 眉毛
- FUSingleMakeupTypeEyeshadow, // 眼影
- FUSingleMakeupTypeEyeliner, // 眼线
- FUSingleMakeupTypeEyelash, // 睫毛
- FUSingleMakeupTypeHighlight, // 高光
- FUSingleMakeupTypeShadow, // 阴影
- FUSingleMakeupTypePupil // 美瞳
- };
- #pragma mark - 内联函数
- static inline BOOL FUDeviceIsiPhoneXStyle() {
- UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
- if (@available(iOS 11.0, *)) {
- CGFloat bottomInsets = keyWindow.safeAreaInsets.bottom;
- if (bottomInsets > 0) {
- return YES;
- }
- }
- return NO;
- }
- static inline CGFloat FUHeightIncludeBottomSafeArea(CGFloat height) {
- if (@available(iOS 11.0, *)) {
- height += [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
- }
- return height;
- }
- static inline CGFloat FUHeightIncludeTopSafeArea(CGFloat height) {
- if (@available(iOS 11.0, *)) {
- height += [UIApplication sharedApplication].delegate.window.safeAreaInsets.top;
- }
- return height;
- }
- static inline NSString * FUCurrentDateString() {
- NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
- formatter.dateFormat = @"YYYYMMddhhmmssSS";
- NSDate *date = [NSDate date];
- NSString *dateString = [formatter stringFromDate:date];
- return dateString;
- }
|