TinyCrayon-iOS-SDK:强大到使人惊讶的 Mask 及切图工具库
2017-06-18 18:01
501 查看
原文链接:https://github.com/TinyCrayon/TinyCrayon-iOS-SDK
TinyCrayon-iOS-SDK:强大到使人惊讶的 Mask 及切图工具库。# 为开源点赞# —— 由SwiftLanguage分享
A smart and easy-to-use image masking and cutout SDK for mobile apps.
TinyCrayon SDK provides tools for adding image cutout and layer mask capabilities to your mobile applications.
Try our sample apps Image
Eraser, Color Effect, Focus
Effect.
Features
Installation
Prerequisites
Streamlined, using CocoaPods
Manually, using the SDK download
Download the SDK
Add the framework
Settings for Objective-C
Usage
Add a TCMaskView
TCMask class
Further reading
License
Terms of use
Image layer mask is a fundamental technique in image manipulations. It allows you to selectively modify the opacity (transparency) of the layer they belong to. This flexibility to define the opacity of different areas of a layer
is the basis for more interesting image manipulation techniques such as selective coloring and luminosity masking.
The current version of TinyCrayon SDK provides the following three tools:
Quick Select: Smart and easy to use, users just need to select part of the object and the edge detection algorithm will find the boundary.
Hair Brush: Smooth and natual looking, paint on the hair/fur of an object and the algorithm will select the hair/fur for you in high quality.
Regular Brush: A regular brush tool with the capability to adjust its size, hardness and opacity.
iPad support: TinyCrayon SDK uses auto layout for its views and adapts to each screen size - iPhone or iPad.
Highly customizable: Style the UI, view modes and localized languages as you wish.
Swift: Keeping up with time, we chose Swift as the main development language of the TinyCrayon SDK, leading to leaner easier code.
Objective-C support: All of our public API is Objective-C compatible.
A physical iOS device.
Recommended: installation
of CocoaPods to simplify dependency management
Started Guide will help you. CocoaPods is the preferred and simplest way to use the TinyCrayon SDK.
Important: Please make sure that you have a CocoaPods version >= 0.39.0 installed. You can check your version of CocoaPods with
Here's what you have to add to your
you do not have
directory):
Then run
project root directory (same directory as your
Open MyApp.xcworkspace and build.
Manually, using the
If you don't want to use Cocoapods you can still take advantage of the TinyCrayon SDK by importing the frameworks directly.
SDK zip (this is a ~20MB file and may take some time).
Unzip the TinyCrayon.zip
the
Drag
the
to create a
To present a
Swift
Objective-C
The delegate of the
be used to be notified when the user cancels or completes the edit. In last case the function
called.
as the first parameter when the user cancels or completes the edit. For example, when the user completes the edit with
swift
Objective-C
of image masking result from
properties:
data: An array of 8-bits unsigned char, its length is equal to the number of pixels of the image in
Each element in data represents the mask value.
size: The size of mask, which is equal to the size of the image in
and easy to use functions to process layer mask with image. For example, to cutout an object:
Swift
Objective-C
To try these examples, and find out about more options please take a look at the Examples.
Eraser, Color Effect, Focus
Effect.
Check out TinyCrayon guides and API
reference for more details.
TinyCrayon-iOS-SDK:强大到使人惊讶的 Mask 及切图工具库。# 为开源点赞# —— 由SwiftLanguage分享
A smart and easy-to-use image masking and cutout SDK for mobile apps.
TinyCrayon SDK provides tools for adding image cutout and layer mask capabilities to your mobile applications.
Quick Select Tool | Hair Brush Tool |
Eraser, Color Effect, Focus
Effect.
Table of Contents
OverviewFeatures
Installation
Prerequisites
Streamlined, using CocoaPods
Manually, using the SDK download
Download the SDK
Add the framework
Settings for Objective-C
Usage
Add a TCMaskView
TCMask class
Further reading
License
Terms of use
Overview
TinyCrayon SDK provides tools for adding image cutout and layer mask capabilities to your mobile applications.Image layer mask is a fundamental technique in image manipulations. It allows you to selectively modify the opacity (transparency) of the layer they belong to. This flexibility to define the opacity of different areas of a layer
is the basis for more interesting image manipulation techniques such as selective coloring and luminosity masking.
The current version of TinyCrayon SDK provides the following three tools:
Quick Select: Smart and easy to use, users just need to select part of the object and the edge detection algorithm will find the boundary.
Hair Brush: Smooth and natual looking, paint on the hair/fur of an object and the algorithm will select the hair/fur for you in high quality.
Regular Brush: A regular brush tool with the capability to adjust its size, hardness and opacity.
Features
Free: TinyCrayon SDK is provided under MIT license, you can use it in your commercial applications for free!iPad support: TinyCrayon SDK uses auto layout for its views and adapts to each screen size - iPhone or iPad.
Highly customizable: Style the UI, view modes and localized languages as you wish.
Swift: Keeping up with time, we chose Swift as the main development language of the TinyCrayon SDK, leading to leaner easier code.
Objective-C support: All of our public API is Objective-C compatible.
Installation
Prerequisites
Xcode 8.0 or later.A physical iOS device.
Recommended: installation
of CocoaPods to simplify dependency management
Streamlined, using CocoaPods
TinyCrayon SDK is available via CocoaPods. If you're new to CocoaPods, this GettingStarted Guide will help you. CocoaPods is the preferred and simplest way to use the TinyCrayon SDK.
Important: Please make sure that you have a CocoaPods version >= 0.39.0 installed. You can check your version of CocoaPods with
pod --version.
Here's what you have to add to your
Podfile(if
you do not have
Podfile, create one in your project root
directory):
target 'MyApp' do
pod 'TinyCrayon'
end
[/code]Then run
pod installin your
project root directory (same directory as your
Podfile).
Open MyApp.xcworkspace and build.
Manually, using the
SDK download
If you don't want to use Cocoapods you can still take advantage of the TinyCrayon SDK by importing the frameworks directly.Download the SDK
Download the TinyCrayonSDK zip (this is a ~20MB file and may take some time).
Unzip the TinyCrayon.zip
Add the framework
DragTCCore.frameworkinto
the
Linked Frameworks and Librariessection of your target.
Drag
TCMask.frameworkinto
the
Embedded Binariessection of your target.
Settings for Objective-C
If your project is using Objective-C, setAlways Embed Swift Standard Librariesto be YES in your Build Settings.
Usage
Add a TCMaskView
TheTCMaskViewclass is responsible
to create a
UIViewControllerfor the user to mask the image.
To present a
TCMaskView:
Swift
let maskView = TCMaskView(image: image)
maskView.delegate = self
maskView.presentFrom(rootViewController: self, animated: true)
[/code]Objective-C
TCMaskView *maskView = [[TCMaskView alloc] initWithImage:image];
maskView.delegate = self;
[maskView presentFromRootViewController:self animated:true];
[/code]The delegate of the
TCMaskViewcan
be used to be notified when the user cancels or completes the edit. In last case the function
tcMaskViewDidComplete(mask:image:)is
called.
TCMask class
TCMaskis provided by
TCMaskViewDelegatefunctions
as the first parameter when the user cancels or completes the edit. For example, when the user completes the edit with
TCMaskView:
swift
func tcMaskViewDidComplete(mask: TCMask, image: UIImage) {}
[/code]Objective-C
- (void)tcMaskViewDidCompleteWithMask:(TCMask *)mask image:(UIImage *)image {}
[/code]TCMaskis an encapsulation
of image masking result from
TCMaskView, it has the following
properties:
data: An array of 8-bits unsigned char, its length is equal to the number of pixels of the image in
TCMaskView.
Each element in data represents the mask value.
size: The size of mask, which is equal to the size of the image in
TCMaskView.
TCMaskalso provides some simple
and easy to use functions to process layer mask with image. For example, to cutout an object:
Swift
let outputImage = mask.cutout(image: image, resize: false)
[/code]Objective-C
UIImage *outputImage = [mask cutoutWithImage:image resize:false];
[/code]To try these examples, and find out about more options please take a look at the Examples.
Further reading
Try our sample apps ImageEraser, Color Effect, Focus
Effect.
Check out TinyCrayon guides and API
reference for more details.
License
The MIT licenseTerms of use
By using TinyCrayon SDK, you agree to keep the banner ad embedded in TCMaskView fully viewable and clickable to the users.相关文章推荐
- IOS 5下强大的UI修改工具—— UIAppearance .
- 【iOS开发】---- 强大的UI修改工具 UIAppearance
- 【iOS开发】---- 强大的UI修改工具 UIAppearance
- 教你快速高效接入SDK——iOS多渠道自动打包工具核心原理
- 【iOS开发】---- 强大的UI修改工具 UIAppearance-有图片效果
- 【iOS开发】---- 强大的UI修改工具 UIAppearance
- iOS开发用到的强大的开源工具
- IOS SDK详解之沙盒(一)图解+小工具
- 和Charles同样强大的iOS免费抓包工具mitmproxy
- ★iOS 性能测试工具 SDK
- 苹果发布新的iOS 8 SDK和开发工具
- 工具链无效。新 App 和 App 更新必须使用公共(正式)版 Xcode 6 或更高版本以及 iOS 8 SDK 或更高版本来构建。请勿提交 Beta 版软件构建的 App。
- 浅析iOS开发者应用程序开发工具套件-iOS SDK
- 强大的iOS开发必备工具
- 【iOS开发】---- 强大的UI修改工具 UIAppearance
- 强大的iOS日志工具 NSLogger
- 工具链无效。新 App 和 App 更新必须使用公共(正式)版 Xcode 6 或更高版本以及 iOS 8 SDK 或更高版本来构建。请勿提交 Beta 版软件构建的 App。
- 强大的iOS开发必备工具