PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/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
19#import <UIKit/UIKit.h>
20
21@interface UIImage (GTMUIImageResizeAdditions)
22
23// Returns an image resized to |targetSize|.
24//
25// If |preserveAspectRatio| is YES, the original image aspect ratio is
26// preserved.
27//
28// When |preserveAspectRatio| is YES and if |targetSize|'s aspect ratio
29// is different from the image, the resulting image will be shrunken to
30// a size that is within |targetSize|.
31//
32// To preserve the |targetSize| when |preserveAspectRatio| is YES, set
33// |trimToFit| to YES. The resulting image will be the largest proportion
34// of the receiver that fits in the targetSize, aligned to center of the image.
35//
36// Image interpolation level for resizing is set to kCGInterpolationDefault.
37- (UIImage *)gtm_imageByResizingToSize:(CGSize)targetSize
38                   preserveAspectRatio:(BOOL)preserveAspectRatio
39                             trimToFit:(BOOL)trimToFit;
40
41// Returns an image rotated by |orientation| where the current orientation is
42// taken as UIImageOrientationUp. Nil if |orientation| is invalid.
43//
44// For example, UIImageOrientationRight is a 90 degree rotation clockwise,
45// UIImageOrientationDown is a 180 degree rotation closewise.
46//
47// Supplying UIImageOrientationUp to |orientation| will return a copy of the
48// image.
49- (UIImage *)gtm_imageByRotating:(UIImageOrientation)orientation;
50
51@end