ObjFW
 
Loading...
Searching...
No Matches
OFColorSpace.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008-2026 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3.0 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * version 3.0 for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * version 3.0 along with this program. If not, see
17 * <https://www.gnu.org/licenses/>.
18 */
19
20#import "OFObject.h"
21
22OF_ASSUME_NONNULL_BEGIN
23
25
26@class OFColorSpace;
27@class OFMatrix4x4;
28
43 size_t count);
44
51{
53 OFMatrix4x4 *_RGBToXYZMatrix, *_XYZToRGBMatrix;
54 bool _linear;
55 OF_RESERVE_IVARS(OFColorSpace, 4)
56}
57
58#ifdef OF_HAVE_CLASS_PROPERTIES
59@property (class, readonly, retain, nonatomic) OFColorSpace *sRGBColorSpace;
60@property (class, readonly, retain, nonatomic)
61 OFColorSpace *linearSRGBColorSpace;
62@property (class, readonly, retain, nonatomic) OFColorSpace *BT709ColorSpace;
63@property (class, readonly, retain, nonatomic)
64 OFColorSpace *displayP3ColorSpace;
65@property (class, readonly, retain, nonatomic)
66 OFColorSpace *linearDisplayP3ColorSpace;
67@property (class, readonly, retain, nonatomic) OFColorSpace *BT2020ColorSpace;
68@property (class, readonly, retain, nonatomic)
69 OFColorSpace *linearBT2020ColorSpace;
70@property (class, readonly, retain, nonatomic) OFColorSpace *adobeRGBColorSpace;
71@property (class, readonly, retain, nonatomic)
72 OFColorSpace *linearAdobeRGBColorSpace;
73#endif
74
80@property (readonly, nonatomic) OFColorSpaceTransferFunction EOTF;
81
87@property (readonly, nonatomic) OFColorSpaceTransferFunction OETF;
88
92@property (readonly, retain, nonatomic) OFMatrix4x4 *RGBToXYZMatrix;
93
97@property (readonly, retain, nonatomic) OFMatrix4x4 *XYZToRGBMatrix;
98
102@property (readonly, nonatomic, getter=isLinear) bool linear;
103
114+ (instancetype)colorSpaceWithEOTF: (OFColorSpaceTransferFunction)EOTF
116 RGBToXYZMatrix: (OFMatrix4x4 *)RGBToXYZMatrix
117 XYZToRGBMatrix: (OFMatrix4x4 *)XYZToRGBMatrix
118 linear: (bool)linear;
119
124
129
137
142
147
152
158
163
168
179- (instancetype)initWithEOTF: (OFColorSpaceTransferFunction)EOTF
181 RGBToXYZMatrix: (OFMatrix4x4 *)RGBToXYZMatrix
182 XYZToRGBMatrix: (OFMatrix4x4 *)XYZToRGBMatrix
183 linear: (bool)linear;
184@end
185
186OF_ASSUME_NONNULL_END
void(* OFColorSpaceTransferFunction)(OFVector4D *vectors, size_t count)
A transfer function for a color space.
Definition OFColorSpace.h:42
A class representing a color space.
Definition OFColorSpace.h:51
OFColorSpace * BT709ColorSpace()
The BT.709 color space.
Definition OFColorSpace.m:451
OFMatrix4x4 * XYZToRGBMatrix
A matrix to map a CIE XYZ value to a linear RGB value.
Definition OFColorSpace.h:97
OFColorSpace * displayP3ColorSpace()
The Display P3 color space.
Definition OFColorSpace.m:459
OFColorSpace * linearBT2020ColorSpace()
The ITU-R Recommendation BT.2020 color space with linear transfer function.
Definition OFColorSpace.m:483
OFColorSpace * linearSRGBColorSpace()
The sRGB color space with linear transfer function.
Definition OFColorSpace.m:443
OFColorSpace * linearAdobeRGBColorSpace()
The Adobe RGB (1998) color space with linear transfer function.
Definition OFColorSpace.m:499
bool linear
Whether the color space is linear.
Definition OFColorSpace.h:102
OFColorSpace * adobeRGBColorSpace()
The Adobe RGB (1998) color space.
Definition OFColorSpace.m:491
OFColorSpaceTransferFunction EOTF
The Electro-Optical Transfer Function of the color space.
Definition OFColorSpace.h:80
OFColorSpaceTransferFunction OETF
The Opto-Electronic Transfer Function of the color space.
Definition OFColorSpace.h:87
OFColorSpace * linearDisplayP3ColorSpace()
The Display P3 color space with linear transfer function.
Definition OFColorSpace.m:467
OFColorSpace * BT2020ColorSpace()
The ITU-R Recommendation BT.2020 color space.
Definition OFColorSpace.m:475
OFMatrix4x4 * RGBToXYZMatrix
A matrix to map a linear RGB value to a CIE XYZ value.
Definition OFColorSpace.h:92
OFColorSpace * sRGBColorSpace()
The sRGB color space.
Definition OFColorSpace.m:435
A 4x4 matrix of floats.
Definition OFMatrix4x4.h:30
The root class for all other classes inside ObjFW.
Definition OFObject.h:956
instancetype retain()
Increases the retain count.
A vector in 4D space.
Definition OFObject.h:551