QGVAPConfigModel.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // Tencent is pleased to support the open source community by making vap available.
  2. //
  3. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  4. //
  5. // Licensed under the MIT License (the "License"); you may not use this file except in
  6. // compliance with the License. You may obtain a copy of the License at
  7. //
  8. // http://opensource.org/licenses/MIT
  9. //
  10. // Unless required by applicable law or agreed to in writing, software distributed under the License is
  11. // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  12. // either express or implied. See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. #import <AppKit/AppKit.h>
  16. typedef NSString * VapAttachmentVariable NS_EXTENSIBLE_STRING_ENUM;//预定义变量
  17. typedef NSString * VapAttachmentFitType NS_EXTENSIBLE_STRING_ENUM;//资源适配类型
  18. typedef NSString * VapAttachmentSourceType NS_EXTENSIBLE_STRING_ENUM;//资源类型
  19. typedef NSString * VapAttachmentLoadType NS_EXTENSIBLE_STRING_ENUM;//资源加载类型
  20. typedef NSString * VapAttachmentSourceStyle NS_EXTENSIBLE_STRING_ENUM;//字体
  21. typedef NSString * VapAttachmentMaskType NS_EXTENSIBLE_STRING_ENUM;//遮罩融合类型
  22. //资源适配类型
  23. APPKIT_EXTERN VapAttachmentFitType const kVapAttachmentFitTypeFitXY; //按指定尺寸缩放
  24. APPKIT_EXTERN VapAttachmentFitType const kVapAttachmentFitTypeCenterFull; //默认按资源尺寸展示,如果资源尺寸小于遮罩,则等比缩放至可填满
  25. //资源类型
  26. APPKIT_EXTERN VapAttachmentSourceType const kVapAttachmentSourceTypeTextStr; //文字
  27. APPKIT_EXTERN VapAttachmentSourceType const kVapAttachmentSourceTypeImgUrl; //图片
  28. //资源加载类型
  29. APPKIT_EXTERN VapAttachmentLoadType const kVapAttachmentLoadTypeLocal;
  30. APPKIT_EXTERN VapAttachmentLoadType const kVapAttachmentLoadTypeNet;
  31. //字体
  32. APPKIT_EXTERN VapAttachmentSourceStyle const kVapAttachmentSourceStyleBoldText; //粗体
  33. //遮罩融合类型
  34. APPKIT_EXTERN VapAttachmentMaskType const kVapAttachmentMaskTypeSrcOut; //表示去除遮挡区域
  35. APPKIT_EXTERN VapAttachmentMaskType const kVapAttachmentMaskTypeSrcIn; //表示根据遮罩形状裁剪
  36. APPKIT_EXTERN VapAttachmentMaskType const kVapAttachmentMaskTypeSrcMix;
  37. APPKIT_EXTERN NSInteger const kVapLayoutMaxWidth;
  38. typedef NS_ENUM(NSInteger, VapxAlphaPostion){
  39. VapxAlphaPostion_leftTop,
  40. VapxAlphaPostion_leftCenter,
  41. VapxAlphaPostion_leftBottom,
  42. VapxAlphaPostion_bottomLeft,
  43. VapxAlphaPostion_bottomCenter,
  44. VapxAlphaPostion_bottomRight,
  45. VapxAlphaPostion_rightBottom,
  46. VapxAlphaPostion_rightCenter,
  47. VapxAlphaPostion_rightTop,
  48. VapxAlphaPostion_topRight,
  49. VapxAlphaPostion_topCenter,
  50. VapxAlphaPostion_topLeft
  51. };
  52. typedef NS_ENUM(NSInteger, QGVAPOrientation){
  53. QGVAPOrientation_None = 0, // 兼容
  54. QGVAPOrientation_Portrait = 1, // 竖屏
  55. QGVAPOrientation_landscape = 2, // 横屏
  56. };
  57. //https://docs.qq.com/sheet/DTGl0bXdidFVkS3pn?tab=7od8yj&c=C25A0I0
  58. @class QGVAPCommonInfo,QGVAPSourceInfo,QGVAPMergedInfo;
  59. @interface QGVAPConfigModel : NSObject
  60. @property (nonatomic, strong) QGVAPCommonInfo *info;
  61. @property (nonatomic, strong) NSArray<QGVAPSourceInfo *> *resources;
  62. @property (nonatomic, strong) NSDictionary<NSNumber *, NSArray<QGVAPMergedInfo*> *> *mergedConfig; ///@{帧,@[多个融合信息]}
  63. - (NSString *)jsonString;
  64. @end
  65. #pragma mark - 整体信息
  66. @interface QGVAPCommonInfo : NSObject
  67. @property (nonatomic, assign) NSInteger version;
  68. @property (nonatomic, assign) NSInteger framesCount;
  69. @property (nonatomic, assign) CGSize size;
  70. @property (nonatomic, assign) CGSize videoSize;
  71. @property (nonatomic, assign) QGVAPOrientation targetOrientaion;
  72. @property (nonatomic, assign) NSInteger fps;
  73. @property (nonatomic, assign) BOOL isMerged;
  74. @property (nonatomic, assign) CGRect alphaAreaRect;
  75. @property (nonatomic, assign) CGRect rgbAreaRect;
  76. @property (nonatomic, assign) VapxAlphaPostion alphaPostion;
  77. @property (nonatomic, strong) NSArray *alphaPaths;
  78. @property (nonatomic, strong) NSArray *rgbPaths;
  79. - (NSString *)jsonString;
  80. @end
  81. #pragma mark - 渲染资源信息
  82. @interface QGVAPSourceInfo : NSObject
  83. //原始信息
  84. @property (nonatomic, strong) NSString *srcID;
  85. @property (nonatomic, strong) VapAttachmentSourceType type;
  86. @property (nonatomic, strong) VapAttachmentLoadType loadType;
  87. @property (nonatomic, strong) NSString *contentTag;
  88. @property (nonatomic, strong) NSString *color;
  89. @property (nonatomic, strong) VapAttachmentSourceStyle style;
  90. @property (nonatomic, assign) CGSize size;
  91. @property (nonatomic, strong) VapAttachmentFitType fitType;
  92. - (NSString *)jsonString;
  93. @end
  94. #pragma mark - 融合信息
  95. @interface QGVAPMergedInfo : NSObject
  96. @property (nonatomic, strong) QGVAPSourceInfo *source;
  97. @property (nonatomic, assign) NSInteger renderIndex;
  98. @property (nonatomic, assign) CGRect renderRect;
  99. @property (nonatomic, assign) BOOL needMask;
  100. @property (nonatomic, assign) CGRect maskRect;
  101. @property (nonatomic, assign) NSInteger maskRotation;
  102. //
  103. @property (nonatomic, strong) NSString *tempPathForMask;
  104. - (NSString *)jsonString;
  105. @end