V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
wezzard
V2EX  ›  iDev

Introducing Core Graphics Extended Library

  •  
  •   wezzard · 2015-03-15 13:04:56 +08:00 · 2097 次点击
    这是一个创建于 3545 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Core Graphics Extended Library is aiming to completes missing conveniences in Core Graphics.

    Get Started

    • Download Core Graphics Extended Library
    • Drag Core Graphics Extended Library’s Xcode project file to your workspace
    • Add Core Graphics Extended Library to yourEmebed Binaries field in your target’s general page if you are building an app. Or add Core Graphics Extended Library to your Linked Frameworks and Libraries field in your target’s general page if you are building a framework.
    • Add import CoreGraphicsExt to your Swift source file
    • Enjoy your journey of Core Graphics Extended Library

    What This Library Extends With

    Linear Mixing

    You can now linear mix CGFloat, CGPoint and CGSize now

    Geometric Position Detection

    You can now check:
    - If a CGPoint value is inside a circle which is the biggest circle inside the given CGRect value
    - If a CGPoint value is on the circumference of a circle which is the biggest circle inside the given CGRect value
    - If a CGPoint value is inside a CGRect value
    - If a CGPoint value is on the circumference of a CGRect value
    - If a CGRect value touches an other.

    More Conveniences on Value Creation

    You can now create CGRect value with:
    - Center and size
    - Center, width and height
    - A given CGRect value and optional origin and size
    - CGPoint values which require created CGRect value to cover
    - CGRect values which require created CGRect value to cover

    You also can now create CGRect value by:
    - Swapping width and height
    - Modify a given CGRect value’s origin or size

    You can now create CGPoint value with
    - Definite proportion and seperated points

    Integral And Align to Screen Pixel

    You can now integral CGFloat, CGPoint, CGSize and CGRect value by accessing their integral property.

    You can now algin CGFloat, CGPoint, CGSize and CGRect value to screen pixel by calling func alignToScreenPixel(policy: ScreenPixelAlignmentPolicy) function on those value.

    Arithmetic Operation on CGPoint And CGSize Value

    You can +, - a CGPoint value with an other now.
    You can *, / a CGPoint value with a CGFloat value now
    You can make a dot product with two CGPoint values now.

    You can +, - a CGSize value with an other now.
    You can *, / a CGSize value with a CGFloat or an Int value now

    More Functionalities Can Be Found Inside The Library

    • Get distance between two CGPoint values
    • Get mid point between two CGPoint values
    • Get max and min side length of CGSize value
    • Enumerate each vertex on a CGRect value

    License

    Swift Extended Library is available under the MIT license. See the LICENSE file for more info.

    https://github.com/WeZZard/Core-Graphics-Extended-Library

    1 条回复    2015-03-15 13:31:10 +08:00
    jprovim
        1
    jprovim  
       2015-03-15 13:31:10 +08:00
    1. pod install ???
    2. 有沒有Demo Project?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1066 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 21:39 · PVG 05:39 · LAX 13:39 · JFK 16:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.