FWImageWrapper

@interface FWImageWrapper : FWObjectWrapper

Undocumented

FWTheme

  • 获取当前主题样式对应静态图片用于显示,iOS13+可跟随系统改变

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIImage *image;
  • 指定主题样式获取对应静态图片用于显示,iOS13+可跟随系统改变

    Declaration

    Objective-C

    - (nullable UIImage *)imageForStyle:(FWThemeStyle)style;
  • 是否是主题图片,仅支持判断使用fwTheme创建的图片

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isThemeImage;

Color

  • 快速生成当前图片对应的默认主题图片

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) UIImage *_Nonnull themeImage;
  • 指定主题颜色,快速生成当前图片对应的主题图片

    Declaration

    Objective-C

    - (nonnull UIImage *)themeImageWithColor:(nonnull UIColor *)themeColor;

FWToolkit

  • 从当前图片创建指定透明度的图片

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithAlpha:(CGFloat)alpha;
  • 从当前图片混合颜色创建UIImage,默认kCGBlendModeDestinationIn模式,适合透明图标

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithTintColor:(nonnull UIColor *)tintColor;
  • 从当前UIImage混合颜色创建UIImage,自定义模式

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithTintColor:(nonnull UIColor *)tintColor
                                   blendMode:(CGBlendMode)blendMode;
  • 缩放图片到指定大小

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithScaleSize:(CGSize)size;
  • 缩放图片到指定大小,指定模式

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithScaleSize:(CGSize)size
                                 contentMode:(UIViewContentMode)contentMode;
  • 按指定模式绘制图片

    Declaration

    Objective-C

    - (void)drawInRect:(CGRect)rect
        withContentMode:(UIViewContentMode)contentMode
          clipsToBounds:(BOOL)clipsToBounds;
  • 裁剪指定区域图片

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithCropRect:(CGRect)rect;
  • 指定颜色填充图片边缘

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithInsets:(UIEdgeInsets)insets
                                    color:(nullable UIColor *)color;
  • 拉伸图片(平铺模式),指定端盖区域(不拉伸区域)

    Declaration

    Objective-C

    - (nonnull UIImage *)imageWithCapInsets:(UIEdgeInsets)insets;
  • 拉伸图片(指定模式),指定端盖区域(不拉伸区域)。Tile为平铺模式,Stretch为拉伸模式

    Declaration

    Objective-C

    - (nonnull UIImage *)imageWithCapInsets:(UIEdgeInsets)insets
                               resizingMode:(UIImageResizingMode)resizingMode;
  • 生成圆角图片

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithCornerRadius:(CGFloat)radius;
  • 按角度常数(0~360)转动图片,默认图片尺寸适应内容

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithRotateDegree:(CGFloat)degree;
  • 按角度常数(0~360)转动图片,指定图片尺寸是否延伸来适应内容,否则图片尺寸不变,内容被裁剪

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithRotateDegree:(CGFloat)degree
                                        fitSize:(BOOL)fitSize;
  • 生成mark图片

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithMaskImage:(nonnull UIImage *)maskImage;
  • 图片合并,并制定叠加图片的起始位置

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithMergeImage:(nonnull UIImage *)image
                                      atPoint:(CGPoint)point;
  • 图片应用CIFilter滤镜处理

    Declaration

    Objective-C

    - (nullable UIImage *)imageWithFilter:(nonnull CIFilter *)filter;
  • 压缩图片到指定字节,图片太大时会改为JPG格式。不保证图片大小一定小于该大小

    Declaration

    Objective-C

    - (nullable UIImage *)compressImageWithMaxLength:(NSInteger)maxLength;
  • 压缩图片到指定字节,图片太大时会改为JPG格式,可设置递减压缩率,默认0.1。不保证图片大小一定小于该大小

    Declaration

    Objective-C

    - (nullable NSData *)compressDataWithMaxLength:(NSInteger)maxLength
                                     compressRatio:(CGFloat)compressRatio;
  • 长边压缩图片尺寸,获取等比例的图片

    Declaration

    Objective-C

    - (nullable UIImage *)compressImageWithMaxWidth:(NSInteger)maxWidth;
  • 通过指定图片最长边,获取等比例的图片size

    Declaration

    Objective-C

    - (CGSize)scaleSizeWithMaxWidth:(CGFloat)maxWidth;
  • 获取原始渲染模式图片,始终显示原色,不显示tintColor。默认自动根据上下文

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIImage *_Nonnull originalImage;
  • 获取模板渲染模式图片,始终显示tintColor,不显示原色。默认自动根据上下文

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIImage *_Nonnull templateImage;
  • 判断图片是否有透明通道

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL hasAlpha;
  • 获取当前图片的像素大小,多倍图会放大到一倍

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGSize pixelSize;