2015-05-28 15:52:46 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-05-28 15:52:46 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-05-28 15:52:46 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
#import <React/RCTBorderStyle.h>
|
2018-09-07 18:12:19 +00:00
|
|
|
#import <React/RCTDefines.h>
|
2015-12-22 16:30:00 +00:00
|
|
|
|
2015-05-28 15:52:46 +00:00
|
|
|
typedef struct {
|
|
|
|
CGFloat topLeft;
|
|
|
|
CGFloat topRight;
|
|
|
|
CGFloat bottomLeft;
|
|
|
|
CGFloat bottomRight;
|
|
|
|
} RCTCornerRadii;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
CGSize topLeft;
|
|
|
|
CGSize topRight;
|
|
|
|
CGSize bottomLeft;
|
|
|
|
CGSize bottomRight;
|
|
|
|
} RCTCornerInsets;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
CGColorRef top;
|
|
|
|
CGColorRef left;
|
|
|
|
CGColorRef bottom;
|
|
|
|
CGColorRef right;
|
|
|
|
} RCTBorderColors;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if the border widths, colors and radii are all equal.
|
|
|
|
*/
|
2018-09-07 18:12:19 +00:00
|
|
|
RCT_EXTERN BOOL RCTBorderInsetsAreEqual(UIEdgeInsets borderInsets);
|
|
|
|
RCT_EXTERN BOOL RCTCornerRadiiAreEqual(RCTCornerRadii cornerRadii);
|
|
|
|
RCT_EXTERN BOOL RCTBorderColorsAreEqual(RCTBorderColors borderColors);
|
2015-05-28 15:52:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert RCTCornerRadii to RCTCornerInsets by applying border insets.
|
2015-12-22 16:30:00 +00:00
|
|
|
* Effectively, returns radius - inset, with a lower bound of 0.0.
|
2015-05-28 15:52:46 +00:00
|
|
|
*/
|
2018-09-07 18:12:19 +00:00
|
|
|
RCT_EXTERN RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii,
|
|
|
|
UIEdgeInsets borderInsets);
|
2015-05-28 15:52:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a CGPath representing a rounded rectangle with the specified bounds
|
|
|
|
* and corner insets. Note that the CGPathRef must be released by the caller.
|
|
|
|
*/
|
2018-09-07 18:12:19 +00:00
|
|
|
RCT_EXTERN CGPathRef RCTPathCreateWithRoundedRect(CGRect bounds,
|
|
|
|
RCTCornerInsets cornerInsets,
|
|
|
|
const CGAffineTransform *transform);
|
2015-05-28 15:52:46 +00:00
|
|
|
|
|
|
|
/**
|
2015-12-22 16:30:00 +00:00
|
|
|
* Draw a CSS-compliant border as an image. You can determine if it's scalable
|
|
|
|
* by inspecting the image's `capInsets`.
|
|
|
|
*
|
|
|
|
* `borderInsets` defines the border widths for each edge.
|
2015-05-28 15:52:46 +00:00
|
|
|
*/
|
2018-09-07 18:12:19 +00:00
|
|
|
RCT_EXTERN UIImage *RCTGetBorderImage(RCTBorderStyle borderStyle,
|
|
|
|
CGSize viewSize,
|
|
|
|
RCTCornerRadii cornerRadii,
|
|
|
|
UIEdgeInsets borderInsets,
|
|
|
|
RCTBorderColors borderColors,
|
|
|
|
CGColorRef backgroundColor,
|
|
|
|
BOOL drawToEdge);
|