MCPcopy Create free account
hub / github.com/HumbleUI/Skija / Codec

Class Codec

shared/java/Codec.java:8–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import io.github.humbleui.types.*;
7
8public class Codec extends Managed implements IHasImageInfo {
9 static { Library.staticLoad(); }
10
11 @ApiStatus.Internal
12 public ImageInfo _imageInfo = null;
13
14 @ApiStatus.Internal
15 public Codec(long ptr) {
16 super(ptr, _FinalizerHolder.PTR);
17 }
18
19 /**
20 * If this data represents an encoded image that we know how to decode,
21 * return an Codec that can decode it. Otherwise throws IllegalArgumentException.
22 */
23 public static Codec makeFromData(Data data) {
24 try {
25 Stats.onNativeCall();
26 long ptr = _nMakeFromData(Native.getPtr(data));
27 if (ptr == 0)
28 throw new IllegalArgumentException("Unsupported format");
29 return new Codec(ptr);
30 } finally {
31 ReferenceUtil.reachabilityFence(data);
32 }
33 }
34
35 @Override @NotNull
36 public ImageInfo getImageInfo() {
37 try {
38 if (_imageInfo == null) {
39 Stats.onNativeCall();
40 _imageInfo = _nGetImageInfo(_ptr);
41 }
42 return _imageInfo;
43 } finally {
44 ReferenceUtil.reachabilityFence(this);
45 }
46 }
47
48 @NotNull @Contract("-> new")
49 public IPoint getSize() {
50 try {
51 Stats.onNativeCall();
52 return IPoint._makeFromLong(_nGetSize(_ptr));
53 } finally {
54 ReferenceUtil.reachabilityFence(this);
55 }
56 }
57
58 @NotNull
59 public EncodedOrigin getEncodedOrigin() {
60 try {
61 Stats.onNativeCall();
62 return EncodedOrigin._values[_nGetEncodedOrigin(_ptr)];
63 } finally {
64 ReferenceUtil.reachabilityFence(this);
65 }

Callers

nothing calls this directly

Calls 1

staticLoadMethod · 0.95

Tested by

no test coverage detected