-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathWindow.java
More file actions
173 lines (150 loc) · 4.08 KB
/
Copy pathWindow.java
File metadata and controls
173 lines (150 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package app.f3d.F3D;
public class Window {
public enum Type {
NONE,
EXTERNAL,
GLX,
WGL,
COCOA,
EGL,
OSMESA,
WASM,
UNKNOWN
}
Window(long nativeAddress) {
mNativeAddress = nativeAddress;
mCamera = new Camera(nativeAddress);
}
/**
* Get the type of the window.
*
* @return window type
*/
public native Type getType();
/**
* Check if the window is offscreen.
*
* @return true if offscreen, false otherwise
*/
public native boolean isOffscreen();
/**
* Get the camera provided by the window.
*
* @return camera instance
*/
public Camera getCamera() {
return mCamera;
}
/**
* Perform a render of the window to the screen.
* All dynamic options are updated if needed.
*
* @return true on success, false otherwise
*/
public native boolean render();
/**
* Perform a render of the window to the screen and save the result in an image.
* Set noBackground to true to have a transparent background.
*
* @param noBackground if true, background will be transparent
* @return resulting image
*/
public native Image renderToImage(boolean noBackground);
/**
* Perform a render of the window to the screen and save the result in an image.
*
* @return resulting image
*/
public Image renderToImage() {
return renderToImage(false);
}
/**
* Set the size of the window.
*
* @param width window width
* @param height window height
* @return this window for method chaining
*/
public native Window setSize(int width, int height);
/**
* Get the size of the window as an array {width, height}.
*
* @return window size as {width, height}
*/
public native int[] getSize();
/**
* Get the width of the window.
*
* @return window width
*/
public native int getWidth();
/**
* Get the height of the window.
*
* @return window height
*/
public native int getHeight();
/**
* Set the position of the window.
*
* @param x x position
* @param y y position
* @return this window for method chaining
*/
public native Window setPosition(int x, int y);
/**
* Get the position of the window as an array {x, y}.
*
* @return window position as {x, y}
*/
public native int[] getPosition();
/**
* Get the position of the left border of the window.
*
* @return window left border position
*/
public native int getLeft();
/**
* Get the position of the top border of the window.
*
* @return window top border position
*/
public native int getTop();
/**
* Set the icon to be shown by a window manager.
*
* @param icon icon data as byte array
* @return this window for method chaining
*/
public native Window setIcon(byte[] icon);
/**
* Set the window name to be shown by a window manager.
*
* @param windowName window name
* @return this window for method chaining
*/
public native Window setWindowName(String windowName);
/**
* Convert a point in display coordinate to world coordinate.
*
* @param displayPoint array of 3 doubles [x, y, z] in display coordinates
* @return array of 3 doubles [x, y, z] in world coordinates
*/
public native double[] getWorldFromDisplay(double[] displayPoint);
/**
* Convert a point in world coordinate to display coordinate.
*
* @param worldPoint array of 3 doubles [x, y, z] in world coordinates
* @return array of 3 doubles [x, y, z] in display coordinates
*/
public native double[] getDisplayFromWorld(double[] worldPoint);
/**
* Get the DPI scale value of the window.
* Returns 1.0 on platforms where DPI scaling is not supported.
*
* @return DPI scale.
*/
public native double getDPIScale();
private long mNativeAddress;
private Camera mCamera;
}