UIImage(FWApplication)

@interface UIImage (FWApplication)

注意CGContextDrawImage如果图片尺寸太大会导致内存不足闪退(如高斯模糊效果),建议先压缩再调用

Color

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIImage *fw_grayImage
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)fw_colorAtPoint:(CGPoint)point NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)fw_colorAtPixel:(CGPoint)point NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIColor *fw_averageColor

Effect

  • Undocumented

    Declaration

    Objective-C

    - (nullable UIImage *)fw_imageWithReflectScale:(CGFloat)scale NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIImage *)fw_imageWithReflectScale:(CGFloat)scale gap:(CGFloat)gap alpha:(CGFloat)alpha NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIImage *)fw_imageWithShadowColor:(UIColor *)color offset:(CGSize)offset blur:(CGFloat)blur NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIImage *fw_maskImage
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIImage *)fw_imageWithBlurRadius:(CGFloat)blurRadius saturationDelta:(CGFloat)saturationDelta tintColor:(nullable UIColor *)tintColor maskImage:(nullable UIImage *)maskImage NS_REFINED_FOR_SWIFT;

Alpha

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIImage *fw_alphaImage

View

  • Undocumented

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithView:(UIView *)view limitWidth:(CGFloat)limitWidth NS_REFINED_FOR_SWIFT;

Icon

  • Undocumented

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithAppIcon NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithAppIcon:(CGSize)size NS_REFINED_FOR_SWIFT;

Pdf

  • Undocumented

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithPdf:(id)path NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithPdf:(id)path size:(CGSize)size NS_REFINED_FOR_SWIFT;

Emoji

  • Undocumented

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithEmoji:(NSString *)emoji size:(CGFloat)size NS_REFINED_FOR_SWIFT;

Gradient

  • 创建渐变颜色UIImage,支持四个方向,默认向下Down

    Declaration

    Objective-C

    + (nullable UIImage *)
        fw_gradientImageWithSize:(CGSize)size
                          colors:(nonnull NSArray *)colors
                       locations:(nullable const CGFloat *)locations
                       direction:(UISwipeGestureRecognizerDirection)direction;

    Parameters

    size

    图片大小

    colors

    渐变颜色,CGColor数组,如:@[(bridge id)[UIColor redColor].CGColor, (bridge id)[UIColor blueColor].CGColor]

    locations

    渐变位置,传NULL时均分,如:CGFloat locations[] = {0.0, 1.0};

    direction

    渐变方向,自动计算startPoint和endPoint,支持四个方向,默认向下Down

    Return Value

    渐变颜色UIImage

  • 创建渐变颜色UIImage

    Declaration

    Objective-C

    + (nullable UIImage *)fw_gradientImageWithSize:(CGSize)size
                                            colors:(nonnull NSArray *)colors
                                         locations:
                                             (nullable const CGFloat *)locations
                                        startPoint:(CGPoint)startPoint
                                          endPoint:(CGPoint)endPoint;

    Parameters

    size

    图片大小

    colors

    渐变颜色,CGColor数组,如:@[(bridge id)[UIColor redColor].CGColor, (bridge id)[UIColor blueColor].CGColor]

    locations

    渐变位置,传NULL时均分,如:CGFloat locations[] = {0.0, 1.0};

    startPoint

    渐变开始点,需要根据rect计算

    endPoint

    渐变结束点,需要根据rect计算

    Return Value

    渐变颜色UIImage