ImageResize.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Erica Sadun, http://ericasadun.com
  3. iPhone Developer's Cookbook, 3.0 Edition
  4. BSD License, Use at your own risk
  5. */
  6. #import <Foundation/Foundation.h>
  7. #define CGAutorelease(x) (__typeof(x))[NSMakeCollectable(x) autorelease]
  8. //#define SUPPPORTS_UNDOCUMENTED_APIS 1
  9. @interface ImageResize : NSObject
  10. // Create image
  11. + (UIImage *) imageFromView: (UIView *) theView;
  12. // Base Image Fitting
  13. + (CGSize) fitSize: (CGSize)thisSize inSize: (CGSize) aSize;
  14. + (UIImage *) unrotateImage: (UIImage *) image;
  15. + (UIImage *) image: (UIImage *) image fitInSize: (CGSize) size; // retain proportions, fit in size
  16. + (UIImage *) image: (UIImage *) image fitInView: (UIView *) view;
  17. + (UIImage *) image: (UIImage *) image centerInSize: (CGSize) size; // center, no resize
  18. + (UIImage *) image: (UIImage *) image centerInView: (UIView *) view;
  19. + (UIImage *) image: (UIImage *) image fillSize: (CGSize) size; // fill all pixels
  20. + (UIImage *) image: (UIImage *) image fillView: (UIView *) view;
  21. #if SUPPPORTS_UNDOCUMENTED_APIS
  22. + (UIImage *) image: (UIImage *) image withOrientation: (UIImageOrientation) orientation;
  23. #endif
  24. + (UIImage *) getImageFromView:(UIView*) vi;
  25. + (BOOL) saveImageToSize:(NSString*)fromfile toFile:(NSString*)toFile toWidth:(int)toWidth toHeight:(int)toHeight;
  26. @end