/core/externals/update-engine/externals/google-toolbox-for-mac/iPhone/GTMUIImage+Resize.h

http://macfuse.googlecode.com/ · C++ Header · 51 lines · 7 code · 5 blank · 39 comment · 0 complexity · f41ef29a3e28b68f5e31d962437c3fb2 MD5 · raw file

  1. //
  2. // GTMUIImage+Resize.h
  3. //
  4. // Copyright 2009 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import <UIKit/UIKit.h>
  19. @interface UIImage (GTMUIImageResizeAdditions)
  20. // Returns an image resized to |targetSize|.
  21. //
  22. // If |preserveAspectRatio| is YES, the original image aspect ratio is
  23. // preserved.
  24. //
  25. // When |preserveAspectRatio| is YES and if |targetSize|'s aspect ratio
  26. // is different from the image, the resulting image will be shrunken to
  27. // a size that is within |targetSize|.
  28. //
  29. // To preserve the |targetSize| when |preserveAspectRatio| is YES, set
  30. // |trimToFit| to YES. The resulting image will be the largest proportion
  31. // of the receiver that fits in the targetSize, aligned to center of the image.
  32. //
  33. // Image interpolation level for resizing is set to kCGInterpolationDefault.
  34. - (UIImage *)gtm_imageByResizingToSize:(CGSize)targetSize
  35. preserveAspectRatio:(BOOL)preserveAspectRatio
  36. trimToFit:(BOOL)trimToFit;
  37. // Returns an image rotated by |orientation| where the current orientation is
  38. // taken as UIImageOrientationUp. Nil if |orientation| is invalid.
  39. //
  40. // For example, UIImageOrientationRight is a 90 degree rotation clockwise,
  41. // UIImageOrientationDown is a 180 degree rotation closewise.
  42. //
  43. // Supplying UIImageOrientationUp to |orientation| will return a copy of the
  44. // image.
  45. - (UIImage *)gtm_imageByRotating:(UIImageOrientation)orientation;
  46. @end