Photo.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // Photo.h
  3. // Components
  4. // 照片处理对象
  5. // Created by Liu Yang on 10-9-15.
  6. // Copyright 2010 __MyCompanyName__. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @interface NSData (MBBase64)
  10. + (id)dataWithBase64EncodedString:(NSString *)string; // Padding '=' characters are optional. Whitespace is ignored.
  11. - (NSString *)base64Encoding;
  12. @end
  13. @interface Photo : NSObject {
  14. }
  15. /*
  16. * 缩放图片
  17. * image 图片对象
  18. * toWidth 宽
  19. * toHeight 高
  20. * return 返回图片对象
  21. */
  22. +(UIImage *)scaleImage:(UIImage *)image toWidth:(int)toWidth toHeight:(int)toHeight;
  23. /*
  24. * 缩放图片数据
  25. * imageData 图片数据
  26. * toWidth 宽
  27. * toHeight 高
  28. * return 返回图片数据对象
  29. */
  30. +(NSData *)scaleData:(NSData *)imageData toWidth:(int)toWidth toHeight:(int)toHeight;
  31. /*
  32. * 圆角
  33. * image 图片对象
  34. * size 尺寸
  35. */
  36. +(id) createRoundedRectImage:(UIImage*)image size:(CGSize)size;
  37. /*
  38. * 图片转换为字符串
  39. */
  40. +(NSString *) image2String:(UIImage *)image;
  41. +(NSData *) image2Data:(UIImage *)image isOriginal:(BOOL)isOriginal; // isOriginal 是否原图
  42. /*
  43. * 字符串转换为图片
  44. */
  45. +(UIImage *) string2Image:(NSString *)string;
  46. @end