MaxstARSDK  3.5.0
All Classes Functions Variables
TrackedImage.java
1 /*
2  * Copyright 2017 Maxst, Inc. All Rights Reserved.
3  */
4 package com.maxst.ar;
5 
9 public class TrackedImage {
10  private long cPtr = 0;
11  private int width;
12  private int height;
13  private int length;
14  private ColorFormat colorFormat;
15  private byte [] data;
16 
17  protected void setData(long cPtr) {
18  if (cPtr == 0) {
19  return;
20  }
21 
22  width = MaxstARJNI.TrackedImage_getWidth(cPtr);
23  height = MaxstARJNI.TrackedImage_getHeight(cPtr);
24  int tempLength = MaxstARJNI.TrackedImage_getLength(cPtr);
25 
26  if (data == null || tempLength != length) {
27  data = new byte[tempLength];
28  }
29  length = tempLength;
30 
31  int format = MaxstARJNI.TrackedImage_getFormat(cPtr);
32  colorFormat = ColorFormat.fromValue(format);
33  if (width == 0 || height == 0) {
34  return;
35  }
36 
37 
38  MaxstARJNI.TrackedImage_getData(cPtr, data, length);
39  }
40 
45  public int getWidth() {
46  return width;
47  }
48 
53  public int getHeight() {
54  return height;
55  }
56 
61  public int getLength() {
62  return length;
63  }
64 
70  return colorFormat;
71  }
72 
77  public byte [] getData() {
78  return data;
79  }
80 }