TCMaskViewMode

Swift

class TCMaskViewMode : NSObject

Objective-C

@interface TCMaskViewMode : NSObject

TCMaskViewMode defines how the current masking result is shown to the user, the result value (v) shown to user is blended with current mask (m) by foreground image/color (f) and background image/color (b):

  • If inverted is false: v = f * m + b * (1 - m)
  • If inverted is true: v = f * (1 - m) + b * m

For both foreground and background settings:

  • If image is not nil, image will be used
  • If image is nil and color is not nil, color will be used
  • If both image and color are nil, foreground will be set to a PNG transparent color and background will be set to the image of masking
  • Initialize a TCMaskViewMode

    Declaration

    Swift

    init()

    Objective-C

    - (nonnull instancetype)init;
    		
  • Initialize a TCMaskViewMode

    Declaration

    Swift

    init(foregroundColor: UIColor, backgroundColor: UIColor, isInverted: Bool)

    Objective-C

    - (nonnull instancetype)initWithForegroundColor:(UIColor * _Nonnull)foregroundColor backgroundColor:(UIColor * _Nonnull)backgroundColor isInverted:(BOOL)isInverted;
  • Initialize a TCMaskViewMode

    Declaration

    Swift

    init(foregroundImage: UIImage!, backgroundColor: UIColor, isInverted: Bool)

    Objective-C

    - (nonnull instancetype)initWithForegroundImage:(UIImage * _Null_unspecified)foregroundImage backgroundColor:(UIColor * _Nonnull)backgroundColor isInverted:(BOOL)isInverted;
  • Initialize a TCMaskViewMode

    Declaration

    Swift

    init(foregroundColor: UIColor, backgroundImage: UIImage!, isInverted: Bool)

    Objective-C

    - (nonnull instancetype)initWithForegroundColor:(UIColor * _Nonnull)foregroundColor backgroundImage:(UIImage * _Null_unspecified)backgroundImage isInverted:(BOOL)isInverted;
  • Initialize a TCMaskViewMode

    Declaration

    Swift

    init(foregroundImage: UIImage!, backgroundImage: UIImage!, isInverted: Bool)

    Objective-C

    - (nonnull instancetype)initWithForegroundImage:(UIImage * _Null_unspecified)foregroundImage backgroundImage:(UIImage * _Null_unspecified)backgroundImage isInverted:(BOOL)isInverted
  • Background color of TCMaskViewMode

    Declaration

    Swift

    var backgroundColor : UIColor!

    Objective-C

    @property (nonatomic, strong) UIColor * _Null_unspecified backgroundColor;
  • Foreground color of TCMaskViewMode

    Declaration

    Swift

    var foregroundColor : UIColor!

    Objective-C

    @property (nonatomic, strong) UIColor * _Null_unspecified foregroundColor;
  • Background image of TCMaskViewMode

    Declaration

    Swift

    var backgroundImage : UIImage!

    Objective-C

    @property (nonatomic, strong) UIImage * _Null_unspecified backgroundImage;
  • Foreground image of TCMaskViewMode

    Declaration

    Swift

    var foregroundImage : UIImage!

    Objective-C

    @property (nonatomic, strong) UIImage * _Null_unspecified foregroundImage;
  • A Boolean value that determines whether the blending between foreground and background color/image should be inverted. The default value is false.

    Declaration

    Swift

    var isInverted = false

    Objective-C

    @property (nonatomic) BOOL isInverted;
  • Create a TCMaskViewMode which looks like a PNG transparent pattern.

    Declaration

    Swift

    static func transparent() -> TCMaskViewMode

    Objective-C

    + (TCMaskViewMode * _Nonnull)transparent;

    Return Value

    A new TCMaskViewMode which looks like a PNG transparent pattern.