@@ -21,10 +21,10 @@ extension NSRect {
21
21
/// - precondition: There must be a set current NSGraphicsContext.
22
22
@available ( swift 4 )
23
23
public func fill( using operation: NSCompositingOperation =
24
- NSGraphicsContext . current ( ) ? . compositingOperation ?? . sourceOver) {
25
- precondition ( NSGraphicsContext . current ( ) != nil ,
24
+ NSGraphicsContext . current? . compositingOperation ?? . sourceOver) {
25
+ precondition ( NSGraphicsContext . current != nil ,
26
26
" There must be a set current NSGraphicsContext " )
27
- NSRectFillUsingOperation ( self , operation)
27
+ __NSRectFillUsingOperation ( self , operation)
28
28
}
29
29
30
30
/// Draws a frame around the inside of this rect in the current
@@ -35,10 +35,10 @@ extension NSRect {
35
35
@available ( swift 4 )
36
36
public func frame( withWidth width: CGFloat = 1.0 ,
37
37
using operation: NSCompositingOperation =
38
- NSGraphicsContext . current ( ) ? . compositingOperation ?? . sourceOver) {
39
- precondition ( NSGraphicsContext . current ( ) != nil ,
38
+ NSGraphicsContext . current? . compositingOperation ?? . sourceOver) {
39
+ precondition ( NSGraphicsContext . current != nil ,
40
40
" There must be a set current NSGraphicsContext " )
41
- NSFrameRectWithWidthUsingOperation ( self , width, operation)
41
+ __NSFrameRectWithWidthUsingOperation ( self , width, operation)
42
42
}
43
43
44
44
/// Modifies the current graphics context clipping path by intersecting it
@@ -48,9 +48,9 @@ extension NSRect {
48
48
/// - precondition: There must be a set current NSGraphicsContext.
49
49
@available ( swift 4 )
50
50
public func clip( ) {
51
- precondition ( NSGraphicsContext . current ( ) != nil ,
51
+ precondition ( NSGraphicsContext . current != nil ,
52
52
" There must be a set current NSGraphicsContext " )
53
- NSRectClip ( self )
53
+ __NSRectClip ( self )
54
54
}
55
55
}
56
56
@@ -62,15 +62,15 @@ extension Sequence where Iterator.Element == NSRect {
62
62
/// - precondition: There must be a set current NSGraphicsContext.
63
63
@available ( swift 4 )
64
64
public func fill( using operation: NSCompositingOperation =
65
- NSGraphicsContext . current ( ) ? . compositingOperation ?? . sourceOver) {
66
- precondition ( NSGraphicsContext . current ( ) != nil ,
65
+ NSGraphicsContext . current? . compositingOperation ?? . sourceOver) {
66
+ precondition ( NSGraphicsContext . current != nil ,
67
67
" There must be a set current NSGraphicsContext " )
68
68
let rects = Array ( self )
69
69
let count = rects. count
70
70
guard count > 0 else { return }
71
71
rects. withUnsafeBufferPointer { rectBufferPointer in
72
72
guard let rectArray = rectBufferPointer. baseAddress else { return }
73
- NSRectFillListUsingOperation ( rectArray, count, operation)
73
+ __NSRectFillListUsingOperation ( rectArray, count, operation)
74
74
}
75
75
}
76
76
@@ -81,14 +81,14 @@ extension Sequence where Iterator.Element == NSRect {
81
81
/// - precondition: There must be a set current NSGraphicsContext.
82
82
@available ( swift 4 )
83
83
public func clip( ) {
84
- precondition ( NSGraphicsContext . current ( ) != nil ,
84
+ precondition ( NSGraphicsContext . current != nil ,
85
85
" There must be a set current NSGraphicsContext " )
86
86
let rects = Array ( self )
87
87
let count = rects. count
88
88
guard count > 0 else { return }
89
89
rects. withUnsafeBufferPointer { rectBufferPointer in
90
90
guard let rectArray = rectBufferPointer. baseAddress else { return }
91
- NSRectClipList ( rectArray, count)
91
+ __NSRectClipList ( rectArray, count)
92
92
}
93
93
}
94
94
}
@@ -101,8 +101,8 @@ extension Sequence where Iterator.Element == (CGRect, NSColor) {
101
101
/// - precondition: There must be a set current NSGraphicsContext.
102
102
@available ( swift 4 )
103
103
public func fill( using operation: NSCompositingOperation =
104
- NSGraphicsContext . current ( ) ? . compositingOperation ?? . sourceOver) {
105
- precondition ( NSGraphicsContext . current ( ) != nil ,
104
+ NSGraphicsContext . current? . compositingOperation ?? . sourceOver) {
105
+ precondition ( NSGraphicsContext . current != nil ,
106
106
" There must be a set current NSGraphicsContext " )
107
107
let rects = map { $0. 0 }
108
108
let colors = map { $0. 1 }
@@ -112,7 +112,7 @@ extension Sequence where Iterator.Element == (CGRect, NSColor) {
112
112
colors. withUnsafeBufferPointer { colorBufferPointer in
113
113
guard let rectArray = rectBufferPointer. baseAddress else { return }
114
114
guard let colorArray = colorBufferPointer. baseAddress else { return }
115
- NSRectFillListWithColorsUsingOperation (
115
+ __NSRectFillListWithColorsUsingOperation (
116
116
rectArray, colorArray, count, operation)
117
117
}
118
118
}
@@ -128,10 +128,10 @@ extension Sequence where Iterator.Element == (CGRect, gray: CGFloat) {
128
128
/// - precondition: There must be a set current NSGraphicsContext.
129
129
@available ( swift 4 )
130
130
public func fill( using operation: NSCompositingOperation =
131
- NSGraphicsContext . current ( ) ? . compositingOperation ?? . sourceOver) {
131
+ NSGraphicsContext . current? . compositingOperation ?? . sourceOver) {
132
132
// NSRectFillListWithGrays does not have a variant taking an operation, but
133
133
// is added here for consistency with the other drawing operations.
134
- guard let graphicsContext = NSGraphicsContext . current ( ) else {
134
+ guard let graphicsContext = NSGraphicsContext . current else {
135
135
fatalError ( " There must be a set current NSGraphicsContext " )
136
136
}
137
137
let cgContext : CGContext
@@ -144,31 +144,31 @@ extension Sequence where Iterator.Element == (CGRect, gray: CGFloat) {
144
144
cgContext. saveGState ( )
145
145
forEach {
146
146
cgContext. setFillColor ( gray: $0. gray, alpha: 1.0 )
147
- NSRectFillUsingOperation ( $0. 0 , operation)
147
+ __NSRectFillUsingOperation ( $0. 0 , operation)
148
148
}
149
149
cgContext. restoreGState ( )
150
150
}
151
151
}
152
152
153
- extension NSWindowDepth {
153
+ extension NSWindow . Depth {
154
154
@available ( swift 4 )
155
155
public static func bestDepth(
156
156
colorSpaceName: NSColorSpaceName ,
157
157
bitsPerSample: Int ,
158
158
bitsPerPixel: Int ,
159
159
isPlanar: Bool
160
- ) -> ( NSWindowDepth , isExactMatch: Bool ) {
160
+ ) -> ( NSWindow . Depth , isExactMatch: Bool ) {
161
161
var isExactMatch : ObjCBool = false
162
- let depth = NSBestDepth (
163
- colorSpaceName as String ,
162
+ let depth = __NSBestDepth (
163
+ colorSpaceName,
164
164
bitsPerSample, bitsPerPixel, isPlanar, & isExactMatch)
165
165
return ( depth, isExactMatch: isExactMatch. boolValue)
166
166
}
167
167
@available ( swift 4 )
168
- public static var availableDepths : [ NSWindowDepth ] {
168
+ public static var availableDepths : [ NSWindow . Depth ] {
169
169
// __NSAvailableWindowDepths is NULL terminated, the length is not known up front
170
- let depthsCArray = NSAvailableWindowDepths ( )
171
- var depths : [ NSWindowDepth ] = [ ]
170
+ let depthsCArray = __NSAvailableWindowDepths ( )
171
+ var depths : [ NSWindow . Depth ] = [ ]
172
172
var length = 0
173
173
var depth = depthsCArray [ length]
174
174
while depth. rawValue != 0 {
@@ -194,7 +194,7 @@ extension NSAnimationEffect {
194
194
delegate. completionHandler = completionHandler
195
195
// Note that the delegate of `__NSShowAnimationEffect` is retained for the
196
196
// duration of the animation.
197
- NSShowAnimationEffect (
197
+ __NSShowAnimationEffect (
198
198
self ,
199
199
centerLocation,
200
200
size,
@@ -207,6 +207,6 @@ extension NSAnimationEffect {
207
207
extension NSSound {
208
208
@available ( swift 4 )
209
209
public static func beep( ) {
210
- NSBeep ( )
210
+ __NSBeep ( )
211
211
}
212
212
}
0 commit comments