forked from cheesemaker/toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUUImage.h
More file actions
56 lines (40 loc) · 1.96 KB
/
UUImage.h
File metadata and controls
56 lines (40 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// UUImage.h
// Useful Utilities - UIImage extensions
//
// Created by Jonathan on 3/11/13.
//
// License:
// You are free to use this code for whatever purposes you desire. The only requirement is that you smile everytime you use it.
//
// Contact: @cheesemaker or jon@threejacks.com
#import <UIKit/UIKit.h>
@interface UIImage (UUFramework)
- (UIImage*) uuRemoveOrientation;
- (UIImage*) uuScaleToSize:(CGSize)targetSize;
- (UIImage*) uuScaleAndCropToSize:(CGSize)targetSize;
- (UIImage*) uuCropToSize:(CGSize)targetSize;
- (UIImage*) uuBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;
+ (UIImage*) uuViewToImage:(UIView*)view;
- (UIImage*) uuScaleToWidth:(CGFloat)width;
- (UIImage*) uuScaleToHeight:(CGFloat)height;
// Picks the smaller of height or width and scales the image
- (UIImage*) uuScaleSmallestDimensionToSize:(CGFloat)size;
- (CGSize) uuCalculateScaleToWidthDestSize:(CGFloat)width;
- (CGSize) uuCalculateScaleToHeightDestSize:(CGFloat)height;
- (CGSize) uuCalculateScaleToFitDestSize:(CGFloat)size;
// Pure math functions handy to use in layout methods
+ (CGSize) uuCalculateScaleToWidthDestSize:(CGFloat)width fromSize:(CGSize)srcSize;
+ (CGSize) uuCalculateScaleToHeightDestSize:(CGFloat)height fromSize:(CGSize)srcSize;
+ (UIImage*) uuMakeStretchableImage:(NSString*)imageName insets:(UIEdgeInsets)insets;
+ (UIImage*) uuSolidColorImage:(UIColor*)color;
+ (UIImage*) uuSolidColorImage:(UIColor*)color cornerRadius:(CGFloat)cornerRadius borderColor:(UIColor*)borderColor borderWidth:(CGFloat)borderWidth;
+ (UIImage*) uuSolidColorImage:(UIColor*)color
cornerRadius:(CGFloat)cornerRadius
borderColor:(UIColor*)borderColor
borderWidth:(CGFloat)borderWidth
roundedCorners:(UIRectCorner)roundedCorners;
@end
@interface UIImage (UUAnimatedGIF)
+ (UIImage*) uuImageWithGIFData:(NSData*)data;
@end