Introducing Core Graphics Extended Library

2015-03-15 13:04:56 +08:00
 wezzard

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

Get Started

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

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

2091 次点击
所在节点    iDev
1 条回复
jprovim
2015-03-15 13:31:10 +08:00
1. pod install ???
2. 有沒有Demo Project?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/177009

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX