Skip to content

Commit fff21f1

Browse files
committed
added support decoding for RGB, not only RGBA
1 parent 5ab671e commit fff21f1

17 files changed

+557
-149
lines changed

.swiftpm/xcode/xcuserdata/radzivonbartoshyk.xcuserdatad/xcschemes/xcschememanagement.plist

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@
99
<key>orderHint</key>
1010
<integer>0</integer>
1111
</dict>
12+
<key>JxlCoder-Package.xcscheme_^#shared#^_</key>
13+
<dict>
14+
<key>orderHint</key>
15+
<integer>1</integer>
16+
</dict>
1217
<key>JxlCoder.xcscheme_^#shared#^_</key>
1318
<dict>
1419
<key>orderHint</key>
15-
<integer>4</integer>
20+
<integer>1</integer>
1621
</dict>
1722
<key>jxlcoder.xcscheme_^#shared#^_</key>
1823
<dict>

Jxl Coder.xcodeproj/project.pbxproj

+26-12
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@
1212
D341F4C72A97FC29003A496C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D341F4C62A97FC29003A496C /* ContentView.swift */; };
1313
D341F4C92A97FC2A003A496C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D341F4C82A97FC2A003A496C /* Assets.xcassets */; };
1414
D341F4CC2A97FC2A003A496C /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D341F4CB2A97FC2A003A496C /* Preview Assets.xcassets */; };
15+
D39B79982AAE4AD300F50EA4 /* RgbRgbaConverter.mm in Sources */ = {isa = PBXBuildFile; fileRef = D39B79972AAE4AD300F50EA4 /* RgbRgbaConverter.mm */; };
16+
D39B799E2AAE4F0200F50EA4 /* pexels-cheng.jxl in Resources */ = {isa = PBXBuildFile; fileRef = D39B799D2AAE4F0200F50EA4 /* pexels-cheng.jxl */; };
17+
D39B79B42AAE558E00F50EA4 /* pngtree.jxl in Resources */ = {isa = PBXBuildFile; fileRef = D39B79B32AAE558E00F50EA4 /* pngtree.jxl */; };
1518
D3B84ACC2A9C580800DAFE87 /* Nuke in Frameworks */ = {isa = PBXBuildFile; productRef = D3B84ACB2A9C580800DAFE87 /* Nuke */; };
1619
D3B84ACE2A9C580800DAFE87 /* NukeUI in Frameworks */ = {isa = PBXBuildFile; productRef = D3B84ACD2A9C580800DAFE87 /* NukeUI */; };
1720
D3B84AD32A9C58EB00DAFE87 /* SDWebImage in Frameworks */ = {isa = PBXBuildFile; productRef = D3B84AD22A9C58EB00DAFE87 /* SDWebImage */; };
1821
D3D2B9EB2A9BACF100EBB7A9 /* libjxl_threads.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D2B9E62A9BACF000EBB7A9 /* libjxl_threads.xcframework */; };
1922
D3D2B9EC2A9BACF100EBB7A9 /* libbrotlidec.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D2B9E72A9BACF000EBB7A9 /* libbrotlidec.xcframework */; };
2023
D3D2B9EE2A9BACF100EBB7A9 /* libbrotlienc.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D2B9E92A9BACF100EBB7A9 /* libbrotlienc.xcframework */; };
2124
D3D2B9EF2A9BACF100EBB7A9 /* libbrotlicommon.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D2B9EA2A9BACF100EBB7A9 /* libbrotlicommon.xcframework */; };
22-
D3D2B9F52A9BAD6A00EBB7A9 /* JXLCPlusCoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3D2B9F42A9BAD6A00EBB7A9 /* JXLCPlusCoder.mm */; };
25+
D3D2B9F52A9BAD6A00EBB7A9 /* JxlInternalCoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3D2B9F42A9BAD6A00EBB7A9 /* JxlInternalCoder.mm */; };
2326
D3D2B9F82A9BAE1C00EBB7A9 /* libjxl.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D2B9F72A9BAE1C00EBB7A9 /* libjxl.xcframework */; };
2427
D3D2B9FA2A9BAEB600EBB7A9 /* libhwy.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D2B9F92A9BAEB600EBB7A9 /* libhwy.xcframework */; };
25-
D3D2B9FD2A9BAEF300EBB7A9 /* jxl_worker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3D2B9FB2A9BAEF300EBB7A9 /* jxl_worker.cpp */; };
28+
D3D2B9FD2A9BAEF300EBB7A9 /* JxlWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3D2B9FB2A9BAEF300EBB7A9 /* JxlWorker.cpp */; };
2629
D3D2BA002A9BB4AF00EBB7A9 /* JXLCoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3D2B9FF2A9BB4AF00EBB7A9 /* JXLCoder.swift */; };
2730
D3D2BA022A9BB50F00EBB7A9 /* JXLSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3D2BA012A9BB50F00EBB7A9 /* JXLSupport.swift */; };
2831
D3D2BA062A9BC06500EBB7A9 /* first.jxl in Resources */ = {isa = PBXBuildFile; fileRef = D3D2BA042A9BC06500EBB7A9 /* first.jxl */; };
@@ -41,6 +44,10 @@
4144
D341F4C62A97FC29003A496C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
4245
D341F4C82A97FC2A003A496C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4346
D341F4CB2A97FC2A003A496C /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
47+
D39B79972AAE4AD300F50EA4 /* RgbRgbaConverter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RgbRgbaConverter.mm; sourceTree = "<group>"; };
48+
D39B79992AAE4ADC00F50EA4 /* RgbRgbaConverter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RgbRgbaConverter.h; sourceTree = "<group>"; };
49+
D39B799D2AAE4F0200F50EA4 /* pexels-cheng.jxl */ = {isa = PBXFileReference; lastKnownFileType = file; path = "pexels-cheng.jxl"; sourceTree = "<group>"; };
50+
D39B79B32AAE558E00F50EA4 /* pngtree.jxl */ = {isa = PBXFileReference; lastKnownFileType = file; path = pngtree.jxl; sourceTree = "<group>"; };
4451
D3B84AD62A9C5FE700DAFE87 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
4552
D3B84AD72A9C636E00DAFE87 /* JXLCoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JXLCoder.h; sourceTree = "<group>"; };
4653
D3D2B9E62A9BACF000EBB7A9 /* libjxl_threads.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = libjxl_threads.xcframework; sourceTree = "<group>"; };
@@ -49,12 +56,12 @@
4956
D3D2B9EA2A9BACF100EBB7A9 /* libbrotlicommon.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = libbrotlicommon.xcframework; sourceTree = "<group>"; };
5057
D3D2B9F22A9BAD4500EBB7A9 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
5158
D3D2B9F32A9BAD6900EBB7A9 /* Jxl Coder-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Jxl Coder-Bridging-Header.h"; sourceTree = "<group>"; };
52-
D3D2B9F42A9BAD6A00EBB7A9 /* JXLCPlusCoder.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = JXLCPlusCoder.mm; sourceTree = "<group>"; };
53-
D3D2B9F62A9BAD8C00EBB7A9 /* JXLCPlusCoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JXLCPlusCoder.h; sourceTree = "<group>"; };
59+
D3D2B9F42A9BAD6A00EBB7A9 /* JxlInternalCoder.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = JxlInternalCoder.mm; sourceTree = "<group>"; };
60+
D3D2B9F62A9BAD8C00EBB7A9 /* JxlInternalCoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JxlInternalCoder.h; sourceTree = "<group>"; };
5461
D3D2B9F72A9BAE1C00EBB7A9 /* libjxl.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = libjxl.xcframework; sourceTree = "<group>"; };
5562
D3D2B9F92A9BAEB600EBB7A9 /* libhwy.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = libhwy.xcframework; sourceTree = "<group>"; };
56-
D3D2B9FB2A9BAEF300EBB7A9 /* jxl_worker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jxl_worker.cpp; sourceTree = "<group>"; };
57-
D3D2B9FC2A9BAEF300EBB7A9 /* jxl_worker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = jxl_worker.hpp; sourceTree = "<group>"; };
63+
D3D2B9FB2A9BAEF300EBB7A9 /* JxlWorker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JxlWorker.cpp; sourceTree = "<group>"; };
64+
D3D2B9FC2A9BAEF300EBB7A9 /* JxlWorker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = JxlWorker.hpp; sourceTree = "<group>"; };
5865
D3D2B9FF2A9BB4AF00EBB7A9 /* JXLCoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JXLCoder.swift; sourceTree = "<group>"; };
5966
D3D2BA012A9BB50F00EBB7A9 /* JXLSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JXLSupport.swift; sourceTree = "<group>"; };
6067
D3D2BA042A9BC06500EBB7A9 /* first.jxl */ = {isa = PBXFileReference; lastKnownFileType = file; path = first.jxl; sourceTree = "<group>"; };
@@ -177,12 +184,14 @@
177184
isa = PBXGroup;
178185
children = (
179186
D3D2B9F12A9BAD3800EBB7A9 /* include */,
180-
D3D2B9F42A9BAD6A00EBB7A9 /* JXLCPlusCoder.mm */,
181-
D3D2B9F62A9BAD8C00EBB7A9 /* JXLCPlusCoder.h */,
182-
D3D2B9FB2A9BAEF300EBB7A9 /* jxl_worker.cpp */,
183-
D3D2B9FC2A9BAEF300EBB7A9 /* jxl_worker.hpp */,
187+
D3D2B9F42A9BAD6A00EBB7A9 /* JxlInternalCoder.mm */,
188+
D3D2B9F62A9BAD8C00EBB7A9 /* JxlInternalCoder.h */,
189+
D3D2B9FB2A9BAEF300EBB7A9 /* JxlWorker.cpp */,
190+
D3D2B9FC2A9BAEF300EBB7A9 /* JxlWorker.hpp */,
184191
D3D2BA082A9BD1B600EBB7A9 /* JXLSystemImage.mm */,
185192
D3D2BA0A2A9BD1C200EBB7A9 /* JXLSystemImage.hpp */,
193+
D39B79972AAE4AD300F50EA4 /* RgbRgbaConverter.mm */,
194+
D39B79992AAE4ADC00F50EA4 /* RgbRgbaConverter.h */,
186195
);
187196
path = jxlc;
188197
sourceTree = "<group>";
@@ -207,6 +216,8 @@
207216
D3D2BA032A9BC05A00EBB7A9 /* Resources */ = {
208217
isa = PBXGroup;
209218
children = (
219+
D39B79B32AAE558E00F50EA4 /* pngtree.jxl */,
220+
D39B799D2AAE4F0200F50EA4 /* pexels-cheng.jxl */,
210221
D3D2BA042A9BC06500EBB7A9 /* first.jxl */,
211222
D3D2BA052A9BC06500EBB7A9 /* second.jxl */,
212223
);
@@ -295,6 +306,8 @@
295306
D3D2BA062A9BC06500EBB7A9 /* first.jxl in Resources */,
296307
D341F4CC2A97FC2A003A496C /* Preview Assets.xcassets in Resources */,
297308
D3D2BA072A9BC06500EBB7A9 /* second.jxl in Resources */,
309+
D39B799E2AAE4F0200F50EA4 /* pexels-cheng.jxl in Resources */,
310+
D39B79B42AAE558E00F50EA4 /* pngtree.jxl in Resources */,
298311
D341F4C92A97FC2A003A496C /* Assets.xcassets in Resources */,
299312
);
300313
runOnlyForDeploymentPostprocessing = 0;
@@ -348,10 +361,11 @@
348361
isa = PBXSourcesBuildPhase;
349362
buildActionMask = 2147483647;
350363
files = (
351-
D3D2B9F52A9BAD6A00EBB7A9 /* JXLCPlusCoder.mm in Sources */,
364+
D39B79982AAE4AD300F50EA4 /* RgbRgbaConverter.mm in Sources */,
365+
D3D2B9F52A9BAD6A00EBB7A9 /* JxlInternalCoder.mm in Sources */,
352366
D3D2BA092A9BD1B600EBB7A9 /* JXLSystemImage.mm in Sources */,
353367
D3D55DB12AA4DBBD00EA7CB0 /* JxlSDWebImageCoder.swift in Sources */,
354-
D3D2B9FD2A9BAEF300EBB7A9 /* jxl_worker.cpp in Sources */,
368+
D3D2B9FD2A9BAEF300EBB7A9 /* JxlWorker.cpp in Sources */,
355369
D3D2BA002A9BB4AF00EBB7A9 /* JXLCoder.swift in Sources */,
356370
D3D2BA022A9BB50F00EBB7A9 /* JXLSupport.swift in Sources */,
357371
D341F4C72A97FC29003A496C /* ContentView.swift in Sources */,

Jxl Coder/ContentView.swift

+22
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import JxlCoder
1212

1313
struct ContentView: View {
1414

15+
@State var tenDepthImage: UIImage?
16+
@State var alphaImage: UIImage?
1517
@State var firstImage: UIImage?
1618
@State var secondImage: UIImage?
1719
@State var thirdImage: UIImage?
@@ -20,6 +22,19 @@ struct ContentView: View {
2022
VStack {
2123
ScrollView(.vertical, showsIndicators: false) {
2224
VStack {
25+
26+
if let tenDepthImage {
27+
Image(uiImage: tenDepthImage)
28+
.resizable()
29+
.aspectRatio(contentMode: .fill)
30+
}
31+
32+
if let alphaImage {
33+
Image(uiImage: alphaImage)
34+
.resizable()
35+
.aspectRatio(contentMode: .fill)
36+
}
37+
2338
if let firstImage {
2439
Image(uiImage: firstImage)
2540
.resizable()
@@ -40,12 +55,19 @@ struct ContentView: View {
4055
}
4156
}
4257
}
58+
.background(Color.green.opacity(0.3))
4359
.padding()
4460
.onAppear {
4561
let url1 = Bundle.main.url(forResource: "first", withExtension: "jxl")!
4662
let url2 = Bundle.main.url(forResource: "second", withExtension: "jxl")!
63+
let url3 = Bundle.main.url(forResource: "pexels-cheng", withExtension: "jxl")!
64+
let url4 = Bundle.main.url(forResource: "pngtree", withExtension: "jxl")!
4765
let fImage = try! JXLCoder.decode(url: url1)
4866
let sImage = try! JXLCoder.decode(url: url2)
67+
let kImage = try! JXLCoder.decode(url: url3)
68+
let vImage = try! JXLCoder.decode(url: url4)
69+
alphaImage = vImage
70+
tenDepthImage = kImage
4971
firstImage = fImage
5072
secondImage = sImage
5173
let testEncImage = try! JXLCoder.encode(image: UIImage(named: "test_1")!, colorSpace: .rgb)

Jxl Coder/Jxl Coder-Bridging-Header.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// Use this file to import your target's public headers that you would like to expose to Swift.
33
//
44

5-
#import "JXLCPlusCoder.h"
5+
#import "JxlInternalCoder.h"

Jxl Coder/Resources/pexels-cheng.jxl

535 KB
Binary file not shown.

Jxl Coder/Resources/pngtree.jxl

268 KB
Binary file not shown.

Sources/JxlCoder/JXLCoder.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import jxlc
1111
#endif
1212

1313
public class JXLCoder {
14-
private static let shared = JXLCPlusCoder()
14+
private static let shared = JxlInternalCoder()
1515
private static let magic1 = Data([0xFF, 0x0A])
1616
private static let magic2 = Data([0x0, 0x0, 0x0, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A])
1717

Sources/jxlc/JXLCPlusCoder.h

-33
This file was deleted.

Sources/jxlc/JXLSystemImage.hpp

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
//
2-
// JXLSystemImage.h
3-
// Jxl Coder
2+
// JXLSystemImage.mm
3+
// JxclCoder [https://github.com/awxkee/jxl-coder-swift]
44
//
55
// Created by Radzivon Bartoshyk on 27/08/2023.
66
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files (the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions:
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
//
725

826
#ifndef JXLSystemImage_h
927
#define JXLSystemImage_h

Sources/jxlc/JXLSystemImage.mm

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
//
2-
// JXLSystemImage.m
3-
// Jxl Coder
2+
// JXLSystemImage.mm
3+
// JxclCoder [https://github.com/awxkee/jxl-coder-swift]
44
//
55
// Created by Radzivon Bartoshyk on 27/08/2023.
66
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files (the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions:
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
//
725

826
#import <Foundation/Foundation.h>
927
#import "JXLSystemImage.hpp"

Sources/jxlc/JxlInternalCoder.h

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// JxlInternalCoder.h
3+
// JxclCoder [https://github.com/awxkee/jxl-coder-swift]
4+
//
5+
// Created by Radzivon Bartoshyk on 27/08/2023.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files (the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions:
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
//
25+
26+
#ifndef JXLCoder_h
27+
#define JXLCoder_h
28+
29+
#import <Foundation/Foundation.h>
30+
#import "JXLSystemImage.hpp"
31+
32+
typedef NS_ENUM(NSInteger, JXLColorSpace) {
33+
kRGB NS_SWIFT_NAME(rgb),
34+
kRGBA NS_SWIFT_NAME(rgba)
35+
};
36+
37+
typedef NS_ENUM(NSInteger, JXLCompressionOption) {
38+
kLoseless NS_SWIFT_NAME(loseless),
39+
kLossy NS_SWIFT_NAME(lossy)
40+
};
41+
42+
@interface JxlInternalCoder: NSObject
43+
- (nullable JXLSystemImage *)decode:(nonnull NSInputStream *)inputStream error:(NSError *_Nullable * _Nullable)error;
44+
- (CGSize)getSize:(nonnull NSInputStream *)inputStream error:(NSError *_Nullable * _Nullable)error;
45+
- (nullable NSData *)encode:(nonnull JXLSystemImage *)platformImage
46+
colorSpace:(JXLColorSpace)colorSpace
47+
compressionOption:(JXLCompressionOption)compressionOption
48+
compressionDistance:(double)compressionDistance error:(NSError * _Nullable *_Nullable)error;
49+
@end
50+
51+
#endif /* JXLCoder_h */

0 commit comments

Comments
 (0)