Saturday, September 20, 2014

Premultiplied Alpha

CGImageCreate內的參數有一個是CGBitmapInfo,
是這樣宣告而來的,
private let bitmapInfo:CGBitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedFirst.toRaw())
點過去看會發現,會發現有8種設定,
enum CGImageAlphaInfo : UInt32 {
    case None /* For example, RGB. */
    case PremultipliedLast /* For example, premultiplied RGBA */
    case PremultipliedFirst /* For example, premultiplied ARGB */
    case Last /* For example, non-premultiplied RGBA */
    case First /* For example, non-premultiplied ARGB */
    case NoneSkipLast /* For example, RBGX. */
    case NoneSkipFirst /* For example, XRGB. */
    case Only /* No color data, alpha data only */
}

這時就看到一個陌生的單字"premultiplied",
請教google大神的翻譯,結果翻譯成中文是"預乘",
這翻譯應該還是難以理解吧?

Wednesday, September 17, 2014

Image Dump using Swift

目前大多的工作是設計方面的,
對於了解視覺方面的事情平時自然也很有興趣,
所以用 Swift 寫寫圖片相關的東西了解運作也是很正常的。

回到主題,之前是因為看到有人用 Objective-C 寫了一個 Image Dump,
而最近因為寫一個簡報,就順手改寫了個 Swift 的版本,
也把一些筆記整理進來。

Thursday, May 22, 2014

Use Automator export @2x image



Set Xcode Framework Search Path


Sometimes when you pull project from your friend, but xcode tell you that can't find Framework. You need set xcode framework search path $(SRCROOT) and it can solve problem.

Saturday, April 6, 2013

Create ellipse shape and set color by delegate

Here's a way to create ellipse shape and use delegate to set what color the ellipse shape is.

In my app "Money42",it's has a switch button to set who pay the money.

When the switch button init,it will use delegate to set color itself.

The delegate method is only do one thing,that's return a color NSArray from NSUserDefaults which we set before.

Wednesday, April 3, 2013

Core Data Relationship and Relationship Delete Rules

If your data model is complex,you could need to set Core Data Relationship,

Take my App "FrozenTime" for example,It need to set two entity(Album and Photo).

Album and Photo is One-to-Many Relationships.

The red rectangle area is the "One-to-Many Relationships" look like.