forked from facebookarchive/AsyncDisplayKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIImage+ASConvenience.h
More file actions
75 lines (66 loc) · 3.5 KB
/
UIImage+ASConvenience.h
File metadata and controls
75 lines (66 loc) · 3.5 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// UIImage+ASConvenience.h
// AsyncDisplayKit
//
// Created by Hannah Troisi on 6/24/16.
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <UIKit/UIImage.h>
#import <UIKit/UIBezierPath.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN
// High-performance flat-colored, rounded-corner resizable images
//
// For "Baked-in Opaque" corners, set cornerColor equal to the color behind the rounded image object, i.e. the background color.
// For "Baked-in Alpha" corners, set cornerColor = [UIColor clearColor]
//
// See http://asyncdisplaykit.org/docs/corner-rounding.html for an explanation.
@interface UIImage (ASDKAdditions)
/**
* This generates a flat-color, rounded-corner resizeable image
*
* @param cornerRadius The radius of the rounded-corner
* @param cornerColor The fill color of the corners (For Alpha corners use clearColor)
* @param fillColor The fill color of the rounded-corner image
*/
+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
cornerColor:(UIColor *)cornerColor
fillColor:(UIColor *)fillColor AS_WARN_UNUSED_RESULT;
/**
* This generates a flat-color, rounded-corner resizeable image with a border
*
* @param cornerRadius The radius of the rounded-corner
* @param cornerColor The fill color of the corners (For Alpha corners use clearColor)
* @param fillColor The fill color of the rounded-corner image
* @param borderColor The border color. Set to nil for no border.
* @param borderWidth The border width. Dummy value if borderColor = nil.
*/
+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
cornerColor:(UIColor *)cornerColor
fillColor:(UIColor *)fillColor
borderColor:(nullable UIColor *)borderColor
borderWidth:(CGFloat)borderWidth AS_WARN_UNUSED_RESULT;
/**
* This generates a flat-color, rounded-corner resizeable image with a border
*
* @param cornerRadius The radius of the rounded-corner
* @param cornerColor The fill color of the corners (For Alpha corners use clearColor)
* @param fillColor The fill color of the rounded-corner image
* @param borderColor The border color. Set to nil for no border.
* @param borderWidth The border width. Dummy value if borderColor = nil.
* @param roundedCorners Select individual or multiple corners to round. Set to UIRectCornerAllCorners to round all 4 corners.
* @param scale The number of pixels per point. Provide 0.0 to use the screen scale.
*/
+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
cornerColor:(UIColor *)cornerColor
fillColor:(UIColor *)fillColor
borderColor:(nullable UIColor *)borderColor
borderWidth:(CGFloat)borderWidth
roundedCorners:(UIRectCorner)roundedCorners
scale:(CGFloat)scale AS_WARN_UNUSED_RESULT;
@end
NS_ASSUME_NONNULL_END