Skip to content

Commit 6f3bf50

Browse files
committed
Remove Float80
Because it is available for iOS, tvOS and watchOS only with their simulators.
1 parent 7dad2f8 commit 6f3bf50

19 files changed

Lines changed: 17 additions & 1369 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ let package = Package(
300300
**Cartfile**
301301

302302
```
303-
github "koher/EasyImagy" "0.4.0-alpha.6"
303+
github "koher/EasyImagy" "0.4.0-alpha.7"
304304
```
305305

306306
### Manually

Sources/EasyImagy/HigherOrderFunctions.swift

Lines changed: 0 additions & 220 deletions
Large diffs are not rendered by default.

Sources/EasyImagy/HigherOrderFunctions.swift.gyb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
% 'UInt64',
1313
% 'Float',
1414
% 'Double',
15-
% 'Float80',
1615
% 'Bool',
1716
% ]
1817
% basic_types = [f'RGBA<{t}>' for t in basic_channel_types] + basic_channel_types

Sources/EasyImagy/ImageAppKit.swift

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -287,63 +287,6 @@ extension Image where Pixel == RGBA<Double> {
287287
}
288288
}
289289

290-
extension Image where Pixel == RGBA<Float80> {
291-
public init(nsImage: NSImage) {
292-
if let cgImage: CGImage = nsImage.cgImage(forProposedRect: nil, context: nil, hints: nil) {
293-
self.init(cgImage: cgImage)
294-
} else {
295-
precondition(nsImage.size == .zero, "The `size` of the given `NSImage` instance (\(nsImage)) must be equal to `.zero` when the `cgImage` of the instance is `nil`.")
296-
self.init(width: 0, height: 0, pixels: [])
297-
}
298-
}
299-
300-
private init?(nsImageOrNil: NSImage?) {
301-
guard let nsImage: NSImage = nsImageOrNil else { return nil }
302-
self.init(nsImage: nsImage)
303-
}
304-
305-
public init?(named name: NSImage.Name) {
306-
self.init(nsImageOrNil: NSImage(named: name))
307-
}
308-
309-
public init?(contentsOfFile path: String) {
310-
self.init(nsImageOrNil: NSImage(contentsOfFile: path))
311-
}
312-
313-
public init?(data: Data) {
314-
self.init(nsImageOrNil: NSImage(data: data))
315-
}
316-
317-
public var nsImage: NSImage {
318-
return NSImage(cgImage: cgImage, size: .zero)
319-
}
320-
321-
public func data(using format: Image.Format) -> Data? {
322-
guard width > 0 && height > 0 else { return nil }
323-
324-
let imageRep = NSBitmapImageRep(cgImage: cgImage)
325-
imageRep.size = CGSize(width: CGFloat(width), height: CGFloat(height))
326-
327-
switch format {
328-
case .png:
329-
return imageRep.representation(using: .png, properties: [:])
330-
case .jpeg(let complessionQuality):
331-
return imageRep.representation(using: .jpeg, properties: [.compressionFactor: NSNumber(value: complessionQuality)])
332-
}
333-
}
334-
335-
public func write(to url: URL, atomically: Bool, format: Image.Format) throws {
336-
guard let data = data(using: format) else {
337-
throw Image.Format.FormattingError<Image<RGBA<Float80>>>(image: self, format: format)
338-
}
339-
try data.write(to: url, options: atomically ? .atomic : .init(rawValue: 0))
340-
}
341-
342-
public func write<S : StringProtocol>(toFile path: S, atomically: Bool, format: Image.Format) throws {
343-
try write(to: URL(fileURLWithPath: String(path)), atomically: atomically, format: format)
344-
}
345-
}
346-
347290
extension Image where Pixel == RGBA<Bool> {
348291
public init(nsImage: NSImage) {
349292
if let cgImage: CGImage = nsImage.cgImage(forProposedRect: nil, context: nil, hints: nil) {
@@ -686,63 +629,6 @@ extension Image where Pixel == Double {
686629
}
687630
}
688631

689-
extension Image where Pixel == Float80 {
690-
public init(nsImage: NSImage) {
691-
if let cgImage: CGImage = nsImage.cgImage(forProposedRect: nil, context: nil, hints: nil) {
692-
self.init(cgImage: cgImage)
693-
} else {
694-
precondition(nsImage.size == .zero, "The `size` of the given `NSImage` instance (\(nsImage)) must be equal to `.zero` when the `cgImage` of the instance is `nil`.")
695-
self.init(width: 0, height: 0, pixels: [])
696-
}
697-
}
698-
699-
private init?(nsImageOrNil: NSImage?) {
700-
guard let nsImage: NSImage = nsImageOrNil else { return nil }
701-
self.init(nsImage: nsImage)
702-
}
703-
704-
public init?(named name: NSImage.Name) {
705-
self.init(nsImageOrNil: NSImage(named: name))
706-
}
707-
708-
public init?(contentsOfFile path: String) {
709-
self.init(nsImageOrNil: NSImage(contentsOfFile: path))
710-
}
711-
712-
public init?(data: Data) {
713-
self.init(nsImageOrNil: NSImage(data: data))
714-
}
715-
716-
public var nsImage: NSImage {
717-
return NSImage(cgImage: cgImage, size: .zero)
718-
}
719-
720-
public func data(using format: Image.Format) -> Data? {
721-
guard width > 0 && height > 0 else { return nil }
722-
723-
let imageRep = NSBitmapImageRep(cgImage: cgImage)
724-
imageRep.size = CGSize(width: CGFloat(width), height: CGFloat(height))
725-
726-
switch format {
727-
case .png:
728-
return imageRep.representation(using: .png, properties: [:])
729-
case .jpeg(let complessionQuality):
730-
return imageRep.representation(using: .jpeg, properties: [.compressionFactor: NSNumber(value: complessionQuality)])
731-
}
732-
}
733-
734-
public func write(to url: URL, atomically: Bool, format: Image.Format) throws {
735-
guard let data = data(using: format) else {
736-
throw Image.Format.FormattingError<Image<Float80>>(image: self, format: format)
737-
}
738-
try data.write(to: url, options: atomically ? .atomic : .init(rawValue: 0))
739-
}
740-
741-
public func write<S : StringProtocol>(toFile path: S, atomically: Bool, format: Image.Format) throws {
742-
try write(to: URL(fileURLWithPath: String(path)), atomically: atomically, format: format)
743-
}
744-
}
745-
746632
extension Image where Pixel == Bool {
747633
public init(nsImage: NSImage) {
748634
if let cgImage: CGImage = nsImage.cgImage(forProposedRect: nil, context: nil, hints: nil) {

Sources/EasyImagy/ImageAppKit.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% types = ['UInt8', 'UInt16', 'UInt32', 'Float', 'Double', 'Float80', 'Bool']
1+
% types = ['UInt8', 'UInt16', 'UInt32', 'Float', 'Double', 'Bool']
22
#if os(macOS)
33
import Foundation
44
import AppKit

Sources/EasyImagy/ImageCoreGraphics.swift

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -249,50 +249,6 @@
249249
}
250250
}
251251

252-
extension Image where Pixel == RGBA<Float80> {
253-
private static var colorSpace: CGColorSpace {
254-
return CGColorSpaceCreateDeviceRGB()
255-
}
256-
257-
private static var bitmapInfo: CGBitmapInfo {
258-
return CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue | CGBitmapInfo.byteOrder32Big.rawValue)
259-
}
260-
261-
private init(width: Int, height: Int, setUp: (CGContext) -> ()) {
262-
let pixels: [RGBA<UInt8>] = Image.drawnPixels(
263-
width: width,
264-
height: height,
265-
defaultPixel: .transparent,
266-
colorSpace: Image<RGBA<UInt8>>.colorSpace,
267-
bitmapInfo: Image<RGBA<UInt8>>.bitmapInfo,
268-
minValue: .min,
269-
maxValue: .max,
270-
isEqual: ==,
271-
toSummable: Int.init,
272-
product: (*) as (Int, Int) -> Int,
273-
quotient: (/) as (Int, Int) -> Int,
274-
toOriginal: UInt8.init,
275-
setUp: setUp
276-
)
277-
278-
self.init(width: width, height: height, pixels: pixels.map { $0.map { Float80($0) / 255 } })
279-
}
280-
281-
public init(cgImage: CGImage) {
282-
let width = cgImage.width
283-
let height = cgImage.height
284-
285-
self.init(width: width, height: height, setUp: { context in
286-
let rect = CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(height))
287-
context.draw(cgImage, in: rect)
288-
})
289-
}
290-
291-
public var cgImage: CGImage {
292-
return map { $0.map { UInt8(clamp($0, lower: 0.0, upper: 1.0) * 255) } }.cgImage
293-
}
294-
}
295-
296252
extension Image where Pixel == RGBA<Bool> {
297253
private static var colorSpace: CGColorSpace {
298254
return CGColorSpaceCreateDeviceRGB()
@@ -533,43 +489,6 @@
533489
return map { UInt8(clamp($0, lower: 0.0, upper: 1.0) * 255) }.cgImage
534490
}
535491
}
536-
537-
extension Image where Pixel == Float80 {
538-
private static var colorSpace: CGColorSpace {
539-
return CGColorSpaceCreateDeviceGray()
540-
}
541-
542-
private static var bitmapInfo: CGBitmapInfo {
543-
return CGBitmapInfo()
544-
}
545-
546-
private init(width: Int, height: Int, setUp: (CGContext) -> ()) {
547-
let pixels: [UInt8] = Image.drawnPixels(
548-
width: width,
549-
height: height,
550-
defaultPixel: 0,
551-
colorSpace: Image<UInt8>.colorSpace,
552-
bitmapInfo: Image<UInt8>.bitmapInfo,
553-
setUp: setUp
554-
)
555-
556-
self.init(width: width, height: height, pixels: pixels.map { Float80($0) / 255 })
557-
}
558-
559-
public init(cgImage: CGImage) {
560-
let width = cgImage.width
561-
let height = cgImage.height
562-
563-
self.init(width: width, height: height, setUp: { context in
564-
let rect = CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(height))
565-
context.draw(cgImage, in: rect)
566-
})
567-
}
568-
569-
public var cgImage: CGImage {
570-
return map { UInt8(clamp($0, lower: 0.0, upper: 1.0) * 255) }.cgImage
571-
}
572-
}
573492

574493
extension Image where Pixel == Bool {
575494
private static var colorSpace: CGColorSpace {

Sources/EasyImagy/ImageCoreGraphics.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
% uint_types = ['UInt8', 'UInt16', 'UInt32']
2-
% float_types = ['Float', 'Double', 'Float80']
2+
% float_types = ['Float', 'Double']
33
% type_to_summable = {
44
% 'UInt8' : 'Int',
55
% 'UInt16': 'Int',

0 commit comments

Comments
 (0)