SMPixelFree.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // SMPixelFree.h
  3. // SMBeautyEngine
  4. //
  5. // Created by mumu on 2020/7/27.
  6. // Copyright © 2020 孙慕. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <OpenGLES/EAGL.h>
  10. #import <OpenGLES/ES2/gl.h>
  11. #import <OpenGLES/ES2/glext.h>
  12. #import "pixelFree_c.hpp"
  13. NS_ASSUME_NONNULL_BEGIN
  14. __attribute__((visibility("default"))) @interface SMPixelFree : NSObject
  15. /// 初始化
  16. /// @param context sdk 运行的上线文,context != nil 所有着色器程序将在这里初始化, 否在视频第一帧处理时候初始化
  17. - (instancetype)initWithProcessContext:(EAGLContext *)context srcFilterPath:(NSString *)filterPath authFile:(NSString *)authFile;
  18. /*!
  19. @property glContext
  20. @brief OpenGL context
  21. @since v1.0.0
  22. */
  23. @property(nonatomic, strong, readonly) EAGLContext* glContext;
  24. /**
  25. 处理纹理数据
  26. @param texture 纹理数据
  27. @param width 宽度
  28. @param height 高度
  29. */
  30. - (void)processWithTexture:(GLuint)texture width:(GLint)width height:(GLint)height;
  31. /**
  32. 处理cpu数据
  33. @param pixelBuffer 纹理数据
  34. @param rotationMode 人脸检测方向
  35. */
  36. - (int)processWithBuffer:(CVPixelBufferRef)pixelBuffer rotationMode:(PFRotationMode)rotationMode;
  37. /**
  38. 图片处理
  39. @param image 纹理数据
  40. @param rotationMode 人脸检测方向
  41. @return 处理后效果图
  42. */
  43. - (UIImage *)processWithImage:(UIImage *)image rotationMode:(PFRotationMode)rotationMode;
  44. - (void)pixelFreeSetBeautyFiterParam:(int)key value:(void *)value;
  45. // 加载美颜bundle
  46. - (void)createBeautyItemFormBundle:(void*)data size:(int)sz;
  47. - (void)pixelFreeGetFaceRect:(float *)faceRect;
  48. - (int)getPixelFreeFaceNum;
  49. // 图片调色设置
  50. - (int)pixelFreeSetColorGrading:(PFImageColorGrading *)imageColorGrading;
  51. // HLS 功能
  52. - (int)pixelFreeAddHLSFilter:(PFHLSFilterParams*)HLSFilterParams;
  53. - (int)pixelFreeDeleteHLSFilter:(int)handle;
  54. - (int)pixelFreeChangeHLSFilter:(int)handle params:(PFHLSFilterParams*)HLSFilterParams;
  55. // 自定义贴纸专属
  56. - (void)pixelFreeSetFiterStickerWithPath:(NSString *)path;
  57. @end
  58. NS_ASSUME_NONNULL_END