MGImage.h 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // MGImage.h
  3. // MGBankCard
  4. //
  5. // Created by megvii on 15/12/11.
  6. // Copyright © 2015Year megvii. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import <CoreMedia/CoreMedia.h>
  11. #import <AVFoundation/AVFoundation.h>
  12. @interface MGImage : NSObject
  13. /**
  14. * 裁剪图片
  15. *
  16. * @param image 原始图片
  17. * @param bounds 裁剪的区域
  18. *
  19. * @return 裁剪后的图片
  20. */
  21. UIImage* MGCroppedImage(UIImage *image, CGRect bounds);
  22. /**
  23. * 修正图片方向
  24. *
  25. * @param image 原始图片
  26. *
  27. * @return 修正完成的图片
  28. */
  29. UIImage* MGFixOrientationWithImage(UIImage *image);
  30. /**
  31. * 把sampleBuffer转化为图片
  32. *
  33. * @param sampleBuffer sampleBuffer
  34. * @param orientation 图片的方向
  35. *
  36. * @return 转化完成的图片
  37. */
  38. UIImage* MGImageFromSampleBuffer(CMSampleBufferRef sampleBuffer, UIImageOrientation orientation);
  39. /*视频角度转化为数值*/
  40. CGFloat MGAngleOffsetFromPortraitOrientationToOrientation(AVCaptureVideoOrientation orientation);
  41. @end