| 5 | import org.jetbrains.skija.impl.*; |
| 6 | |
| 7 | public class ColorSpace extends Managed { |
| 8 | static { Library.staticLoad(); } |
| 9 | |
| 10 | public static class _SRGBHolder { |
| 11 | static { Stats.onNativeCall(); } |
| 12 | public static final ColorSpace INSTANCE = new ColorSpace(_nMakeSRGB(), false); |
| 13 | } |
| 14 | |
| 15 | public static ColorSpace getSRGB() { |
| 16 | return _SRGBHolder.INSTANCE; |
| 17 | } |
| 18 | |
| 19 | public static class _SRGBLinearHolder { |
| 20 | static { Stats.onNativeCall(); } |
| 21 | public static final ColorSpace INSTANCE = new ColorSpace(_nMakeSRGBLinear(), false); |
| 22 | } |
| 23 | |
| 24 | public static ColorSpace getSRGBLinear() { |
| 25 | return _SRGBLinearHolder.INSTANCE; |
| 26 | } |
| 27 | |
| 28 | public static class _DisplayP3Holder { |
| 29 | static { Stats.onNativeCall(); } |
| 30 | public static final ColorSpace INSTANCE = new ColorSpace(_nMakeDisplayP3(), false); |
| 31 | } |
| 32 | |
| 33 | public static ColorSpace getDisplayP3() { |
| 34 | return _DisplayP3Holder.INSTANCE; |
| 35 | } |
| 36 | |
| 37 | public Color4f convert(ColorSpace to, Color4f color) { |
| 38 | to = to == null ? getSRGB() : to; |
| 39 | try { |
| 40 | return new Color4f(_nConvert(_ptr, Native.getPtr(to), color.getR(), color.getG(), color.getB(), color.getA())); |
| 41 | } finally { |
| 42 | Reference.reachabilityFence(this); |
| 43 | Reference.reachabilityFence(to); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | @ApiStatus.Internal |
| 48 | public ColorSpace(long ptr) { |
| 49 | super(ptr, _FinalizerHolder.PTR, true); |
| 50 | } |
| 51 | |
| 52 | @ApiStatus.Internal |
| 53 | public ColorSpace(long ptr, boolean managed) { |
| 54 | super(ptr, _FinalizerHolder.PTR, managed); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @return true if the color space gamma is near enough to be approximated as sRGB |
| 59 | */ |
| 60 | public boolean isGammaCloseToSRGB() { |
| 61 | try { |
| 62 | Stats.onNativeCall(); |
| 63 | return _nIsGammaCloseToSRGB(_ptr); |
| 64 | } finally { |
nothing calls this directly
no test coverage detected