VAPMacros.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // VAPMacros.h
  2. // Tencent is pleased to support the open source community by making vap available.
  3. //
  4. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  5. //
  6. // Licensed under the MIT License (the "License"); you may not use this file except in
  7. // compliance with the License. You may obtain a copy of the License at
  8. //
  9. // http://opensource.org/licenses/MIT
  10. //
  11. // Unless required by applicable law or agreed to in writing, software distributed under the License is
  12. // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  13. // either express or implied. See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #ifndef VAPMacros_h
  16. #define VAPMacros_h
  17. #define STRINGIZE(x) #x
  18. #define STRINGIZE2(x) STRINGIZE(x)
  19. #define SHADER_STRING(text) @ STRINGIZE2(text)
  20. #ifndef HWDSYNTH_DYNAMIC_PROPERTY_OBJECT
  21. #define HWDSYNTH_DYNAMIC_PROPERTY_OBJECT(_dynamic_getter_, _dynamic_setter_, _association_policy_) \
  22. - (void)_dynamic_setter_ : (id)object { \
  23. [self willChangeValueForKey:@#_dynamic_getter_]; \
  24. objc_setAssociatedObject(self, _cmd, object, _association_policy_); \
  25. [self didChangeValueForKey:@#_dynamic_getter_]; \
  26. } \
  27. - (id)_dynamic_getter_ { \
  28. return objc_getAssociatedObject(self, @selector(_dynamic_setter_:)); \
  29. }
  30. #endif
  31. #ifndef HWDSYNTH_DYNAMIC_PROPERTY_CTYPE
  32. #define HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(_dynamic_getter_, _dynamic_setter_, _type_) \
  33. - (void)_dynamic_setter_ : (_type_)object { \
  34. [self willChangeValueForKey:@#_dynamic_getter_]; \
  35. NSValue *value = [NSValue value:&object withObjCType:@encode(_type_)]; \
  36. objc_setAssociatedObject(self, _cmd, value, OBJC_ASSOCIATION_RETAIN); \
  37. [self didChangeValueForKey:@#_dynamic_getter_]; \
  38. } \
  39. - (_type_)_dynamic_getter_ { \
  40. _type_ cValue = { 0 }; \
  41. NSValue *value = objc_getAssociatedObject(self, @selector(_dynamic_setter_:)); \
  42. [value getValue:&cValue]; \
  43. return cValue; \
  44. }
  45. #endif
  46. #import "QGHWDShaderTypes.h"
  47. #import <UIKit/UIKit.h>
  48. #import "QGVAPMaskInfo.h"
  49. extern NSInteger const kQGHWDMP4DefaultFPS; //默认fps 25
  50. extern NSInteger const kQGHWDMP4MinFPS; //最小fps 1
  51. extern NSInteger const QGHWDMP4MaxFPS; //最大fps 60
  52. extern NSInteger const VapMaxCompatibleVersion; //最大兼容版本
  53. @class QGVAPSourceDisplayItem;
  54. typedef UIView VAPView; //特效播放容器
  55. /* mp4素材中每一帧alpha通道数据的位置*/
  56. typedef NS_ENUM(NSInteger, QGHWDTextureBlendMode){
  57. QGHWDTextureBlendMode_AlphaLeft = 0, // 左侧alpha
  58. QGHWDTextureBlendMode_AlphaRight = 1, // 右侧alpha
  59. QGHWDTextureBlendMode_AlphaTop = 2, // 上侧alpha
  60. QGHWDTextureBlendMode_AlphaBottom = 3, // 下测alpha
  61. };
  62. typedef void(^VAPImageCompletionBlock)(UIImage * image, NSError * error,NSString *imageURL);
  63. typedef void(^VAPGestureEventBlock)(UIGestureRecognizer *gestureRecognizer, BOOL insideSource, QGVAPSourceDisplayItem *source);
  64. #endif /* VAPMacros_h */