Added InlineArray pattern overloads to the library to optimize for macOS 26.

This commit is contained in:
2026-09-18 12:30:54 +02:00
parent 52d5d2ec42
commit c9f887bacb
4 changed files with 75 additions and 0 deletions
@@ -244,6 +244,17 @@ public final class Sprite {
}
}
/// Sets an 8×8 stencil pattern (8 rows of image data).
@available(macOS 26, *)
public func setStencilPattern(_ rows: [8 of UInt8]) {
// The C side copies the pattern, so passing the array's storage
// directly is safe.
rows.span.withUnsafeBufferPointer { buffer in
spriteAPI.pointee.setStencilPattern.unsafelyUnwrapped(
pointer, UnsafeMutablePointer(mutating: buffer.baseAddress))
}
}
public func clearStencil() {
retainedStencil = nil
spriteAPI.pointee.clearStencil.unsafelyUnwrapped(pointer)