colorWithGenericGamma22White:alpha:
GenericGamma22カラースペース上で指定された白黒値とアルファ値でNSColorを作って返します。
+ (NSColor *)colorWithGenericGamma22White:(CGFloat)white
alpha:(CGFloat)alpha
Swift
init(genericGamma22White white: CGFloat, alpha alpha: CGFloat)
解説
GenericGamma22カラースペース上で指定された白黒値とアルファ値でNSColorを作って返します。
引数
(CGFloat)white
Swift
white: CGFloat
alpha:(CGFloat)alpha
Swift
alpha: CGFloat
フレームワーク
ApplicationKit
クラス
NSColor
使用可能
10.7
更新時のバージョン
OS X 10.11.4
Swift 2.0
関連記事
例文
Swift
//NSColor //colorWithGenericGamma22White:alpha: var aButton006 : NSButton? var aView006 : NSView? //実験用ビューのボタンを押した時に実行されるところ func viewAction006(sender : AnyObject?){ //準備 let aView = aView006 //準備ここまで aView?.lockFocus() let backgroundColor = NSColor(genericGamma22White: 0.6, alpha: 1.0) backgroundColor.setFill() NSRectFill(NSMakeRect(0, 20, 300.0, 178.0)) aView?.unlockFocus() } @IBAction func function006(sender: AnyObject) { let aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300.0, 200.0), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, `defer`: false, screen: NSScreen.mainScreen()) windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 aWindow.center()//ウインドウをスクリーンの中心に aWindow.title = "View アクション"//タイトル設定 //ボタン let theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 10.0, 100.0, 30.0)) theButton.title = "Color!" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("viewAction006:") theButton.target = self aWindow.contentView!.addSubview(theButton) //ビュー let theView : NSView = NSView(frame: NSMakeRect(0.0, 30.0, 300.0, 180.0)) theView.wantsLayer = true aWindow.contentView!.addSubview(theView) //実験ウインドウにUIパーツを渡す self.aButton006 = theButton //ボタン self.aView006 = theView //テストビュー aWindow.orderFront(self)//前面に aWindow.makeKeyAndOrderFront(self)//表示 }