ImageUtil.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // ImageUtil.h
  3. // kneet2
  4. //
  5. // Created by Jason Lee on 10/15/15.
  6. // Copyright © 2015 ntels. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @protocol ImageUtilDelegate <NSObject>
  10. @optional
  11. - (void)didFinishPickingImage:(UIImage *)image;
  12. @end
  13. @interface ImageUtil : NSObject
  14. #pragma mark - properties
  15. @property (weak, nonatomic) id <ImageUtilDelegate> delegate;
  16. #pragma mark - instance methos
  17. - (void)prepareImagePicker:(UIViewController *)vc;
  18. - (void)setPresentViewController:(UIViewController *)vc;
  19. - (void)showImagePickerController:(UIImagePickerControllerSourceType)sourceType ;
  20. #pragma mark - class methods
  21. /**
  22. 해당 컬러의 이미지 객체를 생성
  23. @param color
  24. @return UIImage 이미지 객체
  25. */
  26. + (UIImage *)imageWithColor:(UIColor *)color height:(CGFloat)height;
  27. + (CGFloat)getImageAspectRatio:(UIImage *)image;
  28. + (UIImage *)resizeImage:(UIImage *)image width:(float)resizeWidth height:(float)resizeHeight;
  29. + (UIImage *)resizeImage:(UIImage *)image width:(float)resizeWidth;
  30. + (UIImage *)resizeImage:(UIImage *)image height:(float)resizeHeight;
  31. + (CGRect)convertCropRect:(CGRect)cropRect image:(UIImage *)image;
  32. + (UIImage *)croppedImage:(CGRect)cropRect image:(UIImage *)image;
  33. + (UIImage *)resizeImage:(UIImage *)image size:(CGSize)size imageOrientation:(UIImageOrientation)imageOrientation;
  34. + (UIImage *)getMaskedImageWithSourchImage:(UIImage *)srcImage andMaskImage:(UIImage *)maskImage;
  35. + (UIImage *)imageToGrayScale:(UIImage *)image;
  36. + (UIImage *)stretchedImage:(UIImage *)srcImage expectSize:(CGSize)size;
  37. + (UIImage*)resizableImageWithCapInsets:(UIEdgeInsets)make resizingMode:(UIImageResizingMode)resizingMode img:(UIImage *)img;
  38. @end