From 5d4d4a471cb42fc1d4f2b436574eeced786a5cab Mon Sep 17 00:00:00 2001 From: Yuta Koshizawa Date: Sun, 15 Sep 2024 14:03:38 +0900 Subject: [PATCH] Make image types to conform to Sendable --- Sources/SwiftImage/Image.swift | 2 ++ Sources/SwiftImage/ImageSlice.swift | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Sources/SwiftImage/Image.swift b/Sources/SwiftImage/Image.swift index 2bb1bc16..f6810ae4 100644 --- a/Sources/SwiftImage/Image.swift +++ b/Sources/SwiftImage/Image.swift @@ -38,6 +38,8 @@ public struct Image : ImageProtocol { } } +extension Image : Sendable where Pixel : Sendable {} + extension Image { // Initializers for ImageSlice public init(_ imageSlice: ImageSlice) { self.init(width: imageSlice.width, height: imageSlice.height, pixels: Array(imageSlice)) diff --git a/Sources/SwiftImage/ImageSlice.swift b/Sources/SwiftImage/ImageSlice.swift index ca54a2f7..f51f646d 100644 --- a/Sources/SwiftImage/ImageSlice.swift +++ b/Sources/SwiftImage/ImageSlice.swift @@ -40,6 +40,8 @@ public struct ImageSlice : ImageProtocol { } } +extension ImageSlice : Sendable where Pixel : Sendable {} + extension ImageSlice { public init(_ image: Image) { self.init(image: image, xRange: image.xRange, yRange: image.yRange)